Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a59daead authored by dojha's avatar dojha Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatardojha <dojha@codeaurora.org>
parent d3068532
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1386,6 +1386,7 @@ static int tasha_micbias_control(struct snd_soc_codec *codec,
			snd_soc_update_bits(codec, micb_reg, 0xC0, 0x80);
		break;
	case MICB_PULLUP_DISABLE:
		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))
@@ -1404,6 +1405,7 @@ static int tasha_micbias_control(struct snd_soc_codec *codec,
					post_dapm_on, &tasha->mbhc);
		break;
	case MICB_DISABLE:
		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))