diff options
author | Adam Thomson <Adam.Thomson.Opensource@diasemi.com> | 2015-10-07 06:57:14 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-10-07 07:15:22 -0400 |
commit | ba856fbd602175d386ab5a4fc0fdd89b912546cb (patch) | |
tree | b8df2caf3e8b7487101a6ceab3b07f90eedecb1b | |
parent | b7ebd78d1d142e4e47c3547b08faf51218384583 (diff) |
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: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/da7219.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c index adcc079ef801..abba4b36caa0 100644 --- a/sound/soc/codecs/da7219.c +++ b/sound/soc/codecs/da7219.c | |||
@@ -1494,6 +1494,7 @@ static int da7219_set_bias_level(struct snd_soc_codec *codec, | |||
1494 | enum snd_soc_bias_level level) | 1494 | enum snd_soc_bias_level level) |
1495 | { | 1495 | { |
1496 | struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec); | 1496 | struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec); |
1497 | int ret; | ||
1497 | 1498 | ||
1498 | switch (level) { | 1499 | switch (level) { |
1499 | case SND_SOC_BIAS_ON: | 1500 | case SND_SOC_BIAS_ON: |
@@ -1502,7 +1503,14 @@ static int da7219_set_bias_level(struct snd_soc_codec *codec, | |||
1502 | case SND_SOC_BIAS_STANDBY: | 1503 | case SND_SOC_BIAS_STANDBY: |
1503 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { | 1504 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1504 | /* MCLK */ | 1505 | /* MCLK */ |
1505 | clk_prepare_enable(da7219->mclk); | 1506 | if (da7219->mclk) { |
1507 | ret = clk_prepare_enable(da7219->mclk); | ||
1508 | if (ret) { | ||
1509 | dev_err(codec->dev, | ||
1510 | "Failed to enable mclk\n"); | ||
1511 | return ret; | ||
1512 | } | ||
1513 | } | ||
1506 | 1514 | ||
1507 | /* Master bias */ | 1515 | /* Master bias */ |
1508 | snd_soc_update_bits(codec, DA7219_REFERENCES, | 1516 | snd_soc_update_bits(codec, DA7219_REFERENCES, |
@@ -1528,7 +1536,8 @@ static int da7219_set_bias_level(struct snd_soc_codec *codec, | |||
1528 | } | 1536 | } |
1529 | 1537 | ||
1530 | /* MCLK */ | 1538 | /* MCLK */ |
1531 | clk_disable_unprepare(da7219->mclk); | 1539 | if (da7219->mclk) |
1540 | clk_disable_unprepare(da7219->mclk); | ||
1532 | break; | 1541 | break; |
1533 | } | 1542 | } |
1534 | 1543 | ||