Skip to content

Commit 6b8ba0d

Browse files
morimotobroonie
authored andcommitted
ASoC: soc-dapm: add snd_soc_dapm_to_dev()
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>
1 parent 32bd60d commit 6b8ba0d

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

include/sound/soc-dapm.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ struct snd_soc_dapm_context {
587587
unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
588588
unsigned int suspend_bias_off:1; /* Use BIAS_OFF in suspend if the DAPM is idle */
589589

590-
struct device *dev; /* from parent - for debug */
590+
struct device *dev; /* from parent - for debug */ /* REMOVE ME */
591591
struct snd_soc_component *component; /* parent component */
592592
struct snd_soc_card *card; /* parent card */
593593

@@ -660,6 +660,7 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
660660
int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream,
661661
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai);
662662
int snd_soc_dapm_widget_name_cmp(struct snd_soc_dapm_widget *widget, const char *s);
663+
struct device *snd_soc_dapm_to_dev(struct snd_soc_dapm_context *dapm);
663664

664665
/* dapm path setup */
665666
int snd_soc_dapm_new_widgets(struct snd_soc_card *card);

sound/soc/soc-dapm.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,15 @@ static void pop_dbg(struct device *dev, u32 pop_time, const char *fmt, ...)
165165
kfree(buf);
166166
}
167167

168+
struct device *snd_soc_dapm_to_dev(struct snd_soc_dapm_context *dapm)
169+
{
170+
if (dapm->component)
171+
return dapm->component->dev;
172+
173+
return dapm->card->dev;
174+
}
175+
EXPORT_SYMBOL_GPL(snd_soc_dapm_to_dev);
176+
168177
static bool dapm_dirty_widget(struct snd_soc_dapm_widget *w)
169178
{
170179
return !list_empty(&w->dirty);

0 commit comments

Comments
 (0)