scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers

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

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20241219-ufs-qcom-suspend-fix-v3-2-63c4b95a70b9@linaro.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by Manivannan Sadhasivam and committed by Martin K. Petersen bb985070 7bac6568

Changed files
+6 -3
drivers
ufs
core
+6 -3
drivers/ufs/core/ufshcd.c
··· 10590 10590 } 10591 10591 10592 10592 /* 10593 - * Set the default power management level for runtime and system PM. 10593 + * Set the default power management level for runtime and system PM if 10594 + * not set by the host controller drivers. 10594 10595 * Default power saving mode is to keep UFS link in Hibern8 state 10595 10596 * and UFS device in sleep state. 10596 10597 */ 10597 - hba->rpm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state( 10598 + if (!hba->rpm_lvl) 10599 + hba->rpm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state( 10598 10600 UFS_SLEEP_PWR_MODE, 10599 10601 UIC_LINK_HIBERN8_STATE); 10600 - hba->spm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state( 10602 + if (!hba->spm_lvl) 10603 + hba->spm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state( 10601 10604 UFS_SLEEP_PWR_MODE, 10602 10605 UIC_LINK_HIBERN8_STATE); 10603 10606