]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/extcon-arizona-disable-mic-detect-if-running-when-dr.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / extcon-arizona-disable-mic-detect-if-running-when-dr.patch
CommitLineData
1143c684
SL
1From 55887771451f248b24648caf31269d3a926178db Mon Sep 17 00:00:00 2001
2From: Charles Keepax <ckeepax@opensource.cirrus.com>
3Date: Thu, 4 Apr 2019 17:33:56 +0100
4Subject: extcon: arizona: Disable mic detect if running when driver is removed
5
6[ Upstream commit 00053de52231117ddc154042549f2256183ffb86 ]
7
8Microphone detection provides the button detection features on the
9Arizona CODECs as such it will be running if the jack is currently
10inserted. If the driver is unbound whilst the jack is still inserted
11this will cause warnings from the regulator framework as the MICVDD
12regulator is put but was never disabled.
13
14Correct this by disabling microphone detection on driver removal and if
15the microphone detection was running disable the regulator and put the
16runtime reference that was currently held.
17
18Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
19Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
20Signed-off-by: Sasha Levin <sashal@kernel.org>
21---
22 drivers/extcon/extcon-arizona.c | 10 ++++++++++
23 1 file changed, 10 insertions(+)
24
25diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
26index e4890dd4fefd6..38fb212e58ee8 100644
27--- a/drivers/extcon/extcon-arizona.c
28+++ b/drivers/extcon/extcon-arizona.c
29@@ -1616,6 +1616,16 @@ static int arizona_extcon_remove(struct platform_device *pdev)
30 struct arizona_extcon_info *info = platform_get_drvdata(pdev);
31 struct arizona *arizona = info->arizona;
32 int jack_irq_rise, jack_irq_fall;
33+ bool change;
34+
35+ regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1,
36+ ARIZONA_MICD_ENA, 0,
37+ &change);
38+
39+ if (change) {
40+ regulator_disable(info->micvdd);
41+ pm_runtime_put(info->dev);
42+ }
43
44 gpiod_put(info->micd_pol_gpio);
45
46--
472.20.1
48