Skip to content

Commit 8d3019b

Browse files
oortcometbroonie
authored andcommitted
ASoC: rt5682: Fix the vol+ button detection issue
Fix the wrong button vol+ detection issue with some brand headsets by fine tuning the threshold of button vol+ and SAR ADC button accuracy. Signed-off-by: Derek Fang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent dc2d01c commit 8d3019b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

sound/soc/codecs/rt5682.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ static const struct reg_sequence patch_list[] = {
4343
{RT5682_DAC_ADC_DIG_VOL1, 0xa020},
4444
{RT5682_I2C_CTRL, 0x000f},
4545
{RT5682_PLL2_INTERNAL, 0x8266},
46-
{RT5682_SAR_IL_CMD_3, 0x8365},
46+
{RT5682_SAR_IL_CMD_1, 0x22b7},
47+
{RT5682_SAR_IL_CMD_3, 0x0365},
48+
{RT5682_SAR_IL_CMD_6, 0x0110},
4749
};
4850

4951
void rt5682_apply_patch_list(struct rt5682_priv *rt5682, struct device *dev)
@@ -1726,8 +1728,6 @@ static const struct snd_soc_dapm_widget rt5682_dapm_widgets[] = {
17261728
SND_SOC_DAPM_MIXER("Stereo1 ADC MIXR", RT5682_STO1_ADC_DIG_VOL,
17271729
RT5682_R_MUTE_SFT, 1, rt5682_sto1_adc_r_mix,
17281730
ARRAY_SIZE(rt5682_sto1_adc_r_mix)),
1729-
SND_SOC_DAPM_SUPPLY("BTN Detection Mode", RT5682_SAR_IL_CMD_1,
1730-
14, 1, NULL, 0),
17311731

17321732
/* ADC PGA */
17331733
SND_SOC_DAPM_PGA("Stereo1 ADC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
@@ -1898,8 +1898,6 @@ static const struct snd_soc_dapm_route rt5682_dapm_routes[] = {
18981898
{"Stereo1 ADC MIXR", "ADC2 Switch", "Stereo1 ADC R2 Mux"},
18991899
{"Stereo1 ADC MIXR", NULL, "ADC Stereo1 Filter"},
19001900

1901-
{"ADC Stereo1 Filter", NULL, "BTN Detection Mode"},
1902-
19031901
{"Stereo1 ADC MIX", NULL, "Stereo1 ADC MIXL"},
19041902
{"Stereo1 ADC MIX", NULL, "Stereo1 ADC MIXR"},
19051903

@@ -2949,7 +2947,8 @@ static int rt5682_suspend(struct snd_soc_component *component)
29492947

29502948
/* enter SAR ADC power saving mode */
29512949
snd_soc_component_update_bits(component, RT5682_SAR_IL_CMD_1,
2952-
RT5682_SAR_BUTT_DET_MASK | RT5682_SAR_BUTDET_MODE_MASK | RT5682_SAR_BUTDET_RST_MASK, 0);
2950+
RT5682_SAR_BUTT_DET_MASK | RT5682_SAR_BUTDET_MODE_MASK |
2951+
RT5682_SAR_BUTDET_RST_MASK | RT5682_SAR_SEL_MB1_MB2_MASK, 0);
29532952
snd_soc_component_update_bits(component, RT5682_SAR_IL_CMD_1,
29542953
RT5682_SAR_BUTT_DET_MASK | RT5682_SAR_BUTDET_MODE_MASK | RT5682_SAR_BUTDET_RST_MASK,
29552954
RT5682_SAR_BUTT_DET_EN | RT5682_SAR_BUTDET_POW_SAV | RT5682_SAR_BUTDET_RST_NORMAL);
@@ -2971,6 +2970,9 @@ static int rt5682_resume(struct snd_soc_component *component)
29712970
regcache_sync(rt5682->regmap);
29722971

29732972
if (rt5682->hs_jack && rt5682->jack_type == SND_JACK_HEADSET) {
2973+
snd_soc_component_update_bits(component, RT5682_SAR_IL_CMD_1,
2974+
RT5682_SAR_BUTDET_MODE_MASK | RT5682_SAR_SEL_MB1_MB2_MASK,
2975+
RT5682_SAR_BUTDET_POW_NORM | RT5682_SAR_SEL_MB1_MB2_AUTO);
29742976
snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
29752977
RT5682_MB1_PATH_MASK | RT5682_MB2_PATH_MASK,
29762978
RT5682_CTRL_MB1_FSM | RT5682_CTRL_MB2_FSM);

0 commit comments

Comments
 (0)