mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
FROMGIT: scsi: ufs: ufs-mediatek: Prevent device regulators setting LPM incorrectly
Device regulatrs are allowed to enter low-power mode if neither device is
not in active mode, nor VCC does not keep on.
Fix this by adding conditions before LPM decision.
Link: https://lore.kernel.org/r/20220616053725.5681-6-stanley.chu@mediatek.com
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Po-Wen Kao <powen.kao@mediatek.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 005ffdf09c git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Bug: 239946304
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Change-Id: I927da22710a9c28959e0b452bf64c42524d7ad44
This commit is contained in:
committed by
Treehugger Robot
parent
6396878b40
commit
28ffcf0cc2
@@ -1034,10 +1034,18 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm)
|
||||
if (!hba->vreg_info.vccq2 || !hba->vreg_info.vcc)
|
||||
return;
|
||||
|
||||
if (lpm && !hba->vreg_info.vcc->enabled)
|
||||
/* Bypass LPM when device is still active */
|
||||
if (lpm && ufshcd_is_ufs_dev_active(hba))
|
||||
return;
|
||||
|
||||
/* Bypass LPM if VCC is enabled */
|
||||
if (lpm && hba->vreg_info.vcc->enabled)
|
||||
return;
|
||||
|
||||
if (lpm)
|
||||
regulator_set_mode(hba->vreg_info.vccq2->reg,
|
||||
REGULATOR_MODE_IDLE);
|
||||
else if (!lpm)
|
||||
else
|
||||
regulator_set_mode(hba->vreg_info.vccq2->reg,
|
||||
REGULATOR_MODE_NORMAL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user