* [PATCH V2] ufs: ufs-qcom: disable lane clocks during phy hibern8
@ 2025-09-09 5:51 Palash Kambar
2025-09-11 17:05 ` Manivannan Sadhasivam
2025-09-16 1:51 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Palash Kambar @ 2025-09-09 5:51 UTC (permalink / raw)
To: mani, James.Bottomley, martin.petersen
Cc: linux-arm-msm, linux-scsi, linux-kernel, quic_nitirawa,
Palash Kambar
Currently, the UFS lane clocks remain enabled even after the link
enters the Hibern8 state and are only disabled during runtime/system
suspend.This patch modifies the behavior to disable the lane clocks
during ufs_qcom_setup_clocks(), which is invoked shortly after the
link enters Hibern8 via gate work.
While hibern8_notify() offers immediate control, toggling clocks on
every transition isn't ideal due to varied contexts like clock scaling.
Since setup_clocks() manages PHY/controller resources and is invoked
soon after Hibern8 entry, it serves as a central and stable point
for clock gating.
Signed-off-by: Palash Kambar <quic_pkambar@quicinc.com>
---
changes from V1:
1) Addressed Manivannan's comments and added detailed justification.
---
drivers/ufs/host/ufs-qcom.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index c0761ccc1381..83ad25ce053d 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -1092,6 +1092,13 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
case PRE_CHANGE:
if (on) {
ufs_qcom_icc_update_bw(host);
+ if (ufs_qcom_is_link_hibern8(hba)) {
+ err = ufs_qcom_enable_lane_clks(host);
+ if (err) {
+ dev_err(hba->dev, "enable lane clks failed, ret=%d\n", err);
+ return err;
+ }
+ }
} else {
if (!ufs_qcom_is_link_active(hba)) {
/* disable device ref_clk */
@@ -1105,6 +1112,9 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
if (ufshcd_is_hs_mode(&hba->pwr_info))
ufs_qcom_dev_ref_clk_ctrl(host, true);
} else {
+ if (ufs_qcom_is_link_hibern8(hba))
+ ufs_qcom_disable_lane_clks(host);
+
ufs_qcom_icc_set_bw(host, ufs_qcom_bw_table[MODE_MIN][0][0].mem_bw,
ufs_qcom_bw_table[MODE_MIN][0][0].cfg_bw);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] ufs: ufs-qcom: disable lane clocks during phy hibern8
2025-09-09 5:51 [PATCH V2] ufs: ufs-qcom: disable lane clocks during phy hibern8 Palash Kambar
@ 2025-09-11 17:05 ` Manivannan Sadhasivam
2025-09-16 1:51 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2025-09-11 17:05 UTC (permalink / raw)
To: Palash Kambar
Cc: James.Bottomley, martin.petersen, linux-arm-msm, linux-scsi,
linux-kernel, quic_nitirawa
On Tue, Sep 09, 2025 at 11:21:49AM GMT, Palash Kambar wrote:
> Currently, the UFS lane clocks remain enabled even after the link
> enters the Hibern8 state and are only disabled during runtime/system
> suspend.This patch modifies the behavior to disable the lane clocks
> during ufs_qcom_setup_clocks(), which is invoked shortly after the
> link enters Hibern8 via gate work.
>
> While hibern8_notify() offers immediate control, toggling clocks on
> every transition isn't ideal due to varied contexts like clock scaling.
> Since setup_clocks() manages PHY/controller resources and is invoked
> soon after Hibern8 entry, it serves as a central and stable point
> for clock gating.
>
> Signed-off-by: Palash Kambar <quic_pkambar@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
- Mani
>
> ---
> changes from V1:
> 1) Addressed Manivannan's comments and added detailed justification.
> ---
> drivers/ufs/host/ufs-qcom.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index c0761ccc1381..83ad25ce053d 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -1092,6 +1092,13 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
> case PRE_CHANGE:
> if (on) {
> ufs_qcom_icc_update_bw(host);
> + if (ufs_qcom_is_link_hibern8(hba)) {
> + err = ufs_qcom_enable_lane_clks(host);
> + if (err) {
> + dev_err(hba->dev, "enable lane clks failed, ret=%d\n", err);
> + return err;
> + }
> + }
> } else {
> if (!ufs_qcom_is_link_active(hba)) {
> /* disable device ref_clk */
> @@ -1105,6 +1112,9 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
> if (ufshcd_is_hs_mode(&hba->pwr_info))
> ufs_qcom_dev_ref_clk_ctrl(host, true);
> } else {
> + if (ufs_qcom_is_link_hibern8(hba))
> + ufs_qcom_disable_lane_clks(host);
> +
> ufs_qcom_icc_set_bw(host, ufs_qcom_bw_table[MODE_MIN][0][0].mem_bw,
> ufs_qcom_bw_table[MODE_MIN][0][0].cfg_bw);
> }
> --
> 2.34.1
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] ufs: ufs-qcom: disable lane clocks during phy hibern8
2025-09-09 5:51 [PATCH V2] ufs: ufs-qcom: disable lane clocks during phy hibern8 Palash Kambar
2025-09-11 17:05 ` Manivannan Sadhasivam
@ 2025-09-16 1:51 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2025-09-16 1:51 UTC (permalink / raw)
To: Palash Kambar
Cc: mani, James.Bottomley, martin.petersen, linux-arm-msm, linux-scsi,
linux-kernel, quic_nitirawa
Palash,
> Currently, the UFS lane clocks remain enabled even after the link
> enters the Hibern8 state and are only disabled during runtime/system
> suspend.This patch modifies the behavior to disable the lane clocks
> during ufs_qcom_setup_clocks(), which is invoked shortly after the
> link enters Hibern8 via gate work.
Applied to 6.18/scsi-staging, thanks!
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-16 1:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-09 5:51 [PATCH V2] ufs: ufs-qcom: disable lane clocks during phy hibern8 Palash Kambar
2025-09-11 17:05 ` Manivannan Sadhasivam
2025-09-16 1:51 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox