All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: ops: Fix multiple value control type
@ 2022-06-17 19:07 ` Sameer Pujar
  0 siblings, 0 replies; 5+ messages in thread
From: Sameer Pujar @ 2022-06-17 19:07 UTC (permalink / raw)
  To: broonie, lgirdwood, perex, tiwai
  Cc: jonathanh, alsa-devel, linux-tegra, linux-kernel, Sameer Pujar

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 <spujar@nvidia.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] ASoC: ops: Fix multiple value control type
@ 2022-06-17 19:07 ` Sameer Pujar
  0 siblings, 0 replies; 5+ messages in thread
From: Sameer Pujar @ 2022-06-17 19:07 UTC (permalink / raw)
  To: broonie, lgirdwood, perex, tiwai
  Cc: linux-tegra, alsa-devel, linux-kernel, Sameer Pujar, jonathanh

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 <spujar@nvidia.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: ops: Fix multiple value control type
  2022-06-17 19:07 ` Sameer Pujar
  (?)
@ 2022-06-17 20:02 ` Pierre-Louis Bossart
  -1 siblings, 0 replies; 5+ messages in thread
From: Pierre-Louis Bossart @ 2022-06-17 20:02 UTC (permalink / raw)
  To: Sameer Pujar, broonie, lgirdwood, perex, tiwai
  Cc: linux-tegra, alsa-devel, linux-kernel, jonathanh



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 <spujar@nvidia.com>

Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

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;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: ops: Fix multiple value control type
  2022-06-17 19:07 ` Sameer Pujar
@ 2022-06-17 23:15   ` Mark Brown
  -1 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2022-06-17 23:15 UTC (permalink / raw)
  To: Sameer Pujar
  Cc: lgirdwood, perex, tiwai, jonathanh, alsa-devel, linux-tegra,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: ops: Fix multiple value control type
@ 2022-06-17 23:15   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2022-06-17 23:15 UTC (permalink / raw)
  To: Sameer Pujar
  Cc: alsa-devel, lgirdwood, linux-kernel, tiwai, jonathanh, linux-tegra

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-17 23:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17 19:07 [PATCH] ASoC: ops: Fix multiple value control type Sameer Pujar
2022-06-17 19:07 ` Sameer Pujar
2022-06-17 20:02 ` Pierre-Louis Bossart
2022-06-17 23:15 ` Mark Brown
2022-06-17 23:15   ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.