asoc: lpass-cdc: update logic to vote during ssr

After ADSP is up during SSR, core_hw_vote may fail and audio_hw_vote
may successed in lpass_cdc_runtime_resume which is caused some timing.
When getting slave device_id, as core_hw_vote is 0, it will skip reading
swr registers and return 0 which causes fail to read correct device_id.
Make this change to avoid calling lpass_cdc_runtime_resume when adsp_up
notification doesn't reach lpass_cdc.

Change-Id: I90a97e5c47bb95180a96ba1c60b462f1fa0124b7
Signed-off-by: Meng Wang <quic_mengw@quicinc.com>
Signed-off-by: Kunlei Zhang <quic_kunleiz@quicinc.com>
This commit is contained in:
Meng Wang
2021-12-13 17:21:29 +08:00
committed by Kunlei Zhang
parent f3752c324e
commit 14b172d92c
5 changed files with 52 additions and 3 deletions

View File

@@ -1376,6 +1376,7 @@ int lpass_cdc_runtime_resume(struct device *dev)
int ret = 0;
trace_printk("%s, enter\n", __func__);
dev_dbg(dev,"%s, enter\n", __func__);
mutex_lock(&priv->vote_lock);
if (priv->lpass_core_hw_vote == NULL) {
dev_dbg(dev, "%s: Invalid lpass core hw node\n", __func__);
@@ -1415,6 +1416,8 @@ audio_vote:
done:
mutex_unlock(&priv->vote_lock);
trace_printk("%s, leave\n", __func__);
dev_dbg(dev,"%s, leave, hw_vote %d, audio_vote %d\n", __func__,
priv->core_hw_vote_count, priv->core_audio_vote_count);
pm_runtime_set_autosuspend_delay(priv->dev, LPASS_CDC_AUTO_SUSPEND_DELAY);
return 0;
}
@@ -1425,6 +1428,7 @@ int lpass_cdc_runtime_suspend(struct device *dev)
struct lpass_cdc_priv *priv = dev_get_drvdata(dev->parent);
trace_printk("%s, enter\n", __func__);
dev_dbg(dev,"%s, enter\n", __func__);
mutex_lock(&priv->vote_lock);
if (priv->lpass_core_hw_vote != NULL) {
if (--priv->core_hw_vote_count == 0)
@@ -1454,6 +1458,8 @@ int lpass_cdc_runtime_suspend(struct device *dev)
mutex_unlock(&priv->vote_lock);
trace_printk("%s, leave\n", __func__);
dev_dbg(dev,"%s, leave, hw_vote %d, audio_vote %d\n", __func__,
priv->core_hw_vote_count, priv->core_audio_vote_count);
return 0;
}
EXPORT_SYMBOL(lpass_cdc_runtime_suspend);