Commit Graph

12 Commits

Author SHA1 Message Date
Shubhi Garg
e4ded64e88 oot: fix mutex unlocking in vrs rtc
Kernel throws a dump trace upon setting wakealarm time on VRS RTC.
We are unlocking mutex twice in a single API call. Delete one instance
which is not required.

[  590.301592] Call trace:
[  590.304035]  __mutex_unlock_slowpath.isra.0+0x1d4/0x2d0
[  590.309274]  mutex_unlock+0x60/0x80
[  590.312766]  0xffff80007ce0e6ec
[  590.315909]  __rtc_set_alarm+0x100/0x200
[  590.319751]  rtc_timer_enqueue+0x168/0x2e8
[  590.331275]  dev_attr_store+0x20/0x601e8
[  590.335117]  sysfs_kf_write+0x4c/0x88
[  590.338609]  kernfs_fop_write_iter+0x144/0x1d8
[  590.343149]  vfs_write+0x254/0x398
[  590.353626]  invoke_syscall+0x50/0x14040
[  590.357468]  el0_svc_common.constprop.0+0x48/0x100
[  590.362357]  do_el0_svc+0x24/0x40
[  590.365501]  el0_svc+0x34/0xc8
[  590.372835]  el0t_64_sync+0x194/0x19830/0x140
[  590.376679] ---[ end trace 0000000000000000 ]---

Bug 4715238

Change-Id: I7e070772c81474eb22859f2a00934211e6dad834
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3258911
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3502098
2025-12-01 05:38:59 -08:00
Jon Hunter
74c0a6d16d drivers: Drop inline from driver remove wrapper
The driver remove function is a function pointer and therefore, it does
not make sense to define the function as an 'inline'. Update the
coccinelle script and drivers to remove the inline statement.

Bug 4749580

Change-Id: Ia03691b75c4edffe609f27468b911a92a5ddbd68
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233980
(cherry picked from commit 2c3a31c9b72785ee35ad079422b624f59a35f622)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3276870
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-01-06 06:09:10 -08:00
Jon Hunter
15ca4ff659 drivers: Fix platform_driver remove for Linux v6.11
In Linux v6.11, the 'platform_driver' structure 'remove' callback was
updated to return void instead of 'int'. Update all the impacted drivers
as necessary to fix this.

Bug 4749580

Change-Id: I3bb5c549777f7ccad0e3f870373fdd25726ad7ed
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3182878
(cherry picked from commit 951b2423a8)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3210788
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-09-11 04:39:43 -07:00
Shubhi Garg
b02f2cd5ee rtc: update VRS RTC IRQ to system hwclock
Update RTC IRQ occurred to system hwclock by adding
rtc_update_irq in irq handler.

Bug 3740696

Change-Id: I1ad9c05f759b5b11f8f212eb91a709f1b3625336
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2764942
(cherry picked from commit 1926f478143bb1962da8748b6cbc9c094c37a7a4)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2999458
(cherry picked from commit 608ed39528a9735ad229067c8f9c6853d9a33a6e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026474
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2023-12-04 04:24:18 -08:00
Shubhi Garg
b60b757d9c 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>
2023-09-14 13:25:47 -07:00
Shubhi Garg
5b1a5fc4b6 rtc: fix max77851 pmic rtc hang in set time
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>
2023-09-14 13:25:42 -07:00
Shubhi Garg
da71dfa5a5 rtc: max77851: add max77851 rtc driver
Add max77851 rtc driver into nvidia-oot repo

Fix jammy-src kernel-only build max77851 rtc
in embedded recovery defconfig
 - guard regmap function calls with CONFIG_REGMAP_IRQ
 - guard i2c call with CONFIG_I2C

Bug 200749982

Change-Id: I9bfcbfa7bab42f393c7baa1f3dba78d599ca510a
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2595387
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2947783
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-14 13:25:37 -07:00
Jon Hunter
48061dcb5d rtc: Remove DT check for VRS RTC
The VRS RTC driver does not required device-tree because the device is
populated by the parent NVIDIA VRS PSEQ driver. Therefore, remove the
device-tree check in the probe function of the VRS RTC driver so that it
is not necessary to populate the device-tree node for the RTC device.

Bug 4006278

Change-Id: I0c5ca81a65109b3f0d5e12465a5496e558c9887c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2867042
(cherry picked from commit de193f1eec7497164b73b922deddaf216457592c)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2870757
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-21 02:35:48 -07:00
Jon Hunter
6fb4e1b127 rtc: Fix automatic loading of VRS RTC driver
The NVIDIA VRS RTC driver is not automatically loaded when built as an
out-of-tree module. Populate the MODULE_DEVICE_TABLE to fix this.

Bug 4006278

Change-Id: I651a6ab4a6aba6666532aed19146d9772c1c77ed
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2866611
(cherry picked from commit 4867aa729b46a262d50a03487b1869a5e3703be7)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2866850
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-03-13 04:58:37 -07:00
Shubhi Garg
1fa3407928 rtc: fix coverity defects
CID 10166554: Unintentional integer overflow defect.
Fixes by typecasting ret of signed 32bit value to signed
64bit value.

Bug 3952896

Change-Id: I35cbc8bf3e9eb906688f9bb27953d1e5bf76633d
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2864836
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-11 19:15:24 -08:00
Manish Bhardwaj
dee4d41861 nvidia-oot: add support for recovery kernel
Stop compilation for nvidia-oot drivers, whose
core kernel support is missing in recovery
kernel.

Bug 3863448

Change-Id: I36f09f74d4448af4b13eeebaaeadc53c3f83e002
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2856892
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-23 22:53:00 -08:00
Shubhi Garg
2f9478c1eb rtc: add VRS10 PSEQ RTC driver
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
2022-07-29 00:09:21 -07:00