soc: swr: Release resource lock when not needed

Resource lock should not be held while doing bank
switch as bank switch requires interrupt handling
which needs access to the resource lock.

Change-Id: Ic17178c7e6f16a7db91da6577ed2ce70c9c9f084
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
This commit is contained in:
Karthikeyan Mani 2019-05-21 17:31:24 -07:00
parent f6dc08395d
commit f68219039a

View file

@ -2289,11 +2289,14 @@ static int swrm_runtime_resume(struct device *dev)
__func__, swrm->state);
mutex_lock(&swrm->reslock);
if (swrm->lpass_core_hw_vote)
if (swrm->lpass_core_hw_vote) {
ret = clk_prepare_enable(swrm->lpass_core_hw_vote);
if (ret < 0)
if (ret < 0) {
dev_err(dev, "%s:lpass core hw enable failed\n",
__func__);
ret = 0;
}
}
if ((swrm->state == SWR_MSTR_DOWN) ||
(swrm->state == SWR_MSTR_SSR && swrm->dev_up)) {
@ -2306,7 +2309,6 @@ static int swrm_runtime_resume(struct device *dev)
if (swrm_clk_request(swrm, true))
goto exit;
if (!swrm->clk_stop_mode0_supp || swrm->state == SWR_MSTR_SSR) {
enable_bank_switch(swrm, 0, SWR_ROW_50, SWR_MIN_COL);
list_for_each_entry(swr_dev, &mstr->devices, dev_list) {
ret = swr_device_up(swr_dev);
if (ret == -ENODEV) {
@ -2327,7 +2329,11 @@ static int swrm_runtime_resume(struct device *dev)
swrm_master_init(swrm);
swrm_cmd_fifo_wr_cmd(swrm, 0x4, 0xF, 0x0,
SWRS_SCP_INT_STATUS_MASK_1);
if (swrm->state == SWR_MSTR_SSR) {
mutex_unlock(&swrm->reslock);
enable_bank_switch(swrm, 0, SWR_ROW_50, SWR_MIN_COL);
mutex_lock(&swrm->reslock);
}
} else {
/*wake up from clock stop*/
swr_master_write(swrm, SWRM_MCP_BUS_CTRL_ADDR, 0x2);
@ -2358,11 +2364,14 @@ static int swrm_runtime_suspend(struct device *dev)
mutex_lock(&swrm->force_down_lock);
current_state = swrm->state;
mutex_unlock(&swrm->force_down_lock);
if (swrm->lpass_core_hw_vote)
if (swrm->lpass_core_hw_vote) {
ret = clk_prepare_enable(swrm->lpass_core_hw_vote);
if (ret < 0)
if (ret < 0) {
dev_err(dev, "%s:lpass core hw enable failed\n",
__func__);
ret = 0;
}
}
if ((current_state == SWR_MSTR_UP) ||
(current_state == SWR_MSTR_SSR)) {