mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 16:46:15 -04:00
BACKPORT: scsi: ufs: export ufshcd_auto_hibern8_update for vendor usage
Export ufshcd_auto_hibern8_update to allow vendors to use common interface to customize auto-hibernate timer. Bug: 149040610 Change-Id: Iaa95229f8741424aeaf691d12373a201aadb4446 (cherry picked from commit ba7af5ec5126dca17cdc8cfdb6740cdfb4bad70c) [ Resolved minor conflict in drivers/scsi/ufshcd.c ] Cc: Alim Akhtar <alim.akhtar@samsung.com> Cc: Avri Altman <avri.altman@wdc.com> Cc: Bart Van Assche <bvanassche@acm.org> Cc: Bean Huo <beanhuo@micron.com> Cc: Can Guo <cang@codeaurora.org> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Link: https://lore.kernel.org/r/1577683950-1702-5-git-send-email-stanley.chu@mediatek.com Reviewed-by: Asutosh Das <asutoshd@codeaurora.org> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
2d01a72940
commit
4379ae3e6e
3 changed files with 19 additions and 20 deletions
|
|
@ -118,26 +118,6 @@ static ssize_t spm_target_link_state_show(struct device *dev,
|
|||
ufs_pm_lvl_states[hba->spm_lvl].link_state));
|
||||
}
|
||||
|
||||
static void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
if (!ufshcd_is_auto_hibern8_supported(hba))
|
||||
return;
|
||||
|
||||
spin_lock_irqsave(hba->host->host_lock, flags);
|
||||
if (hba->ahit != ahit)
|
||||
hba->ahit = ahit;
|
||||
spin_unlock_irqrestore(hba->host->host_lock, flags);
|
||||
if (!pm_runtime_suspended(hba->dev)) {
|
||||
pm_runtime_get_sync(hba->dev);
|
||||
ufshcd_hold(hba, false);
|
||||
ufshcd_auto_hibern8_enable(hba);
|
||||
ufshcd_release(hba);
|
||||
pm_runtime_put(hba->dev);
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert Auto-Hibernate Idle Timer register value to microseconds */
|
||||
static int ufshcd_ahit_to_us(u32 ahit)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4047,6 +4047,24 @@ int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(ufshcd_uic_hibern8_exit);
|
||||
|
||||
void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
if (!(hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT))
|
||||
return;
|
||||
|
||||
spin_lock_irqsave(hba->host->host_lock, flags);
|
||||
if (hba->ahit == ahit)
|
||||
goto out_unlock;
|
||||
hba->ahit = ahit;
|
||||
if (!pm_runtime_suspended(hba->dev))
|
||||
ufshcd_writel(hba, hba->ahit, REG_AUTO_HIBERNATE_IDLE_TIMER);
|
||||
out_unlock:
|
||||
spin_unlock_irqrestore(hba->host->host_lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ufshcd_auto_hibern8_update);
|
||||
|
||||
void ufshcd_auto_hibern8_enable(struct ufs_hba *hba)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
|
|
|||
|
|
@ -976,6 +976,7 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,
|
|||
enum flag_idn idn, bool *flag_res);
|
||||
|
||||
void ufshcd_auto_hibern8_enable(struct ufs_hba *hba);
|
||||
void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit);
|
||||
|
||||
#define SD_ASCII_STD true
|
||||
#define SD_RAW false
|
||||
|
|
|
|||
Loading…
Reference in a new issue