ASoC: codecs: ES8326: Solve headphone detection issue
authorZhang Yi <zhangyi@everest-semi.com>
Tue, 4 Jun 2024 02:19:46 +0000 (10:19 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 4 Jun 2024 17:49:24 +0000 (18:49 +0100)
When switching between OMTP and CTIA headset, we can hear pop noise.
To solve this issue, We modified the configuration for headphone detection

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

index 03b539ba540f662fd4d564b8d3dec56394015023..6a4e42e5e35b9947f7670aa1a51d6ad7d1693763 100644 (file)
@@ -857,12 +857,16 @@ 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_write(es8326->regmap, ES8326_INT_SOURCE, 0x00);
                        regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
+                       regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x10, 0x00);
                        es8326_enable_micbias(es8326->component);
                        usleep_range(50000, 70000);
                        regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
+                       regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x10, 0x10);
+                       usleep_range(50000, 70000);
+                       regmap_write(es8326->regmap, ES8326_INT_SOURCE,
+                                       (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
                        regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x1f);
                        regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x08);
                        queue_delayed_work(system_wq, &es8326->jack_detect_work,