summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorLaxminath Kasam <lkasam@codeaurora.org>2016-04-15 13:41:20 +0530
committerJeevan Shriram <jshriram@codeaurora.org>2016-05-06 12:06:21 -0700
commit80af15a3359261861c43d1ce22c9cf45df4bbd7d (patch)
treee38abb78356c4c3dea8ba68ef6aab5af88577e4c /sound
parent97a9be4c8b2575d7ed7b70b78051bc7c2743120d (diff)
ASoC: wsa881x-analog: Fix warning in bandgap and clock control
During temperature read, resource acquire can fail if mclk is not enabled successfully. In such case, clock and bandgap control counters are not incremented. But resource release is still happening resulting in counters going negative and warn_on messages. Fix it by handling resource acquire failure case. CRs-Fixed: 1003365 Change-Id: If2371e06866a615ca7d7dad64a5d7a17f258b3b6 Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/wsa881x-analog.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/sound/soc/codecs/wsa881x-analog.c b/sound/soc/codecs/wsa881x-analog.c
index c7b193f3d80b..fa1d099e082a 100644
--- a/sound/soc/codecs/wsa881x-analog.c
+++ b/sound/soc/codecs/wsa881x-analog.c
@@ -899,7 +899,8 @@ static int wsa881x_startup(struct wsa881x_pdata *pdata)
if (pdata->enable_mclk) {
ret = pdata->enable_mclk(card, true);
if (ret < 0) {
- pr_err("%s: mclk enable failed %d\n",
+ dev_err_ratelimited(codec->dev,
+ "%s: mclk enable failed %d\n",
__func__, ret);
return ret;
}
@@ -962,7 +963,8 @@ static int32_t wsa881x_resource_acquire(struct snd_soc_codec *codec,
if (enable) {
ret = wsa881x_startup(wsa881x);
if (ret < 0) {
- pr_err("%s: failed to startup\n", __func__);
+ dev_err_ratelimited(codec->dev,
+ "%s: failed to startup\n", __func__);
return ret;
}
}
@@ -971,7 +973,8 @@ static int32_t wsa881x_resource_acquire(struct snd_soc_codec *codec,
if (!enable) {
ret = wsa881x_shutdown(wsa881x);
if (ret < 0)
- pr_err("%s: failed to shutdown\n", __func__);
+ dev_err_ratelimited(codec->dev,
+ "%s: failed to shutdown\n", __func__);
}
return ret;
}
@@ -980,12 +983,18 @@ static int32_t wsa881x_temp_reg_read(struct snd_soc_codec *codec,
struct wsa_temp_register *wsa_temp_reg)
{
struct wsa881x_pdata *wsa881x = snd_soc_codec_get_drvdata(codec);
+ int ret = 0;
if (!wsa881x) {
dev_err(codec->dev, "%s: wsa881x is NULL\n", __func__);
return -EINVAL;
}
- wsa881x_resource_acquire(codec, true);
+ ret = wsa881x_resource_acquire(codec, true);
+ if (ret) {
+ dev_err_ratelimited(codec->dev,
+ "%s: resource acquire fail\n", __func__);
+ return ret;
+ }
if (WSA881X_IS_2_0(wsa881x->version)) {
snd_soc_update_bits(codec, WSA881X_TADC_VALUE_CTL, 0x01, 0x00);
@@ -1003,9 +1012,12 @@ static int32_t wsa881x_temp_reg_read(struct snd_soc_codec *codec,
wsa_temp_reg->d2_msb = snd_soc_read(codec, WSA881X_OTP_REG_3);
wsa_temp_reg->d2_lsb = snd_soc_read(codec, WSA881X_OTP_REG_4);
- wsa881x_resource_acquire(codec, false);
+ ret = wsa881x_resource_acquire(codec, false);
+ if (ret)
+ dev_err_ratelimited(codec->dev,
+ "%s: resource release fail\n", __func__);
- return 0;
+ return ret;
}
static int wsa881x_probe(struct snd_soc_codec *codec)