mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:24:47 +01:00
ASoC: soc-dapm: add snd_soc_dapm_alloc()
Because struct snd_soc_dapm_context is soc-dapm framework specific, user driver don't need to access its member directly, we would like to hide them. struct snd_soc_dapm_context will be removed from header in the future. Current card/component are using dapm_context instance. But it will be moved to soc-dapm.c, and we can use will be only pointer. Makes it to pointer. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://patch.msgid.link/87h5shqgw1.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
cf0e8c555b
commit
13c84b4c6f
5 changed files with 20 additions and 6 deletions
|
|
@ -237,8 +237,7 @@ struct snd_soc_component {
|
|||
* the driver will be marked as BROKEN when these fields are removed.
|
||||
*/
|
||||
|
||||
/* Don't use these, use snd_soc_component_get_dapm() */
|
||||
struct snd_soc_dapm_context dapm;
|
||||
struct snd_soc_dapm_context *dapm;
|
||||
|
||||
/* machine specific init */
|
||||
int (*init)(struct snd_soc_component *component);
|
||||
|
|
@ -268,7 +267,7 @@ struct snd_soc_component {
|
|||
static inline struct snd_soc_dapm_context *snd_soc_component_to_dapm(
|
||||
struct snd_soc_component *component)
|
||||
{
|
||||
return &component->dapm;
|
||||
return component->dapm;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -627,6 +627,8 @@ enum snd_soc_dapm_direction {
|
|||
#define SND_SOC_DAPM_EP_SOURCE SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_IN)
|
||||
#define SND_SOC_DAPM_EP_SINK SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_OUT)
|
||||
|
||||
struct snd_soc_dapm_context *snd_soc_dapm_alloc(struct device *dev);
|
||||
|
||||
int snd_soc_dapm_regulator_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event);
|
||||
int snd_soc_dapm_clock_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event);
|
||||
int snd_soc_dapm_pinctrl_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event);
|
||||
|
|
|
|||
|
|
@ -1076,7 +1076,7 @@ struct snd_soc_card {
|
|||
struct list_head dobj_list;
|
||||
|
||||
/* Generic DAPM context for the card */
|
||||
struct snd_soc_dapm_context dapm;
|
||||
struct snd_soc_dapm_context *dapm;
|
||||
struct snd_soc_dapm_stats dapm_stats;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
|
|
@ -1136,7 +1136,7 @@ static inline int snd_soc_card_is_instantiated(struct snd_soc_card *card)
|
|||
|
||||
static inline struct snd_soc_dapm_context *snd_soc_card_to_dapm(struct snd_soc_card *card)
|
||||
{
|
||||
return &card->dapm;
|
||||
return card->dapm;
|
||||
}
|
||||
|
||||
/* SoC machine DAI configuration, glues a codec and cpu DAI together */
|
||||
|
|
|
|||
|
|
@ -2556,6 +2556,10 @@ int snd_soc_register_card(struct snd_soc_card *card)
|
|||
if (!card->name || !card->dev)
|
||||
return -EINVAL;
|
||||
|
||||
card->dapm = snd_soc_dapm_alloc(card->dev);
|
||||
if (!card->dapm)
|
||||
return -ENOMEM;
|
||||
|
||||
dev_set_drvdata(card->dev, card);
|
||||
|
||||
INIT_LIST_HEAD(&card->widgets);
|
||||
|
|
@ -2840,6 +2844,10 @@ int snd_soc_component_initialize(struct snd_soc_component *component,
|
|||
const struct snd_soc_component_driver *driver,
|
||||
struct device *dev)
|
||||
{
|
||||
component->dapm = snd_soc_dapm_alloc(dev);
|
||||
if (!component->dapm)
|
||||
return -ENOMEM;
|
||||
|
||||
INIT_LIST_HEAD(&component->dai_list);
|
||||
INIT_LIST_HEAD(&component->dobj_list);
|
||||
INIT_LIST_HEAD(&component->card_list);
|
||||
|
|
|
|||
|
|
@ -165,6 +165,11 @@ static void pop_dbg(struct device *dev, u32 pop_time, const char *fmt, ...)
|
|||
kfree(buf);
|
||||
}
|
||||
|
||||
struct snd_soc_dapm_context *snd_soc_dapm_alloc(struct device *dev)
|
||||
{
|
||||
return devm_kzalloc(dev, sizeof(struct snd_soc_dapm_context), GFP_KERNEL);
|
||||
}
|
||||
|
||||
struct device *snd_soc_dapm_to_dev(struct snd_soc_dapm_context *dapm)
|
||||
{
|
||||
if (dapm->component)
|
||||
|
|
@ -1076,7 +1081,7 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm,
|
|||
if (ret != 0)
|
||||
goto out;
|
||||
|
||||
if (dapm != &card->dapm)
|
||||
if (dapm != card->dapm)
|
||||
ret = snd_soc_dapm_force_bias_level(dapm, level);
|
||||
|
||||
if (ret != 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue