scsi: ufs: Put hba into LPM during clk gating

During clock gating, after clocks are disabled, put hba into LPM to save
more power.

Change-Id: I1d8d76f3b72a2346c9ab6268555b0b416cb3b16f
Signed-off-by: Can Guo <cang@codeaurora.org>
This commit is contained in:
Can Guo 2020-09-07 11:59:44 +08:00
commit e9425a0ede

View file

@ -270,6 +270,10 @@ static void ufshcd_resume_clkscaling(struct ufs_hba *hba);
static void ufshcd_suspend_clkscaling(struct ufs_hba *hba);
static void __ufshcd_suspend_clkscaling(struct ufs_hba *hba);
static int ufshcd_scale_clks(struct ufs_hba *hba, bool scale_up);
#if defined(CONFIG_SCSI_UFSHCD_QTI)
static void ufshcd_hba_vreg_set_lpm(struct ufs_hba *hba);
static void ufshcd_hba_vreg_set_hpm(struct ufs_hba *hba);
#endif
static irqreturn_t ufshcd_intr(int irq, void *__hba);
static int ufshcd_change_power_mode(struct ufs_hba *hba,
struct ufs_pa_layer_attr *pwr_mode);
@ -1619,6 +1623,9 @@ static void ufshcd_ungate_work(struct work_struct *work)
}
spin_unlock_irqrestore(hba->host->host_lock, flags);
#if defined(CONFIG_SCSI_UFSHCD_QTI)
ufshcd_hba_vreg_set_hpm(hba);
#endif
ufshcd_setup_clocks(hba, true);
ufshcd_enable_irq(hba);
@ -1784,6 +1791,10 @@ static void ufshcd_gate_work(struct work_struct *work)
/* If link is active, device ref_clk can't be switched off */
__ufshcd_setup_clocks(hba, false, true);
#if defined(CONFIG_SCSI_UFSHCD_QTI)
/* Put the host controller in low power mode if possible */
ufshcd_hba_vreg_set_lpm(hba);
#endif
/*
* In case you are here to cancel this work the gating state
* would be marked as REQ_CLKS_ON. In this case keep the state