Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b52295b authored by Nitin Rawat's avatar Nitin Rawat
Browse files

scsi: ufs: update pm_lvl during probe only when current pm_lvl is invalid



As per current code, pm_lvl is read from DT on every probe
during system resume after suspend.

Therefore, rpm_lvl and spm_lvl updated by sysfs will be overwritten
with the pm_lvl read from DT during probe after resume from
system suspend.

To avoid this read pm_lvl from DT only when current pm_lvl
is invalid or during the first ufs probe after boot.

Change-Id: I059d574a81d0e0f7cee8b6492e495819579a2d4c
Signed-off-by: default avatarNitin Rawat <nitirawa@codeaurora.org>
parent ce480240
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1786,16 +1786,22 @@ static void ufshcd_parse_pm_levels(struct ufs_hba *hba)
{
	struct device *dev = hba->dev;
	struct device_node *np = dev->of_node;
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	enum ufs_pm_level rpm_lvl = UFS_PM_LVL_MAX, spm_lvl = UFS_PM_LVL_MAX;

	if (!np)
		return;

	if (host->is_dt_pm_level_read)
		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;
	host->is_dt_pm_level_read = true;
}

#if defined(CONFIG_SCSI_UFSHCD_QTI)
+1 −0
Original line number Diff line number Diff line
@@ -376,6 +376,7 @@ struct ufs_qcom_host {
	atomic_t clks_on;
	struct ufs_qcom_qos_req *ufs_qos;
	bool bypass_g4_cfgready;
	bool is_dt_pm_level_read;
};

static inline u32