diff options
author | Fabio Estevam <festevam@denx.de> | 2022-01-04 15:06:13 -0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-01-05 13:53:58 +0000 |
commit | a319cb32e7cfd2703db3a883ce260a7b06729895 (patch) | |
tree | 59024a036f1f5d8dc7d32c33b7eaddf44ab3d64f | |
parent | 9f3d45318dd9e739ed62e4218839a7a824d3cced (diff) |
ASoC: cs4265: Add a remove() function
When the reset_gpio GPIO is used, it is better to put the codec
back into reset state when the driver unbinds.
Add a remove() function to accomplish that.
Suggested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220104180613.639317-1-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/cs4265.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c index b89002189a2b..4aaee1873a11 100644 --- a/sound/soc/codecs/cs4265.c +++ b/sound/soc/codecs/cs4265.c @@ -626,6 +626,16 @@ static int cs4265_i2c_probe(struct i2c_client *i2c_client, ARRAY_SIZE(cs4265_dai)); } +static int cs4265_i2c_remove(struct i2c_client *i2c) +{ + struct cs4265_private *cs4265 = i2c_get_clientdata(i2c); + + if (cs4265->reset_gpio) + gpiod_set_value_cansleep(cs4265->reset_gpio, 0); + + return 0; +} + static const struct of_device_id cs4265_of_match[] = { { .compatible = "cirrus,cs4265", }, { } @@ -645,6 +655,7 @@ static struct i2c_driver cs4265_i2c_driver = { }, .id_table = cs4265_id, .probe = cs4265_i2c_probe, + .remove = cs4265_i2c_remove, }; module_i2c_driver(cs4265_i2c_driver); |