ASoC: snd_soc_info_volsw and platfrom_max

Srinivas Kandagatla srinivas.kandagatla at linaro.org
Mon Aug 15 11:22:37 CEST 2022


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




More information about the Alsa-devel mailing list