* [PATCH] ASOC:DAPM: update DPCM runtime when mixer/mux changes
2013-12-13 12:13 [PATCH V2] ASOC:DAPM: " Nenghua Cao
@ 2013-12-13 12:13 ` Nenghua Cao
2013-12-15 13:56 ` Vinod Koul
2013-12-16 20:14 ` Mark Brown
0 siblings, 2 replies; 6+ messages in thread
From: Nenghua Cao @ 2013-12-13 12:13 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
Yacine Belkadi, alsa-devel
Cc: Henry zhao, Nenghua Cao, cxie4
From: Nenghua Cao <nhcao@marvell.com>
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: Nenghua Cao <nhcao@marvell.com>
---
sound/soc/soc-dapm.c | 28 ++++++++++++++++++++++++----
1 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index dcade13..67e63ab 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -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);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ASOC:DAPM: update DPCM runtime when mixer/mux changes
2013-12-13 12:13 ` [PATCH] " Nenghua Cao
@ 2013-12-15 13:56 ` Vinod Koul
2013-12-16 2:43 ` Nenghua Cao
2013-12-16 20:14 ` Mark Brown
1 sibling, 1 reply; 6+ messages in thread
From: Vinod Koul @ 2013-12-15 13:56 UTC (permalink / raw)
To: Nenghua Cao
Cc: alsa-devel, Takashi Iwai, Liam Girdwood, Henry zhao, Mark Brown,
Yacine Belkadi, cxie4
On Fri, Dec 13, 2013 at 08:13:49PM +0800, Nenghua Cao wrote:
> From: Nenghua Cao <nhcao@marvell.com>
>
> 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: Nenghua Cao <nhcao@marvell.com>
> ---
> sound/soc/soc-dapm.c | 28 ++++++++++++++++++++++++----
> 1 files changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index dcade13..67e63ab 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -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);
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
> +
> 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);
> --
> 1.7.0.4
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASOC:DAPM: update DPCM runtime when mixer/mux changes
2013-12-15 13:56 ` Vinod Koul
@ 2013-12-16 2:43 ` Nenghua Cao
0 siblings, 0 replies; 6+ messages in thread
From: Nenghua Cao @ 2013-12-16 2:43 UTC (permalink / raw)
To: Vinod Koul
Cc: alsa-devel@alsa-project.org, Takashi Iwai, Liam Girdwood,
Henry Zhao, Mark Brown, Yacine Belkadi, Chao Xie
On 12/15/2013 09:56 PM, Vinod Koul wrote:
> On Fri, Dec 13, 2013 at 08:13:49PM +0800, Nenghua Cao wrote:
>> > From: Nenghua Cao <nhcao@marvell.com>
>> >
>> > 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: Nenghua Cao <nhcao@marvell.com>
>> > ---
>> > sound/soc/soc-dapm.c | 28 ++++++++++++++++++++++++----
>> > 1 files changed, 24 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
>> > index dcade13..67e63ab 100644
>> > --- a/sound/soc/soc-dapm.c
>> > +++ b/sound/soc/soc-dapm.c
>> > @@ -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);
> 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.
> --
> ~Vinod
>> > +
>> > 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);
>> > --
>> > 1.7.0.4
>> >
>> > _______________________________________________
>> > Alsa-devel mailing list
>> > Alsa-devel@alsa-project.org
>> > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH]ASOC:DAPM: update DPCM runtime when mixer/mux changes
@ 2013-12-16 8:03 anish singh
2013-12-16 9:06 ` Lars-Peter Clausen
0 siblings, 1 reply; 6+ messages in thread
From: anish singh @ 2013-12-16 8:03 UTC (permalink / raw)
To: alsa-devel, broonie, nhcao, lgirdwood, gabrbedd, Takashi Iwai,
Jaroslav Kysela, Lars-Peter Clausen
<This patch is dependent on the $subject
so i have used $subject instead of different
one>
I can see only one usage of:
snd_soc_dapm_mixer_update_power
and zero user of:
snd_soc_dapm_mux_update_power()
And after this $subject patch I think
both of these functions becomes redundant.
It will help in reducing the code size if we
can get rid of this dead code.We can
also remove code from tlv320aic3x.c and
just let it use the core implementation.
grep -rniI "snd_soc_dapm_mixer_update_power" sound/
sound/soc/soc-dapm.c:2149:
int snd_soc_dapm_mixer_update_power
sound/soc/codecs/tlv320aic3x.c:174:
snd_soc_dapm_mixer_update_power
grep -rniI "snd_soc_dapm_mux_update_power" sound/
no users.
I would send a patch if experts agree.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH]ASOC:DAPM: update DPCM runtime when mixer/mux changes
2013-12-16 8:03 [PATCH]ASOC:DAPM: update DPCM runtime when mixer/mux changes anish singh
@ 2013-12-16 9:06 ` Lars-Peter Clausen
0 siblings, 0 replies; 6+ messages in thread
From: Lars-Peter Clausen @ 2013-12-16 9:06 UTC (permalink / raw)
To: anish singh; +Cc: alsa-devel, Takashi Iwai, lgirdwood, nhcao, broonie, gabrbedd
On 12/16/2013 09:03 AM, anish singh wrote:
> <This patch is dependent on the $subject
> so i have used $subject instead of different
> one>
> I can see only one usage of:
> snd_soc_dapm_mixer_update_power
> and zero user of:
> snd_soc_dapm_mux_update_power()
>
> And after this $subject patch I think
> both of these functions becomes redundant.
No, the patch doesn't change anything in regard to those two functions.
Those two functions are used by drivers where the mixer or mux has a special
register layout that is not covered by the core mixer and mux update
functions and where does not make sense to add support for this to the core
functions since the layout is special.
>
> It will help in reducing the code size if we
> can get rid of this dead code.We can
> also remove code from tlv320aic3x.c and
> just let it use the core implementation.
The tlv320aic3x driver has special requirements, hence it has its own
function for updating the mux settings.
- Lars
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASOC:DAPM: update DPCM runtime when mixer/mux changes
2013-12-13 12:13 ` [PATCH] " Nenghua Cao
2013-12-15 13:56 ` Vinod Koul
@ 2013-12-16 20:14 ` Mark Brown
1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2013-12-16 20:14 UTC (permalink / raw)
To: Nenghua Cao
Cc: alsa-devel, Takashi Iwai, Liam Girdwood, Henry zhao,
Yacine Belkadi, cxie4
[-- Attachment #1.1: Type: text/plain, Size: 334 bytes --]
On Fri, Dec 13, 2013 at 08:13:49PM +0800, Nenghua Cao wrote:
> From: Nenghua Cao <nhcao@marvell.com>
>
> 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.
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-12-16 20:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-16 8:03 [PATCH]ASOC:DAPM: update DPCM runtime when mixer/mux changes anish singh
2013-12-16 9:06 ` Lars-Peter Clausen
-- strict thread matches above, loose matches on Subject: below --
2013-12-13 12:13 [PATCH V2] ASOC:DAPM: " Nenghua Cao
2013-12-13 12:13 ` [PATCH] " Nenghua Cao
2013-12-15 13:56 ` Vinod Koul
2013-12-16 2:43 ` Nenghua Cao
2013-12-16 20:14 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).