All of lore.kernel.org
 help / color / mirror / Atom feed
* ASoC: snd_soc_info_volsw and platfrom_max
@ 2022-08-15  9:22 Srinivas Kandagatla
  2022-08-16 13:11 ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Srinivas Kandagatla @ 2022-08-15  9:22 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel

Hi Mark,

After patch  30ac49841386 (ASoC: ops: Don't modify the driver's 
plaform_max when reading state) all the controls that are using signed 
TLV range like below
/* -84dB min - 40dB max */

SOC_SINGLE_S8_TLV("RX0 Digital Volume", WCD934X_CDC_RX0_RX_VOL_CTL, 
                    -84, 40, digital_gain),

reports max value as 40 instead of 124.

before this patch the controls max value was calculated considering the 
min value, but with this patch this calculation has changed resulting in 
low volume on most of the codecs that are using SOC_SINGLE_S8_TLV.

snd_soc_put_volsw does the right thing by considering mc->min, but 
info_volsw does it differently.

Below change fixes the issue for me, but I am bit confused with the 
first line of this function that calculates max value as max = mc->max - 
mc->min and then limits it to platform_max.

diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index bd88de056358..49fb34609202 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -196,7 +196,7 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,

  	uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1;
  	uinfo->value.integer.min = 0;
-	uinfo->value.integer.max = max;
+	uinfo->value.integer.max = max  - mc->min;

  	return 0;
  }


Or should we fix the macro to set platform_max to be max - min.

thanks,
Srini



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

end of thread, other threads:[~2022-08-16 16:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-15  9:22 ASoC: snd_soc_info_volsw and platfrom_max Srinivas Kandagatla
2022-08-16 13:11 ` Mark Brown
2022-08-16 13:44   ` Srinivas Kandagatla
2022-08-16 15:56     ` Mark Brown
2022-08-16 16:20       ` Srinivas Kandagatla
2022-08-16 16:54         ` 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.