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 reverts commit b60b757d9c.
Reason for revert:
rtc_valid_tm api checks year range if it is > 70. While
max77851 RTC_YEAR register provides range from 0 to 199,
add +100 always to fall under valid range.
This fixes rtc read time issue from sysfs.
root@jetson:/home/nvidia# cat /sys/class/rtc/rtc1/time
cat: /sys/class/rtc/rtc1/time: Invalid argument
Bug 4911320
Change-Id: I70b5495bb11f9b0b6dd80e19e626ccdb8d3ac6f6
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3273546
Reviewed-by: Evan Wei <evwei@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
When we set time from max77851 pmic RTC, it hangs because
it calls read_time function which locks via mutex twice. System
goes in deadlock state. Reading time is not required during time set
as it is not performing anything thus removing it.
Following logs are seen during hang:
[ 242.930292] INFO: task systemd-timedat:1127 blocked for more than 120 seconds.
[ 242.937695] Tainted: G E 5.10.104-tegra #1
[ 242.943743] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 242.951643] task:systemd-timedat state:D stack: 0 pid: 1127 ppid: 1 flags:0x00000808
[ 242.960074] Call trace:
[ 242.962618] __switch_to+0xd0/0x120
[ 242.966193] __schedule+0x404/0xab0
[ 242.969709] schedule+0x78/0x110
[ 242.972963] schedule_preempt_disabled+0x2c/0x50
[ 242.977621] __mutex_lock.isra.0+0x1b4/0x5b0
[ 242.981925] __mutex_lock_slowpath+0x48/0x90
[ 242.986226] mutex_lock+0x74/0x80
[ 242.989610] max77851_rtc_read_time+0x48/0xf0
[ 242.994004] max77851_rtc_set_time+0xd4/0x1a0
[ 242.998398] rtc_set_time+0xac/0x220
[ 243.002003] rtc_dev_ioctl+0x478/0x950
[ 243.005805] __arm64_sys_ioctl+0xac/0xf0
[ 243.009773] el0_svc_common.constprop.0+0x80/0x1d0
[ 243.014605] do_el0_svc+0x38/0xb0
[ 243.017950] el0_svc+0x1c/0x30
[ 243.021029] el0_sync_handler+0xa8/0xb0
[ 243.024898] el0_sync+0x16c/0x180
Bug 200749982
Change-Id: I6f7d88871184bf64a03fa789746a189e0c0aa826
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2726550
(cherry picked from commit 129e9c03af0db8857d65e65ea72ce19ae2656b27)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2728925
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2947784
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Adding RTC driver support for Nvidia based Voltage Regulator Power
Sequencer. Driver depends on CONFIG_MFD_NVVRS_PSEQ to get enabled which
is a parent driver for RTC. Following are the VRS RTC functionalies:
1. RTC executes alarm function to wake system from suspend/shutdown state.
2. RTC has 32bit time counter register which increments each second.
3. RTC triggers interrupt when the set alarm time becomes equal to the time
read from TIME registers.
Bug 200669555
Change-Id: I7890c084e5a1ec075823fee3ae5171fe7a89c6e0
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2748752
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit