[v1,3/5] scsi: ufs: add ufshcd_is_auto_hibern8_enabled facility
diff mbox series

Message ID 20200124064926.29472-4-stanley.chu@mediatek.com
State New
Headers show
  • MediaTek UFS vendor implemenation part III and Auto-Hibern8 fix
Related show

Commit Message

Stanley Chu Jan. 24, 2020, 6:49 a.m. UTC
Auto-Hibern8 may be disabled by some vendors or sysfs
in runtime even if Auto-Hibern8 capability is supported
by host. Thus provide a way to detect if Auto-Hibern8 is
actually enabled for future related handlings.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
 drivers/scsi/ufs/ufshcd.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff mbox series

diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 2ae6c7c8528c..81c71a3e3474 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -55,6 +55,7 @@ 
 #include <linux/clk.h>
 #include <linux/completion.h>
 #include <linux/regulator/consumer.h>
+#include <linux/bitfield.h>
 #include "unipro.h"
 #include <asm/irq.h>
@@ -773,6 +774,11 @@  static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba)
 	return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT);
+static inline bool ufshcd_is_auto_hibern8_enabled(struct ufs_hba *hba)
+	return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit) ? true : false;
 #define ufshcd_writel(hba, val, reg)	\
 	writel((val), (hba)->mmio_base + (reg))
 #define ufshcd_readl(hba, reg)	\