]>
Commit | Line | Data |
---|---|---|
1143c684 SL |
1 | From 55887771451f248b24648caf31269d3a926178db Mon Sep 17 00:00:00 2001 |
2 | From: Charles Keepax <ckeepax@opensource.cirrus.com> | |
3 | Date: Thu, 4 Apr 2019 17:33:56 +0100 | |
4 | Subject: extcon: arizona: Disable mic detect if running when driver is removed | |
5 | ||
6 | [ Upstream commit 00053de52231117ddc154042549f2256183ffb86 ] | |
7 | ||
8 | Microphone detection provides the button detection features on the | |
9 | Arizona CODECs as such it will be running if the jack is currently | |
10 | inserted. If the driver is unbound whilst the jack is still inserted | |
11 | this will cause warnings from the regulator framework as the MICVDD | |
12 | regulator is put but was never disabled. | |
13 | ||
14 | Correct this by disabling microphone detection on driver removal and if | |
15 | the microphone detection was running disable the regulator and put the | |
16 | runtime reference that was currently held. | |
17 | ||
18 | Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> | |
19 | Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> | |
20 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
21 | --- | |
22 | drivers/extcon/extcon-arizona.c | 10 ++++++++++ | |
23 | 1 file changed, 10 insertions(+) | |
24 | ||
25 | diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c | |
26 | index 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 | -- | |
47 | 2.20.1 | |
48 |