mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
rtc: fix year calculation in max77851 pmic rtc
Add +100 to year only if PMIC does not have separate alarm enable registers. Since MAX77851 has separate alarm enable register , MAX77851 RTC supports year calculation from 0..199 so we do not need to add 100 on reading RTC YEAR register. Currently, default, driver is adding +100 which is wrong. This change fixes rtc year calculation. Bug 200749982 Change-Id: Ibaf1d2fb81e59cc21c22d509cf9ffc7b6005916c Signed-off-by: Shubhi Garg <shgarg@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2727859 (cherry picked from commit b43364942c67fdf7958a42bfad5fe02725da00e3) Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2728926 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2947785 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: Bitan Biswas <bbiswas@nvidia.com> Tested-by: Bitan Biswas <bbiswas@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
5b1a5fc4b6
commit
b60b757d9c
@@ -240,9 +240,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_mday = data[RTC_DATE] & 0x1f;
|
||||
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_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,
|
||||
|
||||
Reference in New Issue
Block a user