2022-06-17 19:15:42

by Sameer Pujar

[permalink] [raw]
Subject: [PATCH] ASoC: ops: Fix multiple value control type

The commit aa2a4b897132("ASoC: ops: Fix boolean/integer detection for
simple controls") fixes false positives with controls not ending in
" Volume" string. But it now forces boolean type for the multi value
controls. Fix this by adding a max check before assigning types.

Fixes: aa2a4b897132("ASoC: ops: Fix boolean/integer detection for simple controls")
Signed-off-by: Sameer Pujar <[email protected]>
---
sound/soc/soc-ops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index 0267e39..21be8e8 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -190,7 +190,7 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
vol_string = NULL;
}

- if (!vol_string)
+ if (!vol_string && max == 1)
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
else
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
--
2.7.4


2022-06-17 20:09:25

by Pierre-Louis Bossart

[permalink] [raw]
Subject: Re: [PATCH] ASoC: ops: Fix multiple value control type



On 6/17/22 14:07, Sameer Pujar wrote:
> The commit aa2a4b897132("ASoC: ops: Fix boolean/integer detection for
> simple controls") fixes false positives with controls not ending in
> " Volume" string. But it now forces boolean type for the multi value
> controls. Fix this by adding a max check before assigning types.
>
> Fixes: aa2a4b897132("ASoC: ops: Fix boolean/integer detection for simple controls")
> Signed-off-by: Sameer Pujar <[email protected]>

Tested-by: Pierre-Louis Bossart <[email protected]>

This fixes the second regression we noticed today, with mixer values
such as:

numid=5,iface=MIXER,name='PGA4.0 4 Master Capture Volume'
; type=BOOLEAN,access=rw---R--,values=2
: values=on,on
| dBscale-min=-50.00dB,step=1.00dB,mute=1

This caused an across-the-board fail with alsa-bat tests

https://github.com/thesofproject/linux/pull/3702

Thanks Sameer!

> ---
> sound/soc/soc-ops.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
> index 0267e39..21be8e8 100644
> --- a/sound/soc/soc-ops.c
> +++ b/sound/soc/soc-ops.c
> @@ -190,7 +190,7 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
> vol_string = NULL;
> }
>
> - if (!vol_string)
> + if (!vol_string && max == 1)
> uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
> else
> uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;

2022-06-17 23:42:53

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] ASoC: ops: Fix multiple value control type

On Sat, Jun 18, 2022 at 12:37:08AM +0530, Sameer Pujar wrote:
> The commit aa2a4b897132("ASoC: ops: Fix boolean/integer detection for
> simple controls") fixes false positives with controls not ending in
> " Volume" string. But it now forces boolean type for the multi value
> controls. Fix this by adding a max check before assigning types.

Thanks but someone already sent a fix for this.


Attachments:
(No filename) (398.00 B)
signature.asc (499.00 B)
Download all attachments