aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sound/soc/codecs/rt5682-i2c.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-08-30 14:57:03 +0200
committerTakashi Iwai <tiwai@suse.de>2021-08-30 14:57:03 +0200
commita8729efbbb847f6ea9b06e73491ec8ddb560465e (patch)
treec2e172452158457ab238080405060110934ad9d1 /sound/soc/codecs/rt5682-i2c.c
parentMerge branch 'for-linus' into for-next (diff)
parentMerge remote-tracking branch 'asoc/for-5.15' into asoc-linus (diff)
downloadwireguard-linux-a8729efbbb847f6ea9b06e73491ec8ddb560465e.tar.xz
wireguard-linux-a8729efbbb847f6ea9b06e73491ec8ddb560465e.zip
Merge tag 'asoc-v5.15' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Updates for v5.15 Quite a quiet release this time, mostly a combination of cleanups and a good set of new drivers. - Lots of cleanups and improvements to the Intel drivers, including some new systems support. - New support for AMD Vangoh, CUI CMM-4030D-261, Mediatek Mt8195, Renesas RZ/G2L Mediatek Mt8195, RealTek RT101P, Renesas RZ/G2L,, Rockchip RK3568 S/PDIF.
Diffstat (limited to 'sound/soc/codecs/rt5682-i2c.c')
-rw-r--r--sound/soc/codecs/rt5682-i2c.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c
index 4a56a52adab5..b9d5d7a0975b 100644
--- a/sound/soc/codecs/rt5682-i2c.c
+++ b/sound/soc/codecs/rt5682-i2c.c
@@ -117,6 +117,13 @@ static struct snd_soc_dai_driver rt5682_dai[] = {
},
};
+static void rt5682_i2c_disable_regulators(void *data)
+{
+ struct rt5682_priv *rt5682 = data;
+
+ regulator_bulk_disable(ARRAY_SIZE(rt5682->supplies), rt5682->supplies);
+}
+
static int rt5682_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
@@ -157,6 +164,11 @@ static int rt5682_i2c_probe(struct i2c_client *i2c,
return ret;
}
+ ret = devm_add_action_or_reset(&i2c->dev, rt5682_i2c_disable_regulators,
+ rt5682);
+ if (ret)
+ return ret;
+
ret = regulator_bulk_enable(ARRAY_SIZE(rt5682->supplies),
rt5682->supplies);
if (ret) {
@@ -282,10 +294,7 @@ static void rt5682_i2c_shutdown(struct i2c_client *client)
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;
}