]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: codecs: ES8326: Solve error interruption issue
authorZhang Yi <zhangyi@everest-semi.com>
Tue, 2 Apr 2024 06:20:40 +0000 (14:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 May 2024 10:14:41 +0000 (12:14 +0200)
[ Upstream commit 8a655cee6c9d4588570ad0cb099c5660f9a44a12 ]

We got an error report about headphone type detection and button detection.
We fixed the headphone type detection error by adjusting the debounce timer
configuration. And we fixed the button detection error by disabling the
button detection feature when the headphone are unplugged and enabling it
when headphone are plugged in.

Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240402062043.20608-2-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/codecs/es8326.c

index cbcd02ec6ba42edd9d22020294332cfec40945cf..fd1af97412bdd7f72b5137ebb9f585f4e90c369a 100644 (file)
@@ -757,6 +757,7 @@ static void es8326_jack_detect_handler(struct work_struct *work)
                regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
                regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x0a);
                regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x03);
+               regmap_write(es8326->regmap, ES8326_INT_SOURCE, ES8326_INT_SRC_PIN9);
                /*
                 * Inverted HPJACK_POL bit to trigger one IRQ to double check HP Removal event
                 */
@@ -779,6 +780,8 @@ static void es8326_jack_detect_handler(struct work_struct *work)
                         * set auto-check mode, then restart jack_detect_work after 400ms.
                         * Don't report jack status.
                         */
+                       regmap_write(es8326->regmap, ES8326_INT_SOURCE,
+                                       (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
                        regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
                        es8326_enable_micbias(es8326->component);
                        usleep_range(50000, 70000);
@@ -901,7 +904,7 @@ static int es8326_resume(struct snd_soc_component *component)
        regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E);
        regmap_write(es8326->regmap, ES8326_ANA_LP, 0xf0);
        usleep_range(10000, 15000);
-       regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0xe9);
+       regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0xd9);
        regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0xcb);
        /* set headphone default type and detect pin */
        regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x83);
@@ -952,8 +955,7 @@ static int es8326_resume(struct snd_soc_component *component)
        es8326_enable_micbias(es8326->component);
        usleep_range(50000, 70000);
        regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
-       regmap_write(es8326->regmap, ES8326_INT_SOURCE,
-                   (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
+       regmap_write(es8326->regmap, ES8326_INT_SOURCE, ES8326_INT_SRC_PIN9);
        regmap_write(es8326->regmap, ES8326_INTOUT_IO,
                     es8326->interrupt_clk);
        regmap_write(es8326->regmap, ES8326_SDINOUT1_IO,