summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordojha <dojha@codeaurora.org>2016-03-31 16:12:44 +0530
committerJeevan Shriram <jshriram@codeaurora.org>2016-05-06 12:06:22 -0700
commit4727beff4df11caddc1bfa1c84f4e1b0693f296d (patch)
tree9b059095276f47f809292ad76447a3a001f33b33
parenta58a1941057f8ca6c77aef78b857715b8b22fa84 (diff)
ASoC: codec: micb ref count decrement check
In SSR with recording, race condition which reduces micb_ref to -1 is seen. SSR sets micb_ref to 0, further recording widgets power down can reduce it to -1. During power up, it is increased to 0, micbias is not getting enabled for recording since micb_ref is 0. To prevent this micb_ref is checked for non zero value before decrementing it. CRs-Fixed: 994268 Change-Id: I6ea23fdf8b119cfd178c4f5b79b9d1c01c267a82 Signed-off-by: dojha <dojha@codeaurora.org>
-rwxr-xr-xsound/soc/codecs/wcd9335.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c
index 13933a078e43..18dc404ac31d 100755
--- a/sound/soc/codecs/wcd9335.c
+++ b/sound/soc/codecs/wcd9335.c
@@ -1389,7 +1389,8 @@ static int tasha_micbias_control(struct snd_soc_codec *codec,
snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
break;
case MICB_PULLUP_DISABLE:
- tasha->pullup_ref[micb_index]--;
+ if (tasha->pullup_ref[micb_index] > 0)
+ tasha->pullup_ref[micb_index]--;
if ((tasha->pullup_ref[micb_index] == 0) &&
(tasha->micb_ref[micb_index] == 0))
snd_soc_update_bits(codec, micb_reg, 0xC0, 0x00);
@@ -1407,7 +1408,8 @@ static int tasha_micbias_control(struct snd_soc_codec *codec,
post_dapm_on, &tasha->mbhc);
break;
case MICB_DISABLE:
- tasha->micb_ref[micb_index]--;
+ if (tasha->micb_ref[micb_index] > 0)
+ tasha->micb_ref[micb_index]--;
if ((tasha->micb_ref[micb_index] == 0) &&
(tasha->pullup_ref[micb_index] > 0))
snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);