]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: rt5682s: Adjust SAR ADC button mode to fix noise issue
authorJack Yu <jack.yu@realtek.com>
Wed, 17 Sep 2025 08:11:43 +0000 (08:11 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Oct 2025 11:01:02 +0000 (13:01 +0200)
[ Upstream commit 1dd28fd86c3fa4e395031dd6f2ba920242107010 ]

Adjust register settings for SAR adc button detection mode
to fix noise issue in headset.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://patch.msgid.link/766cd1d2dd7a403ba65bb4cc44845f71@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/codecs/rt5682s.c

index 73c4b3c31f8c45703d965e6fd1b70aa1817e2926..d44f7574631dc849b31f6678b8edacfe30afac0d 100644 (file)
@@ -653,14 +653,15 @@ static void rt5682s_sar_power_mode(struct snd_soc_component *component, int mode
        switch (mode) {
        case SAR_PWR_SAVING:
                snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_3,
-                       RT5682S_CBJ_IN_BUF_MASK, RT5682S_CBJ_IN_BUF_DIS);
+                       RT5682S_CBJ_IN_BUF_MASK, RT5682S_CBJ_IN_BUF_EN);
                snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_1,
-                       RT5682S_MB1_PATH_MASK | RT5682S_MB2_PATH_MASK,
-                       RT5682S_CTRL_MB1_REG | RT5682S_CTRL_MB2_REG);
+                       RT5682S_MB1_PATH_MASK | RT5682S_MB2_PATH_MASK |
+                       RT5682S_VREF_POW_MASK, RT5682S_CTRL_MB1_FSM |
+                       RT5682S_CTRL_MB2_FSM | RT5682S_VREF_POW_FSM);
                snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
                        RT5682S_SAR_BUTDET_MASK | RT5682S_SAR_BUTDET_POW_MASK |
                        RT5682S_SAR_SEL_MB1_2_CTL_MASK, RT5682S_SAR_BUTDET_DIS |
-                       RT5682S_SAR_BUTDET_POW_SAV | RT5682S_SAR_SEL_MB1_2_MANU);
+                       RT5682S_SAR_BUTDET_POW_NORM | RT5682S_SAR_SEL_MB1_2_MANU);
                usleep_range(5000, 5500);
                snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
                        RT5682S_SAR_BUTDET_MASK, RT5682S_SAR_BUTDET_EN);
@@ -688,7 +689,7 @@ static void rt5682s_sar_power_mode(struct snd_soc_component *component, int mode
                snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
                        RT5682S_SAR_BUTDET_MASK | RT5682S_SAR_BUTDET_POW_MASK |
                        RT5682S_SAR_SEL_MB1_2_CTL_MASK, RT5682S_SAR_BUTDET_DIS |
-                       RT5682S_SAR_BUTDET_POW_SAV | RT5682S_SAR_SEL_MB1_2_MANU);
+                       RT5682S_SAR_BUTDET_POW_NORM | RT5682S_SAR_SEL_MB1_2_MANU);
                break;
        default:
                dev_err(component->dev, "Invalid SAR Power mode: %d\n", mode);
@@ -725,7 +726,7 @@ static void rt5682s_disable_push_button_irq(struct snd_soc_component *component)
        snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
                RT5682S_SAR_BUTDET_MASK | RT5682S_SAR_BUTDET_POW_MASK |
                RT5682S_SAR_SEL_MB1_2_CTL_MASK, RT5682S_SAR_BUTDET_DIS |
-               RT5682S_SAR_BUTDET_POW_SAV | RT5682S_SAR_SEL_MB1_2_MANU);
+               RT5682S_SAR_BUTDET_POW_NORM | RT5682S_SAR_SEL_MB1_2_MANU);
 }
 
 /**
@@ -786,7 +787,7 @@ static int rt5682s_headset_detect(struct snd_soc_component *component, int jack_
                        jack_type = SND_JACK_HEADSET;
                        snd_soc_component_write(component, RT5682S_SAR_IL_CMD_3, 0x024c);
                        snd_soc_component_update_bits(component, RT5682S_CBJ_CTRL_1,
-                               RT5682S_FAST_OFF_MASK, RT5682S_FAST_OFF_EN);
+                               RT5682S_FAST_OFF_MASK, RT5682S_FAST_OFF_DIS);
                        snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
                                RT5682S_SAR_SEL_MB1_2_MASK, val << RT5682S_SAR_SEL_MB1_2_SFT);
                        rt5682s_enable_push_button_irq(component);
@@ -966,7 +967,7 @@ static int rt5682s_set_jack_detect(struct snd_soc_component *component,
                        RT5682S_EMB_JD_MASK | RT5682S_DET_TYPE |
                        RT5682S_POL_FAST_OFF_MASK | RT5682S_MIC_CAP_MASK,
                        RT5682S_EMB_JD_EN | RT5682S_DET_TYPE |
-                       RT5682S_POL_FAST_OFF_HIGH | RT5682S_MIC_CAP_HS);
+                       RT5682S_POL_FAST_OFF_LOW | RT5682S_MIC_CAP_HS);
                regmap_update_bits(rt5682s->regmap, RT5682S_SAR_IL_CMD_1,
                        RT5682S_SAR_POW_MASK, RT5682S_SAR_POW_EN);
                regmap_update_bits(rt5682s->regmap, RT5682S_GPIO_CTRL_1,