* [PATCH 1/2] ASoC: da7219: Use of_match_ptr() when assigning match table
2015-10-07 10:57 [PATCH 0/2] ASoC: da7219: Improve mclk error checking, use of_match_ptr Adam Thomson
@ 2015-10-07 10:57 ` Adam Thomson
2015-10-07 10:57 ` [PATCH 2/2] ASoC: da7219: Improve error checking of mclk enable/disable Adam Thomson
1 sibling, 0 replies; 3+ messages in thread
From: Adam Thomson @ 2015-10-07 10:57 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai
Cc: alsa-devel, linux-kernel, Support Opensource
Use of_match_ptr() to handle non-DT kernel scenario where match
table should be NULL.
Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
sound/soc/codecs/da7219.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c
index c86a833..adcc079 100644
--- a/sound/soc/codecs/da7219.c
+++ b/sound/soc/codecs/da7219.c
@@ -1932,7 +1932,7 @@ MODULE_DEVICE_TABLE(i2c, da7219_i2c_id);
static struct i2c_driver da7219_i2c_driver = {
.driver = {
.name = "da7219",
- .of_match_table = da7219_of_match,
+ .of_match_table = of_match_ptr(da7219_of_match),
},
.probe = da7219_i2c_probe,
.remove = da7219_i2c_remove,
--
1.9.3
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/2] ASoC: da7219: Improve error checking of mclk enable/disable
2015-10-07 10:57 [PATCH 0/2] ASoC: da7219: Improve mclk error checking, use of_match_ptr Adam Thomson
2015-10-07 10:57 ` [PATCH 1/2] ASoC: da7219: Use of_match_ptr() when assigning match table Adam Thomson
@ 2015-10-07 10:57 ` Adam Thomson
1 sibling, 0 replies; 3+ messages in thread
From: Adam Thomson @ 2015-10-07 10:57 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai
Cc: alsa-devel, linux-kernel, Support Opensource
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>
---
sound/soc/codecs/da7219.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c
index adcc079..abba4b3 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,
enum snd_soc_bias_level level)
{
struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec);
+ int ret;
switch (level) {
case SND_SOC_BIAS_ON:
@@ -1502,7 +1503,14 @@ static int da7219_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_STANDBY:
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
/* 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 */
snd_soc_update_bits(codec, DA7219_REFERENCES,
@@ -1528,7 +1536,8 @@ static int da7219_set_bias_level(struct snd_soc_codec *codec,
}
/* MCLK */
- clk_disable_unprepare(da7219->mclk);
+ if (da7219->mclk)
+ clk_disable_unprepare(da7219->mclk);
break;
}
--
1.9.3
^ permalink raw reply [flat|nested] 3+ messages in thread