diff options
author | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2019-08-13 16:19:26 +0300 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2020-02-12 11:06:02 +0100 |
commit | 38d1b8d1e9d9b310abdb6065fea2b8f5515a14a3 (patch) | |
tree | 4268edd88bdd80731feed940e7de32b644c3743c /sound | |
parent | 5dadbb5f482a74e08d09356f34ea4322e749d59d (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>
Diffstat (limited to 'sound')
-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 aa1393d56fc1..5d54a4828b42 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 = { |