Merge "soc: swr-mstr: Update soundwire state to SSR during UP"

This commit is contained in:
qctecmdr 2020-11-25 18:57:01 -08:00 committed by Gerrit - the friendly Code Review server
commit 8527c974cb
2 changed files with 18 additions and 1 deletions

View File

@ -3192,7 +3192,7 @@ exit:
if (!hw_core_err)
swrm_request_hw_vote(swrm, LPASS_HW_CORE, false);
if (swrm_clk_req_err)
if (swrm_clk_req_err || aud_core_err || hw_core_err)
pm_runtime_set_autosuspend_delay(&pdev->dev,
ERR_AUTO_SUSPEND_TIMER_VAL);
else
@ -3222,6 +3222,10 @@ static int swrm_runtime_suspend(struct device *dev)
__func__, swrm->state);
dev_dbg(dev, "%s: pm_runtime: suspend state: %d\n",
__func__, swrm->state);
if (swrm->state == SWR_MSTR_SSR_RESET) {
swrm->state = SWR_MSTR_SSR;
return 0;
}
mutex_lock(&swrm->reslock);
mutex_lock(&swrm->force_down_lock);
current_state = swrm->state;
@ -3565,6 +3569,18 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
dev_err(swrm->dev, "%s: clock voting not zero\n",
__func__);
if (swrm->state == SWR_MSTR_UP ||
pm_runtime_autosuspend_expiration(swrm->dev)) {
swrm->state = SWR_MSTR_SSR_RESET;
dev_dbg(swrm->dev,
"%s:suspend swr if active at SSR up\n",
__func__);
pm_runtime_set_autosuspend_delay(swrm->dev,
ERR_AUTO_SUSPEND_TIMER_VAL);
usleep_range(50000, 50100);
swrm->state = SWR_MSTR_SSR;
}
mutex_lock(&swrm->devlock);
swrm->dev_up = true;
mutex_unlock(&swrm->devlock);

View File

@ -51,6 +51,7 @@ enum {
SWR_MSTR_UP,
SWR_MSTR_DOWN,
SWR_MSTR_SSR,
SWR_MSTR_SSR_RESET,
};
enum swrm_pm_state {