aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Hsu <supercraig0719@gmail.com>2017-06-21 23:21:01 -0400
committerMark Brown <broonie@kernel.org>2017-06-23 08:02:13 -0400
commit8fe19795da1b9dea2353f016622842a2f163039e (patch)
tree82d073ca964e83cebe0b3bba0e2d27968599b9f5
parent403d2fef06104275dd4909d2684c86aabe25c917 (diff)
ASoC: nau8825: fix jack type detection issue after resume
Fix the issue that mic type detection error after resume. The microphone type detection procedure will recognize testing signal on JKSLV pin, but before the procedure, JKSLV already had supply voltage, that results in the failure. Therefore, the patch turns off the power and reset the jack type configuration before suspend. Then redo the jack detection procedure after resume. The patch help to fix the issue as follows: Google issue 37973093: CTIA/OMTP jack type detection failure after resume Reported Issue Chrome OS Version : ChromeOS R59-9460.13.0 Type of hardware : DVT sample What steps will reproduce the problem? (1 Play a music (2 Insert a headphones (3 Close laptop lid 3 sec then open it What is the expected output? The music is normal in the headphones. What do you see instead? Singer voice in the music is not clear. How frequently does this problem reproduce? Always What is the impact to the user, and is there a workaround? If so, what is it? Re-insert the headset or close the laptop lid and then open it again can be repaired. Signed-off-by: John Hsu <KCHSU0@nuvoton.com> Signed-off-by: John Hsu <supercraig0719@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/nau8825.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
index c00b86dd80dc..503a6d8130b7 100644
--- a/sound/soc/codecs/nau8825.c
+++ b/sound/soc/codecs/nau8825.c
@@ -1612,7 +1612,6 @@ static int nau8825_jack_insert(struct nau8825 *nau8825)
1612 snd_soc_dapm_sync(dapm); 1612 snd_soc_dapm_sync(dapm);
1613 break; 1613 break;
1614 case 2: 1614 case 2:
1615 case 3:
1616 dev_dbg(nau8825->dev, "CTIA (micgnd2) mic connected\n"); 1615 dev_dbg(nau8825->dev, "CTIA (micgnd2) mic connected\n");
1617 type = SND_JACK_HEADSET; 1616 type = SND_JACK_HEADSET;
1618 1617
@@ -1632,6 +1631,11 @@ static int nau8825_jack_insert(struct nau8825 *nau8825)
1632 snd_soc_dapm_force_enable_pin(dapm, "SAR"); 1631 snd_soc_dapm_force_enable_pin(dapm, "SAR");
1633 snd_soc_dapm_sync(dapm); 1632 snd_soc_dapm_sync(dapm);
1634 break; 1633 break;
1634 case 3:
1635 /* detect error case */
1636 dev_err(nau8825->dev, "detection error; disable mic function\n");
1637 type = SND_JACK_HEADPHONE;
1638 break;
1635 } 1639 }
1636 1640
1637 /* Leaving HPOL/R grounded after jack insert by default. They will be 1641 /* Leaving HPOL/R grounded after jack insert by default. They will be
@@ -2328,6 +2332,13 @@ static int nau8825_set_bias_level(struct snd_soc_codec *codec,
2328 break; 2332 break;
2329 2333
2330 case SND_SOC_BIAS_OFF: 2334 case SND_SOC_BIAS_OFF:
2335 /* Reset the configuration of jack type for detection */
2336 /* Detach 2kOhm Resistors from MICBIAS to MICGND1/2 */
2337 regmap_update_bits(nau8825->regmap, NAU8825_REG_MIC_BIAS,
2338 NAU8825_MICBIAS_JKSLV | NAU8825_MICBIAS_JKR2, 0);
2339 /* ground HPL/HPR, MICGRND1/2 */
2340 regmap_update_bits(nau8825->regmap,
2341 NAU8825_REG_HSD_CTRL, 0xf, 0xf);
2331 /* Cancel and reset cross talk detection funciton */ 2342 /* Cancel and reset cross talk detection funciton */
2332 nau8825_xtalk_cancel(nau8825); 2343 nau8825_xtalk_cancel(nau8825);
2333 /* Turn off all interruptions before system shutdown. Keep the 2344 /* Turn off all interruptions before system shutdown. Keep the
@@ -2351,6 +2362,10 @@ static int __maybe_unused nau8825_suspend(struct snd_soc_codec *codec)
2351 2362
2352 disable_irq(nau8825->irq); 2363 disable_irq(nau8825->irq);
2353 snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); 2364 snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF);
2365 /* Power down codec power; don't suppoet button wakeup */
2366 snd_soc_dapm_disable_pin(nau8825->dapm, "SAR");
2367 snd_soc_dapm_disable_pin(nau8825->dapm, "MICBIAS");
2368 snd_soc_dapm_sync(nau8825->dapm);
2354 regcache_cache_only(nau8825->regmap, true); 2369 regcache_cache_only(nau8825->regmap, true);
2355 regcache_mark_dirty(nau8825->regmap); 2370 regcache_mark_dirty(nau8825->regmap);
2356 2371