summaryrefslogtreecommitdiff
path: root/asoc
diff options
context:
space:
mode:
authorVangala, Amarnath <avangala@codeaurora.org>2020-10-27 23:53:04 +0530
committerSoumya Managoli <smanag@codeaurora.org>2021-03-26 18:07:46 +0530
commit258d29334a915d45b7ad6b1820cc5a0be5b375b0 (patch)
tree0c61f1d609ef39ecaea5f4b9dc22c2bf6a8ab2ca /asoc
parentb0bf9aab325803d62c1d7f042d7ef877e2189387 (diff)
downloadmsm-extra-258d29334a915d45b7ad6b1820cc5a0be5b375b0.tar.gz
asoc: codecs: fix race condition of core vote and reg access
Auto suspend timer for core vote is triggering before read write complete. Move the auto suspend of core vote to post read write operation. Change-Id: Ib0f6b026fe0e7fd3fbe052691db492915e436a78 Signed-off-by: Vangala, Amarnath <avangala@codeaurora.org>
Diffstat (limited to 'asoc')
-rw-r--r--asoc/codecs/bolero/rx-macro.c17
-rw-r--r--asoc/codecs/bolero/tx-macro.c13
-rw-r--r--asoc/codecs/bolero/va-macro.c13
-rw-r--r--asoc/codecs/bolero/wsa-macro.c13
4 files changed, 35 insertions, 21 deletions
diff --git a/asoc/codecs/bolero/rx-macro.c b/asoc/codecs/bolero/rx-macro.c
index 9167088f..9934a865 100644
--- a/asoc/codecs/bolero/rx-macro.c
+++ b/asoc/codecs/bolero/rx-macro.c
@@ -1236,6 +1236,7 @@ static int rx_macro_mclk_enable(struct rx_macro_priv *rx_priv,
rx_priv->default_clk_id,
rx_priv->clk_id,
true);
+ rx_macro_core_vote(rx_priv, false);
if (ret < 0) {
dev_err(rx_priv->dev,
"%s: rx request clock enable failed\n",
@@ -1290,6 +1291,7 @@ static int rx_macro_mclk_enable(struct rx_macro_priv *rx_priv,
rx_priv->default_clk_id,
rx_priv->clk_id,
false);
+ rx_macro_core_vote(rx_priv, false);
rx_priv->clk_id = rx_priv->default_clk_id;
}
}
@@ -1409,11 +1411,11 @@ static int rx_macro_event_handler(struct snd_soc_component *component,
"%s, failed to enable clk, ret:%d\n",
__func__, ret);
} else {
- rx_macro_core_vote(rx_priv, true);
bolero_clk_rsc_request_clock(rx_priv->dev,
rx_priv->default_clk_id,
RX_CORE_CLK, false);
}
+ rx_macro_core_vote(rx_priv, false);
break;
case BOLERO_MACRO_EVT_SSR_UP:
trace_printk("%s, enter SSR up\n", __func__);
@@ -3678,22 +3680,25 @@ static const struct snd_soc_dapm_route rx_audio_map[] = {
static int rx_macro_core_vote(void *handle, bool enable)
{
+ int rc = 0;
struct rx_macro_priv *rx_priv = (struct rx_macro_priv *) handle;
if (rx_priv == NULL) {
pr_err("%s: rx priv data is NULL\n", __func__);
return -EINVAL;
}
+
if (enable) {
pm_runtime_get_sync(rx_priv->dev);
+ if (bolero_check_core_votes(rx_priv->dev))
+ rc = 0;
+ else
+ rc = -ENOTSYNC;
+ } else {
pm_runtime_put_autosuspend(rx_priv->dev);
pm_runtime_mark_last_busy(rx_priv->dev);
}
-
- if (bolero_check_core_votes(rx_priv->dev))
- return 0;
- else
- return -EINVAL;
+ return rc;
}
static int rx_swrm_clock(void *handle, bool enable)
diff --git a/asoc/codecs/bolero/tx-macro.c b/asoc/codecs/bolero/tx-macro.c
index a9afea49..7f0e758b 100644
--- a/asoc/codecs/bolero/tx-macro.c
+++ b/asoc/codecs/bolero/tx-macro.c
@@ -2678,22 +2678,25 @@ static int tx_macro_clk_switch(struct snd_soc_component *component, int clk_src)
static int tx_macro_core_vote(void *handle, bool enable)
{
+ int rc = 0;
struct tx_macro_priv *tx_priv = (struct tx_macro_priv *) handle;
if (tx_priv == NULL) {
pr_err("%s: tx priv data is NULL\n", __func__);
return -EINVAL;
}
+
if (enable) {
pm_runtime_get_sync(tx_priv->dev);
+ if (bolero_check_core_votes(tx_priv->dev))
+ rc = 0;
+ else
+ rc = -ENOTSYNC;
+ } else {
pm_runtime_put_autosuspend(tx_priv->dev);
pm_runtime_mark_last_busy(tx_priv->dev);
}
-
- if (bolero_check_core_votes(tx_priv->dev))
- return 0;
- else
- return -EINVAL;
+ return rc;
}
static int tx_macro_swrm_clock(void *handle, bool enable)
diff --git a/asoc/codecs/bolero/va-macro.c b/asoc/codecs/bolero/va-macro.c
index 20117e7f..93fc0fc9 100644
--- a/asoc/codecs/bolero/va-macro.c
+++ b/asoc/codecs/bolero/va-macro.c
@@ -671,22 +671,25 @@ done:
static int va_macro_core_vote(void *handle, bool enable)
{
+ int rc = 0;
struct va_macro_priv *va_priv = (struct va_macro_priv *) handle;
if (va_priv == NULL) {
pr_err("%s: va priv data is NULL\n", __func__);
return -EINVAL;
}
+
if (enable) {
pm_runtime_get_sync(va_priv->dev);
+ if (bolero_check_core_votes(va_priv->dev))
+ rc = 0;
+ else
+ rc = -ENOTSYNC;
+ } else {
pm_runtime_put_autosuspend(va_priv->dev);
pm_runtime_mark_last_busy(va_priv->dev);
}
-
- if (bolero_check_core_votes(va_priv->dev))
- return 0;
- else
- return -EINVAL;
+ return rc;
}
static int va_macro_swrm_clock(void *handle, bool enable)
diff --git a/asoc/codecs/bolero/wsa-macro.c b/asoc/codecs/bolero/wsa-macro.c
index e867141f..4e06d12b 100644
--- a/asoc/codecs/bolero/wsa-macro.c
+++ b/asoc/codecs/bolero/wsa-macro.c
@@ -2828,22 +2828,25 @@ static void wsa_macro_init_reg(struct snd_soc_component *component)
static int wsa_macro_core_vote(void *handle, bool enable)
{
+ int rc = 0;
struct wsa_macro_priv *wsa_priv = (struct wsa_macro_priv *) handle;
if (wsa_priv == NULL) {
pr_err("%s: wsa priv data is NULL\n", __func__);
return -EINVAL;
}
+
if (enable) {
pm_runtime_get_sync(wsa_priv->dev);
+ if (bolero_check_core_votes(wsa_priv->dev))
+ rc = 0;
+ else
+ rc = -ENOTSYNC;
+ } else {
pm_runtime_put_autosuspend(wsa_priv->dev);
pm_runtime_mark_last_busy(wsa_priv->dev);
}
-
- if (bolero_check_core_votes(wsa_priv->dev))
- return 0;
- else
- return -EINVAL;
+ return rc;
}
static int wsa_swrm_clock(void *handle, bool enable)