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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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
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
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
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>
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>