Commit Graph

311 Commits

Author SHA1 Message Date
Jon Hunter
c2fd2c3c66 misc: bluedroid_pm: Ensure 'host_wake' is configured
Currently the wakeup source is configured if only the 'ext_wake' is
valid. However, the bluedroid_pm_timer and proc interface that are
configured when 'ext_wake' is valid, also assumes that 'host_wake' is
also valid. Therefore, update the code to only configure the
bluedroid_pm_timer and proc interface if both of these are valid.

Bug 4958861

Change-Id: I16ef55359c36acc9dc50464f43816ae2ef3c3123
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3397252
(cherry picked from commit b1e18d66aa0ab6d491b88caac5fa9abddb69d0e4)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3462461
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-10-02 10:13:17 -07:00
Jon Hunter
432f3748e0 misc: bluedroid_pm: Free proc on failure
If the call to wakeup_source_register() fails during probe, then the
'proc' interface is not freed. Ensure that this is freed as expected.

JIRA LINQPJ14-60

Change-Id: I188be2998429c1ada6ccdf765791367e61735359
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3397251
(cherry picked from commit a0f0bebe2a2a54b87f91b1812c22bbd14470a61c)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3461888
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-10-02 10:13:12 -07:00
Jon Hunter
7c70fbf0cf misc: bluedroid_pm: Verify wakeup registration
The structure returned from the function wakeup_source_register() is not
currently checked to see that a valid structure is returned. If
wakeup_source_register fails to register the wake-up source, then this
function will return a NULL pointer and this will lead to a crash when
defereferencing this pointer. Therefore, check that a valid structure is
returned from wakeup_source_register() and if not then return an error
from the probe function.

JIRA LINQPJ14-60
Bug 4958861

Change-Id: I03356700ab03d6c25080b3806ea8b7da3983a302
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3394894
(cherry picked from commit 14286052fb9dd496b243221fa1066f828451b294)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3405519
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-10-02 10:13:06 -07:00
Jon Hunter
8407ab4b3e misc: bluedroid_pm: Fix optional GPIOs
The function devm_gpiod_get_optional() will return an error code encoded
as a pointer type if the GPIO requested is not found. Therefore, we need
to use the IS_ERR() macro to determine if the GPIO is valid, otherwise
we could incorrectly attempt to dereference an invalid pointer. This bug
was introduced when migrating the bluedroid driver to use the gpiod
functions.

Bug 4387902
Bug 4958861

Change-Id: Ib9e7494c92226454d93506c2c0d4c80bd6a7493c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3397231
(cherry picked from commit b461fa1a87f9beb5faa1dc917956603430b12df7)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3405518
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-10-02 10:13:01 -07:00
Bruce Xu
74cc0f56f2 misc: bluedroid: remove duplicate timer declaration
There are 2 timer defined. One statically and one in the
bluedroid_pm_data struct. Both timers call the same function on expiration. In the case of the statically defined timer this is a problem because it assumes that the timer is part of the bluedroid_pm_data and so calling timer_container_of() or from_timer() results in an invalid pointer and hence kernel panic. Fix this by
removing the statically defined timer.

Bug 4958861

Change-Id: I08f9dc3a032f84ca3350fbec5fb97062da8d6795
Signed-off-by: Bruce Xu <brucex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3400991
(cherry picked from commit 61490c6a2a65e24068cd33a92d8730260ad83f95)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3405517
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
2025-10-02 10:12:56 -07:00
Jon Hunter
66ab02d7b9 misc: bluedroid_pm: Use wakeup_source_register/unregister
In Linux v6.16, commit 142ba31d8b4a ("PM: wakeup: Do not expose 4 device
wakeup source APIs") made the wakeup_source_add/destroy internal
functions. Instead of using wakeup_source_add/destroy, use
wakeup_source_register/unregister which internally call
wakeup_source_add/destroy and have been supported since Linux v2.6.x
kernels.

JIRA LINQPJ14-60

Change-Id: I6c471677876192e8985c8c336f95184564618c8a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3375073
(cherry picked from commit 8118ce4f4df7513d26ca3d0150cfa2104e969d35)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3461877
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-10-01 15:28:05 -07:00
Jon Hunter
96cae7f9de drivers: Fix from_timer() for Linux v6.16
In Linux v6.16, commit 41cb08555c41 ("treewide, timers: Rename
from_timer() to timer_container_of()") renamed 'from_timer()' to
'timer_container_of()'. Given that this is a macro we can simplfy see if
the macro 'timer_container_of' is defined and if so use this otherwise
fall back to 'from_timer()'. Update the necessary drivers to fix the
build for Linux v6.16.

JIRA LINQPJ14-60

Change-Id: I7f622b5d046a92da2ade755e6a697c1810f61275
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3383387
(cherry picked from commit 320ec84efd492c0c2711c69104fabc30b4f15ecb)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3461850
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
2025-10-01 15:27:42 -07:00
Robert Huang
38578736f2 tegra-cec: Fix cec_irq flooding issue
The RX_REGISTER_FULL interrupt is not cleared when rx_fifo_data is 0.
Add readw for RX_REGISTER when rx_fifo_data is 0 so that the interrupt
can be cleared.

Bug 5266075

Change-Id: I10ab107efadc22a6ec79255e22bf080384b4ff5c
Signed-off-by: Robert Huang <robhuang@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3367190
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2025-07-24 10:20:35 +00:00
Joshua Cha
a81de1a2c6 nvsciipc: remove redundant sysfs node creation
nvsciipc_uid_groups are redundant since it's already
created by sysfs_create_group.

Bug 5214323

Change-Id: I70f514ff47f30ac1c70b85dec5c0354ef8d85997
Signed-off-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3348582
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Simon Je <sje@nvidia.com>
Reviewed-by: Suneel Kumar Pemmineti <spemmineti@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-07-24 10:20:35 +00:00
Joshua Cha
b42f5d8ada nvsciipc: add put_cred()
Added missing put_cred() after using get_current_cred()

JIRA NVIPC-3520
Bug 5300203

Change-Id: Iddfb1ae78bb265109709360746b315bd1e62561b
Signed-off-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3369157
Reviewed-by: Jungho Kim <junghok@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Simon Je <sje@nvidia.com>
2025-07-24 10:20:35 +00:00
Joshua Cha
fe810a887f nvsciipc: fix endpoint access error
Fix authentication in mutex handling (Linux).
Fix endpoint access error return value and
add endpoint name debug info.

Bug 5237628

Change-Id: Id54b182c41c0d8e637dbe212ceea3d914b56edac
Signed-off-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3345811
(cherry picked from commit 3115465d891b10bc389b813a2fb279d0b0bce9b0)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3345807
Reviewed-by: Suneel Kumar Pemmineti <spemmineti@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Simon Je <sje@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:19 +00:00
Suneel Kumar Pemmineti
2483ab734d nvsciipc KMD: Fix incorrect PID
The code was using task_pid_nr(current) to get the process ID, which
returns the Thread ID (TID) instead of the actual Process ID (PID) for
multi-threaded applications. This caused problems with endpoint
reservation tracking since different threads of the same process would
appear as different owners.

current->tgid (Thread Group ID) represents the actual Process ID in
Linux. task_pid_nr(current) returns the Thread ID which is unique for each
thread within a process. Using TGID ensures all threads from the same
process are properly identified as belonging to the same process.

This fix ensures proper endpoint reservation tracking across all threads
of a multi-threaded application.

Bug 5260259

Change-Id: If2f864dc4456de71b1df49e64320463a24203c68
Signed-off-by: Suneel Kumar Pemmineti <spemmineti@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3360307
Reviewed-by: Simon Je <sje@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jungho Kim <junghok@nvidia.com>
2025-07-24 10:19:19 +00:00
Janardhan Reddy
d4def4008d nvscic2c-pcie: Fix Top25 CWE CERT-C violations
Fix total 8 Top-25 CWE violations of below CERT-C rules:

1) CERT STR07-C - 4
cert_str07_c_violation: Using unsafe interface strcpy instead of
strcpy_s for string manipulation.

2) CERT EXP34-C, FORWARD_NULL - 2
var_compare_op: Comparing drv_ctx to null implies that drv_ctx might be
null. cert_exp34_c_violation: Dereferencing null pointer drv_ctx.

3) CERT INT30-C, CERT INT08-C - 2
cert_int30_c_violation: Unsigned integer operation (*msg).data - 7U may
wrap.

Bug 5238880

Change-Id: I481f61f5c96407f90da51f9878ff55cbb61b1699
Signed-off-by: Janardhan Reddy <jreddya@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3340682
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: Deepak Kumar Badgaiyan <dbadgaiyan@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-07-24 10:19:19 +00:00
Chris Dragan
6db615e47a misc: mods: update mods driver to 4.31
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Change-Id: I41439d9268c2307bddf6f396db299ab937084d69
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3351803
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2025-07-24 10:19:19 +00:00
Joshua Cha
2cdcd7f6a2 nvsciipc: update kernel message level
update kernel message level from error to info for
nvsciipc_ioctl_reserve_ep.

Bug 5228447
Bug 5119903
JIRA NVIPC-3423
JIRA NVIPC-3427

Change-Id: I75bf39f4bf0b04f8d1e3d527293c1f796fad60dc
Signed-off-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3343579
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Jeungwoo Yoo <jeungwooy@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Simon Je <sje@nvidia.com>
2025-07-24 10:19:18 +00:00
Jon Hunter
a59a10dfeb drivers: Update timer APIs for Linux v6.15
In Linux v6.15, the timer APIs hrtimer_init() and del_timer() have been
removed. The hrtimer_setup() was added in Linux v6.13 to replace
hrtimer_init() and hrtimer_init() have finally been removed. The
functions del_timer()/del_timer_sync() were renamed to
timer_delete()/timer_delete_sync() in Linux v6.15. Use conftest to
detect these changes and update the drivers as necessary.

JIRA LINQPJ14-47

Change-Id: Id3994900384aad4b91155507cda91e04898ab12c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3336168
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-07-24 10:19:18 +00:00
Jeungwoo Yoo
89df3ba53b nvsciipc.c: Fix CWE violations
- EXP39-C

Jira NVIPC-3397

Change-Id: Ic4be52a1032ec729442368a96af5cb8b75b99330
Signed-off-by: Jeungwoo Yoo <jeungwooy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3334619
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-by: Simon Je <sje@nvidia.com>
2025-07-24 10:19:17 +00:00
cyeddu
2e075e123d nvscic2c-pcie: Fix Top25 CWE CERT-C violations
Fix total 48 violations of below CERT-C rules:

CERT ARR30-C - 1
CERT EXP34-C - 1
CERT INT08-C - 20
CERT INT30-C - 20
CERT STR07-C - 4
CERT STR31-C - 1
FORWARD_NULL - 1

JIRA NVIPC-3120

Change-Id: I2b9b35e97fe6968ec4c656cdcdd01a764640033c
Signed-off-by: Anjanii <amohil@nvidia.com>
Signed-off-by: Janardhan Reddy <jreddya@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3263785
Reviewed-by: Deepak Kumar Badgaiyan <dbadgaiyan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
2025-07-24 10:19:17 +00:00
Jeungwoo Yoo
8e91b73244 nvsciipc.c: Fix CWE violations
- EXP39-C

Jira NVIPC-3397

Change-Id: Iacdcd3160f2060ffd8b1e0cc8958ff29cac670f4
Signed-off-by: Jeungwoo Yoo <jeungwooy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3326688
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Simon Je <sje@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Joshua Cha <joshuac@nvidia.com>
2025-07-24 10:19:17 +00:00
Joshua Cha
454c782d5c nvsciipc: add missing check routing in set db
add pointer check routine for set_db CMD.

JIRA NVIPC-3520

Change-Id: Ie9768ae839d88519013dfece97192d111acacbb2
Signed-off-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3329729
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Jeungwoo Yoo <jeungwooy@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Simon Je <sje@nvidia.com>
2025-07-24 10:19:17 +00:00
Joshua Cha
27a2c762f1 nvsciipc: add missing authentication
added missing client authentication to ioctl func below.
nvsciipc_ioctl_get_db_by_idx()
nvsciipc_ioctl_get_vuid()

JRIA NVIPC-3513

Change-Id: I32c3c97ba1c5196ba5858d13393fada073527d2f
Signed-off-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3324672
Reviewed-by: Simon Je <sje@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jeungwoo Yoo <jeungwooy@nvidia.com>
2025-07-24 10:19:17 +00:00
Ken Chang
8e90031cd8 tegra-cec: poll WR_LOCK for TX data sync
After programming the TX Register, it takes 3-4 clock cycles for TX
data synchronization to the CEC core domain. The TX_EMPTY interrupt
should not be cleared until this data synchronization is complete.

Enable CEC HW feature to automatically clears the TX_EMPTY interrupt
after TX data synchronization is complete. It takes time for HW to
clear the interrupt and TX_EMPTY can still appear high, hence SW
needs to poll WR_LOCK until it goes to 0. This will avoid SW to
attempt the next TX block during the same TX_EMPTY interrupt.

Also read RX_REGISTER based on the buffer occupancy which is
indicated by the CEC_RX_BUFFER_STAT_0 register.

Bug 4954851

Change-Id: I3ec3792c9ae3b8a00c800c921cf4e4d09369e6b9
Signed-off-by: Ken Chang <kenc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3322519
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Prafull Suryawanshi <prafulls@nvidia.com>
Tested-by: Ruopeng Huang (SW-TEGRA) <robhuang@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:17 +00:00
Joshua Cha
915ce6717f nvsciipc: set nvsciipc max endpoint count
validate nvsciipc max endpoint count.
validate set_db entry pointer.

JIRA NVIPC-3506

Change-Id: Id29531af24367de952b2dccebe23515ad52bfd33
Signed-off-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3322061
Reviewed-by: Suneel Kumar Pemmineti <spemmineti@nvidia.com>
Reviewed-by: Simon Je <sje@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:17 +00:00
Joshua Cha
e8d5a43b9f nvsciipc: add endpoint mutex
add endpoint mutex to nvsciipc KMD

JIRA NVIPC-3427

Change-Id: I1644213f59d24da4c4eeb693fa3016904388a26b
Signed-off-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3309493
Reviewed-by: Suneel Kumar Pemmineti <spemmineti@nvidia.com>
Reviewed-by: Simon Je <sje@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:17 +00:00
Robert Huang
a0aa537149 misc: cec: add wake up support.
This change adds SC7 wake support to cec driver.
CEC engine can detect TV packets in SC7 state and
can wake up when particular pattern detected.
In resume functionality, the total arrived packets on FIFO
needs to read and reported back to user-space.

This change adds -
1. Program CEC engine to activate for SC7 wake.
2. Program required opcode and physical address.
3. Register for wake and read packets in resume path.
4. Provide sysfs control to program physical address.

Verification of SC7 wake is done for below cases -
1. TV turn on and off is tested.
2. TV source input change is tested.
3. CEC Analyzer set-stream is tested.

Bug 4974679

Change-Id: Ia1ceeb13b89614c96d0b6d42f2bb58419865414b
Signed-off-by: Robert Huang <robhuang@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3300821
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Prafull Suryawanshi <prafulls@nvidia.com>
2025-07-24 10:19:16 +00:00
Suneel Kumar Pemmineti
04ccb5c0c3 nvsciipc: enable endpoint security
- allow ioctl access if UID looked up is one of process UID
  or SGIDs.
- removed legacy codes
- set UID of set DB ioctl using sysfs

JIRA: NVIPC-2817

Change-Id: Ic910b5bdbb362e9cda0cc3af4bcd9c1642725a25
Signed-off-by: Suneel Kumar Pemmineti <spemmineti@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3225830
Tested-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-by: Simon Je <sje@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:16 +00:00
gkrishnakuma
70313ee7da Shield2: HDMI-IN: Make HDMI-IN driver
Build HDMI-IN kernel driver for Android builds.

Jira SHLD2-543

Change-Id: I0ff84d4ce3467c0825e379c93142307508750dc1
Signed-off-by: Guruprashanth Krishnakumar <gkrishnakuma@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3272404
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ankita Garg <ankitag@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-07-24 10:19:16 +00:00
Jon Hunter
eea9f99397 drivers: Remove CONFIG_TEGRA_VIRTUALIZATION
Remove CONFIG_TEGRA_VIRTUALIZATION so that virtualization is always
enabled for drivers. This permits the same drivers to work on bare-metal
Linux machines as well as virtual Linux machines.

Bug 5157858

Change-Id: I29d13dae957ed2273b65f95fff0bee1e06f45a27
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3314409
Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:16 +00:00
Joshua Cha
da67f89f15 nvsciipc: add shutdown callback
print kernel message during system shutdown

JIRA NVIPC-3318

Change-Id: Ib6025c4058fc2f03d89d44e0c6f2ee90073ba8e2
Signed-off-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3309294
Reviewed-by: Jeungwoo Yoo <jeungwooy@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Simon Je <sje@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-07-24 10:19:16 +00:00
Joshua Cha
a674701be0 nvsciipc: add suspend/resume callback
print suspend/resume status

JIRA NVIPC-3318

Change-Id: I43585ba82ccb75dda92f7276e5d5bab416087818
Signed-off-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3297783
Reviewed-by: Jeungwoo Yoo <jeungwooy@nvidia.com>
Reviewed-by: Simon Je <sje@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-07-24 10:19:15 +00:00
Suneel Kumar Pemmineti
38d739c860 nvsciipc: Add UID member to Config structure
- Added UID member to nvsciipc_config_entry data
structure. this is needed for implementing
test_nvsciipc_cfgblob in linux.
- removed static from ioctl function to attach eBPF program
- add error-injection.h and ALLOW_ERROR_INJECTION macro to ioctl
  to use bpf_override_return()

JIRA NVIPC-2817

Change-Id: Ic27156e321368041f41fbabff9e6375140fe1d0e
Signed-off-by: Suneel Kumar Pemmineti <spemmineti@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3301786
Tested-by: Joshua Cha <joshuac@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Simon Je <sje@nvidia.com>
2025-07-24 10:19:15 +00:00
Suneel Kumar Pemmineti
63a1d3e6e0 nvsciipc: Add nvsciipc_ioctl_get_db_by_idx
- Added nvsciipc_ioctl_get_db_by_idx to retrieve
the endpoint DB entry using index

JIRA: NVIPC-2818
Change-Id: I5651cf29b11dad0ff505f5f497a896572b893e94
Signed-off-by: Suneel Kumar Pemmineti <spemmineti@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3297838
Reviewed-by: Simon Je <sje@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:15 +00:00
Manish Bhardwaj
b6c2cf9a34 nvidia-oot: check dependency of pci driver on host1x
Bug 4936618

Change-Id: I9c8d98b43cffa6cff4ea06d7bb38acf0b42819fb
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3257441
Reviewed-by: Bharath H S <bhs@nvidia.com>
Tested-by: Hyong Bin Kim <hyongbink@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: Hyong Bin Kim <hyongbink@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:13 +00:00
Deepak Badgaiyan
676ada0f2b nvscic2c-pcie: fix bar to be used in Thor
With Thor BAR_2 should be used for data transfer.

https://git-master.nvidia.com/r/c/linux-nv-oot/+/3246908
reverted the change made earlier to enable to Thor supported.

The revert was due to mistake hence use correct bar number
while using pci_resource_len()

Bug 5046041

Change-Id: I7627b9eab5b509fb55cb30138e86a1674841af8a
Signed-off-by: Deepak Badgaiyan <dbadgaiyan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3283714
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Janardhan Reddy AnnapuReddy <jreddya@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
2025-07-24 10:19:13 +00:00
Deepak Badgaiyan
0b94a70702 nvscic2c-pcie: update endpoint function deinit
In Thor core_deinit event is issue from pcie_epc_stop(),
Which mean we can not call pci_epc_unmap_addr() in core_deinit
due to mutex deadlock.
Release epc->lock in core_deinit before calling epc-core API's.
Take back mutex before returning.

Jira NVIPC-3183
Bug 5046041

Change-Id: Ie24bbb9cc95e4024fd95ae099cda51ef90ddd2f8
Signed-off-by: Deepak Badgaiyan <dbadgaiyan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3282858
Reviewed-by: Anish Khurana <ankhurana@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Janardhan Reddy AnnapuReddy <jreddya@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
2025-07-24 10:19:13 +00:00
Jon Hunter
a2602b88b8 misc: tegra-cec: Fix build for Linux v6.11+
In Linux v6.11, the 'platform_driver' structure 'remove' callback was
updated to return void instead of 'int'. Update the Tegra CEC driver
as necessary to fix this.

Bug 4749580

Change-Id: I3cd34f41e519240ff48378e79bb654cf78767085
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3276923
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
(cherry picked from commit 66afcf9c40)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3282569
Reviewed-by: svcacv <svcacv@nvidia.com>
Tested-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-by: Prafull Suryawanshi <prafulls@nvidia.com>
2025-07-24 10:19:13 +00:00
Prafull Suryawanshi
ce33039eea tegra-cec: make tegra-cec as loadable module.
This change makes tegra-cec driver as loadable module
and adds uapi tegra_cec.h file for IOCTL interface.

Verification:
Verified on orin-slt with basic cec tx-rx data with TV.

bug 4954851

Change-Id: Id3ca696429b2897aa9d80604a365f3221c94a770
Signed-off-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3273953
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:13 +00:00
Prafull Suryawanshi
27e8c7ae95 tegra-cec: remove pre-t23x support.
This change removes pre-t23x support and removing
dependency on tegra-dc module for tegra-cec driver.

It also removes the previously used uapi header file
for user-space ioctl intefrace which will be added along
with loadable module change.

Verification:
Verified on orin-slt with basic cec tx-rx data with TV.

bug 4954851

Change-Id: Ie820ba706ac5e66da282e411a4ae74bd0e6cb58b
Signed-off-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3264311
(cherry picked from commit 0cac4c3b02)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3258901
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2025-07-24 10:19:13 +00:00
Prateek Patel
658d1e1452 drivers: cec: fix cert_c defect
Add a sanity check on cec->soc, which could be NULL.

CID 490328

Bug 3512545

Change-Id: Ibd334c5637a85342ed5307eecb697416f32e0360
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2710156
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2025-07-24 10:19:13 +00:00
prafulls
070456617d misc: tegra-cec: replace dev_err with dev_info.
The probe retry message shall not be error message.
Replacing it with dev_info to fix kernel warning test.

bug 3578262

Change-Id: I8fd016e11b6edc14a402214a44c1e916bcc0d16e
Signed-off-by: prafulls <prafulls@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2685084
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Shu Zhong <shuz@nvidia.com>
GVS: Gerrit_Virtual_Submit
2025-07-24 10:19:13 +00:00
Prafull Suryawanshi
a33a00e4be misc: tegra-cec: add T23x support.
This change includes below -
1. For T23x, CEC engine is moved to AON partition. As AON partition
   does not powergate, skip all powergate/unpowergate calls for t23x.
2. The clock on which CEC engine operates, 32k/rtc_clk, it is always
   running clock in AON partition. So skip clock enable/disable APIs.
3. This change also skips calls to TEGRA DC engine which is not available
   from T23x.
4. RX Buffer size is increased to 64 depth from 1 depth. So new register is
   provided to program depth so that interrupt gets triggered when certain
   depth is filled. By default it is 64 depth so program it to 1 depth
   to match old behavior.
5. When tegradc is absent, read physical address from SPARE register which
   will be populated by UEFI.
6. This change also adds new register definitions in header file which
   needs to program when adding support for CEC SC7 wakeup.
7. Timing registers updated for T23x as per HW guidelines.
8. Some initialization code is changed for T23x.
9. Add devicetree binding documentation.

bug 200727002

Change-Id: I71c2d323632c61e4c4b82bcdbca9e72179761224
Signed-off-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2523595
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Shu Zhong <shuz@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2025-07-24 10:19:13 +00:00
Ankit Patel
ebc4fef1b7 drivers: use overlay instead of relative path
Modified misc/tegra-cec and video/tegra/dc NVIDIA git repo Makefile, Now
overlay macro will be used instead of relative path from kernel source
tree, to find the included header file.

Bug 200606454

Signed-off-by: Ankit Patel <anpatel@nvidia.com>
Change-Id: I684388e9c81be94915c05db3cdae8b6100c6db91
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2521240
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:13 +00:00
Naveen Kumar S
ba7084570c video: tegra: dc: add pm_runtime support
Add genpd/pm_runtime support to handle power domains
in Tegra Display driver. Also updated CEC and HDA_DC
drivers to add pm_runtime calls.

Added new APIs in CEC and SOR drivers to abstract
calls to pm_runtime and tegra_powergate APIs based
on specific Kernel version. Guarded powergate_id
with CONFIG_TEGRA_POWERGATE since its not needed
when pm_runtime APIs are used, and the powergate IDs
are defined in tegra_powergate.h which is not used
in K5.9.

Removed pm_runtime autosuspend setting since display
driver doesn't assign PM suspend/resume hooks at
present. Suspend/resume calls are linked to platform
device callbacks.

Removed pm_runtime_enable() call in dc_common probe
since there's logically no need of power-domains
in dc_common and also there is no power-domains node
in display_hub node in device-tree. Same with DSI.

All the power-domains handled by each DC are listed
in "power-domains" and "power-domain-names" properties
under respective dc nodes in device tree.

bug 200601926

Change-Id: I0fc9d21ff56185a69de6e0663b5932a93cf40e2b
Signed-off-by: Naveen Kumar S <nkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2358953
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Shu Zhong <shuz@nvidia.com>
Reviewed-by: Ujwal Patel <ujwalp@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2025-07-24 10:19:13 +00:00
Naveen Kumar S
78df3dae46 misc: tegra-cec: fix access_ok() API's parameters
This change fixes below follow-up issues with the earlier fix
to access_ok() API done as part of
https://git-master.nvidia.com/r/c/linux-nvidia/+/2361042:

1. Definition of VERIFY_READ and VERIFY_WRITE have been removed
after K4.14. Hence, used them only for kernel versions < K5.4.
2. Changed access_type parameter of tegra_cec_access_ok() API
to bool. WRITE or READ will be chosen based on the bool value.
3. In the last CL, VERIFY_WRITE was changed to VERIFY_READ in
two access_ok() calls by mistake. Corrected them in this CL.
4. Defined access_type variable with attribute __maybe_unused
since gcc doesn't seem to consider a variable as used if only
passed as function parameter.

bug 200601926

Change-Id: I9f3540cd028280ca679b4b69d5b4a72aa943b2ae
Signed-off-by: Naveen Kumar S <nkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2394585
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Shu Zhong <shuz@nvidia.com>
Reviewed-by: Ujwal Patel <ujwalp@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2025-07-24 10:19:13 +00:00
Naveen Kumar S
2609b37114 misc: tegra-cec: update access_ok() parameters
Starting K5.9, the access type parameter (read/write) of
access_ok() API has been removed. And also, the address
parameter has been updated to "void *" type from "unsigned
long". Introduced API tegra_access_ok() to abstract the
difference in parameters across different kernel versions.

bug 200601926

Change-Id: I0d72e03f5e0c56eb935107eaf306bc2d68ed13e3
Signed-off-by: Naveen Kumar S <nkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2361042
Reviewed-by: Shu Zhong <shuz@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:13 +00:00
Bitan Biswas
5d79fa89e6 nvidia: drivers: fix linux-5.7-rc5 build
Fix build linux-5.7-rc5 errors including following:
	- change timespec to timespec64. replace getnstimeofday
	  with ktime_get_ts64
	- replace usage of macro FIELD_SIZEOF with sizeof_field in ethtool.c
	  nvethernet and eqos files.
	- support 2 arguments for of_get_phy_mode call

bug 200617764

Change-Id: I46067d7d36d08ee9556b2722e9ccec707b8853d4
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2347244
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:13 +00:00
Ankit Patel
3685bbca00 headers : move/modified header for User-space ABI
copied/moved/modified headers from the driver directory to the
include/uapi directory, which have IOCTL components required to
get access from user space as per Linux kernel user-space ABI.

Bug 2062672

Signed-off-by: Ankit Patel <anpatel@nvidia.com>
Change-Id: Ie70b2839e0a1031a685ff3e4bb93c73741645f44
(cherry picked from commit 348c5ff55d7499222f154aea9e9893e6cfa677ce)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2318682
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:13 +00:00
Nicolin Chen
76e580a325 media: tegra: Remove temp WAR for function calls
There are two type of temp WARs in the nvidia repo:
1) Some functions are defined in driver files that depend on
   CONFIG_TEGRA_GRHOST_NVCSI. So these function call should
   have dependency protection in the header file.

2) The powergate header file is adding an unnecessary define
   check for tegra194-powergate.h and this broke two places
   that were referring one of the defines in it.

So this change fix the WARs above by:
a) Removing those temp WARs by adding dummy NOP functions for
   those platofrms that don't have CONFIG_TEGRA_GRHOST_NVCSI.
b) Removing the define check in tegra194-powergate.h and the
   version check when referring TEGRA194_POWER_DOMAIN_DISP.

Bug 2284925

Change-Id: Iad86bfe20f2981b3d31bccf5f51184799fe7e289
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1803439
GVS: Gerrit_Virtual_Submit
Reviewed-by: David Bang <dbang@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:13 +00:00
Chun Xu
2efe0a33c4 tegra-cec: add interface to get post_recovery
Provide IOCTL interface for usersapce to get whether current boot is from
booting from recovery.

Bug 200394215

Change-Id: I45f492b766a75542ff470366001f92fa2fd65d23
Signed-off-by: Chun Xu <chunx@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1780659
(cherry picked from commit 8a4bda6d7e0904ce9c0cafabac4aefb49e879b8b)
Reviewed-on: https://git-master.nvidia.com/r/1792946
GVS: Gerrit_Virtual_Submit
Reviewed-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:13 +00:00
Chun Xu
64d16c1ddf tegra_cec: suppport dump registers and snoop mode
Provide dump registers and changingRX snoop mode interface.

Bug 200382184

Change-Id: Idb55d22112bc6be9de89b8ff8e060e73de469507
Signed-off-by: Chun Xu <chunx@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1765068
(cherry picked from commit 3310df0f117d792d3d0bfab6326592851faaeed7)
Reviewed-on: https://git-master.nvidia.com/r/1641846
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:13 +00:00