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>
* 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);
static inline struct snd_soc_dapm_context *snd_soc_component_to_dapm(
struct snd_soc_component *component)
{
- return &component->dapm;
+ return component->dapm;
}
/**
#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);
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
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 */
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);
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);
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)
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)