summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorBhalchandra Gajare <gajare@codeaurora.org>2015-12-17 19:59:53 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:15:48 -0700
commit164661cbb4f29236e41d49353d7109f9bf4b18cd (patch)
treec325b816993327c71c8f17b0d558155a0e5cd2da /sound/soc
parent804f2dca61eeb0d8e2c521ef28aca2c839c139da (diff)
ASoC: wcd9335: Fix internal clock enable during SSR
After subsystem restart is completed, driver will try to restore the internal clock state to state before subsystem restart. In some cases, it is possible that the internal clock state is not restored properly. This causes the internal clock to be off when it is expected to be turned on. Fix this issue by making sure the clock states are restored correctly post subsystem restart. CRs-fixed: 948899 Change-Id: I0084287b2d3b62c7498bae423952e64dd0d6e0f4 Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Diffstat (limited to 'sound/soc')
-rwxr-xr-xsound/soc/codecs/wcd9335.c29
-rw-r--r--sound/soc/codecs/wcd9xxx-resmgr-v2.c7
2 files changed, 23 insertions, 13 deletions
diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c
index 1d14f38d2f86..694b52faa8ea 100755
--- a/sound/soc/codecs/wcd9335.c
+++ b/sound/soc/codecs/wcd9335.c
@@ -11088,18 +11088,12 @@ int tasha_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
}
EXPORT_SYMBOL(tasha_codec_info_create_codec_entry);
-/*
- * tasha_codec_internal_rco_ctrl()
- * Make sure that the caller does not acquire
- * BG_CLK_LOCK.
- */
-static int tasha_codec_internal_rco_ctrl(struct snd_soc_codec *codec,
- bool enable)
+static int __tasha_codec_internal_rco_ctrl(
+ struct snd_soc_codec *codec, bool enable)
{
struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
int ret = 0;
- WCD9XXX_V2_BG_CLK_LOCK(tasha->resmgr);
if (enable) {
tasha_cdc_sido_ccl_enable(tasha, true);
if (wcd_resmgr_get_clk_type(tasha->resmgr) ==
@@ -11124,6 +11118,23 @@ static int tasha_codec_internal_rco_ctrl(struct snd_soc_codec *codec,
__func__, (enable ? "enabling" : "disabling"));
ret = -EINVAL;
}
+
+ return ret;
+}
+
+/*
+ * tasha_codec_internal_rco_ctrl()
+ * Make sure that the caller does not acquire
+ * BG_CLK_LOCK.
+ */
+static int tasha_codec_internal_rco_ctrl(struct snd_soc_codec *codec,
+ bool enable)
+{
+ struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
+ int ret = 0;
+
+ WCD9XXX_V2_BG_CLK_LOCK(tasha->resmgr);
+ ret = __tasha_codec_internal_rco_ctrl(codec, enable);
WCD9XXX_V2_BG_CLK_UNLOCK(tasha->resmgr);
return ret;
}
@@ -12116,7 +12127,7 @@ static int tasha_cpe_initialize(struct snd_soc_codec *codec)
}
static const struct wcd_resmgr_cb tasha_resmgr_cb = {
- .cdc_rco_ctrl = tasha_codec_internal_rco_ctrl,
+ .cdc_rco_ctrl = __tasha_codec_internal_rco_ctrl,
};
static int tasha_device_down(struct wcd9xxx *wcd9xxx)
diff --git a/sound/soc/codecs/wcd9xxx-resmgr-v2.c b/sound/soc/codecs/wcd9xxx-resmgr-v2.c
index 6560f6967bb4..824758d9859a 100644
--- a/sound/soc/codecs/wcd9xxx-resmgr-v2.c
+++ b/sound/soc/codecs/wcd9xxx-resmgr-v2.c
@@ -75,7 +75,6 @@ static void wcd_resmgr_cdc_specific_get_clk(struct wcd9xxx_resmgr_v2 *resmgr,
int clk_users)
{
/* Caller of this function should have acquired BG_CLK lock */
- WCD9XXX_V2_BG_CLK_UNLOCK(resmgr);
if (clk_users) {
if (resmgr->resmgr_cb &&
resmgr->resmgr_cb->cdc_rco_ctrl) {
@@ -84,8 +83,6 @@ static void wcd_resmgr_cdc_specific_get_clk(struct wcd9xxx_resmgr_v2 *resmgr,
true);
}
}
- /* Acquire BG_CLK lock before return */
- WCD9XXX_V2_BG_CLK_LOCK(resmgr);
}
void wcd_resmgr_post_ssr_v2(struct wcd9xxx_resmgr_v2 *resmgr)
@@ -324,7 +321,8 @@ static int wcd_resmgr_disable_clk_rco(struct wcd9xxx_resmgr_v2 *resmgr)
{
if ((resmgr->clk_rco_users <= 0) ||
(resmgr->clk_type == WCD_CLK_OFF)) {
- pr_err("%s: No RCO Clk users, cannot disable\n", __func__);
+ pr_err("%s: rco_clk_users = %d, clk_type = %d, cannot disable\n",
+ __func__, resmgr->clk_rco_users, resmgr->clk_type);
return -EINVAL;
}
@@ -485,6 +483,7 @@ int wcd_resmgr_post_init(struct wcd9xxx_resmgr_v2 *resmgr,
}
resmgr->codec = codec;
+ resmgr->resmgr_cb = resmgr_cb;
return 0;
}