diff options
author | Daniel Mack <zonque@gmail.com> | 2013-10-01 08:48:26 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-10-03 09:14:38 -0400 |
commit | 25c84cc1ace56421fa9a676a387a1919e7bc4e62 (patch) | |
tree | c509e0ebdc1782c0c32dbd28eea95c67ea951711 /sound | |
parent | d5fd3ccc2d9df493ad6f1eaf7aba72f690e98937 (diff) |
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')
-rw-r--r-- | sound/soc/codecs/tas5086.c | 30 |
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 = { | |||
762 | }; | 762 | }; |
763 | 763 | ||
764 | #ifdef CONFIG_PM | 764 | #ifdef CONFIG_PM |
765 | static int tas5086_soc_suspend(struct snd_soc_codec *codec) | ||
766 | { | ||
767 | struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); | ||
768 | int ret; | ||
769 | |||
770 | /* Shut down all channels */ | ||
771 | ret = regmap_write(priv->regmap, TAS5086_SYS_CONTROL_2, 0x60); | ||
772 | if (ret < 0) | ||
773 | return ret; | ||
774 | |||
775 | return 0; | ||
776 | } | ||
777 | |||
765 | static int tas5086_soc_resume(struct snd_soc_codec *codec) | 778 | static int tas5086_soc_resume(struct snd_soc_codec *codec) |
766 | { | 779 | { |
767 | struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); | 780 | struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); |
781 | int ret; | ||
768 | 782 | ||
769 | /* Restore codec state */ | 783 | tas5086_reset(priv); |
770 | return regcache_sync(priv->regmap); | 784 | regcache_mark_dirty(priv->regmap); |
785 | |||
786 | ret = tas5086_init(codec->dev, priv); | ||
787 | if (ret < 0) | ||
788 | return ret; | ||
789 | |||
790 | ret = regcache_sync(priv->regmap); | ||
791 | if (ret < 0) | ||
792 | return ret; | ||
793 | |||
794 | return 0; | ||
771 | } | 795 | } |
772 | #else | 796 | #else |
797 | #define tas5086_soc_suspend NULL | ||
773 | #define tas5086_soc_resume NULL | 798 | #define tas5086_soc_resume NULL |
774 | #endif /* CONFIG_PM */ | 799 | #endif /* CONFIG_PM */ |
775 | 800 | ||
@@ -832,6 +857,7 @@ static int tas5086_remove(struct snd_soc_codec *codec) | |||
832 | static struct snd_soc_codec_driver soc_codec_dev_tas5086 = { | 857 | static struct snd_soc_codec_driver soc_codec_dev_tas5086 = { |
833 | .probe = tas5086_probe, | 858 | .probe = tas5086_probe, |
834 | .remove = tas5086_remove, | 859 | .remove = tas5086_remove, |
860 | .suspend = tas5086_soc_suspend, | ||
835 | .resume = tas5086_soc_resume, | 861 | .resume = tas5086_soc_resume, |
836 | .controls = tas5086_controls, | 862 | .controls = tas5086_controls, |
837 | .num_controls = ARRAY_SIZE(tas5086_controls), | 863 | .num_controls = ARRAY_SIZE(tas5086_controls), |