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

Commit 06cdfc4e authored by Veerabhadrarao Badiganti's avatar Veerabhadrarao Badiganti
Browse files

scsi: ufs: Honor device quirks and spm level for Link state



With the 'commit ed2d1adb ("scsi: ufs: Add support for turning
off UFS power supplies")' the device spm level and the device quirk
to keep link always in H8 state are getting override if the
vccq-pwr-collapse-sup property set.

For e.g, In-general to keep link in off state during suspend
this vccq-pwr-collapse-sup flag enabled but at the same time if we
would to keep the link in H8 state only for a specific vendor using
the device quirk this change is not allowing. As it overrides the
spm level.

So removing logic which overrides spm-level and removing
dependency on vccq-pwr-collapse-sup flag.

Change-Id: I005fcc306b07f393ca38e595603348a2f6e6837e
Signed-off-by: default avatarVeerabhadrarao Badiganti <vbadigan@codeaurora.org>
parent 1674a415
Loading
Loading
Loading
Loading
+19 −13
Original line number Diff line number Diff line
@@ -9082,21 +9082,27 @@ static int ufshcd_probe_hba(struct ufs_hba *hba)
			goto out;
	}

	/**
	 * UFS3.0 and newer devices use Vcc and Vccq(1.2V)
	 * while UFS2.1 devices use Vcc and Vccq2(1.8V) power
	 * supplies. If the system allows turning off the regulators
	 * during power collapse event, turn off the regulators
	 * during system suspend events. This will cause the UFS
	 * device to re-initialize upon system resume events.
	 */
	if ((hba->dev_info.w_spec_version >= 0x300 && hba->vreg_info.vccq &&
		hba->vreg_info.vccq->sys_suspend_pwr_off) ||
		(hba->dev_info.w_spec_version < 0x300 &&
		hba->vreg_info.vccq2->sys_suspend_pwr_off))
		hba->spm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state(
	/*
	 * On 4.19 kernel, the controlling of Vccq requlator got changed.
	 * Its relying on sys_suspend_pwr_off regulator dt flag instead of spm
	 * level.
	 * Updated logic is not honoring spm level specified and the device
	 * specific quirks for the desired link state.
	 * Below change is to fix above listed issue without distrubing the
	 * present logic.
	 */
	if (hba->spm_lvl == ufs_get_desired_pm_lvl_for_dev_link_state(
				UFS_POWERDOWN_PWR_MODE,
				UIC_LINK_OFF_STATE);
				UIC_LINK_OFF_STATE)) {
		if ((hba->dev_info.w_spec_version >= 0x300 &&
		     hba->vreg_info.vccq &&
		     !hba->vreg_info.vccq->sys_suspend_pwr_off))
			hba->vreg_info.vccq->sys_suspend_pwr_off = true;

		if ((hba->dev_info.w_spec_version < 0x300 &&
		     !hba->vreg_info.vccq2->sys_suspend_pwr_off))
			hba->vreg_info.vccq2->sys_suspend_pwr_off = true;
	}

	/* UFS device is also active now */
	ufshcd_set_ufs_dev_active(hba);