ASoC: wcd9xxx: don't acquire BCL from codec driver
Codec driver shouldn't acquire BCL lock especially from DAPM widget.
Otherwise mutex deadlock can happen in below scenario.
--
thread0 | thread1
| *lock BCL
| power up DAPM widget B
| snd_soc_dapm_sync()
DAPM widget A starts sync |
*lock BCL |
--
Fix codec driver to hold codec->mutex instead of BCL and prevent possible
mutex deadlock.
CRs-fixed: 502427
Change-Id: Ibc4a70eba4824a384874244f36831e2d98c85d4b
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
diff --git a/sound/soc/codecs/wcd9xxx-resmgr.c b/sound/soc/codecs/wcd9xxx-resmgr.c
index 84f236e..be11e53 100644
--- a/sound/soc/codecs/wcd9xxx-resmgr.c
+++ b/sound/soc/codecs/wcd9xxx-resmgr.c
@@ -209,8 +209,8 @@
int old_clk_rco_users, old_clk_mclk_users;
pr_debug("%s: enter\n", __func__);
- WCD9XXX_BCL_ASSERT_LOCKED(resmgr);
+ WCD9XXX_BG_CLK_LOCK(resmgr);
old_bg_audio_users = resmgr->bg_audio_users;
old_bg_mbhc_users = resmgr->bg_mbhc_users;
old_clk_rco_users = resmgr->clk_rco_users;
@@ -243,6 +243,7 @@
while (old_clk_rco_users--)
wcd9xxx_resmgr_get_clk_block(resmgr, WCD9XXX_CLK_RCO);
}
+ WCD9XXX_BG_CLK_UNLOCK(resmgr);
pr_debug("%s: leave\n", __func__);
}