Commit 0836cc25 authored by Peter Wang's avatar Peter Wang Committed by Martin K. Petersen

scsi: ufs: ufs-mediatek: Support low-power mode for VCCQ

Allow VCCQ to enter low-power mode, and also remove the restriction of VCC
because VCCQ/VCCQ2 can be changed to low-power mode even if VCC stays on
while the device is not in active power mode.

Link: https://lore.kernel.org/r/20220616053725.5681-7-stanley.chu@mediatek.comReviewed-by: default avatarStanley Chu <stanley.chu@mediatek.com>
Signed-off-by: default avatarPeter Wang <peter.wang@mediatek.com>
Signed-off-by: default avatarStanley Chu <stanley.chu@mediatek.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 005ffdf0
......@@ -1031,7 +1031,13 @@ static int ufs_mtk_link_set_lpm(struct ufs_hba *hba)
static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm)
{
if (!hba->vreg_info.vccq2 || !hba->vreg_info.vcc)
struct ufs_vreg *vccqx = NULL;
if (!hba->vreg_info.vccq && !hba->vreg_info.vccq2)
return;
/* Skip if VCC is assumed always-on */
if (!hba->vreg_info.vcc)
return;
/* Bypass LPM when device is still active */
......@@ -1042,12 +1048,13 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm)
if (lpm && hba->vreg_info.vcc->enabled)
return;
if (lpm)
regulator_set_mode(hba->vreg_info.vccq2->reg,
REGULATOR_MODE_IDLE);
if (hba->vreg_info.vccq)
vccqx = hba->vreg_info.vccq;
else
regulator_set_mode(hba->vreg_info.vccq2->reg,
REGULATOR_MODE_NORMAL);
vccqx = hba->vreg_info.vccq2;
regulator_set_mode(vccqx->reg,
lpm ? REGULATOR_MODE_IDLE : REGULATOR_MODE_NORMAL);
}
static void ufs_mtk_auto_hibern8_disable(struct ufs_hba *hba)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment