From: Liam Girdwood Date: Mon, 6 Feb 2012 16:05:14 +0000 (+0000) Subject: ASoC: dapm: Export mixer|mux_update_power() to public API. X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=40f02cd9f21dc2bd2c65713eb986139bb1ea0363;p=linux-beck.git ASoC: dapm: Export mixer|mux_update_power() to public API. Allow for the operation of custom mixer and mux DAPM widgets that can call snd_soc_dapm_mixer_update_power() and snd_soc_dapm_mux_update_power() directly after updating their status. This is useful with complex DAPM Mixer operations where we need to do additional work in addition to setting a few mixer register bits. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index bfa0d3cbbf25..db8435a79a82 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -371,6 +371,12 @@ int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, const char *stream, int event); void snd_soc_dapm_shutdown(struct snd_soc_card *card); +/* external DAPM widget events */ +int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, + struct snd_kcontrol *kcontrol, int connect); +int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget, + struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e); + /* dapm sys fs - used by the core */ int snd_soc_dapm_sys_add(struct device *dev); void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index ec58a3146569..e9776a133d84 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -1699,9 +1699,8 @@ static inline void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm) #endif /* test and update the power status of a mux widget */ -static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget, - struct snd_kcontrol *kcontrol, int change, - int mux, struct soc_enum *e) +int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget, + struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e) { struct snd_soc_dapm_path *path; int found = 0; @@ -1711,9 +1710,6 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget, widget->id != snd_soc_dapm_value_mux) return -ENODEV; - if (!change) - return 0; - /* find dapm widget path assoc with kcontrol */ list_for_each_entry(path, &widget->dapm->card->paths, list) { if (path->kcontrol != kcontrol) @@ -1742,9 +1738,10 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget, return 0; } +EXPORT_SYMBOL_GPL(snd_soc_dapm_mux_update_power); /* test and update the power status of a mixer or switch widget */ -static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, +int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, struct snd_kcontrol *kcontrol, int connect) { struct snd_soc_dapm_path *path; @@ -1773,6 +1770,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, return 0; } +EXPORT_SYMBOL_GPL(snd_soc_dapm_mixer_update_power); /* show dapm widget status in sys fs */ static ssize_t dapm_widget_show(struct device *dev, @@ -2357,7 +2355,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, update.val = val; widget->dapm->update = &update; - dapm_mixer_update_power(widget, kcontrol, connect); + snd_soc_dapm_mixer_update_power(widget, kcontrol, connect); widget->dapm->update = NULL; } @@ -2448,7 +2446,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, update.val = val; widget->dapm->update = &update; - dapm_mux_update_power(widget, kcontrol, change, mux, e); + snd_soc_dapm_mux_update_power(widget, kcontrol, mux, e); widget->dapm->update = NULL; } @@ -2509,8 +2507,7 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, widget->value = ucontrol->value.enumerated.item[0]; - dapm_mux_update_power(widget, kcontrol, change, - widget->value, e); + snd_soc_dapm_mux_update_power(widget, kcontrol, widget->value, e); } } @@ -2613,7 +2610,7 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, update.val = val; widget->dapm->update = &update; - dapm_mux_update_power(widget, kcontrol, change, mux, e); + snd_soc_dapm_mux_update_power(widget, kcontrol, mux, e); widget->dapm->update = NULL; }