summaryrefslogtreecommitdiff
path: root/soc
diff options
context:
space:
mode:
authorAditya Bavanari <abavanar@codeaurora.org>2020-03-19 18:30:10 +0530
committerAditya Bavanari <abavanar@codeaurora.org>2020-04-02 18:20:15 +0530
commitbb981b707efecb499346bf2cad3142efad6f1e8d (patch)
tree71e8ced4bba1726066b459341b022ea3aac7cc5d /soc
parent9e8e0f6d803c5cd744df8edce965bb1c8a1866ce (diff)
downloadmsm-extra-bb981b707efecb499346bf2cad3142efad6f1e8d.tar.gz
audio-kernel: Synchronize hw vote and unvote requests
HW vote and unvote is currently called from multiple clients leading to synchronization issues during SSR/PDR scenarios. Synchronize all the vote requests by using digital codec resource manager. Change-Id: I7e63f69ab5d761a3bb4c7ce70bbef2e8bfd76cfb Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
Diffstat (limited to 'soc')
-rw-r--r--soc/pinctrl-lpi.c17
-rw-r--r--soc/swr-mstr-ctrl.c19
2 files changed, 26 insertions, 10 deletions
diff --git a/soc/pinctrl-lpi.c b/soc/pinctrl-lpi.c
index c3d2326a..0b0eef5a 100644
--- a/soc/pinctrl-lpi.c
+++ b/soc/pinctrl-lpi.c
@@ -16,6 +16,7 @@
#include <linux/clk.h>
#include <linux/bitops.h>
#include <soc/snd_event.h>
+#include <dsp/digital-cdc-rsc-mgr.h>
#include <linux/pm_runtime.h>
#include <dsp/audio_notifier.h>
@@ -469,6 +470,7 @@ static int lpi_notifier_service_cb(struct notifier_block *this,
unsigned long opcode, void *ptr)
{
static bool initial_boot = true;
+ struct lpi_gpio_state *state = dev_get_drvdata(lpi_dev);
pr_debug("%s: Service opcode 0x%lx\n", __func__, opcode);
@@ -484,6 +486,17 @@ static int lpi_notifier_service_cb(struct notifier_block *this,
case AUDIO_NOTIFIER_SERVICE_UP:
if (initial_boot)
initial_boot = false;
+
+ /* Reset HW votes after SSR */
+ if (!lpi_dev_up) {
+ if (state->lpass_core_hw_vote)
+ digital_cdc_rsc_mgr_hw_vote_reset(
+ state->lpass_core_hw_vote);
+ if (state->lpass_audio_hw_vote)
+ digital_cdc_rsc_mgr_hw_vote_reset(
+ state->lpass_audio_hw_vote);
+ }
+
lpi_dev_up = true;
snd_event_notify(lpi_dev, SND_EVENT_UP);
break;
@@ -870,7 +883,7 @@ int lpi_pinctrl_runtime_resume(struct device *dev)
}
mutex_lock(&state->core_hw_vote_lock);
- ret = clk_prepare_enable(hw_vote);
+ ret = digital_cdc_rsc_mgr_hw_vote_enable(hw_vote);
if (ret < 0) {
pm_runtime_set_autosuspend_delay(dev,
LPI_AUTO_SUSPEND_DELAY_ERROR);
@@ -906,7 +919,7 @@ int lpi_pinctrl_runtime_suspend(struct device *dev)
mutex_lock(&state->core_hw_vote_lock);
if (state->core_hw_vote_status) {
- clk_disable_unprepare(hw_vote);
+ digital_cdc_rsc_mgr_hw_vote_disable(hw_vote);
state->core_hw_vote_status = false;
}
mutex_unlock(&state->core_hw_vote_lock);
diff --git a/soc/swr-mstr-ctrl.c b/soc/swr-mstr-ctrl.c
index 4aa5c0c6..77ece45e 100644
--- a/soc/swr-mstr-ctrl.c
+++ b/soc/swr-mstr-ctrl.c
@@ -22,6 +22,7 @@
#include <soc/swr-common.h>
#include <linux/regmap.h>
#include <dsp/msm-audio-event-notify.h>
+#include <dsp/digital-cdc-rsc-mgr.h>
#include "swrm_registers.h"
#include "swr-mstr-ctrl.h"
@@ -378,8 +379,8 @@ static int swrm_request_hw_vote(struct swr_mstr_ctrl *swrm,
}
if (++swrm->hw_core_clk_en == 1) {
ret =
- clk_prepare_enable(
- swrm->lpass_core_hw_vote);
+ digital_cdc_rsc_mgr_hw_vote_enable(
+ swrm->lpass_core_hw_vote);
if (ret < 0) {
dev_err(swrm->dev,
"%s:lpass core hw enable failed\n",
@@ -392,8 +393,8 @@ static int swrm_request_hw_vote(struct swr_mstr_ctrl *swrm,
if (swrm->hw_core_clk_en < 0)
swrm->hw_core_clk_en = 0;
else if (swrm->hw_core_clk_en == 0)
- clk_disable_unprepare(
- swrm->lpass_core_hw_vote);
+ digital_cdc_rsc_mgr_hw_vote_disable(
+ swrm->lpass_core_hw_vote);
}
}
}
@@ -410,8 +411,8 @@ static int swrm_request_hw_vote(struct swr_mstr_ctrl *swrm,
}
if (++swrm->aud_core_clk_en == 1) {
ret =
- clk_prepare_enable(
- swrm->lpass_core_audio);
+ digital_cdc_rsc_mgr_hw_vote_enable(
+ swrm->lpass_core_audio);
if (ret < 0) {
dev_err(swrm->dev,
"%s:lpass audio hw enable failed\n",
@@ -424,8 +425,8 @@ static int swrm_request_hw_vote(struct swr_mstr_ctrl *swrm,
if (swrm->aud_core_clk_en < 0)
swrm->aud_core_clk_en = 0;
else if (swrm->aud_core_clk_en == 0)
- clk_disable_unprepare(
- swrm->lpass_core_audio);
+ digital_cdc_rsc_mgr_hw_vote_disable(
+ swrm->lpass_core_audio);
}
}
}
@@ -3334,6 +3335,8 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
swrm_device_down(&pdev->dev);
mutex_lock(&swrm->devlock);
swrm->dev_up = false;
+ swrm->hw_core_clk_en = 0;
+ swrm->aud_core_clk_en = 0;
mutex_unlock(&swrm->devlock);
mutex_lock(&swrm->reslock);
swrm->state = SWR_MSTR_SSR;