[RFC/PATCH 2/2] ASoC: rt5682: Implement remove callback
Stephen Boyd
swboyd at chromium.org
Sat May 8 09:51:51 CEST 2021
Let's implement a remove callback for this driver that's similar to the
shutdown hook, but also disables the regulators before they're put by
devm code.
Cc: Jairaj Arava <jairaj.arava at intel.com>
Cc: Sathyanarayana Nujella <sathyanarayana.nujella at intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart at intel.com>
Cc: Shuming Fan <shumingf at realtek.com>
Cc: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
Signed-off-by: Stephen Boyd <swboyd at chromium.org>
---
This is totally untested, but sending it in case anyone is interested.
sound/soc/codecs/rt5682-i2c.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c
index 8265b537ff4f..52a6fc56a232 100644
--- a/sound/soc/codecs/rt5682-i2c.c
+++ b/sound/soc/codecs/rt5682-i2c.c
@@ -280,6 +280,16 @@ static void rt5682_i2c_shutdown(struct i2c_client *client)
rt5682_reset(rt5682);
}
+static int rt5682_i2c_remove(struct i2c_client *client)
+{
+ struct rt5682_priv *rt5682 = i2c_get_clientdata(client);
+
+ rt5682_i2c_shutdown(client);
+ regulator_bulk_disable(ARRAY_SIZE(rt5682->supplies), rt5682->supplies);
+
+ return 0;
+}
+
static const struct of_device_id rt5682_of_match[] = {
{.compatible = "realtek,rt5682i"},
{},
@@ -306,6 +316,7 @@ static struct i2c_driver rt5682_i2c_driver = {
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = rt5682_i2c_probe,
+ .remove = rt5682_i2c_remove,
.shutdown = rt5682_i2c_shutdown,
.id_table = rt5682_i2c_id,
};
--
https://chromeos.dev
More information about the Alsa-devel
mailing list