Skip to content

Commit 9b30ceb

Browse files
committed
ASoC: ak4458 & ak5558: disable regulator if error
Merge series from Shengjiu Wang <shengjiu.wang@nxp.com>: Disable regulator when error happens to balance the reference count.
2 parents 39191ce + 1f8f726 commit 9b30ceb

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

sound/soc/codecs/ak4458.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,15 @@ static int ak4458_runtime_resume(struct device *dev)
671671
regcache_cache_only(ak4458->regmap, false);
672672
regcache_mark_dirty(ak4458->regmap);
673673

674-
return regcache_sync(ak4458->regmap);
674+
ret = regcache_sync(ak4458->regmap);
675+
if (ret)
676+
goto err;
677+
678+
return 0;
679+
err:
680+
regcache_cache_only(ak4458->regmap, true);
681+
regulator_bulk_disable(ARRAY_SIZE(ak4458->supplies), ak4458->supplies);
682+
return ret;
675683
}
676684

677685
static const struct snd_soc_component_driver soc_codec_dev_ak4458 = {

sound/soc/codecs/ak5558.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,15 @@ static int ak5558_runtime_resume(struct device *dev)
372372
regcache_cache_only(ak5558->regmap, false);
373373
regcache_mark_dirty(ak5558->regmap);
374374

375-
return regcache_sync(ak5558->regmap);
375+
ret = regcache_sync(ak5558->regmap);
376+
if (ret)
377+
goto err;
378+
379+
return 0;
380+
err:
381+
regcache_cache_only(ak5558->regmap, true);
382+
regulator_bulk_disable(ARRAY_SIZE(ak5558->supplies), ak5558->supplies);
383+
return ret;
376384
}
377385

378386
static const struct dev_pm_ops ak5558_pm = {

0 commit comments

Comments
 (0)