diff mbox series

[v3,2/4] scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers

Message ID 20241219-ufs-qcom-suspend-fix-v3-2-63c4b95a70b9@linaro.org (mailing list archive)
State New
Headers show
Series scsi: ufs: qcom: Suspend fixes | expand

Commit Message

Manivannan Sadhasivam via B4 Relay Dec. 19, 2024, 4:50 p.m. UTC
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Otherwise, the default levels will override the levels set by the host
controller drivers.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/ufs/core/ufshcd.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Bart Van Assche Dec. 19, 2024, 5:03 p.m. UTC | #1
On 12/19/24 8:50 AM, Manivannan Sadhasivam via B4 Relay wrote:
> Otherwise, the default levels will override the levels set by the host
> controller drivers.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 7bd0f5482db3..457add6edb31 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -10551,14 +10551,17 @@  int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
 	}
 
 	/*
-	 * Set the default power management level for runtime and system PM.
+	 * Set the default power management level for runtime and system PM if
+	 * not set by the host controller drivers.
 	 * Default power saving mode is to keep UFS link in Hibern8 state
 	 * and UFS device in sleep state.
 	 */
-	hba->rpm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state(
+	if (!hba->rpm_lvl)
+		hba->rpm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state(
 						UFS_SLEEP_PWR_MODE,
 						UIC_LINK_HIBERN8_STATE);
-	hba->spm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state(
+	if (!hba->spm_lvl)
+		hba->spm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state(
 						UFS_SLEEP_PWR_MODE,
 						UIC_LINK_HIBERN8_STATE);