]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ASoC: soc-dapm: add snd_soc_dapm_to_dev()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 4 Sep 2025 05:21:08 +0000 (05:21 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 18 Sep 2025 21:24:09 +0000 (22:24 +0100)
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.

Some drivers need to get dev from dapm (which will be removed).
We need such function. Add it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87cy86x06z.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dapm.h
sound/soc/soc-dapm.c

index ed39458b94bf9b5c594def913dc16123456cdf50..ccd36a198a1346da81d8b8d01091e2d7de1ac050 100644 (file)
@@ -587,7 +587,7 @@ struct snd_soc_dapm_context {
        unsigned int idle_bias_off:1;           /* Use BIAS_OFF instead of STANDBY */
        unsigned int suspend_bias_off:1;        /* Use BIAS_OFF in suspend if the DAPM is idle */
 
-       struct device *dev;                     /* from parent - for debug */
+       struct device *dev;                     /* from parent - for debug */ /* REMOVE ME */
        struct snd_soc_component *component;    /* parent component */
        struct snd_soc_card *card;              /* parent card */
 
@@ -660,6 +660,7 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream,
                            struct snd_pcm_hw_params *params, struct snd_soc_dai *dai);
 int snd_soc_dapm_widget_name_cmp(struct snd_soc_dapm_widget *widget, const char *s);
+struct device *snd_soc_dapm_to_dev(struct snd_soc_dapm_context *dapm);
 
 /* dapm path setup */
 int snd_soc_dapm_new_widgets(struct snd_soc_card *card);
index d74c096cc20840e66b04c58f677f14c34008ccc6..83cdf97edb9da00dde077209b1b656f009a83724 100644 (file)
@@ -165,6 +165,15 @@ static void pop_dbg(struct device *dev, u32 pop_time, const char *fmt, ...)
        kfree(buf);
 }
 
+struct device *snd_soc_dapm_to_dev(struct snd_soc_dapm_context *dapm)
+{
+       if (dapm->component)
+               return dapm->component->dev;
+
+       return dapm->card->dev;
+}
+EXPORT_SYMBOL_GPL(snd_soc_dapm_to_dev);
+
 static bool dapm_dirty_widget(struct snd_soc_dapm_widget *w)
 {
        return !list_empty(&w->dirty);