diff mbox series

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

Message ID 1571848785-27698-2-git-send-email-asutoshd@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Asutosh Das (asd) Oct. 23, 2019, 4:39 p.m. UTC
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>
---
 drivers/scsi/ufs/ufs-qcom.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Asutosh Das (asd) Oct. 23, 2019, 4:47 p.m. UTC | #1
On 2019-10-23 09:39, Asutosh Das wrote:
> 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>
> ---
>  drivers/scsi/ufs/ufs-qcom.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
> index a5b7148..d117088 100644
> --- a/drivers/scsi/ufs/ufs-qcom.c
> +++ b/drivers/scsi/ufs/ufs-qcom.c
> @@ -1305,6 +1305,9 @@ 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);
The error handling is not done here.

>  		else
> @@ -1324,6 +1327,7 @@ static int ufs_qcom_clk_scale_notify(struct 
> ufs_hba *hba,
>  				    dev_req_params->hs_rate,
>  				    false);
>  		ufs_qcom_update_bus_bw_vote(host);
> +		ufshcd_uic_hibern8_exit(hba);
>  	}
> 
>  out:

In the post-change condition as well, the error handling is not done.
On error, it should be brought out of hibernate.
I'll put up another change fixing that.

-asd
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index a5b7148..d117088 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -1305,6 +1305,9 @@  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
@@ -1324,6 +1327,7 @@  static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba,
 				    dev_req_params->hs_rate,
 				    false);
 		ufs_qcom_update_bus_bw_vote(host);
+		ufshcd_uic_hibern8_exit(hba);
 	}
 
 out: