mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
Revert "Revert "rtc: fix year calculation in max77851 pmic rtc""
This reverts commit 40b9876e2f277472677c22b947da7260cf39626e. Reason for revert: Initial change to fix year calculation is correct. We do not need to blindly add +100 in year value. RTC_YEAR register can accomodate values from 0..199. Being year base 1900 and valid rtc time being 1970, valid year values are 1970..2099. Bug 4911320 Change-Id: Ic4183f4d85e4612b6a5a7ab53baf0483b7b6acad Signed-off-by: Shubhi Garg <shgarg@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3283957 Reviewed-by: Evan Wei <evwei@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com>
This commit is contained in:
@@ -242,9 +242,12 @@ static void max77851_rtc_data_to_tm(u8 *data, struct rtc_time *tm,
|
|||||||
tm->tm_wday = ffs(data[RTC_WEEKDAY] & mask) - 1;
|
tm->tm_wday = ffs(data[RTC_WEEKDAY] & mask) - 1;
|
||||||
tm->tm_mday = data[RTC_DATE] & 0x1f;
|
tm->tm_mday = data[RTC_DATE] & 0x1f;
|
||||||
tm->tm_mon = (data[RTC_MONTH] & 0x0f) - 1;
|
tm->tm_mon = (data[RTC_MONTH] & 0x0f) - 1;
|
||||||
tm->tm_year = (data[RTC_YEAR] & mask) + 100;
|
tm->tm_year = (data[RTC_YEAR] & mask);
|
||||||
tm->tm_yday = 0;
|
tm->tm_yday = 0;
|
||||||
tm->tm_isdst = 0;
|
tm->tm_isdst = 0;
|
||||||
|
|
||||||
|
if (!info->drv_data->alarm_enable_reg)
|
||||||
|
tm->tm_year += 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int max77851_rtc_tm_to_data(struct rtc_time *tm, u8 *data,
|
static int max77851_rtc_tm_to_data(struct rtc_time *tm, u8 *data,
|
||||||
|
|||||||
Reference in New Issue
Block a user