]>
Commit | Line | Data |
---|---|---|
64fefc3e SL |
1 | From ffe19ec75d5cd1b613e25f6b81dce788d4d5e8ea Mon Sep 17 00:00:00 2001 |
2 | From: Charles Keepax <ckeepax@opensource.cirrus.com> | |
3 | Date: Thu, 4 Apr 2019 17:27:20 +0100 | |
4 | Subject: ASoC: cs35l35: Disable regulators on driver removal | |
5 | ||
6 | [ Upstream commit 47c4cc08cb5b34e93ab337b924c5ede77ca3c936 ] | |
7 | ||
8 | The chips main power supplies VA and VP are enabled during probe but | |
9 | then never disabled, this will cause warnings from the regulator | |
10 | framework on driver removal. Fix this by adding a remove callback and | |
11 | disabling the supplies, whilst doing so follow best practice and put the | |
12 | chip back into reset as well. | |
13 | ||
14 | Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> | |
15 | Signed-off-by: Mark Brown <broonie@kernel.org> | |
16 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
17 | --- | |
18 | sound/soc/codecs/cs35l35.c | 11 +++++++++++ | |
19 | 1 file changed, 11 insertions(+) | |
20 | ||
21 | diff --git a/sound/soc/codecs/cs35l35.c b/sound/soc/codecs/cs35l35.c | |
22 | index 9f4a59871cee7..c71696146c5ec 100644 | |
23 | --- a/sound/soc/codecs/cs35l35.c | |
24 | +++ b/sound/soc/codecs/cs35l35.c | |
25 | @@ -1635,6 +1635,16 @@ static int cs35l35_i2c_probe(struct i2c_client *i2c_client, | |
26 | return ret; | |
27 | } | |
28 | ||
29 | +static int cs35l35_i2c_remove(struct i2c_client *i2c_client) | |
30 | +{ | |
31 | + struct cs35l35_private *cs35l35 = i2c_get_clientdata(i2c_client); | |
32 | + | |
33 | + regulator_bulk_disable(cs35l35->num_supplies, cs35l35->supplies); | |
34 | + gpiod_set_value_cansleep(cs35l35->reset_gpio, 0); | |
35 | + | |
36 | + return 0; | |
37 | +} | |
38 | + | |
39 | static const struct of_device_id cs35l35_of_match[] = { | |
40 | {.compatible = "cirrus,cs35l35"}, | |
41 | {}, | |
42 | @@ -1655,6 +1665,7 @@ static struct i2c_driver cs35l35_i2c_driver = { | |
43 | }, | |
44 | .id_table = cs35l35_id, | |
45 | .probe = cs35l35_i2c_probe, | |
46 | + .remove = cs35l35_i2c_remove, | |
47 | }; | |
48 | ||
49 | module_i2c_driver(cs35l35_i2c_driver); | |
50 | -- | |
51 | 2.20.1 | |
52 |