]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ASoC: dapm: Add a update parameter to snd_soc_dapm_{mux,mixer}_update_power
authorLars-Peter Clausen <lars@metafoo.de>
Wed, 24 Jul 2013 13:27:38 +0000 (15:27 +0200)
committerMark Brown <broonie@linaro.org>
Wed, 24 Jul 2013 13:56:19 +0000 (14:56 +0100)
In order to avoid race conditions the assignment of dapm->update should happen
while card->dapm_mutex is being held. To allow CODEC drivers to run a register
update when using snd_soc_dapm_mux_update_power() or
snd_soc_dapm_mixer_update_power() add a update parameter to these two functions.
The update parameter will be assigned to dapm->update while card->dapm_mutex is
locked.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
include/sound/soc-dapm.h
sound/soc/soc-dapm.c

index 3717ad0894860021699f769c3d685a8685d5bcf6..e77c6f5a83901032967a9bf84c398392ebd17454 100644 (file)
@@ -333,6 +333,7 @@ struct snd_soc_dapm_route;
 struct snd_soc_dapm_context;
 struct regulator;
 struct snd_soc_dapm_widget_list;
+struct snd_soc_dapm_update;
 
 int dapm_reg_event(struct snd_soc_dapm_widget *w,
                   struct snd_kcontrol *kcontrol, int event);
@@ -392,9 +393,11 @@ 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_context *dapm,
-               struct snd_kcontrol *kcontrol, int connect);
+               struct snd_kcontrol *kcontrol, int connect,
+               struct snd_soc_dapm_update *update);
 int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm,
-               struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e);
+               struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e,
+               struct snd_soc_dapm_update *update);
 
 /* dapm sys fs - used by the core */
 int snd_soc_dapm_sys_add(struct device *dev);
index 6f8a01bf6ca8d991a0e306de51c1e8edcbb73dac..758761146a42c59da5e8fa92386378fd88c35163 100644 (file)
@@ -1982,13 +1982,16 @@ static int soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm,
 }
 
 int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm,
-       struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e)
+       struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e,
+       struct snd_soc_dapm_update *update)
 {
        struct snd_soc_card *card = dapm->card;
        int ret;
 
        mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+       dapm->update = update;
        ret = soc_dapm_mux_update_power(dapm, kcontrol, mux, e);
+       dapm->update = NULL;
        mutex_unlock(&card->dapm_mutex);
        if (ret > 0)
                soc_dpcm_runtime_update(card);
@@ -2022,13 +2025,16 @@ static int soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm,
 }
 
 int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm,
-       struct snd_kcontrol *kcontrol, int connect)
+       struct snd_kcontrol *kcontrol, int connect,
+       struct snd_soc_dapm_update *update)
 {
        struct snd_soc_card *card = dapm->card;
        int ret;
 
        mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+       dapm->update = update;
        ret = soc_dapm_mixer_update_power(dapm, kcontrol, connect);
+       dapm->update = NULL;
        mutex_unlock(&card->dapm_mutex);
        if (ret > 0)
                soc_dpcm_runtime_update(card);