diff mbox series

[v1,2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling

Message ID 94cda1143d3332c3284a09b88139e358eab5a233.1632171047.git.nguyenb@codeaurora.org (mailing list archive)
State Superseded, archived
Headers show
Series Put Qualcomm's ufs controller to hibern8 during clock scaling | expand

Commit Message

Bao D. Nguyen Sept. 20, 2021, 9:07 p.m. UTC
From: Asutosh Das <asutoshd@codeaurora.org>

Qualcomm controller needs to be in hibern8 before scaling clocks.
This change puts the controller in hibern8 state before scaling
and brings it out after scaling of clocks.

Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Bao D. Nguyen <nguyenb@codeaurora.org>
---
 drivers/scsi/ufs/ufs-qcom.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Alim Akhtar Sept. 28, 2021, 6:03 a.m. UTC | #1
Hello,

>-----Original Message-----
>From: nguyenb=codeaurora.org@mg.codeaurora.org
>[mailto:nguyenb=codeaurora.org@mg.codeaurora.org] On Behalf Of Bao D.
>Nguyen
>Sent: Tuesday, September 21, 2021 2:38 AM
>To: cang@codeaurora.org; asutoshd@codeaurora.org;
>martin.petersen@oracle.com; linux-scsi@vger.kernel.org
>Cc: linux-arm-msm@vger.kernel.org; Bao D . Nguyen
><nguyenb@codeaurora.org>; Andy Gross <agross@kernel.org>; Bjorn Andersson
><bjorn.andersson@linaro.org>; Alim Akhtar <alim.akhtar@samsung.com>; Avri
>Altman <avri.altman@wdc.com>; James E.J. Bottomley <jejb@linux.ibm.com>;
>open list <linux-kernel@vger.kernel.org>
>Subject: [PATCH v1 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock
scaling
>
>From: Asutosh Das <asutoshd@codeaurora.org>
>
>Qualcomm controller needs to be in hibern8 before scaling clocks.
>This change puts the controller in hibern8 state before scaling and brings
it out
>after scaling of clocks.
>
>Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
>Signed-off-by: Bao D. Nguyen <nguyenb@codeaurora.org>
>---

Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>

> drivers/scsi/ufs/ufs-qcom.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index
>92d4c61..92f5bb4 100644
>--- a/drivers/scsi/ufs/ufs-qcom.c
>+++ b/drivers/scsi/ufs/ufs-qcom.c
>@@ -1212,24 +1212,34 @@ static int ufs_qcom_clk_scale_notify(struct ufs_hba
>*hba,
> 	int err = 0;
>
> 	if (status == PRE_CHANGE) {
>+		err = ufshcd_uic_hibern8_enter(hba);
>+		if (err)
>+			return err;
> 		if (scale_up)
> 			err = ufs_qcom_clk_scale_up_pre_change(hba);
> 		else
> 			err = ufs_qcom_clk_scale_down_pre_change(hba);
>+		if (err)
>+			ufshcd_uic_hibern8_exit(hba);
>+
> 	} else {
> 		if (scale_up)
> 			err = ufs_qcom_clk_scale_up_post_change(hba);
> 		else
> 			err = ufs_qcom_clk_scale_down_post_change(hba);
>
>-		if (err || !dev_req_params)
>+
>+		if (err || !dev_req_params) {
>+			ufshcd_uic_hibern8_exit(hba);
> 			goto out;
>+		}
>
> 		ufs_qcom_cfg_timers(hba,
> 				    dev_req_params->gear_rx,
> 				    dev_req_params->pwr_rx,
> 				    dev_req_params->hs_rate,
> 				    false);
>+		ufshcd_uic_hibern8_exit(hba);
> 	}
>
> out:
>--
>The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a
>Linux Foundation Collaborative Project
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 92d4c61..92f5bb4 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -1212,24 +1212,34 @@  static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba,
 	int err = 0;
 
 	if (status == PRE_CHANGE) {
+		err = ufshcd_uic_hibern8_enter(hba);
+		if (err)
+			return err;
 		if (scale_up)
 			err = ufs_qcom_clk_scale_up_pre_change(hba);
 		else
 			err = ufs_qcom_clk_scale_down_pre_change(hba);
+		if (err)
+			ufshcd_uic_hibern8_exit(hba);
+
 	} else {
 		if (scale_up)
 			err = ufs_qcom_clk_scale_up_post_change(hba);
 		else
 			err = ufs_qcom_clk_scale_down_post_change(hba);
 
-		if (err || !dev_req_params)
+
+		if (err || !dev_req_params) {
+			ufshcd_uic_hibern8_exit(hba);
 			goto out;
+		}
 
 		ufs_qcom_cfg_timers(hba,
 				    dev_req_params->gear_rx,
 				    dev_req_params->pwr_rx,
 				    dev_req_params->hs_rate,
 				    false);
+		ufshcd_uic_hibern8_exit(hba);
 	}
 
 out: