ASoC: codecs: wcd938x: fix kcontrol max values
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tue, 22 Feb 2022 18:32:10 +0000 (18:32 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 23 Feb 2022 02:04:07 +0000 (02:04 +0000)
set "HPH Type" Kcontrol max value of WCD_MBHC_HPH_STEREO instead of UINT_MAX.
set "HPHL/R Impedance" Kcontrols max value to INT_MAX instead of UINT_MAX as
max field is integer type.

Without this patch amixer for these controls will show -1 as max value to userspace.

Fixes: bcee7ed09b8e ("ASoC: codecs: wcd938x: add Multi Button Headset Control support")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220222183212.11580-8-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/wcd938x.c

index 33d5403d4e625454f370fb88e603b68de27fe75b..9ae65cbabb1aa8b6819668356416690c52a7f2a5 100644 (file)
@@ -3575,14 +3575,14 @@ static int wcd938x_hph_impedance_get(struct snd_kcontrol *kcontrol,
 }
 
 static const struct snd_kcontrol_new hph_type_detect_controls[] = {
-       SOC_SINGLE_EXT("HPH Type", 0, 0, UINT_MAX, 0,
+       SOC_SINGLE_EXT("HPH Type", 0, 0, WCD_MBHC_HPH_STEREO, 0,
                       wcd938x_get_hph_type, NULL),
 };
 
 static const struct snd_kcontrol_new impedance_detect_controls[] = {
-       SOC_SINGLE_EXT("HPHL Impedance", 0, 0, UINT_MAX, 0,
+       SOC_SINGLE_EXT("HPHL Impedance", 0, 0, INT_MAX, 0,
                       wcd938x_hph_impedance_get, NULL),
-       SOC_SINGLE_EXT("HPHR Impedance", 0, 1, UINT_MAX, 0,
+       SOC_SINGLE_EXT("HPHR Impedance", 0, 1, INT_MAX, 0,
                       wcd938x_hph_impedance_get, NULL),
 };