The objective of this patch is to incorporate Real Time Clock (RTC) support in Universal
Flash Storage (UFS) device. This enhancement is crucial for the internal maintenance
operations of the UFS device.
+ dev_info->rtc_time_baseline = mktime64(2010, 1, 1, 0, 0, 0) -
+ mktime64(1970, 1, 1, 0, 0, 0);
+ schedule_delayed_work(&hba->ufs_rtc_delayed_work,
+ msecs_to_jiffies(UFS_RTC_UPDATE_EVERY_MS));
@@ -9746,6 +9834,8 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
ret = ufshcd_vops_suspend(hba, pm_op, POST_CHANGE);
if (ret)
goto set_link_active;
+
+ cancel_delayed_work(&hba->ufs_rtc_delayed_work);
@@ -9840,6 +9930,8 @@ static int __ufshcd_wl_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
if (ret)
goto set_old_link_state;
ufshcd_set_timestamp_attr(hba);
+ schedule_delayed_work(&hba->ufs_rtc_delayed_work,
+ msecs_to_jiffies(UFS_RTC_UPDATE_EVERY_MS));
diff --git a/include/ufs/ufs.h b/include/ufs/ufs.h
index e77ab1786856..18b39c6b3a97 100644
--- a/include/ufs/ufs.h
+++ b/include/ufs/ufs.h
@@ -14,6 +14,7 @@
#include <linux/bitops.h>
#include <linux/types.h>
#include <uapi/scsi/scsi_bsg_ufs.h>
+#include <linux/rtc.h>
+ struct delayed_work ufs_rtc_delayed_work;