remoteproc: pas: Check running ack for D0 transition

The TCSR register alone cannot be relied for confirming the D0
state, adding another smp2p bit to confirm the D0 state.

Change-Id: Ibfc3cf0b1c47450026b820e5c99ddc2c615224e1
Signed-off-by: Gokul krishna Krishnakumar <quic_gokukris@quicinc.com>
Signed-off-by: Kamati Srinivas <quic_kamasrin@quicinc.com>
This commit is contained in:
Gokul krishna Krishnakumar 2024-06-07 13:41:27 -07:00 committed by Srinivas Kamati
parent 8cd410a570
commit a8ce5c2552
2 changed files with 38 additions and 0 deletions

View File

@ -33,6 +33,7 @@ struct qcom_q6v5 {
int ready_irq;
int handover_irq;
int stop_irq;
int active_state_ack_irq;
struct rproc_subdev *ssr_subdev;
@ -42,6 +43,7 @@ struct qcom_q6v5 {
struct completion start_done;
struct completion stop_done;
struct completion running_ack;
int crash_reason;

View File

@ -812,6 +812,15 @@ static int adsp_start(struct rproc *rproc)
return ret;
}
static irqreturn_t soccp_running_ack(int irq, void *data)
{
struct qcom_q6v5 *q6v5 = data;
complete(&q6v5->running_ack);
return IRQ_HANDLED;
}
/**
* rproc_config_check() - Check back the config register
* @state: new state of the rproc
@ -938,6 +947,8 @@ int rproc_set_state(struct rproc *rproc, bool state)
goto soccp_out;
}
reinit_completion(&(adsp->q6v5.running_ack));
ret = qcom_smem_state_update_bits(adsp->wake_state,
SOCCP_STATE_MASK,
BIT(adsp->wake_bit));
@ -952,6 +963,14 @@ int rproc_set_state(struct rproc *rproc, bool state)
goto soccp_out;
}
ret = wait_for_completion_timeout(&adsp->q6v5.running_ack, msecs_to_jiffies(5));
if (!ret) {
dev_err(adsp->dev, "failed to get ack for state change from D3 to D0\n");
ret = -ETIMEDOUT;
goto soccp_out;
} else
ret = 0;
adsp->current_users = 1;
} else {
if (users > 1) {
@ -1669,9 +1688,26 @@ static int adsp_probe(struct platform_device *pdev)
goto detach_proxy_pds;
}
adsp->q6v5.active_state_ack_irq = platform_get_irq_byname(pdev, "wake-ack");
if (adsp->q6v5.active_state_ack_irq < 0) {
dev_err(&pdev->dev, "failed to acquire readyack irq\n");
goto detach_proxy_pds;
}
ret = devm_request_threaded_irq(&pdev->dev, adsp->q6v5.active_state_ack_irq,
NULL, soccp_running_ack,
IRQF_TRIGGER_RISING | IRQF_ONESHOT,
"qcom_q6v5_pas", &adsp->q6v5);
if (ret) {
dev_err(&pdev->dev, "failed to acquire ready ack IRQ\n");
goto detach_proxy_pds;
}
mutex_init(&adsp->adsp_lock);
init_completion(&(adsp->q6v5.running_ack));
adsp->current_users = 0;
}
qcom_q6v5_register_ssr_subdev(&adsp->q6v5, &adsp->ssr_subdev.subdev);