Merge "soc: swr-mstr-ctrl: Remove ssr_lock handling"
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

commit
54255588ac
@@ -389,33 +389,77 @@ static int swrm_request_hw_vote(struct swr_mstr_ctrl *swrm,
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
mutex_lock(&swrm->devlock);
|
||||||
if (core_type == LPASS_HW_CORE) {
|
if (core_type == LPASS_HW_CORE) {
|
||||||
if (swrm->lpass_core_hw_vote) {
|
if (swrm->lpass_core_hw_vote) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
ret =
|
if (!swrm->dev_up) {
|
||||||
clk_prepare_enable(swrm->lpass_core_hw_vote);
|
dev_dbg(swrm->dev, "%s: device is down or SSR state\n",
|
||||||
if (ret < 0)
|
__func__);
|
||||||
dev_err(swrm->dev,
|
trace_printk("%s: device is down or SSR state\n",
|
||||||
"%s:lpass core hw enable failed\n",
|
__func__);
|
||||||
__func__);
|
mutex_unlock(&swrm->devlock);
|
||||||
} else
|
return -ENODEV;
|
||||||
clk_disable_unprepare(swrm->lpass_core_hw_vote);
|
}
|
||||||
|
if (++swrm->hw_core_clk_en == 1) {
|
||||||
|
ret =
|
||||||
|
clk_prepare_enable(
|
||||||
|
swrm->lpass_core_hw_vote);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(swrm->dev,
|
||||||
|
"%s:lpass core hw enable failed\n",
|
||||||
|
__func__);
|
||||||
|
--swrm->hw_core_clk_en;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
--swrm->hw_core_clk_en;
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (core_type == LPASS_AUDIO_CORE) {
|
if (core_type == LPASS_AUDIO_CORE) {
|
||||||
if (swrm->lpass_core_audio) {
|
if (swrm->lpass_core_audio) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
ret =
|
if (!swrm->dev_up) {
|
||||||
clk_prepare_enable(swrm->lpass_core_audio);
|
dev_dbg(swrm->dev, "%s: device is down or SSR state\n",
|
||||||
if (ret < 0)
|
__func__);
|
||||||
dev_err(swrm->dev,
|
trace_printk("%s: device is down or SSR state\n",
|
||||||
"%s:lpass audio hw enable failed\n",
|
__func__);
|
||||||
__func__);
|
mutex_unlock(&swrm->devlock);
|
||||||
} else
|
return -ENODEV;
|
||||||
clk_disable_unprepare(swrm->lpass_core_audio);
|
}
|
||||||
|
if (++swrm->aud_core_clk_en == 1) {
|
||||||
|
ret =
|
||||||
|
clk_prepare_enable(
|
||||||
|
swrm->lpass_core_audio);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(swrm->dev,
|
||||||
|
"%s:lpass audio hw enable failed\n",
|
||||||
|
__func__);
|
||||||
|
--swrm->aud_core_clk_en;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
--swrm->aud_core_clk_en;
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mutex_unlock(&swrm->devlock);
|
||||||
|
dev_dbg(swrm->dev, "%s: hw_clk_en: %d audio_core_clk_en: %d\n",
|
||||||
|
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
|
||||||
|
trace_printk("%s: hw_clk_en: %d audio_core_clk_en: %d\n",
|
||||||
|
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2160,22 +2204,15 @@ static void swrm_device_wakeup_vote(struct swr_master *mstr)
|
|||||||
dev_err(swrm->dev, "%s Failed to hold suspend\n", __func__);
|
dev_err(swrm->dev, "%s Failed to hold suspend\n", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (++swrm->hw_core_clk_en == 1)
|
mutex_lock(&swrm->reslock);
|
||||||
if (swrm_request_hw_vote(swrm, LPASS_HW_CORE, true)) {
|
if (swrm_request_hw_vote(swrm, LPASS_HW_CORE, true))
|
||||||
dev_err(swrm->dev, "%s:lpass core hw enable failed\n",
|
dev_err(swrm->dev, "%s:lpass core hw enable failed\n",
|
||||||
__func__);
|
__func__);
|
||||||
--swrm->hw_core_clk_en;
|
if (swrm_request_hw_vote(swrm, LPASS_AUDIO_CORE, true))
|
||||||
}
|
dev_err(swrm->dev, "%s:lpass audio hw enable failed\n",
|
||||||
if ( ++swrm->aud_core_clk_en == 1)
|
__func__);
|
||||||
if (swrm_request_hw_vote(swrm, LPASS_AUDIO_CORE, true)) {
|
mutex_unlock(&swrm->reslock);
|
||||||
dev_err(swrm->dev, "%s:lpass audio hw enable failed\n",
|
|
||||||
__func__);
|
|
||||||
--swrm->aud_core_clk_en;
|
|
||||||
}
|
|
||||||
dev_dbg(swrm->dev, "%s: hw_clk_en: %d audio_core_clk_en: %d\n",
|
|
||||||
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
|
|
||||||
trace_printk("%s: hw_clk_en: %d audio_core_clk_en: %d\n",
|
|
||||||
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
|
|
||||||
pm_runtime_get_sync(swrm->dev);
|
pm_runtime_get_sync(swrm->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2190,22 +2227,11 @@ static void swrm_device_wakeup_unvote(struct swr_master *mstr)
|
|||||||
}
|
}
|
||||||
pm_runtime_mark_last_busy(swrm->dev);
|
pm_runtime_mark_last_busy(swrm->dev);
|
||||||
pm_runtime_put_autosuspend(swrm->dev);
|
pm_runtime_put_autosuspend(swrm->dev);
|
||||||
dev_dbg(swrm->dev, "%s: hw_clk_en: %d audio_core_clk_en: %d\n",
|
|
||||||
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
|
|
||||||
|
|
||||||
trace_printk("%s: hw_clk_en: %d audio_core_clk_en: %d\n",
|
mutex_lock(&swrm->reslock);
|
||||||
__func__, swrm->hw_core_clk_en, swrm->aud_core_clk_en);
|
swrm_request_hw_vote(swrm, LPASS_AUDIO_CORE, false);
|
||||||
--swrm->aud_core_clk_en;
|
swrm_request_hw_vote(swrm, LPASS_HW_CORE, false);
|
||||||
if (swrm->aud_core_clk_en < 0)
|
mutex_unlock(&swrm->reslock);
|
||||||
swrm->aud_core_clk_en = 0;
|
|
||||||
else if (swrm->aud_core_clk_en == 0)
|
|
||||||
swrm_request_hw_vote(swrm, LPASS_AUDIO_CORE, false);
|
|
||||||
|
|
||||||
--swrm->hw_core_clk_en;
|
|
||||||
if (swrm->hw_core_clk_en < 0)
|
|
||||||
swrm->hw_core_clk_en = 0;
|
|
||||||
else if (swrm->hw_core_clk_en == 0)
|
|
||||||
swrm_request_hw_vote(swrm, LPASS_HW_CORE, false);
|
|
||||||
|
|
||||||
swrm_unlock_sleep(swrm);
|
swrm_unlock_sleep(swrm);
|
||||||
}
|
}
|
||||||
@@ -3205,12 +3231,19 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
|
|||||||
break;
|
break;
|
||||||
case SWR_DEVICE_SSR_DOWN:
|
case SWR_DEVICE_SSR_DOWN:
|
||||||
trace_printk("%s: swr device down called\n", __func__);
|
trace_printk("%s: swr device down called\n", __func__);
|
||||||
|
mutex_lock(&swrm->mlock);
|
||||||
|
if (swrm->state == SWR_MSTR_DOWN)
|
||||||
|
dev_dbg(swrm->dev, "%s:SWR master is already Down:%d\n",
|
||||||
|
__func__, swrm->state);
|
||||||
|
else
|
||||||
|
swrm_device_down(&pdev->dev);
|
||||||
mutex_lock(&swrm->devlock);
|
mutex_lock(&swrm->devlock);
|
||||||
swrm->dev_up = false;
|
swrm->dev_up = false;
|
||||||
mutex_unlock(&swrm->devlock);
|
mutex_unlock(&swrm->devlock);
|
||||||
mutex_lock(&swrm->reslock);
|
mutex_lock(&swrm->reslock);
|
||||||
swrm->state = SWR_MSTR_SSR;
|
swrm->state = SWR_MSTR_SSR;
|
||||||
mutex_unlock(&swrm->reslock);
|
mutex_unlock(&swrm->reslock);
|
||||||
|
mutex_unlock(&swrm->mlock);
|
||||||
break;
|
break;
|
||||||
case SWR_DEVICE_SSR_UP:
|
case SWR_DEVICE_SSR_UP:
|
||||||
/* wait for clk voting to be zero */
|
/* wait for clk voting to be zero */
|
||||||
|
Reference in New Issue
Block a user