Commit 52765976 authored by Nenghua Cao's avatar Nenghua Cao Committed by Mark Brown

ASoC: dapm: update DPCM runtime when mixer/mux changes

    DPCM can dynamically alter the FE to BE PCM links at runtime based
on mixer/mux setting updates. Add soc_dpcm_runtime_update() calling in
get/put function for mixer/mux to support this feature.
Signed-off-by: default avatarNenghua Cao <nhcao@marvell.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 6ce4eac1
...@@ -2868,6 +2868,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, ...@@ -2868,6 +2868,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
unsigned int val; unsigned int val;
int connect, change; int connect, change;
struct snd_soc_dapm_update update; struct snd_soc_dapm_update update;
int ret = 0;
if (snd_soc_volsw_is_stereo(mc)) if (snd_soc_volsw_is_stereo(mc))
dev_warn(codec->dapm.dev, dev_warn(codec->dapm.dev,
...@@ -2901,12 +2902,16 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, ...@@ -2901,12 +2902,16 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
card->update = &update; card->update = &update;
} }
soc_dapm_mixer_update_power(card, kcontrol, connect); ret = soc_dapm_mixer_update_power(card, kcontrol, connect);
card->update = NULL; card->update = NULL;
} }
mutex_unlock(&card->dapm_mutex); mutex_unlock(&card->dapm_mutex);
if (ret > 0)
soc_dpcm_runtime_update(card);
return change; return change;
} }
EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw); EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw);
...@@ -2955,6 +2960,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, ...@@ -2955,6 +2960,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
unsigned int val, mux, change; unsigned int val, mux, change;
unsigned int mask; unsigned int mask;
struct snd_soc_dapm_update update; struct snd_soc_dapm_update update;
int ret = 0;
if (ucontrol->value.enumerated.item[0] > e->max - 1) if (ucontrol->value.enumerated.item[0] > e->max - 1)
return -EINVAL; return -EINVAL;
...@@ -2978,12 +2984,16 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, ...@@ -2978,12 +2984,16 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
update.val = val; update.val = val;
card->update = &update; card->update = &update;
soc_dapm_mux_update_power(card, kcontrol, mux, e); ret = soc_dapm_mux_update_power(card, kcontrol, mux, e);
card->update = NULL; card->update = NULL;
} }
mutex_unlock(&card->dapm_mutex); mutex_unlock(&card->dapm_mutex);
if (ret > 0)
soc_dpcm_runtime_update(card);
return change; return change;
} }
EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_double); EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_double);
...@@ -3019,6 +3029,7 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, ...@@ -3019,6 +3029,7 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,
struct soc_enum *e = struct soc_enum *e =
(struct soc_enum *)kcontrol->private_value; (struct soc_enum *)kcontrol->private_value;
int change; int change;
int ret = 0;
if (ucontrol->value.enumerated.item[0] >= e->max) if (ucontrol->value.enumerated.item[0] >= e->max)
return -EINVAL; return -EINVAL;
...@@ -3028,9 +3039,13 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, ...@@ -3028,9 +3039,13 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,
value = ucontrol->value.enumerated.item[0]; value = ucontrol->value.enumerated.item[0];
change = dapm_kcontrol_set_value(kcontrol, value); change = dapm_kcontrol_set_value(kcontrol, value);
if (change) if (change)
soc_dapm_mux_update_power(card, kcontrol, value, e); ret = soc_dapm_mux_update_power(card, kcontrol, value, e);
mutex_unlock(&card->dapm_mutex); mutex_unlock(&card->dapm_mutex);
if (ret > 0)
soc_dpcm_runtime_update(card);
return change; return change;
} }
EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_virt); EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_virt);
...@@ -3097,6 +3112,7 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, ...@@ -3097,6 +3112,7 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
unsigned int val, mux, change; unsigned int val, mux, change;
unsigned int mask; unsigned int mask;
struct snd_soc_dapm_update update; struct snd_soc_dapm_update update;
int ret = 0;
if (ucontrol->value.enumerated.item[0] > e->max - 1) if (ucontrol->value.enumerated.item[0] > e->max - 1)
return -EINVAL; return -EINVAL;
...@@ -3120,12 +3136,16 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, ...@@ -3120,12 +3136,16 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
update.val = val; update.val = val;
card->update = &update; card->update = &update;
soc_dapm_mux_update_power(card, kcontrol, mux, e); ret = soc_dapm_mux_update_power(card, kcontrol, mux, e);
card->update = NULL; card->update = NULL;
} }
mutex_unlock(&card->dapm_mutex); mutex_unlock(&card->dapm_mutex);
if (ret > 0)
soc_dpcm_runtime_update(card);
return change; return change;
} }
EXPORT_SYMBOL_GPL(snd_soc_dapm_put_value_enum_double); EXPORT_SYMBOL_GPL(snd_soc_dapm_put_value_enum_double);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment