]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/5.0.15/asoc-rt5682-check-jd-status-when-system-resume.patch
Linux 4.19.42
[thirdparty/kernel/stable-queue.git] / releases / 5.0.15 / asoc-rt5682-check-jd-status-when-system-resume.patch
1 From 5dd8dbf487d168b3ab9a95b66b4ab46c59cc8cf3 Mon Sep 17 00:00:00 2001
2 From: Shuming Fan <shumingf@realtek.com>
3 Date: Fri, 8 Mar 2019 11:36:08 +0800
4 Subject: ASoC: rt5682: Check JD status when system resume
5
6 [ Upstream commit 4834d7070c85a5fb69637265dbbb05d13043280c ]
7
8 The IRQ function may not work when system suspend.
9 We remove snd_soc_dapm_force_enable_pin function call to
10 make sure the bias off when idle and run into suspend/resume function.
11
12 Signed-off-by: Shuming Fan <shumingf@realtek.com>
13 Signed-off-by: Mark Brown <broonie@kernel.org>
14 Signed-off-by: Sasha Levin <sashal@kernel.org>
15 ---
16 sound/soc/codecs/rt5682.c | 34 +++++++++++++++++-----------------
17 1 file changed, 17 insertions(+), 17 deletions(-)
18
19 diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
20 index a9b91bcfcc096..49ff5e52db584 100644
21 --- a/sound/soc/codecs/rt5682.c
22 +++ b/sound/soc/codecs/rt5682.c
23 @@ -904,13 +904,20 @@ static int rt5682_headset_detect(struct snd_soc_component *component,
24 int jack_insert)
25 {
26 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
27 - struct snd_soc_dapm_context *dapm =
28 - snd_soc_component_get_dapm(component);
29 unsigned int val, count;
30
31 if (jack_insert) {
32 - snd_soc_dapm_force_enable_pin(dapm, "CBJ Power");
33 - snd_soc_dapm_sync(dapm);
34 +
35 + snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1,
36 + RT5682_PWR_VREF2, RT5682_PWR_VREF2);
37 + snd_soc_component_update_bits(component,
38 + RT5682_PWR_ANLG_1, RT5682_PWR_FV2, 0);
39 + usleep_range(15000, 20000);
40 + snd_soc_component_update_bits(component,
41 + RT5682_PWR_ANLG_1, RT5682_PWR_FV2, RT5682_PWR_FV2);
42 + snd_soc_component_update_bits(component, RT5682_PWR_ANLG_3,
43 + RT5682_PWR_CBJ, RT5682_PWR_CBJ);
44 +
45 snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
46 RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_HIGH);
47
48 @@ -938,8 +945,10 @@ static int rt5682_headset_detect(struct snd_soc_component *component,
49 rt5682_enable_push_button_irq(component, false);
50 snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
51 RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_LOW);
52 - snd_soc_dapm_disable_pin(dapm, "CBJ Power");
53 - snd_soc_dapm_sync(dapm);
54 + snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1,
55 + RT5682_PWR_VREF2, 0);
56 + snd_soc_component_update_bits(component, RT5682_PWR_ANLG_3,
57 + RT5682_PWR_CBJ, 0);
58
59 rt5682->jack_type = 0;
60 }
61 @@ -1585,8 +1594,6 @@ static const struct snd_soc_dapm_widget rt5682_dapm_widgets[] = {
62 0, NULL, 0),
63 SND_SOC_DAPM_SUPPLY("Vref1", RT5682_PWR_ANLG_1, RT5682_PWR_VREF1_BIT, 0,
64 rt5655_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
65 - SND_SOC_DAPM_SUPPLY("Vref2", RT5682_PWR_ANLG_1, RT5682_PWR_VREF2_BIT, 0,
66 - rt5655_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
67
68 /* ASRC */
69 SND_SOC_DAPM_SUPPLY_S("DAC STO1 ASRC", 1, RT5682_PLL_TRACK_1,
70 @@ -1621,9 +1628,6 @@ static const struct snd_soc_dapm_widget rt5682_dapm_widgets[] = {
71 SND_SOC_DAPM_PGA("BST1 CBJ", SND_SOC_NOPM,
72 0, 0, NULL, 0),
73
74 - SND_SOC_DAPM_SUPPLY("CBJ Power", RT5682_PWR_ANLG_3,
75 - RT5682_PWR_CBJ_BIT, 0, NULL, 0),
76 -
77 /* REC Mixer */
78 SND_SOC_DAPM_MIXER("RECMIX1L", SND_SOC_NOPM, 0, 0, rt5682_rec1_l_mix,
79 ARRAY_SIZE(rt5682_rec1_l_mix)),
80 @@ -1786,17 +1790,13 @@ static const struct snd_soc_dapm_route rt5682_dapm_routes[] = {
81
82 /*Vref*/
83 {"MICBIAS1", NULL, "Vref1"},
84 - {"MICBIAS1", NULL, "Vref2"},
85 {"MICBIAS2", NULL, "Vref1"},
86 - {"MICBIAS2", NULL, "Vref2"},
87
88 {"CLKDET SYS", NULL, "CLKDET"},
89
90 {"IN1P", NULL, "LDO2"},
91
92 {"BST1 CBJ", NULL, "IN1P"},
93 - {"BST1 CBJ", NULL, "CBJ Power"},
94 - {"CBJ Power", NULL, "Vref2"},
95
96 {"RECMIX1L", "CBJ Switch", "BST1 CBJ"},
97 {"RECMIX1L", NULL, "RECMIX1L Power"},
98 @@ -1906,9 +1906,7 @@ static const struct snd_soc_dapm_route rt5682_dapm_routes[] = {
99 {"HP Amp", NULL, "Capless"},
100 {"HP Amp", NULL, "Charge Pump"},
101 {"HP Amp", NULL, "CLKDET SYS"},
102 - {"HP Amp", NULL, "CBJ Power"},
103 {"HP Amp", NULL, "Vref1"},
104 - {"HP Amp", NULL, "Vref2"},
105 {"HPOL Playback", "Switch", "HP Amp"},
106 {"HPOR Playback", "Switch", "HP Amp"},
107 {"HPOL", NULL, "HPOL Playback"},
108 @@ -2357,6 +2355,8 @@ static int rt5682_resume(struct snd_soc_component *component)
109 regcache_cache_only(rt5682->regmap, false);
110 regcache_sync(rt5682->regmap);
111
112 + rt5682_irq(0, rt5682);
113 +
114 return 0;
115 }
116 #else
117 --
118 2.20.1
119