Skip to content

Commit c03226b

Browse files
Srinivas-Kandagatlabroonie
authored andcommitted
ASoC: codecs: wcd938x: fix dB range for HPHL and HPHR
dB range for HPHL and HPHR gains are from +6dB to -30dB in steps of 1.5dB with register values range from 0 to 24. Current code maps these dB ranges incorrectly, fix them to allow proper volume setting. Fixes: e8ba1e0 ("ASoC: codecs: wcd938x: add basic controls") Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20230705125723.40464-1-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 4f3fcf5 commit c03226b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

sound/soc/codecs/wcd938x.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ struct wcd938x_priv {
210210
};
211211

212212
static const SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(ear_pa_gain, 600, -1800);
213-
static const SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(line_gain, 600, -3000);
213+
static const DECLARE_TLV_DB_SCALE(line_gain, -3000, 150, -3000);
214214
static const SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(analog_gain, 0, 3000);
215215

216216
struct wcd938x_mbhc_zdet_param {
@@ -2655,8 +2655,8 @@ static const struct snd_kcontrol_new wcd938x_snd_controls[] = {
26552655
wcd938x_get_swr_port, wcd938x_set_swr_port),
26562656
SOC_SINGLE_EXT("DSD_R Switch", WCD938X_DSD_R, 0, 1, 0,
26572657
wcd938x_get_swr_port, wcd938x_set_swr_port),
2658-
SOC_SINGLE_TLV("HPHL Volume", WCD938X_HPH_L_EN, 0, 0x18, 0, line_gain),
2659-
SOC_SINGLE_TLV("HPHR Volume", WCD938X_HPH_R_EN, 0, 0x18, 0, line_gain),
2658+
SOC_SINGLE_TLV("HPHL Volume", WCD938X_HPH_L_EN, 0, 0x18, 1, line_gain),
2659+
SOC_SINGLE_TLV("HPHR Volume", WCD938X_HPH_R_EN, 0, 0x18, 1, line_gain),
26602660
WCD938X_EAR_PA_GAIN_TLV("EAR_PA Volume", WCD938X_ANA_EAR_COMPANDER_CTL,
26612661
2, 0x10, 0, ear_pa_gain),
26622662
SOC_SINGLE_EXT("ADC1 Switch", WCD938X_ADC1, 1, 1, 0,

0 commit comments

Comments
 (0)