ASOC:DAPM: update DPCM runtime when mixer/mux changes
PATCH v2 1/1 ASOC:DAPM: update DPCM runtime when mixer/mux changes
From: Nenghua Cao <[email protected]>
V2 -> V1:
Removes the flag and update DPCM always when mixer/mux changes, according
to Takashi's and Mark's suggestion.
Quoted 7 lines
Quoted 3 lines
Usually backward compatibility is concerned when something new breaks the existing ones. In your case, always updating DPCM would work, too, even without an extra flag; it's just suboptimal.
Right, and if we have separate versions then at some point we'll end up having to define DPCM versions of everything which is going to get tedious and error prone.
V1 -> V0:
refined patch, and add flag into soc_mixer_control and soc_enum
instead of the alsa core, according to Takashi's suggestion.
Quoted 3 lines
You don't need to extend the ALSA core API for such a purpose. It's ASoC-specific, so rather extend struct
soc_mixer_controlinstead, if such a new flag is really needed.
Nenghua Cao (1):
ASOC:DAPM: update DPCM runtime when mixer/mux changes
sound/soc/soc-dapm.c | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-)
PATCH 1/1 ASOC:DAPM: update DPCM runtime when mixer/mux changes
From: Nenghua Cao <[email protected]>
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.
--- sound/soc/soc-dapm.c | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-)
sound/soc/soc-dapm.c +24 -4
@@ -2868,6 +2868,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,unsigned int val;int connect, change;struct snd_soc_dapm_update update; +int ret =0 ;if (snd_soc_volsw_is_stereo (mc)) dev_warn(codec->dapm.dev,
@@ -2901,12 +2902,16 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, card->update = &update; } -soc_dapm_mixer_update_power (card, kcontrol, connect); + ret =soc_dapm_mixer_update_power (card, kcontrol, connect); card->update =NULL ; }mutex_unlock (&card->dapm_mutex); + +if (ret >0 ) +soc_dpcm_runtime_update (card); +return change; }EXPORT_SYMBOL_GPL (snd_soc_dapm_put_volsw);
@@ -2955,6 +2960,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,unsigned int val, mux, change;unsigned int mask;struct snd_soc_dapm_update update; +int ret =0 ;if (ucontrol->value.enumerated.item[0 ] > e->max -1 )return -EINVAL ;
@@ -2978,12 +2984,16 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, update.val = val; 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 ; }mutex_unlock (&card->dapm_mutex); + +if (ret >0 ) +soc_dpcm_runtime_update (card); +return change; }EXPORT_SYMBOL_GPL (snd_soc_dapm_put_enum_double);
@@ -3019,6 +3029,7 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;int change; +int ret =0 ;if (ucontrol->value.enumerated.item[0 ] >= e->max)return -EINVAL ;
@@ -3028,9 +3039,13 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, value = ucontrol->value.enumerated.item[0 ]; change =dapm_kcontrol_set_value (kcontrol, value);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); + +if (ret >0 ) +soc_dpcm_runtime_update (card); +return change; }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,unsigned int val, mux, change;unsigned int mask;struct snd_soc_dapm_update update; +int ret =0 ;if (ucontrol->value.enumerated.item[0 ] > e->max -1 )return -EINVAL ;
@@ -3120,12 +3136,16 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, update.val = val; 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 ; }mutex_unlock (&card->dapm_mutex); + +if (ret >0 ) +soc_dpcm_runtime_update (card); +return change; }EXPORT_SYMBOL_GPL (snd_soc_dapm_put_value_enum_double);
Signature · 1 line
1.7.0.4
Quoted 27 lines · Nenghua Cao
From: Nenghua Cao <[email protected]>
DPCM can dynamically alter the FE to BE PCM links at runtime based
on mixer/mux setting updates. Addsoc_dpcm_runtime_update()calling in get/put function for mixer/mux to support this feature.Signed-off-by Nenghua Cao <[email protected]>--- sound/soc/soc-dapm.c | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-)sound/soc/soc-dapm.c +1
-0@@ -2868,6 +2868,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,unsigned int val;int connect, change;struct snd_soc_dapm_update update; +int ret =0 ;if (snd_soc_volsw_is_stereo (mc)) dev_warn(codec->dapm.dev,@@ -2901,12 +2902,16 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, card->update = &update; }
sound/soc/soc-dapm.c int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, · line 2913
Quoted 10 lines
sound/soc/soc-dapm.c +4
-1-soc_dapm_mixer_update_power (card, kcontrol, connect); + ret =soc_dapm_mixer_update_power (card, kcontrol, connect); card->update =NULL ; }mutex_unlock (&card->dapm_mutex); + +if (ret >0 ) +soc_dpcm_runtime_update (card);
This version looks much better! Btw would it make sense to have flag in card for dynmaic support and call soc_dpcm_runtime_update() for only these cards?
--
~Vinod
Quoted 86 lines
sound/soc/soc-dapm.c +19
-3+return change; }EXPORT_SYMBOL_GPL (snd_soc_dapm_put_volsw);@@ -2955,6 +2960,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,unsigned int val, mux, change;unsigned int mask;struct snd_soc_dapm_update update; +int ret =0 ;if (ucontrol->value.enumerated.item[0 ] > e->max -1 )return -EINVAL ;@@ -2978,12 +2984,16 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, update.val = val; 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 ; }mutex_unlock (&card->dapm_mutex); + +if (ret >0 ) +soc_dpcm_runtime_update (card); +return change; }EXPORT_SYMBOL_GPL (snd_soc_dapm_put_enum_double);@@ -3019,6 +3029,7 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;int change; +int ret =0 ;if (ucontrol->value.enumerated.item[0 ] >= e->max)return -EINVAL ;@@ -3028,9 +3039,13 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, value = ucontrol->value.enumerated.item[0 ]; change =dapm_kcontrol_set_value (kcontrol, value);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); + +if (ret >0 ) +soc_dpcm_runtime_update (card); +return change; }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,unsigned int val, mux, change;unsigned int mask;struct snd_soc_dapm_update update; +int ret =0 ;if (ucontrol->value.enumerated.item[0 ] > e->max -1 )return -EINVAL ;@@ -3120,12 +3136,16 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, update.val = val; 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 ; }mutex_unlock (&card->dapm_mutex); + +if (ret >0 ) +soc_dpcm_runtime_update (card); +return change; }EXPORT_SYMBOL_GPL (snd_soc_dapm_put_value_enum_double);Signature · 6 lines
1.7.0.4 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 34 lines · Vinod Koul
Quoted 33 lines · Nenghua Cao
Quoted 33 lines
From: Nenghua Cao <[email protected]>
DPCM can dynamically alter the FE to BE PCM links at runtime based
on mixer/mux setting updates. Addsoc_dpcm_runtime_update()calling in get/put function for mixer/mux to support this feature.Signed-off-by Nenghua Cao <[email protected]>--- sound/soc/soc-dapm.c | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-)sound/soc/soc-dapm.c +2
-1@@ -2868,6 +2868,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,unsigned int val;int connect, change;struct snd_soc_dapm_update update; +int ret =0 ;if (snd_soc_volsw_is_stereo (mc)) dev_warn(codec->dapm.dev,@@ -2901,12 +2902,16 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, card->update = &update; } -soc_dapm_mixer_update_power (card, kcontrol, connect); + ret =soc_dapm_mixer_update_power (card, kcontrol, connect); card->update =NULL ; }
Quoted 7 lines
Quoted 4 lines
sound/soc/soc-dapm.c int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, · line 2913
Quoted 4 lines
sound/soc/soc-dapm.c +3
-0mutex_unlock (&card->dapm_mutex); + +if (ret >0 ) +soc_dpcm_runtime_update (card);This version looks much better! Btw would it make sense to have flag in card for dynmaic support and call
soc_dpcm_runtime_update()for only these cards?
Hi, Vinod
In soc_dpcm_runtime_update(), it traverses the FE dai_link's
"dynamic" flag. If the asoc driver supports DPCM, it will do update work. Or it will do nothing. After discussing with Mark and Takashi, it seems no more meaning to add this flag.
Quoted 88 lines
--
~VinodQuoted 86 lines
Quoted 86 lines
sound/soc/soc-dapm.c +19
-3+return change; }EXPORT_SYMBOL_GPL (snd_soc_dapm_put_volsw);@@ -2955,6 +2960,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,unsigned int val, mux, change;unsigned int mask;struct snd_soc_dapm_update update; +int ret =0 ;if (ucontrol->value.enumerated.item[0 ] > e->max -1 )return -EINVAL ;@@ -2978,12 +2984,16 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, update.val = val; 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 ; }mutex_unlock (&card->dapm_mutex); + +if (ret >0 ) +soc_dpcm_runtime_update (card); +return change; }EXPORT_SYMBOL_GPL (snd_soc_dapm_put_enum_double);@@ -3019,6 +3029,7 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;int change; +int ret =0 ;if (ucontrol->value.enumerated.item[0 ] >= e->max)return -EINVAL ;@@ -3028,9 +3039,13 @@ int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol, value = ucontrol->value.enumerated.item[0 ]; change =dapm_kcontrol_set_value (kcontrol, value);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); + +if (ret >0 ) +soc_dpcm_runtime_update (card); +return change; }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,unsigned int val, mux, change;unsigned int mask;struct snd_soc_dapm_update update; +int ret =0 ;if (ucontrol->value.enumerated.item[0 ] > e->max -1 )return -EINVAL ;@@ -3120,12 +3136,16 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, update.val = val; 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 ; }mutex_unlock (&card->dapm_mutex); + +if (ret >0 ) +soc_dpcm_runtime_update (card); +return change; }EXPORT_SYMBOL_GPL (snd_soc_dapm_put_value_enum_double);Signature · 6 lines
1.7.0.4 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 5 lines · Nenghua Cao
From: Nenghua Cao <[email protected]>
DPCM can dynamically alter the FE to BE PCM links at runtime based
on mixer/mux setting updates. Addsoc_dpcm_runtime_update()calling in get/put function for mixer/mux to support this feature.
Applied, thanks.
Mark Brown
maintainerQuoted 6 lines · Nenghua Cao
From: Nenghua Cao <[email protected]>
V2 -> V1:
Removes the flag and update DPCM always when mixer/mux changes, according
to Takashi's and Mark's suggestion.
Don't send cover letters for single patches, if there's anything that needs to be said put it after the --- in the patch mail.
Quoted 11 lines · Mark Brown
Quoted 6 lines · Nenghua Cao
From: Nenghua Cao <[email protected]>
V2 -> V1:
Removes the flag and update DPCM always when mixer/mux changes, according
to Takashi's and Mark's suggestion.Don't send cover letters for single patches, if there's anything that needs to be said put it after the --- in the patch mail.
Got it. Thanks!