ASoC: remove Codec related code
Now no one is using Codec related code. Let's remove all Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Родитель
11fb14f8c5
Коммит
999f7f5af8
|
@ -313,7 +313,6 @@ struct snd_soc_dai {
|
|||
unsigned int sample_bits;
|
||||
|
||||
/* parent platform/codec */
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_component *component;
|
||||
|
||||
/* CODEC TDM slot masks and params (for fixup) */
|
||||
|
|
|
@ -402,8 +402,6 @@ struct snd_soc_pcm_runtime;
|
|||
struct snd_soc_dai;
|
||||
struct snd_soc_dai_driver;
|
||||
struct snd_soc_dai_link;
|
||||
struct snd_soc_codec;
|
||||
struct snd_soc_codec_driver;
|
||||
struct snd_soc_component;
|
||||
struct snd_soc_component_driver;
|
||||
struct soc_enum;
|
||||
|
@ -428,13 +426,6 @@ enum snd_soc_card_subclass {
|
|||
SND_SOC_CARD_CLASS_RUNTIME = 1,
|
||||
};
|
||||
|
||||
int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
|
||||
int source, unsigned int freq, int dir);
|
||||
int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
|
||||
unsigned int freq_in, unsigned int freq_out);
|
||||
int snd_soc_codec_set_jack(struct snd_soc_codec *codec,
|
||||
struct snd_soc_jack *jack, void *data);
|
||||
|
||||
int snd_soc_register_card(struct snd_soc_card *card);
|
||||
int snd_soc_unregister_card(struct snd_soc_card *card);
|
||||
int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card);
|
||||
|
@ -453,10 +444,6 @@ static inline int snd_soc_resume(struct device *dev)
|
|||
}
|
||||
#endif
|
||||
int snd_soc_poweroff(struct device *dev);
|
||||
int snd_soc_register_codec(struct device *dev,
|
||||
const struct snd_soc_codec_driver *codec_drv,
|
||||
struct snd_soc_dai_driver *dai_drv, int num_dai);
|
||||
void snd_soc_unregister_codec(struct device *dev);
|
||||
int snd_soc_add_component(struct device *dev,
|
||||
struct snd_soc_component *component,
|
||||
const struct snd_soc_component_driver *component_driver,
|
||||
|
@ -559,23 +546,7 @@ static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
|
|||
}
|
||||
#endif
|
||||
|
||||
/* codec register bit access */
|
||||
int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int mask, unsigned int value);
|
||||
int snd_soc_update_bits_locked(struct snd_soc_codec *codec,
|
||||
unsigned int reg, unsigned int mask,
|
||||
unsigned int value);
|
||||
int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int mask, unsigned int value);
|
||||
|
||||
#ifdef CONFIG_SND_SOC_AC97_BUS
|
||||
#define snd_soc_alloc_ac97_codec(codec) \
|
||||
snd_soc_alloc_ac97_component(&codec->component)
|
||||
#define snd_soc_new_ac97_codec(codec, id, id_mask) \
|
||||
snd_soc_new_ac97_component(&codec->component, id, id_mask)
|
||||
#define snd_soc_free_ac97_codec(ac97) \
|
||||
snd_soc_free_ac97_component(ac97)
|
||||
|
||||
struct snd_ac97 *snd_soc_alloc_ac97_component(struct snd_soc_component *component);
|
||||
struct snd_ac97 *snd_soc_new_ac97_component(struct snd_soc_component *component,
|
||||
unsigned int id, unsigned int id_mask);
|
||||
|
@ -609,8 +580,6 @@ struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
|
|||
const char *name);
|
||||
int snd_soc_add_component_controls(struct snd_soc_component *component,
|
||||
const struct snd_kcontrol_new *controls, unsigned int num_controls);
|
||||
int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
|
||||
const struct snd_kcontrol_new *controls, unsigned int num_controls);
|
||||
int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
|
||||
const struct snd_kcontrol_new *controls, int num_controls);
|
||||
int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
|
||||
|
@ -843,8 +812,6 @@ struct snd_soc_component {
|
|||
|
||||
unsigned int active;
|
||||
|
||||
unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
|
||||
unsigned int registered_as_component:1;
|
||||
unsigned int suspended:1; /* is in suspend PM state */
|
||||
|
||||
struct list_head list;
|
||||
|
@ -856,9 +823,6 @@ struct snd_soc_component {
|
|||
struct list_head dai_list;
|
||||
int num_dai;
|
||||
|
||||
int (*read)(struct snd_soc_component *, unsigned int, unsigned int *);
|
||||
int (*write)(struct snd_soc_component *, unsigned int, unsigned int);
|
||||
|
||||
struct regmap *regmap;
|
||||
int val_bytes;
|
||||
|
||||
|
@ -880,22 +844,6 @@ struct snd_soc_component {
|
|||
/* Don't use these, use snd_soc_component_get_dapm() */
|
||||
struct snd_soc_dapm_context dapm;
|
||||
|
||||
struct snd_soc_codec *codec;
|
||||
|
||||
int (*probe)(struct snd_soc_component *);
|
||||
void (*remove)(struct snd_soc_component *);
|
||||
int (*suspend)(struct snd_soc_component *);
|
||||
int (*resume)(struct snd_soc_component *);
|
||||
|
||||
int (*set_sysclk)(struct snd_soc_component *component,
|
||||
int clk_id, int source, unsigned int freq, int dir);
|
||||
int (*set_pll)(struct snd_soc_component *component, int pll_id,
|
||||
int source, unsigned int freq_in, unsigned int freq_out);
|
||||
int (*set_jack)(struct snd_soc_component *component,
|
||||
struct snd_soc_jack *jack, void *data);
|
||||
int (*set_bias_level)(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level);
|
||||
|
||||
/* machine specific init */
|
||||
int (*init)(struct snd_soc_component *component);
|
||||
|
||||
|
@ -916,50 +864,6 @@ snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd,
|
|||
#define for_each_rtdcom_safe(rtd, rtdcom1, rtdcom2) \
|
||||
list_for_each_entry_safe(rtdcom1, rtdcom2, &(rtd)->component_list, list)
|
||||
|
||||
/* SoC Audio Codec device */
|
||||
struct snd_soc_codec {
|
||||
struct device *dev;
|
||||
const struct snd_soc_codec_driver *driver;
|
||||
|
||||
struct list_head list;
|
||||
|
||||
/* component */
|
||||
struct snd_soc_component component;
|
||||
};
|
||||
|
||||
/* codec driver */
|
||||
struct snd_soc_codec_driver {
|
||||
|
||||
/* driver ops */
|
||||
int (*probe)(struct snd_soc_codec *);
|
||||
int (*remove)(struct snd_soc_codec *);
|
||||
int (*suspend)(struct snd_soc_codec *);
|
||||
int (*resume)(struct snd_soc_codec *);
|
||||
struct snd_soc_component_driver component_driver;
|
||||
|
||||
/* codec wide operations */
|
||||
int (*set_sysclk)(struct snd_soc_codec *codec,
|
||||
int clk_id, int source, unsigned int freq, int dir);
|
||||
int (*set_pll)(struct snd_soc_codec *codec, int pll_id, int source,
|
||||
unsigned int freq_in, unsigned int freq_out);
|
||||
int (*set_jack)(struct snd_soc_codec *codec,
|
||||
struct snd_soc_jack *jack, void *data);
|
||||
|
||||
unsigned int (*read)(struct snd_soc_codec *, unsigned int);
|
||||
int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
|
||||
|
||||
/* codec bias level */
|
||||
int (*set_bias_level)(struct snd_soc_codec *,
|
||||
enum snd_soc_bias_level level);
|
||||
bool idle_bias_off;
|
||||
bool suspend_bias_off;
|
||||
|
||||
void (*seq_notifier)(struct snd_soc_dapm_context *,
|
||||
enum snd_soc_dapm_type, int);
|
||||
|
||||
bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */
|
||||
};
|
||||
|
||||
struct snd_soc_dai_link_component {
|
||||
const char *name;
|
||||
struct device_node *of_node;
|
||||
|
@ -1213,7 +1117,6 @@ struct snd_soc_pcm_runtime {
|
|||
/* runtime devices */
|
||||
struct snd_pcm *pcm;
|
||||
struct snd_compr *compr;
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_dai *codec_dai;
|
||||
struct snd_soc_dai *cpu_dai;
|
||||
|
||||
|
@ -1281,19 +1184,6 @@ struct soc_enum {
|
|||
struct snd_soc_dobj dobj;
|
||||
};
|
||||
|
||||
/**
|
||||
* snd_soc_component_to_codec() - Casts a component to the CODEC it is embedded in
|
||||
* @component: The component to cast to a CODEC
|
||||
*
|
||||
* This function must only be used on components that are known to be CODECs.
|
||||
* Otherwise the behavior is undefined.
|
||||
*/
|
||||
static inline struct snd_soc_codec *snd_soc_component_to_codec(
|
||||
struct snd_soc_component *component)
|
||||
{
|
||||
return container_of(component, struct snd_soc_codec, component);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_to_component() - Casts a DAPM context to the component it is
|
||||
* embedded in
|
||||
|
@ -1309,19 +1199,6 @@ static inline struct snd_soc_component *snd_soc_dapm_to_component(
|
|||
return container_of(dapm, struct snd_soc_component, dapm);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_to_codec() - Casts a DAPM context to the CODEC it is embedded in
|
||||
* @dapm: The DAPM context to cast to the CODEC
|
||||
*
|
||||
* This function must only be used on DAPM contexts that are known to be part of
|
||||
* a CODEC (e.g. in a CODEC driver). Otherwise the behavior is undefined.
|
||||
*/
|
||||
static inline struct snd_soc_codec *snd_soc_dapm_to_codec(
|
||||
struct snd_soc_dapm_context *dapm)
|
||||
{
|
||||
return snd_soc_component_to_codec(snd_soc_dapm_to_component(dapm));
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_component_get_dapm() - Returns the DAPM context associated with a
|
||||
* component
|
||||
|
@ -1333,31 +1210,6 @@ static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
|
|||
return &component->dapm;
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_codec_get_dapm() - Returns the DAPM context for the CODEC
|
||||
* @codec: The CODEC for which to get the DAPM context
|
||||
*
|
||||
* Note: Use this function instead of directly accessing the CODEC's dapm field
|
||||
*/
|
||||
static inline struct snd_soc_dapm_context *snd_soc_codec_get_dapm(
|
||||
struct snd_soc_codec *codec)
|
||||
{
|
||||
return snd_soc_component_get_dapm(&codec->component);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_init_bias_level() - Initialize CODEC DAPM bias level
|
||||
* @codec: The CODEC for which to initialize the DAPM bias level
|
||||
* @level: The DAPM level to initialize to
|
||||
*
|
||||
* Initializes the CODEC DAPM bias level. See snd_soc_dapm_init_bias_level().
|
||||
*/
|
||||
static inline void snd_soc_codec_init_bias_level(struct snd_soc_codec *codec,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
snd_soc_dapm_init_bias_level(snd_soc_codec_get_dapm(codec), level);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_component_init_bias_level() - Initialize COMPONENT DAPM bias level
|
||||
* @component: The COMPONENT for which to initialize the DAPM bias level
|
||||
|
@ -1373,18 +1225,6 @@ snd_soc_component_init_bias_level(struct snd_soc_component *component,
|
|||
snd_soc_component_get_dapm(component), level);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_get_bias_level() - Get current CODEC DAPM bias level
|
||||
* @codec: The CODEC for which to get the DAPM bias level
|
||||
*
|
||||
* Returns: The current DAPM bias level of the CODEC.
|
||||
*/
|
||||
static inline enum snd_soc_bias_level snd_soc_codec_get_bias_level(
|
||||
struct snd_soc_codec *codec)
|
||||
{
|
||||
return snd_soc_dapm_get_bias_level(snd_soc_codec_get_dapm(codec));
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_component_get_bias_level() - Get current COMPONENT DAPM bias level
|
||||
* @component: The COMPONENT for which to get the DAPM bias level
|
||||
|
@ -1398,21 +1238,6 @@ snd_soc_component_get_bias_level(struct snd_soc_component *component)
|
|||
snd_soc_component_get_dapm(component));
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_codec_force_bias_level() - Set the CODEC DAPM bias level
|
||||
* @codec: The CODEC for which to set the level
|
||||
* @level: The level to set to
|
||||
*
|
||||
* Forces the CODEC bias level to a specific state. See
|
||||
* snd_soc_dapm_force_bias_level().
|
||||
*/
|
||||
static inline int snd_soc_codec_force_bias_level(struct snd_soc_codec *codec,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
return snd_soc_dapm_force_bias_level(snd_soc_codec_get_dapm(codec),
|
||||
level);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_component_force_bias_level() - Set the COMPONENT DAPM bias level
|
||||
* @component: The COMPONENT for which to set the level
|
||||
|
@ -1430,19 +1255,6 @@ snd_soc_component_force_bias_level(struct snd_soc_component *component,
|
|||
level);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol
|
||||
* @kcontrol: The kcontrol
|
||||
*
|
||||
* This function must only be used on DAPM contexts that are known to be part of
|
||||
* a CODEC (e.g. in a CODEC driver). Otherwise the behavior is undefined.
|
||||
*/
|
||||
static inline struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(
|
||||
struct snd_kcontrol *kcontrol)
|
||||
{
|
||||
return snd_soc_dapm_to_codec(snd_soc_dapm_kcontrol_dapm(kcontrol));
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_kcontrol_component() - Returns the component associated to a kcontrol
|
||||
* @kcontrol: The kcontrol
|
||||
|
@ -1456,22 +1268,6 @@ static inline struct snd_soc_component *snd_soc_dapm_kcontrol_component(
|
|||
return snd_soc_dapm_to_component(snd_soc_dapm_kcontrol_dapm(kcontrol));
|
||||
}
|
||||
|
||||
/* codec IO */
|
||||
unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
|
||||
int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int val);
|
||||
|
||||
/**
|
||||
* snd_soc_cache_sync() - Sync the register cache with the hardware
|
||||
* @codec: CODEC to sync
|
||||
*
|
||||
* Note: This function will call regcache_sync()
|
||||
*/
|
||||
static inline int snd_soc_cache_sync(struct snd_soc_codec *codec)
|
||||
{
|
||||
return regcache_sync(codec->component.regmap);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_component_cache_sync() - Sync the register cache with the hardware
|
||||
* @component: COMPONENT to sync
|
||||
|
@ -1514,37 +1310,6 @@ void snd_soc_component_init_regmap(struct snd_soc_component *component,
|
|||
struct regmap *regmap);
|
||||
void snd_soc_component_exit_regmap(struct snd_soc_component *component);
|
||||
|
||||
/**
|
||||
* snd_soc_codec_init_regmap() - Initialize regmap instance for the CODEC
|
||||
* @codec: The CODEC for which to initialize the regmap instance
|
||||
* @regmap: The regmap instance that should be used by the CODEC
|
||||
*
|
||||
* This function allows deferred assignment of the regmap instance that is
|
||||
* associated with the CODEC. Only use this if the regmap instance is not yet
|
||||
* ready when the CODEC is registered. The function must also be called before
|
||||
* the first IO attempt of the CODEC.
|
||||
*/
|
||||
static inline void snd_soc_codec_init_regmap(struct snd_soc_codec *codec,
|
||||
struct regmap *regmap)
|
||||
{
|
||||
snd_soc_component_init_regmap(&codec->component, regmap);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_codec_exit_regmap() - De-initialize regmap instance for the CODEC
|
||||
* @codec: The CODEC for which to de-initialize the regmap instance
|
||||
*
|
||||
* Calls regmap_exit() on the regmap instance associated to the CODEC and
|
||||
* removes the regmap instance from the CODEC.
|
||||
*
|
||||
* This function should only be used if snd_soc_codec_init_regmap() was used to
|
||||
* initialize the regmap instance.
|
||||
*/
|
||||
static inline void snd_soc_codec_exit_regmap(struct snd_soc_codec *codec)
|
||||
{
|
||||
snd_soc_component_exit_regmap(&codec->component);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* device driver data */
|
||||
|
@ -1571,17 +1336,6 @@ static inline void *snd_soc_component_get_drvdata(struct snd_soc_component *c)
|
|||
return dev_get_drvdata(c->dev);
|
||||
}
|
||||
|
||||
static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
|
||||
void *data)
|
||||
{
|
||||
snd_soc_component_set_drvdata(&codec->component, data);
|
||||
}
|
||||
|
||||
static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
|
||||
{
|
||||
return snd_soc_component_get_drvdata(&codec->component);
|
||||
}
|
||||
|
||||
static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
|
||||
{
|
||||
INIT_LIST_HEAD(&card->widgets);
|
||||
|
@ -1633,11 +1387,6 @@ static inline bool snd_soc_component_is_active(
|
|||
return component->active != 0;
|
||||
}
|
||||
|
||||
static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
|
||||
{
|
||||
return snd_soc_component_is_active(&codec->component);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_kcontrol_component() - Returns the component that registered the
|
||||
* control
|
||||
|
@ -1654,20 +1403,6 @@ static inline struct snd_soc_component *snd_soc_kcontrol_component(
|
|||
return snd_kcontrol_chip(kcontrol);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_kcontrol_codec() - Returns the CODEC that registered the control
|
||||
* @kcontrol: The control for which to get the CODEC
|
||||
*
|
||||
* Note: This function will only work correctly if the control has been
|
||||
* registered with snd_soc_add_codec_controls() or via table based setup of
|
||||
* snd_soc_codec_driver. Otherwise the behavior is undefined.
|
||||
*/
|
||||
static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
|
||||
struct snd_kcontrol *kcontrol)
|
||||
{
|
||||
return snd_soc_component_to_codec(snd_soc_kcontrol_component(kcontrol));
|
||||
}
|
||||
|
||||
int snd_soc_util_init(void);
|
||||
void snd_soc_util_exit(void);
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ EXPORT_SYMBOL_GPL(snd_soc_debugfs_root);
|
|||
#endif
|
||||
|
||||
static DEFINE_MUTEX(client_mutex);
|
||||
static LIST_HEAD(codec_list);
|
||||
static LIST_HEAD(component_list);
|
||||
|
||||
/*
|
||||
|
@ -174,21 +173,6 @@ static void soc_cleanup_component_debugfs(struct snd_soc_component *component)
|
|||
debugfs_remove_recursive(component->debugfs_root);
|
||||
}
|
||||
|
||||
static int codec_list_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct snd_soc_codec *codec;
|
||||
|
||||
mutex_lock(&client_mutex);
|
||||
|
||||
list_for_each_entry(codec, &codec_list, list)
|
||||
seq_printf(m, "%s\n", codec->component.name);
|
||||
|
||||
mutex_unlock(&client_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
DEFINE_SHOW_ATTRIBUTE(codec_list);
|
||||
|
||||
static int dai_list_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct snd_soc_component *component;
|
||||
|
@ -241,10 +225,6 @@ static void snd_soc_debugfs_init(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!debugfs_create_file("codecs", 0444, snd_soc_debugfs_root, NULL,
|
||||
&codec_list_fops))
|
||||
pr_warn("ASoC: Failed to create CODEC list debugfs file\n");
|
||||
|
||||
if (!debugfs_create_file("dais", 0444, snd_soc_debugfs_root, NULL,
|
||||
&dai_list_fops))
|
||||
pr_warn("ASoC: Failed to create DAI list debugfs file\n");
|
||||
|
@ -536,8 +516,8 @@ int snd_soc_suspend(struct device *dev)
|
|||
}
|
||||
|
||||
case SND_SOC_BIAS_OFF:
|
||||
if (component->suspend)
|
||||
component->suspend(component);
|
||||
if (component->driver->suspend)
|
||||
component->driver->suspend(component);
|
||||
component->suspended = 1;
|
||||
if (component->regmap)
|
||||
regcache_mark_dirty(component->regmap);
|
||||
|
@ -608,8 +588,8 @@ static void soc_resume_deferred(struct work_struct *work)
|
|||
|
||||
list_for_each_entry(component, &card->component_dev_list, card_list) {
|
||||
if (component->suspended) {
|
||||
if (component->resume)
|
||||
component->resume(component);
|
||||
if (component->driver->resume)
|
||||
component->driver->resume(component);
|
||||
component->suspended = 0;
|
||||
}
|
||||
}
|
||||
|
@ -892,7 +872,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
|
|||
|
||||
/* Single codec links expect codec and codec_dai in runtime data */
|
||||
rtd->codec_dai = codec_dais[0];
|
||||
rtd->codec = rtd->codec_dai->codec;
|
||||
|
||||
/* if there's no platform we match on the empty platform */
|
||||
platform_name = dai_link->platform_name;
|
||||
|
@ -931,8 +910,8 @@ static void soc_remove_component(struct snd_soc_component *component)
|
|||
|
||||
list_del(&component->card_list);
|
||||
|
||||
if (component->remove)
|
||||
component->remove(component);
|
||||
if (component->driver->remove)
|
||||
component->driver->remove(component);
|
||||
|
||||
snd_soc_dapm_free(snd_soc_component_get_dapm(component));
|
||||
|
||||
|
@ -1271,8 +1250,8 @@ static int soc_probe_component(struct snd_soc_card *card,
|
|||
}
|
||||
}
|
||||
|
||||
if (component->probe) {
|
||||
ret = component->probe(component);
|
||||
if (component->driver->probe) {
|
||||
ret = component->driver->probe(component);
|
||||
if (ret < 0) {
|
||||
dev_err(component->dev,
|
||||
"ASoC: failed to probe component %d\n", ret);
|
||||
|
@ -1663,8 +1642,7 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
|
|||
|
||||
/* Flip the polarity for the "CPU" end of a CODEC<->CODEC link */
|
||||
/* the component which has non_legacy_dai_naming is Codec */
|
||||
if (cpu_dai->codec ||
|
||||
cpu_dai->component->driver->non_legacy_dai_naming) {
|
||||
if (cpu_dai->component->driver->non_legacy_dai_naming) {
|
||||
unsigned int inv_dai_fmt;
|
||||
|
||||
inv_dai_fmt = dai_fmt & ~SND_SOC_DAIFMT_MASTER_MASK;
|
||||
|
@ -2256,25 +2234,6 @@ int snd_soc_add_component_controls(struct snd_soc_component *component,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_add_component_controls);
|
||||
|
||||
/**
|
||||
* snd_soc_add_codec_controls - add an array of controls to a codec.
|
||||
* Convenience function to add a list of controls. Many codecs were
|
||||
* duplicating this code.
|
||||
*
|
||||
* @codec: codec to add controls to
|
||||
* @controls: array of controls to add
|
||||
* @num_controls: number of elements in the array
|
||||
*
|
||||
* Return 0 for success, else error.
|
||||
*/
|
||||
int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
|
||||
const struct snd_kcontrol_new *controls, unsigned int num_controls)
|
||||
{
|
||||
return snd_soc_add_component_controls(&codec->component, controls,
|
||||
num_controls);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_add_codec_controls);
|
||||
|
||||
/**
|
||||
* snd_soc_add_card_controls - add an array of controls to a SoC card.
|
||||
* Convenience function to add a list of controls.
|
||||
|
@ -2335,27 +2294,6 @@ int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk);
|
||||
|
||||
/**
|
||||
* snd_soc_codec_set_sysclk - configure CODEC system or master clock.
|
||||
* @codec: CODEC
|
||||
* @clk_id: DAI specific clock ID
|
||||
* @source: Source for the clock
|
||||
* @freq: new clock frequency in Hz
|
||||
* @dir: new clock direction - input/output.
|
||||
*
|
||||
* Configures the CODEC master (MCLK) or system (SYSCLK) clocking.
|
||||
*/
|
||||
int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
|
||||
int source, unsigned int freq, int dir)
|
||||
{
|
||||
if (codec->driver->set_sysclk)
|
||||
return codec->driver->set_sysclk(codec, clk_id, source,
|
||||
freq, dir);
|
||||
else
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_codec_set_sysclk);
|
||||
|
||||
/**
|
||||
* snd_soc_component_set_sysclk - configure COMPONENT system or master clock.
|
||||
* @component: COMPONENT
|
||||
|
@ -2369,11 +2307,6 @@ EXPORT_SYMBOL_GPL(snd_soc_codec_set_sysclk);
|
|||
int snd_soc_component_set_sysclk(struct snd_soc_component *component, int clk_id,
|
||||
int source, unsigned int freq, int dir)
|
||||
{
|
||||
/* will be removed */
|
||||
if (component->set_sysclk)
|
||||
return component->set_sysclk(component, clk_id, source,
|
||||
freq, dir);
|
||||
|
||||
if (component->driver->set_sysclk)
|
||||
return component->driver->set_sysclk(component, clk_id, source,
|
||||
freq, dir);
|
||||
|
@ -2424,27 +2357,6 @@ int snd_soc_dai_set_pll(struct snd_soc_dai *dai, int pll_id, int source,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_dai_set_pll);
|
||||
|
||||
/*
|
||||
* snd_soc_codec_set_pll - configure codec PLL.
|
||||
* @codec: CODEC
|
||||
* @pll_id: DAI specific PLL ID
|
||||
* @source: DAI specific source for the PLL
|
||||
* @freq_in: PLL input clock frequency in Hz
|
||||
* @freq_out: requested PLL output clock frequency in Hz
|
||||
*
|
||||
* Configures and enables PLL to generate output clock based on input clock.
|
||||
*/
|
||||
int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
|
||||
unsigned int freq_in, unsigned int freq_out)
|
||||
{
|
||||
if (codec->driver->set_pll)
|
||||
return codec->driver->set_pll(codec, pll_id, source,
|
||||
freq_in, freq_out);
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_codec_set_pll);
|
||||
|
||||
/*
|
||||
* snd_soc_component_set_pll - configure component PLL.
|
||||
* @component: COMPONENT
|
||||
|
@ -2459,11 +2371,6 @@ int snd_soc_component_set_pll(struct snd_soc_component *component, int pll_id,
|
|||
int source, unsigned int freq_in,
|
||||
unsigned int freq_out)
|
||||
{
|
||||
/* will be removed */
|
||||
if (component->set_pll)
|
||||
return component->set_pll(component, pll_id, source,
|
||||
freq_in, freq_out);
|
||||
|
||||
if (component->driver->set_pll)
|
||||
return component->driver->set_pll(component, pll_id, source,
|
||||
freq_in, freq_out);
|
||||
|
@ -2964,13 +2871,6 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
|
|||
|
||||
component->dev = dev;
|
||||
component->driver = driver;
|
||||
component->probe = component->driver->probe;
|
||||
component->remove = component->driver->remove;
|
||||
component->suspend = component->driver->suspend;
|
||||
component->resume = component->driver->resume;
|
||||
component->set_sysclk = component->driver->set_sysclk;
|
||||
component->set_pll = component->driver->set_pll;
|
||||
component->set_jack = component->driver->set_jack;
|
||||
|
||||
dapm = snd_soc_component_get_dapm(component);
|
||||
dapm->dev = dev;
|
||||
|
@ -3041,7 +2941,7 @@ EXPORT_SYMBOL_GPL(snd_soc_component_exit_regmap);
|
|||
|
||||
static void snd_soc_component_add_unlocked(struct snd_soc_component *component)
|
||||
{
|
||||
if (!component->write && !component->read) {
|
||||
if (!component->driver->write && !component->driver->read) {
|
||||
if (!component->regmap)
|
||||
component->regmap = dev_get_regmap(component->dev, NULL);
|
||||
if (component->regmap)
|
||||
|
@ -3123,9 +3023,6 @@ int snd_soc_add_component(struct device *dev,
|
|||
if (ret)
|
||||
goto err_free;
|
||||
|
||||
component->ignore_pmdown_time = true;
|
||||
component->registered_as_component = true;
|
||||
|
||||
if (component_driver->endianness) {
|
||||
for (i = 0; i < num_dai; i++) {
|
||||
convert_endianness_formats(&dai_drv[i].playback);
|
||||
|
@ -3180,8 +3077,7 @@ static int __snd_soc_unregister_component(struct device *dev)
|
|||
|
||||
mutex_lock(&client_mutex);
|
||||
list_for_each_entry(component, &component_list, list) {
|
||||
if (dev != component->dev ||
|
||||
!component->registered_as_component)
|
||||
if (dev != component->dev)
|
||||
continue;
|
||||
|
||||
snd_soc_tplg_component_remove(component, SND_SOC_TPLG_INDEX_ALL);
|
||||
|
@ -3230,211 +3126,6 @@ struct snd_soc_component *snd_soc_lookup_component(struct device *dev,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_lookup_component);
|
||||
|
||||
static int snd_soc_codec_drv_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
|
||||
return codec->driver->probe(codec);
|
||||
}
|
||||
|
||||
static void snd_soc_codec_drv_remove(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
|
||||
codec->driver->remove(codec);
|
||||
}
|
||||
|
||||
static int snd_soc_codec_drv_suspend(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
|
||||
return codec->driver->suspend(codec);
|
||||
}
|
||||
|
||||
static int snd_soc_codec_drv_resume(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
|
||||
return codec->driver->resume(codec);
|
||||
}
|
||||
|
||||
static int snd_soc_codec_drv_write(struct snd_soc_component *component,
|
||||
unsigned int reg, unsigned int val)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
|
||||
return codec->driver->write(codec, reg, val);
|
||||
}
|
||||
|
||||
static int snd_soc_codec_drv_read(struct snd_soc_component *component,
|
||||
unsigned int reg, unsigned int *val)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
|
||||
*val = codec->driver->read(codec, reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_soc_codec_set_sysclk_(struct snd_soc_component *component,
|
||||
int clk_id, int source, unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
|
||||
return snd_soc_codec_set_sysclk(codec, clk_id, source, freq, dir);
|
||||
}
|
||||
|
||||
static int snd_soc_codec_set_pll_(struct snd_soc_component *component,
|
||||
int pll_id, int source, unsigned int freq_in,
|
||||
unsigned int freq_out)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
|
||||
return snd_soc_codec_set_pll(codec, pll_id, source, freq_in, freq_out);
|
||||
}
|
||||
|
||||
static int snd_soc_codec_set_jack_(struct snd_soc_component *component,
|
||||
struct snd_soc_jack *jack, void *data)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
|
||||
return snd_soc_codec_set_jack(codec, jack, data);
|
||||
}
|
||||
|
||||
static int snd_soc_codec_set_bias_level(struct snd_soc_dapm_context *dapm,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
|
||||
|
||||
return codec->driver->set_bias_level(codec, level);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_register_codec - Register a codec with the ASoC core
|
||||
*
|
||||
* @dev: The parent device for this codec
|
||||
* @codec_drv: Codec driver
|
||||
* @dai_drv: The associated DAI driver
|
||||
* @num_dai: Number of DAIs
|
||||
*/
|
||||
int snd_soc_register_codec(struct device *dev,
|
||||
const struct snd_soc_codec_driver *codec_drv,
|
||||
struct snd_soc_dai_driver *dai_drv,
|
||||
int num_dai)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm;
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_dai *dai;
|
||||
int ret, i;
|
||||
|
||||
dev_dbg(dev, "codec register %s\n", dev_name(dev));
|
||||
|
||||
codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
|
||||
if (codec == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
codec->component.codec = codec;
|
||||
|
||||
ret = snd_soc_component_initialize(&codec->component,
|
||||
&codec_drv->component_driver, dev);
|
||||
if (ret)
|
||||
goto err_free;
|
||||
|
||||
if (codec_drv->probe)
|
||||
codec->component.probe = snd_soc_codec_drv_probe;
|
||||
if (codec_drv->remove)
|
||||
codec->component.remove = snd_soc_codec_drv_remove;
|
||||
if (codec_drv->suspend)
|
||||
codec->component.suspend = snd_soc_codec_drv_suspend;
|
||||
if (codec_drv->resume)
|
||||
codec->component.resume = snd_soc_codec_drv_resume;
|
||||
if (codec_drv->write)
|
||||
codec->component.write = snd_soc_codec_drv_write;
|
||||
if (codec_drv->read)
|
||||
codec->component.read = snd_soc_codec_drv_read;
|
||||
if (codec_drv->set_sysclk)
|
||||
codec->component.set_sysclk = snd_soc_codec_set_sysclk_;
|
||||
if (codec_drv->set_pll)
|
||||
codec->component.set_pll = snd_soc_codec_set_pll_;
|
||||
if (codec_drv->set_jack)
|
||||
codec->component.set_jack = snd_soc_codec_set_jack_;
|
||||
codec->component.ignore_pmdown_time = codec_drv->ignore_pmdown_time;
|
||||
|
||||
dapm = snd_soc_codec_get_dapm(codec);
|
||||
dapm->idle_bias_off = codec_drv->idle_bias_off;
|
||||
dapm->suspend_bias_off = codec_drv->suspend_bias_off;
|
||||
if (codec_drv->seq_notifier)
|
||||
dapm->seq_notifier = codec_drv->seq_notifier;
|
||||
if (codec_drv->set_bias_level)
|
||||
dapm->set_bias_level = snd_soc_codec_set_bias_level;
|
||||
codec->dev = dev;
|
||||
codec->driver = codec_drv;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
codec->component.debugfs_prefix = "codec";
|
||||
#endif
|
||||
|
||||
for (i = 0; i < num_dai; i++) {
|
||||
convert_endianness_formats(&dai_drv[i].playback);
|
||||
convert_endianness_formats(&dai_drv[i].capture);
|
||||
}
|
||||
|
||||
ret = snd_soc_register_dais(&codec->component, dai_drv, num_dai, false);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "ASoC: Failed to register DAIs: %d\n", ret);
|
||||
goto err_cleanup;
|
||||
}
|
||||
|
||||
list_for_each_entry(dai, &codec->component.dai_list, list)
|
||||
dai->codec = codec;
|
||||
|
||||
mutex_lock(&client_mutex);
|
||||
snd_soc_component_add_unlocked(&codec->component);
|
||||
list_add(&codec->list, &codec_list);
|
||||
mutex_unlock(&client_mutex);
|
||||
|
||||
dev_dbg(codec->dev, "ASoC: Registered codec '%s'\n",
|
||||
codec->component.name);
|
||||
return 0;
|
||||
|
||||
err_cleanup:
|
||||
snd_soc_component_cleanup(&codec->component);
|
||||
err_free:
|
||||
kfree(codec);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_register_codec);
|
||||
|
||||
/**
|
||||
* snd_soc_unregister_codec - Unregister a codec from the ASoC core
|
||||
*
|
||||
* @dev: codec to unregister
|
||||
*/
|
||||
void snd_soc_unregister_codec(struct device *dev)
|
||||
{
|
||||
struct snd_soc_codec *codec;
|
||||
|
||||
mutex_lock(&client_mutex);
|
||||
list_for_each_entry(codec, &codec_list, list) {
|
||||
if (dev == codec->dev)
|
||||
goto found;
|
||||
}
|
||||
mutex_unlock(&client_mutex);
|
||||
return;
|
||||
|
||||
found:
|
||||
list_del(&codec->list);
|
||||
snd_soc_component_del_unlocked(&codec->component);
|
||||
mutex_unlock(&client_mutex);
|
||||
|
||||
dev_dbg(codec->dev, "ASoC: Unregistered codec '%s'\n",
|
||||
codec->component.name);
|
||||
|
||||
snd_soc_component_cleanup(&codec->component);
|
||||
kfree(codec);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_unregister_codec);
|
||||
|
||||
/* Retrieve a card's name from device tree */
|
||||
int snd_soc_of_parse_card_name(struct snd_soc_card *card,
|
||||
const char *propname)
|
||||
|
|
|
@ -32,8 +32,6 @@ int snd_soc_component_read(struct snd_soc_component *component,
|
|||
|
||||
if (component->regmap)
|
||||
ret = regmap_read(component->regmap, reg, val);
|
||||
else if (component->read)
|
||||
ret = component->read(component, reg, val);
|
||||
else if (component->driver->read) {
|
||||
*val = component->driver->read(component, reg);
|
||||
ret = 0;
|
||||
|
@ -72,8 +70,6 @@ int snd_soc_component_write(struct snd_soc_component *component,
|
|||
{
|
||||
if (component->regmap)
|
||||
return regmap_write(component->regmap, reg, val);
|
||||
else if (component->write)
|
||||
return component->write(component, reg, val);
|
||||
else if (component->driver->write)
|
||||
return component->driver->write(component, reg, val);
|
||||
else
|
||||
|
@ -209,61 +205,3 @@ int snd_soc_component_test_bits(struct snd_soc_component *component,
|
|||
return old != new;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_test_bits);
|
||||
|
||||
unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg)
|
||||
{
|
||||
unsigned int val;
|
||||
int ret;
|
||||
|
||||
ret = snd_soc_component_read(&codec->component, reg, &val);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
return val;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_read);
|
||||
|
||||
int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int val)
|
||||
{
|
||||
return snd_soc_component_write(&codec->component, reg, val);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_write);
|
||||
|
||||
/**
|
||||
* snd_soc_update_bits - update codec register bits
|
||||
* @codec: audio codec
|
||||
* @reg: codec register
|
||||
* @mask: register mask
|
||||
* @value: new value
|
||||
*
|
||||
* Writes new register value.
|
||||
*
|
||||
* Returns 1 for change, 0 for no change, or negative error code.
|
||||
*/
|
||||
int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int mask, unsigned int value)
|
||||
{
|
||||
return snd_soc_component_update_bits(&codec->component, reg, mask,
|
||||
value);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_update_bits);
|
||||
|
||||
/**
|
||||
* snd_soc_test_bits - test register for change
|
||||
* @codec: audio codec
|
||||
* @reg: codec register
|
||||
* @mask: register mask
|
||||
* @value: new value
|
||||
*
|
||||
* Tests a register with a new value and checks if the new value is
|
||||
* different from the old value.
|
||||
*
|
||||
* Returns 1 for change else 0.
|
||||
*/
|
||||
int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int mask, unsigned int value)
|
||||
{
|
||||
return snd_soc_component_test_bits(&codec->component, reg, mask, value);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_test_bits);
|
||||
|
|
|
@ -28,24 +28,6 @@ struct jack_gpio_tbl {
|
|||
struct snd_soc_jack_gpio *gpios;
|
||||
};
|
||||
|
||||
/**
|
||||
* snd_soc_codec_set_jack - configure codec jack.
|
||||
* @codec: CODEC
|
||||
* @jack: structure to use for the jack
|
||||
* @data: can be used if codec driver need extra data for configuring jack
|
||||
*
|
||||
* Configures and enables jack detection function.
|
||||
*/
|
||||
int snd_soc_codec_set_jack(struct snd_soc_codec *codec,
|
||||
struct snd_soc_jack *jack, void *data)
|
||||
{
|
||||
if (codec->driver->set_jack)
|
||||
return codec->driver->set_jack(codec, jack, data);
|
||||
else
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_codec_set_jack);
|
||||
|
||||
/**
|
||||
* snd_soc_component_set_jack - configure component jack.
|
||||
* @component: COMPONENTs
|
||||
|
@ -57,10 +39,6 @@ EXPORT_SYMBOL_GPL(snd_soc_codec_set_jack);
|
|||
int snd_soc_component_set_jack(struct snd_soc_component *component,
|
||||
struct snd_soc_jack *jack, void *data)
|
||||
{
|
||||
/* will be removed */
|
||||
if (component->set_jack)
|
||||
return component->set_jack(component, jack, data);
|
||||
|
||||
if (component->driver->set_jack)
|
||||
return component->driver->set_jack(component, jack, data);
|
||||
|
||||
|
|
|
@ -135,7 +135,6 @@ bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd)
|
|||
{
|
||||
struct snd_soc_rtdcom_list *rtdcom;
|
||||
struct snd_soc_component *component;
|
||||
int i;
|
||||
bool ignore = true;
|
||||
|
||||
if (!rtd->pmdown_time || rtd->dai_link->ignore_pmdown_time)
|
||||
|
@ -147,10 +146,6 @@ bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd)
|
|||
ignore &= !component->driver->use_pmdown_time;
|
||||
}
|
||||
|
||||
/* this will be removed */
|
||||
for (i = 0; i < rtd->num_codecs; i++)
|
||||
ignore &= rtd->codec_dais[i]->component->ignore_pmdown_time;
|
||||
|
||||
return ignore;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче