summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tas5086.c
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-10-01 14:48:26 +0200
committerMark Brown <broonie@linaro.org>2013-10-03 14:14:38 +0100
commit25c84cc1ace56421fa9a676a387a1919e7bc4e62 (patch)
treec509e0ebdc1782c0c32dbd28eea95c67ea951711 /sound/soc/codecs/tas5086.c
parentd5fd3ccc2d9df493ad6f1eaf7aba72f690e98937 (diff)
downloadlinux-stable-25c84cc1ace56421fa9a676a387a1919e7bc4e62.tar.gz
linux-stable-25c84cc1ace56421fa9a676a387a1919e7bc4e62.tar.bz2
linux-stable-25c84cc1ace56421fa9a676a387a1919e7bc4e62.zip
ASoC: tas5086: add suspend callback
When going to suspend, shut down all channels and re-do the init procedure at resume time. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/codecs/tas5086.c')
-rw-r--r--sound/soc/codecs/tas5086.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c
index 3a88c68145c2..2996d2ea026b 100644
--- a/sound/soc/codecs/tas5086.c
+++ b/sound/soc/codecs/tas5086.c
@@ -762,14 +762,39 @@ static struct snd_soc_dai_driver tas5086_dai = {
};
#ifdef CONFIG_PM
+static int tas5086_soc_suspend(struct snd_soc_codec *codec)
+{
+ struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec);
+ int ret;
+
+ /* Shut down all channels */
+ ret = regmap_write(priv->regmap, TAS5086_SYS_CONTROL_2, 0x60);
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
+
static int tas5086_soc_resume(struct snd_soc_codec *codec)
{
struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec);
+ int ret;
- /* Restore codec state */
- return regcache_sync(priv->regmap);
+ tas5086_reset(priv);
+ regcache_mark_dirty(priv->regmap);
+
+ ret = tas5086_init(codec->dev, priv);
+ if (ret < 0)
+ return ret;
+
+ ret = regcache_sync(priv->regmap);
+ if (ret < 0)
+ return ret;
+
+ return 0;
}
#else
+#define tas5086_soc_suspend NULL
#define tas5086_soc_resume NULL
#endif /* CONFIG_PM */
@@ -832,6 +857,7 @@ static int tas5086_remove(struct snd_soc_codec *codec)
static struct snd_soc_codec_driver soc_codec_dev_tas5086 = {
.probe = tas5086_probe,
.remove = tas5086_remove,
+ .suspend = tas5086_soc_suspend,
.resume = tas5086_soc_resume,
.controls = tas5086_controls,
.num_controls = ARRAY_SIZE(tas5086_controls),