From: Mark Brown Date: Mon, 3 Jun 2013 09:20:39 +0000 (+0100) Subject: ASoC: sgtl5000: Make device cache only when powered off X-Git-Tag: upstream/snapshot3+hdmi~4491^2~16^2~1^2~13^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2bdc1bb2b4e1f517d8aa5bbbad9cb6ccac8a94fb;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git ASoC: sgtl5000: Make device cache only when powered off When the regulators have been disabled mark the device as cache only so that we don't try to interact with the hardware. Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index b429741..c8f2afb 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -907,10 +907,25 @@ static int sgtl5000_set_bias_level(struct snd_soc_codec *codec, if (ret) return ret; udelay(10); + + regcache_cache_only(sgtl5000->regmap, false); + + ret = regcache_sync(sgtl5000->regmap); + if (ret != 0) { + dev_err(codec->dev, + "Failed to restore cache: %d\n", ret); + + regcache_cache_only(sgtl5000->regmap, true); + regulator_bulk_disable(ARRAY_SIZE(sgtl5000->supplies), + sgtl5000->supplies); + + return ret; + } } break; case SND_SOC_BIAS_OFF: + regcache_cache_only(sgtl5000->regmap, true); regulator_bulk_disable(ARRAY_SIZE(sgtl5000->supplies), sgtl5000->supplies); break;