dt-bindings: remoteproc: qcom: Introduce shutdown-ack irq for Q6V5
PATCH v3 1/3 dt-bindings: remoteproc: qcom: Introduce shutdown-ack irq for Q6V5
Introduce shutdown-irq binding required for sysmon shutdown for Q6V5 MSS on SDM845/MSM8996 SoCs and for WCSS Q6V5 on QCS404 SoC.
---
v2:
* Make shutdown-ack mandatory for MSS on SDM845/MSM8996 and for WCSS on QCS404 (Dropping Rob's reviewed-by due to this)
.../bindings/remoteproc/qcom,adsp.txt | 17 ++++++++++++++--- .../bindings/remoteproc/qcom,q6v5.txt | 15 ++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/remoteproc/qcom,adsp.txt +14 -3
@@ -19,13 +19,24 @@ on the Qualcomm ADSP Hexagon core. - interrupts-extended: Usage: required Value type: <prop-encoded-array> - Definition: must list the watchdog, fatal IRQs ready, handover and - stop-ack IRQs + Definition: reference to the interrupts that match interrupt-names - interrupt-names: Usage: required Value type: <stringlist> - Definition: must be "wdog", "fatal", "ready", "handover", "stop-ack" + Definition: The interrupts needed depends on the compatible + string: + qcom,msm8974-adsp-pil: + qcom,msm8996-adsp-pil: + qcom,msm8996-slpi-pil: + qcom,qcs404-adsp-pas: + qcom,qcs404-cdsp-pas: + qcom,sdm845-adsp-pas: + qcom,sdm845-cdsp-pas: + must be "wdog", "fatal", "ready", "handover", "stop-ack" + qcom,qcs404-wcss-pas: + must be "wdog", "fatal", "ready", "handover", "stop-ack", + "shutdown-ack" - firmware-name: Usage: optional
Documentation/devicetree/bindings/remoteproc/qcom,q6v5.txt +12 -3
@@ -28,13 +28,22 @@ on the Qualcomm Hexagon core. - interrupts-extended: Usage: required Value type: <prop-encoded-array> - Definition: must list the watchdog, fatal IRQs ready, handover and - stop-ack IRQs + Definition: reference to the interrupts that match interrupt-names - interrupt-names: Usage: required Value type: <stringlist> - Definition: must be "wdog", "fatal", "ready", "handover", "stop-ack" + Definition: The interrupts needed depends on the the compatible + string: + qcom,q6v5-pil: + qcom,ipq8074-wcss-pil: + qcom,msm8916-mss-pil: + qcom,msm8974-mss-pil: + must be "wdog", "fatal", "ready", "handover", "stop-ack" + qcom,msm8996-mss-pil: + qcom,sdm845-mss-pil: + must be "wdog", "fatal", "ready", "handover", "stop-ack", + "shutdown-ack" - firmware-name: Usage: optional
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 2/3 remoteproc: qcom: Add shutdown-ack irq
Add shutdown-ack irq handling required for sysmon shutdown for Q6V5 MSS on SDM845/MSM8996 and for WCSS Q6V5 on QCS404 SoC.
---
v3:
* Move shutdown-irq handling back to sysmon and modify qcom_add_sysmon_subdev to handle -EPROBE_DEFER
* Dropped has_shutdown_irq flag
v2:
* Move shutdown-irq get to Q6V5 from sysmon to handle -EPROBE_DEFER cases
drivers/remoteproc/qcom_common.h | 16 +++++---- drivers/remoteproc/qcom_q6v5_adsp.c | 9 +++-- drivers/remoteproc/qcom_q6v5_mss.c | 4 ++- drivers/remoteproc/qcom_q6v5_pas.c | 9 +++-- drivers/remoteproc/qcom_sysmon.c | 52 +++++++++++++++++++++++++---- drivers/remoteproc/qcom_wcnss.c | 5 ++- 6 files changed, 73 insertions(+), 22 deletions(-)
drivers/remoteproc/qcom_common.h +9 -7
@@ -43,16 +43,18 @@ void qcom_add_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr,void qcom_remove_ssr_subdev (struct rproc *rproc,struct qcom_rproc_ssr *ssr);#if IS_ENABLED (CONFIG_QCOM_SYSMON ) -struct qcom_sysmon *qcom_add_sysmon_subdev (struct rproc *rproc, -const char *name, -int ssctl_instance); +int qcom_add_sysmon_subdev (struct rproc *rproc, +struct qcom_sysmon *rproc_sysmon, +const char *name, +int ssctl_instance);void qcom_remove_sysmon_subdev (struct qcom_sysmon *sysmon);#else -static inline struct qcom_sysmon *qcom_add_sysmon_subdev (struct rproc *rproc, -const char *name, -int ssctl_instance) +static inline int qcom_add_sysmon_subdev (struct rproc *rproc, +struct qcom_sysmon *rproc_sysmon, +const char *name, +int ssctl_instance) { -return NULL ; +return 0 ; }static inline void qcom_remove_sysmon_subdev (struct qcom_sysmon *sysmon)
drivers/remoteproc/qcom_q6v5_adsp.c +6 -3
@@ -436,9 +436,12 @@ static int adsp_probe(struct platform_device *pdev)qcom_add_glink_subdev (rproc, &adsp->glink_subdev);qcom_add_ssr_subdev (rproc, &adsp->ssr_subdev, desc->ssr_name); - adsp->sysmon =qcom_add_sysmon_subdev (rproc, - desc->sysmon_name, - desc->ssctl_id); + ret =qcom_add_sysmon_subdev (rproc, + adsp->sysmon, + desc->sysmon_name, + desc->ssctl_id); +if (ret) + goto disable_pm; ret =rproc_add (rproc);if (ret)
drivers/remoteproc/qcom_q6v5_mss.c +3 -1
@@ -1340,7 +1340,9 @@ static int q6v5_probe(struct platform_device *pdev)qcom_add_glink_subdev (rproc, &qproc->glink_subdev);qcom_add_smd_subdev (rproc, &qproc->smd_subdev);qcom_add_ssr_subdev (rproc, &qproc->ssr_subdev,"mpss" ); - qproc->sysmon =qcom_add_sysmon_subdev (rproc,"modem" ,0x12 ); + ret =qcom_add_sysmon_subdev (rproc, qproc->sysmon,"modem" ,0x12 ); +if (ret) + goto free_rproc; ret =rproc_add (rproc);if (ret)
drivers/remoteproc/qcom_q6v5_pas.c +6 -3
@@ -301,9 +301,12 @@ static int adsp_probe(struct platform_device *pdev)qcom_add_glink_subdev (rproc, &adsp->glink_subdev);qcom_add_smd_subdev (rproc, &adsp->smd_subdev);qcom_add_ssr_subdev (rproc, &adsp->ssr_subdev, desc->ssr_name); - adsp->sysmon =qcom_add_sysmon_subdev (rproc, - desc->sysmon_name, - desc->ssctl_id); + ret =qcom_add_sysmon_subdev (rproc, + adsp->sysmon, + desc->sysmon_name, + desc->ssctl_id); +if (ret) + goto free_rproc; ret =rproc_add (rproc);if (ret)
drivers/remoteproc/qcom_sysmon.c +45 -7
110 lines not on this page · raw message
drivers/remoteproc/qcom_wcnss.c +4 -1
@@ -552,7 +552,10 @@ static int wcnss_probe(struct platform_device *pdev) }qcom_add_smd_subdev (rproc, &wcnss->smd_subdev); - wcnss->sysmon =qcom_add_sysmon_subdev (rproc,"wcnss" ,WCNSS_SSCTL_ID ); + ret =qcom_add_sysmon_subdev (rproc, wcnss->sysmon, +"wcnss" ,WCNSS_SSCTL_ID ); +if (ret) + goto free_rproc; ret =rproc_add (rproc);if (ret)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 3/3 remoteproc: qcom: Wait for shutdown-ack/ind on sysmon shutdown
In reply to Sibi SankarAfter sending a sysmon shutdown request to the SSCTL service on the subsystem, wait for the service to send shutdown-ack interrupt or an indication message to signal the completion of graceful shutdown.
---
v2:
* Correct the shutdown-irq wait time to 10 * HZ
drivers/remoteproc/qcom_sysmon.c | 42 +++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-)
drivers/remoteproc/qcom_sysmon.c +41 -1
@@ -37,6 +37,7 @@ struct qcom_sysmon {struct rpmsg_endpoint *ept;struct completion comp; +struct completion ind_comp;struct completion shutdown_comp;struct mutex lock;
@@ -141,6 +142,7 @@ static int sysmon_callback(struct rpmsg_device *rpdev, void *data, int count, }#define SSCTL_SHUTDOWN_REQ 0x21 +#define SSCTL_SHUTDOWN_READY_IND 0x21#define SSCTL_SUBSYS_EVENT_REQ 0x23#define SSCTL_MAX_MSG_LEN 7
@@ -256,6 +258,29 @@ static struct qmi_elem_info ssctl_subsys_event_resp_ei[] = { {} }; +static struct qmi_elem_info ssctl_shutdown_ind_ei[] = { + {} +}; + +static void sysmon_ind_cb (struct qmi_handle *qmi,struct sockaddr_qrtr *sq, +struct qmi_txn *txn,const void *data) +{ + struct qcom_sysmon *sysmon = container_of(qmi, struct qcom_sysmon, qmi); + +complete (&sysmon->ind_comp); +} + +static struct qmi_msg_handler qmi_indication_handler[] = { + { + .type =QMI_INDICATION , + .msg_id =SSCTL_SHUTDOWN_READY_IND , + .ei = ssctl_shutdown_ind_ei, + .decoded_size =0 , + .fn = sysmon_ind_cb + }, + {} +}; +/** * ssctl_request_shutdown() - request shutdown via SSCTL QMI service * @sysmon: sysmon context
@@ -266,6 +291,8 @@ static void ssctl_request_shutdown(struct qcom_sysmon *sysmon)struct qmi_txn txn;int ret; +reinit_completion (&sysmon->ind_comp); +reinit_completion (&sysmon->shutdown_comp); ret =qmi_txn_init (&sysmon->qmi, &txn, ssctl_shutdown_resp_ei, &resp);if (ret <0 ) {dev_err (sysmon->dev,"failed to allocate QMI txn\n" );
@@ -287,6 +314,17 @@ static void ssctl_request_shutdown(struct qcom_sysmon *sysmon)dev_err (sysmon->dev,"shutdown request failed\n" ); else dev_dbg(sysmon->dev, "shutdown request completed\n"); + +if (sysmon->shutdown_irq >0 ) { + ret =wait_for_completion_timeout (&sysmon->shutdown_comp, +10 *HZ ); +if (!ret) { + ret =try_wait_for_completion (&sysmon->ind_comp); +if (!ret) +dev_err (sysmon->dev, +"timeout waiting for shutdown ack\n" ); + } + } }/**
@@ -473,6 +511,7 @@ int qcom_add_sysmon_subdev(struct rproc *rproc, sysmon->ssctl_instance = ssctl_instance;init_completion (&sysmon->comp); +init_completion (&sysmon->ind_comp);init_completion (&sysmon->shutdown_comp);mutex_init (&sysmon->lock);
@@ -497,7 +536,8 @@ int qcom_add_sysmon_subdev(struct rproc *rproc, } } - ret =qmi_handle_init (&sysmon->qmi,SSCTL_MAX_MSG_LEN , &ssctl_ops,NULL ); + ret =qmi_handle_init (&sysmon->qmi,SSCTL_MAX_MSG_LEN , &ssctl_ops, + qmi_indication_handler);if (ret <0 ) {dev_err (sysmon->dev,"failed to initialize qmi handle\n" );kfree (sysmon);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project