diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2016-05-31 13:34:59 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-05-31 14:37:08 +0100 |
commit | a2ebd58627e9aa486fccbbdda6338675bdf3e267 (patch) | |
tree | 839224cc378467743d2acedea1647173f7bcecef | |
parent | 1a695a905c18548062509178b98bc91e67510864 (diff) | |
download | lwn-a2ebd58627e9aa486fccbbdda6338675bdf3e267.tar.gz lwn-a2ebd58627e9aa486fccbbdda6338675bdf3e267.zip |
ASoC: ak4642: Implement suspend callback
Add the suspend callback to accompany the existing resume operation.
With the suspend/resume callbacks the regmap (regcache) state handling can
follow the recommended sequence.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/ak4642.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 4d8b9e49e8d6..cc941d66ec3d 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -523,15 +523,23 @@ static struct snd_soc_dai_driver ak4642_dai = { .symmetric_rates = 1, }; -static int ak4642_resume(struct snd_soc_codec *codec) +static int ak4642_suspend(struct snd_soc_codec *codec) { struct regmap *regmap = dev_get_regmap(codec->dev, NULL); + regcache_cache_only(regmap, true); regcache_mark_dirty(regmap); - regcache_sync(regmap); return 0; } +static int ak4642_resume(struct snd_soc_codec *codec) +{ + struct regmap *regmap = dev_get_regmap(codec->dev, NULL); + + regcache_cache_only(regmap, false); + regcache_sync(regmap); + return 0; +} static int ak4642_probe(struct snd_soc_codec *codec) { struct ak4642_priv *priv = snd_soc_codec_get_drvdata(codec); @@ -544,6 +552,7 @@ static int ak4642_probe(struct snd_soc_codec *codec) static struct snd_soc_codec_driver soc_codec_dev_ak4642 = { .probe = ak4642_probe, + .suspend = ak4642_suspend, .resume = ak4642_resume, .set_bias_level = ak4642_set_bias_level, .controls = ak4642_snd_controls, |