mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 13:49:24 -04:00
Merge "scsi: ufs: Support query the spm/rpm level from device tree"
This commit is contained in:
commit
bccedceede
1 changed files with 24 additions and 0 deletions
|
|
@ -1598,6 +1598,28 @@ out:
|
|||
return err;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
ufshcd_is_valid_pm_lvl(enum ufs_pm_level lvl)
|
||||
{
|
||||
return lvl >= 0 && lvl < UFS_PM_LVL_MAX;
|
||||
}
|
||||
|
||||
static void ufshcd_parse_pm_levels(struct ufs_hba *hba)
|
||||
{
|
||||
struct device *dev = hba->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
enum ufs_pm_level rpm_lvl = UFS_PM_LVL_MAX, spm_lvl = UFS_PM_LVL_MAX;
|
||||
|
||||
if (!np)
|
||||
return;
|
||||
if (!of_property_read_u32(np, "rpm-level", &rpm_lvl) &&
|
||||
ufshcd_is_valid_pm_lvl(rpm_lvl))
|
||||
hba->rpm_lvl = rpm_lvl;
|
||||
if (!of_property_read_u32(np, "spm-level", &spm_lvl) &&
|
||||
ufshcd_is_valid_pm_lvl(spm_lvl))
|
||||
hba->spm_lvl = spm_lvl;
|
||||
}
|
||||
|
||||
static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
|
@ -1619,6 +1641,8 @@ static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
|
|||
if (hba->dev_info.wmanufacturerid == UFS_VENDOR_WDC)
|
||||
hba->dev_quirks |= UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE;
|
||||
|
||||
ufshcd_parse_pm_levels(hba);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue