]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: codecs: ES8326: Slove headphone detection issue
authorZhang Yi <zhangyi@everest-semi.com>
Mon, 24 Jun 2024 03:06:04 +0000 (11:06 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 24 Jun 2024 12:38:24 +0000 (13:38 +0100)
We modified the headphone detection setting to avoid an error button state
after codec resume from suspend state

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

index 6a4e42e5e35b9947f7670aa1a51d6ad7d1693763..0468e6db81ca2f8bf7f5db3e1b000e83a4920371 100644 (file)
@@ -877,6 +877,8 @@ static void es8326_jack_detect_handler(struct work_struct *work)
                if (es8326->jack->status & SND_JACK_HEADSET) {
                        /* detect button */
                        dev_dbg(comp->dev, "button pressed\n");
+                       regmap_write(es8326->regmap, ES8326_INT_SOURCE,
+                                       (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
                        queue_delayed_work(system_wq, &es8326->button_press_work, 10);
                        goto exit;
                }
@@ -1052,11 +1054,6 @@ static int es8326_resume(struct snd_soc_component *component)
 
        regmap_write(es8326->regmap, ES8326_ADC_MUTE, 0x0f);
 
-       es8326->jack_remove_retry = 0;
-       es8326->hp = 0;
-       es8326->hpl_vol = 0x03;
-       es8326->hpr_vol = 0x03;
-
        es8326_irq(es8326->irq, es8326);
        return 0;
 }
@@ -1211,6 +1208,10 @@ static int es8326_i2c_probe(struct i2c_client *i2c)
        }
 
        es8326->irq = i2c->irq;
+       es8326->jack_remove_retry = 0;
+       es8326->hp = 0;
+       es8326->hpl_vol = 0x03;
+       es8326->hpr_vol = 0x03;
        INIT_DELAYED_WORK(&es8326->jack_detect_work,
                          es8326_jack_detect_handler);
        INIT_DELAYED_WORK(&es8326->button_press_work,