Commit ba856fbd authored by Adam Thomson's avatar Adam Thomson Committed by Mark Brown

ASoC: da7219: Improve error checking of mclk enable/disable

Should only try to enable/disable the provided mclk, during bias
level changes, if it's not NULL. Also return value of
clk_prepare_enable() should be checked and dealt with accordingly.
Signed-off-by: default avatarAdam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent b7ebd78d
...@@ -1494,6 +1494,7 @@ static int da7219_set_bias_level(struct snd_soc_codec *codec, ...@@ -1494,6 +1494,7 @@ static int da7219_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec); struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec);
int ret;
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
...@@ -1502,7 +1503,14 @@ static int da7219_set_bias_level(struct snd_soc_codec *codec, ...@@ -1502,7 +1503,14 @@ static int da7219_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
/* MCLK */ /* MCLK */
clk_prepare_enable(da7219->mclk); if (da7219->mclk) {
ret = clk_prepare_enable(da7219->mclk);
if (ret) {
dev_err(codec->dev,
"Failed to enable mclk\n");
return ret;
}
}
/* Master bias */ /* Master bias */
snd_soc_update_bits(codec, DA7219_REFERENCES, snd_soc_update_bits(codec, DA7219_REFERENCES,
...@@ -1528,6 +1536,7 @@ static int da7219_set_bias_level(struct snd_soc_codec *codec, ...@@ -1528,6 +1536,7 @@ static int da7219_set_bias_level(struct snd_soc_codec *codec,
} }
/* MCLK */ /* MCLK */
if (da7219->mclk)
clk_disable_unprepare(da7219->mclk); clk_disable_unprepare(da7219->mclk);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment