Skip to content

Commit 1a2feb2

Browse files
bebarinogregkh
authored andcommitted
ASoC: rt5682: Implement remove callback
[ Upstream commit 87b42ab ] 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@intel.com> Cc: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com> Cc: Pierre-Louis Bossart <pierre-louis.bossart@intel.com> Cc: Shuming Fan <shumingf@realtek.com> Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20210508075151.1626903-2-swboyd@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 628acf6 commit 1a2feb2

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎sound/soc/codecs/rt5682-i2c.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,16 @@ static void rt5682_i2c_shutdown(struct i2c_client *client)
275275
rt5682_reset(rt5682);
276276
}
277277

278+
static int rt5682_i2c_remove(struct i2c_client *client)
279+
{
280+
struct rt5682_priv *rt5682 = i2c_get_clientdata(client);
281+
282+
rt5682_i2c_shutdown(client);
283+
regulator_bulk_disable(ARRAY_SIZE(rt5682->supplies), rt5682->supplies);
284+
285+
return 0;
286+
}
287+
278288
static const struct of_device_id rt5682_of_match[] = {
279289
{.compatible = "realtek,rt5682i"},
280290
{},
@@ -301,6 +311,7 @@ static struct i2c_driver rt5682_i2c_driver = {
301311
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
302312
},
303313
.probe = rt5682_i2c_probe,
314+
.remove = rt5682_i2c_remove,
304315
.shutdown = rt5682_i2c_shutdown,
305316
.id_table = rt5682_i2c_id,
306317
};

0 commit comments

Comments
 (0)