diff options
author | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2019-08-13 16:19:26 +0300 |
---|---|---|
committer | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2019-08-16 10:59:55 +0300 |
commit | ea5df2da754fb8eb582128e9759fbf9ef9de3a8b (patch) | |
tree | 14ea570ec8b8e664c8f47723602c3e35f0d9fa74 | |
parent | 35272b2f48285111d463a0f8226a5472c50e6426 (diff) |
ASoC: sgtl5000: Restore mclk on resume device
sgtl5000 goes to fail state after suspend system:
[ 60.308603] sgtl5000 16-000a: ASoC: Failed to turn on bias: -5
[ 60.309264] sgtl5000 16-000a: Unable to sync registers 0x2-0x6. -5
To fix it, mclk is forced to reenable on system resume.
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
-rw-r--r-- | sound/soc/codecs/sgtl5000.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 32000d616312..c13faf07fa19 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1437,9 +1437,35 @@ static int sgtl5000_remove(struct snd_soc_codec *codec) return 0; } +static int sgtl5000_suspend(struct snd_soc_codec *codec) +{ + struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); + + clk_disable_unprepare(sgtl5000->mclk); + + return 0; +} + +static int sgtl5000_resume(struct snd_soc_codec *codec) +{ + int ret; + struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); + + ret = clk_prepare_enable(sgtl5000->mclk); + if (ret) + dev_err(codec->dev, "Error enabling clock %d\n", ret); + + /* Need 8 clocks before I2C accesses */ + udelay(1); + + return ret; +} + static const struct snd_soc_codec_driver sgtl5000_driver = { .probe = sgtl5000_probe, .remove = sgtl5000_remove, + .suspend = sgtl5000_suspend, + .resume = sgtl5000_resume, .set_bias_level = sgtl5000_set_bias_level, .suspend_bias_off = true, .component_driver = { |