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:
@@ -315,6 +315,7 @@ struct lpass_cdc_wsa_macro_priv {
|
||||
u32 wsa_rload[LPASS_CDC_WSA_MACRO_RX1 + 1];
|
||||
u8 idle_detect_en;
|
||||
int noise_gate_mode;
|
||||
bool pre_dev_up;
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_driver lpass_cdc_wsa_macro_dai[];
|
||||
@@ -1031,6 +1032,7 @@ static int lpass_cdc_wsa_macro_event_handler(struct snd_soc_component *component
|
||||
|
||||
switch (event) {
|
||||
case LPASS_CDC_MACRO_EVT_SSR_DOWN:
|
||||
wsa_priv->pre_dev_up = false;
|
||||
trace_printk("%s, enter SSR down\n", __func__);
|
||||
if (wsa_priv->swr_ctrl_data) {
|
||||
swrm_wcd_notify(
|
||||
@@ -1051,6 +1053,7 @@ static int lpass_cdc_wsa_macro_event_handler(struct snd_soc_component *component
|
||||
break;
|
||||
case LPASS_CDC_MACRO_EVT_SSR_UP:
|
||||
trace_printk("%s, enter SSR up\n", __func__);
|
||||
wsa_priv->pre_dev_up = true;
|
||||
/* reset swr after ssr/pdr */
|
||||
wsa_priv->reset_swr = true;
|
||||
if (wsa_priv->swr_ctrl_data)
|
||||
@@ -3303,6 +3306,11 @@ static int lpass_cdc_wsa_macro_core_vote(void *handle, bool enable)
|
||||
pr_err_ratelimited("%s: wsa priv data is NULL\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!wsa_priv->pre_dev_up && enable) {
|
||||
pr_debug("%s: adsp is not up\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (enable) {
|
||||
pm_runtime_get_sync(wsa_priv->dev);
|
||||
if (lpass_cdc_check_core_votes(wsa_priv->dev))
|
||||
@@ -3761,6 +3769,7 @@ static int lpass_cdc_wsa_macro_probe(struct platform_device *pdev)
|
||||
if (!wsa_priv)
|
||||
return -ENOMEM;
|
||||
|
||||
wsa_priv->pre_dev_up = true;
|
||||
wsa_priv->dev = &pdev->dev;
|
||||
ret = of_property_read_u32(pdev->dev.of_node, "reg",
|
||||
&wsa_base_addr);
|
||||
|
Reference in New Issue
Block a user