Commit Graph

56 Commits

Author SHA1 Message Date
Yuyuan Chen
3b31f76f27 kernel: nvidia-oot: Fix Static issues S2/5
Jira CAMERASW-31832

Change-Id: I4060480865bf3895fae22127bb3e0c915af8af9f
Signed-off-by: Yuyuan Chen <yuyuanc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3297678
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Tested-by: Patrick Young <payoung@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ryan Li <ryanli@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: Vincent Chung <vincentc@nvidia.com>
2025-07-24 10:19:15 +00:00
Bob Zhang
9297cd7cfd kernel: nvidia-oot: Fix Linux KMD coverity defects
Fix INT32-C and INT08-C coverity defects for tegra-rtcpu-trace.c.

JIRA CAMERASW-31291

Change-Id: I2b80963663df440a38e39bdc3b15d240270f99a5
Signed-off-by: Bob Zhang <bozhang@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3297723
Reviewed-by: Xiaoming Xiang <xxiang@nvidia.com>
Reviewed-by: Sudhir Vyas <svyas@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: Anubhav Rai <arai@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:15 +00:00
Bob Zhang
d1c50209ba kernel: nvidia-oot: Fix Linux KMD coverity defects
Fix INT30-C and INT08-C coverity defects for
tegra-rtcpu-trace.c.

Fix MISSING_LOCK coverity defects for cdi_mgr.c.

Fix NULL_RETURNS coverity defects for cam_fsync.c.

JIRA CAMERASW-30844

Change-Id: If000ed4459479ba0bc9f06477b25efa65e896fc7
Signed-off-by: Bob Zhang <bozhang@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3283172
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Tested-by: Patrick Young <payoung@nvidia.com>
Reviewed-by: Xiaoming Xiang <xxiang@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Sudhir Vyas <svyas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Anubhav Rai <arai@nvidia.com>
2025-07-24 10:19:14 +00:00
yongtaos
2b06fe0a29 kernel: nvidia-oot: Fix Top-25 coverity defects
Fix INT08-C, INT30-C and STR07-C coverity defects for rtcpu-debug.c.

Jira CAMERASW-30854

Change-Id: I0b516587b72bf631974f5f6ee99a55821744bf85
Signed-off-by: yongtaos <yongtaos@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3278378
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: Zhiyuan Wang <zhiwang@nvidia.com>
2025-07-24 10:19:13 +00:00
kevixie
5ce08ee3ce nvidia-oot: cameraSW: add data validation to dt reads
+ Add the following data validation checks based on
  gaps identified when inspecting code for
  SHR-9320:
  + FSYNC: Add check to ensure existence of generators
    property before parse
  + FSYNC: Add check to ensure generators in default
    group adhere to LCM rule
  + CDI: Add check to ensure reg_len / dat_len do
    not exceed 2 bytes
  + CDI: Ensure err is set before jumping to err_probe
  + CDI: Jump to err_probe if IOExpander i2c-bus read
    fails
  + CDI-TCA: Return error if reg_len or dat_len
    out of expected range
  + FuSaCap: Ensure isp/vi-max-channels validated
  + VI: Add check for vi-mapping index found (this was
    already caught in existing code, but error message
    was non-specific)
  + camera_common: Add check for err that was set but
    never read
  + RTCPU: Add debug prints for properties not found

Jira CAMERASW-30537
Change-Id: I9953029f594c0153d6c335913944fb8906adedd9
Signed-off-by: kevixie <kevixie@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3280557
Reviewed-by: Vincent Chung <vincentc@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Mohit Ingale <mohiti@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:13 +00:00
Evgeny Kornev
c4d1462fd6 tracing: Fix ftrace for ISP trace events
Fix ISP trace events due to 64 bit TS cahnges

Jira CAMERASW-30345

Change-Id: I33aa9325603ec939979e11964224bf3f113a0adb
Signed-off-by: Evgeny Kornev <ekornev@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3266979
Reviewed-by: Jukka Kaartinen <jkaartinen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: Sudhir Vyas <svyas@nvidia.com>
2025-07-24 10:19:12 +00:00
Jon Hunter
efeecacbd1 tegra: rtcpu: Fix build for Linux v6.12
In Linux v6.12 the definition 'no_llseek' was finally removed. Since
Linux v6.0 it had been redefined as NULL. Add a test to conftest to
determine if 'no_llseek' is present and if not then it is no longer
necessary to populate this and we can leave as NULL.

Bug 4876974

Change-Id: Idc0f5eff6f95f404a24b6d795f6a9460b99639e4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3261670
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Pushpesh Pranjal <ppranjal@nvidia.com>
2025-07-24 10:19:11 +00:00
Pushpesh Pranjal
007a357ab1 kernel: nvidia-oot: fix GVS build issue
- fix for no prototype issue
- class_create failure
- ISO C90 mixed declarations

Jira CAMERASW-29337

Change-Id: I16cc1b6f36df1e1f59acc6add927f30e5a963302
Signed-off-by: Pushpesh Pranjal <ppranjal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3248722
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Evgeny Kornev <ekornev@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:11 +00:00
Pushpesh Pranjal
cbf1e15fdc kernel: nvidia-oot: adding use case to discard existing traces
- Add usecase to discard existing traces, using a write call,
that sets last read event index to header's next event index.

Jira CAMERASW-29336

Change-Id: Ibfc94cf5f5484b5a4ad9c2cc6f9eaeb4937ac564
Signed-off-by: Pushpesh Pranjal <ppranjal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3242168
(cherry picked from commit 148495ac64e645aff04abdf1d0334e7ea6400982)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3248850
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Evgeny Kornev <ekornev@nvidia.com>
2025-07-24 10:19:11 +00:00
Pushpesh Pranjal
1ad8bfcf97 kernel: nvidia-oot: adding non-blocking use case
- adding non-blocking use case for fetching raw traces

Jira CAMERASW-27488

Change-Id: Ic60ceb08e9d3e68bf5db20c0da9325c3c183169e
Signed-off-by: Pushpesh Pranjal <ppranjal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3227561
(cherry picked from commit 04b0de1c19db16fb6cfc9b8057d395000c9f6011)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3241812
Reviewed-by: Evgeny Kornev <ekornev@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:11 +00:00
Pushpesh Pranjal
2ac9b955e8 tegra: rtcpu : add device node for fetching raw traces
- added a device node to fetch the raw traces
- keeping both option available: existing worker method,
  using device node to fetch raw traces
- both blocking & non-blocking call support,
  user can decide it
- multiple file open support, each file descriptor
  context have its own read pointer of trace memory

Jira CAMERASW-27486
Jira CAMERASW-27487
Jira CAMERASW-27774

Change-Id: I93942d273570857b0073e0e863e41c221c36ebb7
Signed-off-by: Pushpesh Pranjal <ppranjal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3215749
(cherry picked from commit 21a9c245ea4be51117c379d77c45de1ddc3a167c)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3241811
Reviewed-by: Evgeny Kornev <ekornev@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2025-07-24 10:19:11 +00:00
Akihiro Mizusawa
1656f9c566 nv-oot: rtcpu: Check early boot logs
- Define boot log related HSP message ID's.
- Call camrtc_hsp_vm_read_boot_log as the first step during the HSP
handshake.
- The read_boot_log function will wait for 2000 ms for a boot log
message. If the RCE has hung during boot, this will timeout, and return
with error.
- Move dev_set_drvdata to before camrtc_hsp_probe in camrtc_hsp_create.
Explanation: The RCE, during a normal boot sequence, will boot before
the RTCPU KMD starts probing, so the mailbox will already be full
when the HSP driver is initializing. The RTCPU HSP full interrupt
handler will be called immediately after the handlers are registered
by the mailbox driver. The interrupt handler will reference the HSP
device's drvdata, and it was a race condition as to whether the
interrupt handler would be called before the drvdata was set.
Thus, this change sets drvdata before the interrupt handlers are
installed to prevent this race condition.
- Update the full interrupt handler to return if camhsp is null.

Jira CAMERASW-27443

Change-Id: Ibb7ed41771d2178e0d06adb94ae1955db61b9d92
Signed-off-by: Akihiro Mizusawa <amizusawa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3239620
Reviewed-by: Chinniah Poosapadi <cpoosapadi@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
2025-07-24 10:19:10 +00:00
Akihiro Mizusawa
dadd61f04c tegra rtcpu: add debug map test buffers for ISP1
Add debug map test buffers for ISP1.

Jira CT26X-427

Change-Id: If3f12b789263aa3d8dbbb3b88157cce429335ea9
Signed-off-by: Akihiro Mizusawa <amizusawa@nvidia.com>
2025-07-24 10:19:09 +00:00
fraunak
47917521d4 kernel-oot: update pm register offsets
Added t264 specific pdata struct to
use r5_ctrl and pwr_status registers
values.

Jira CAMERASW-11038

Change-Id: I4ae6b3ffee48eff61a6b7a7309c251c38d68bf30
Signed-off-by: fraunak <fraunak@nvidia.com>
2025-07-24 10:19:09 +00:00
Evgeny Kornev
83a23200ef rtcpu: adjust header len
Len for camrtc_event_header is reduced
to uint16_t so ajust casting to uint16_t

Jira CAMERASW-27782

Change-Id: I5da60c9eb4e1d82d1c9251942d5c51dae06fc374
Signed-off-by: Evgeny Kornev <ekornev@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3218684
(cherry picked from commit 003f7f7e7a32341162c5b07b6fb1725b15859b75)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3228154
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:09 +00:00
Jon Hunter
f01227d4ea 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
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:08 +00:00
Jon Hunter
5a54d4161a drivers: Fix build for Linux v6.12
In Linux v6.12 the definition 'no_llseek' was finally removed. Since
Linux v6.0 it had been redefined as NULL. Add a test to conftest to
determine if 'no_llseek' is present and if not then it is no longer
necessary to populate this and we can leave as NULL.

Bug 4876974

Change-Id: I051fdb285b32260b5913dad89cabe0be04253f67
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3222106
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:07 +00:00
fraunak
cc49f73763 nvidia-oot: add tracing support to identify isp
This change adds the isp logging to identify which isp instance is being
run in the rtcpu traces.

Jira CT26X-1790

Change-Id: I87744fd15629bb9faa96f5970b5f5ecea4b59937
Signed-off-by: fraunak <fraunak@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3221517
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Chinniah Poosapadi <cpoosapadi@nvidia.com>
2025-07-24 10:19:07 +00:00
Pekka Pessi
b53b1d832a rtcpu: validate trace event length
Add checks for trace event length.

A trace event with too small or too large len value could cause a
crash and kernel panic.

Bug 4446545

Change-Id: I404a4e3ba1a4dad04d05583b6ea8126556d0753b
Signed-off-by: Pekka Pessi <ppessi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3126815
(cherry picked from commit 01e1c1b3b3fabd28375aa6ef214ea759175c01f1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3132086
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Evgeny Kornev <ekornev@nvidia.com>
Reviewed-by: Jukka Kaartinen <jkaartinen@nvidia.com>
Reviewed-by: Mika Liljeberg <mliljeberg@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Tested-by: Evgeny Kornev <ekornev@nvidia.com>
2025-07-24 10:19:07 +00:00
Manish Bhardwaj
2d8579274a nvidia-oot: use ivc APIs based on conftest flag
Bug 4551265

Change-Id: I75809a5c112b9e3cd5da570c2d9641bd89cfe07e
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3217450
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2025-07-24 10:19:07 +00:00
Robert Kelly
98be04181c rtcpu: set op point via sysfs
Create and register set and get operating point sysfs functions.

The operating point notification will contain the requested
operating point.

The nvcap resource manager will extract the operating point
from the notfication and send it to rce via the hsp command
interface.

In turn, rce will apply the operating point by adjusting the
functional clock frequencies for the following camera ip:

- rce hardware
- vi hardware
- isp hardware
- nvcsi

Jira CAMERASW-26378

Signed-off-by: Robert Kelly <rkelly@nvidia.com>
Change-Id: Ia814b2716d3738efb3cbc37307a267140b555f42
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3179593
(cherry picked from commit d259727a57ecf4b9463030b3418715891b3b1209)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3189078
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-08-17 10:38:56 -07:00
Bitan Biswas
4593cff331 platform: tegra: rtcpu: fix Mem abort
Fix k6.8 Mem abort after dma_sync_sg_for_cpu
call when running ap_bringup -> camera tests including
test_isp_debugfs_isp6_ob
 - Add pointer NULL check and pass same arguments
   to dma_sync_sg_for_cpu as dma_map_sg

Bug 4396374
Bug 3879036

Change-Id: I8dcad3d3fb21c1bed096d89a879a3343a0358400
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3191329
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2024-08-12 14:11:25 -07:00
Jon Hunter
951b2423a8 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
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Tested-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-08-11 17:20:34 -07:00
Jon Hunter
fc171fe539 drivers: Fix bus->match for Linux v6.11
In Linux v6.11, the 'bus_type' structure match() callback was updated to
make its 'drv' argument constant. Add a conftest test to detect this and
update the relevant drivers according to fix building them for Linux
v6.11.

Bug 4749580

Change-Id: I895d97241a7357074bb34b8e7a5bdfa2e31d5ca5
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3183068
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-07-31 08:06:48 -07:00
Matti Ryttylainen
8bb21ea435 Camera: Add task_fence events for VI/ISP
Nsight needs task_fence events from camera engines.
Add task_fence event traces to be emitted during ISP task begin/end
and during VI frame end.

Jira CAMERASW-24223

Change-Id: Ia44baf73777f30abc823459f5e7dfd4d495d3ca6
Signed-off-by: Matti Ryttylainen <mryttylainen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3141174
(cherry picked from commit ad0f0cba98173bbf055f5e69ebf175d9daf1ac3b)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3181495
Reviewed-by: Sampatlal Arjunram Jangid <sjangid@nvidia.com>
Tested-by: Devang Kubavat <dkubavat@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Pushpesh Pranjal <ppranjal@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
2024-07-28 21:57:31 -07:00
Jon Hunter
f0538cd58d camera: Handle probe deferral
Probing a driver can be deferred if a resource is not ready and this is
accomplished by returning -EPROBE_DEFER from the .probe function. This
tells to kernel to probe the driver again some time later. When probing
a driver is deferred it is not necessary to print an error message
because this is an expected error case. To avoid printing an error
message on probe deferral, the dev_err_probe() function can be used
which will only print an error if the error code is not -EPROBE_DEFER.
Therefore, update the camera drivers to use dev_err_probe() to avoid
printing an error message when -EPROBE_DEFER if returned from ICC.

This change will also cause the probing of the rtcpu-debug driver to
be deferred if -EPROBE_DEFER is returned and prevent the rtcpu-debug
driver from being probed at all if an real error is encountered.

Bug 4496044

Change-Id: I8a5313750e11b4bd661191c0c544c39e43478089
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3084829
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-02-29 15:40:34 -08:00
Laxman Dewangan
0679fc19d6 rtcpu: Port IVC bus driver to use iosys-map utils
The IVC driver in core kernel has been changed to accept
VADDR via iosys_map structure. Use the proper iosys map
utils to pass address when doing the tegra_ivc_init().

Bug 4346767

Change-Id: I416f6fbbea7605da9ae729e2076d10fb6360525d
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3039534
Tested-by: Shardar Mohammed <smohammed@nvidia.com>
Reviewed-by: Shardar Mohammed <smohammed@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-24 22:48:05 -08:00
Laxman Dewangan
bf1cfb5fb4 rtcpu: capture-ivc: Enable build for Linux 6.2
The driver of rtcpu/capture-ivc is modified to support
the new APIs of the IVC from core kernel using conftest.

Enable build of this driver.

Bug 4346767

Change-Id: I427bb8b7d5dad02e805d0707fb67e45772fead31
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3033024
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-13 05:40:01 -08:00
Jon Hunter
7f53d7ba3e nvidia-oot: Add options to disable drivers
In Linux v6.2, the Tegra IVC driver was updated to support iosys-map and
this breaks building some of the out-of-tree drivers for Linux v6.2+
kernels. In Linux v6.3, the GPIO OF APIs were removed and this breaks
building some of the out-of-tree drivers that use these legacy APIs. For
now the broken drivers are not built for these corresponding kernels.

Instead of checking the kernel version in the Makefile for the
corresponding broken driver, move the kernel version checking to the
top-level Makefile and add CONFIG definitions that can be used the
various Makefiles.

This is also needed for working with 3rd party Linux kernels that may
have upstream backports and need to set these CONFIG variables for their
Linux kernel.

Bug 4221847

Change-Id: I35ee59bccdcdb1be56e4680c453279b421692c6a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2996215
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-13 15:46:10 -07:00
Ankur Pawar
6038bd9e6c platform: tegra: rtcpu: use upstream icc API
Use devm_of_icc_get() in rtcpu base and debug driver.
CONFIG_TEGRA_T23X_GRHOST, CONFIG_TEGRA_ISOMGR,
CONFIG_TEGRA_BWMGR are not enabled in K5.15 so cleanup
tegra_camera_platform driver.

Don't read memory-bw from rtcpu dt, set it to max
during probe.

Bug 3997304
Bug 4311411

Change-Id: Ib76b3338749de5d33e13cd518375a6b55dd17f5b
Signed-off-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2899021
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Johnny Liu <johnliu@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-13 07:55:59 -07:00
Mika Liljeberg
cac12c4fb7 tegra: rtcpu: signal trace console support
Use new TLV tag to signal that the trace processor supports
console prints. Populate TLV size field for additional range
checking on RCE side.

Bug 3898176

Change-Id: Ie3cd18198ab325eb34fac4803e93019318cf44df
Signed-off-by: Mika Liljeberg <mliljeberg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2845587
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2988237
Reviewed-by: Matti Ryttylainen <mryttylainen@nvidia.com>
Reviewed-by: Viktor Horsmanheimo <viktorh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-12 17:16:54 -07:00
Jon Hunter
ce678a37b1 drivers: Add conftest test for class_create
In Linux v6.4, the module pointer argument is removed from the
class_create() function. Add a test to the conftest script that checks
if this argument for the class_create() function has been removed and
use the definition created by conftest to select which version of the
function is used.

Bug 4183168
Bug 4221847

Change-Id: I440e4b318001886cd0319bb3499ba33178475e8c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2989020
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-05 17:54:05 -07:00
Jon Hunter
02d724565b platform: tegra: rtcpu: Use conftest
Instead of relying on kernel version to determine if the 'remove'
callback for the 'bus_type' structure return an integer or void, add a
compile time test to the conftest.sh script to determine this at compile
time for the kernel being used. This is beneficial for working with 3rd
party Linux kernels that may have back-ported upstream changes into
their kernel and so the kernel version checks do not work.

Bug 4119327

Change-Id: I5457300619f5fb3b6afe61742bc6fce4cbefcd5d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2985719
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-30 06:45:51 -07:00
Shardar Mohammed
4be2dd36bb nvidia-oot: remove module * from class_create()
Remove the module pointer from the class_create() based
on following change in core kernel

======
driver core: class: remove module * from class_create()

The module pointer in class_create() never actually did anything, and it
shouldn't have been requred to be set as a parameter even if it did
something.  So just remove it and fix up all callers of the function in
the kernel tree at the same time.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
=====

Bug 4276500

Change-Id: Ifa0a92a282151ce12dc4a48f4f4b5b9499d3fbd8
Signed-off-by: Shardar Mohammed <smohammed@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2976600
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-08 18:09:50 -07:00
Aniket Bahadarpurkar
3b116f7c1a tegra: rtcpu: use separate thread for reading ivc
Using global work queue and its associated worker
pool to read IVC messages from RTCPU may lead to
capture timeouts if the worker thread is not able
to get cpu due to other higher priority threads in
the system. Hence use a separate RT thread to read
IVC.

Notes for nvidia-oot: 

Use low fifo priority for worker threads to avoid
pre-empting the interrupt thread serving the HSP
driver.

Bug 200643334
Bug 3293029
Bug 3291799
Bug 4084364

Old-Change-Id: I5a3e749ec46fac1c7a2de74968169443f5cab939
Signed-off-by: Aniket Bahadarpurkar <aniketb@nvidia.com>
Signed-off-by: Pekka Pessi <ppessi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2689827
(cherry picked from commit 18d670accc7960b0afbc7b58b339a323e424e010)
Change-Id: I48e22606e53d934d3788d524fd1f496d0f92a04a
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2939796
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Viktor Horsmanheimo <viktorh@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Kalle Jokiniemi <kjokiniemi@nvidia.com>
Reviewed-by: Sudhir Vyas <svyas@nvidia.com>
Tested-by: Viktor Horsmanheimo <viktorh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-25 15:26:25 -07:00
Jon Hunter
926a606226 platform: tegra: rtcpu: Fix frame-size warning
Building the Tegra RTCPU driver generates the following warning ...

 drivers/platform/tegra/rtcpu/tegra-rtcpu-trace.c:
  In function ‘rtcpu_trace_exceptions’:
 drivers/platform/tegra/rtcpu/tegra-rtcpu-trace.c:331:1:
  error: the frame size of 1424 bytes is larger than 1024 bytes
  [-Werror=frame-larger-than=]
  331 | }
      | ^

Allow the frame size to be 2048 bytes to resolve the warning while a
proper fix is implemented.

Bug 4190165

Change-Id: Id684711f036fce759d7a328ad7d63f754a9b46e0
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2938377
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-19 08:47:13 -07:00
Laxman Dewangan
a8454b9a5f rtcpu: remove unused drivers for clk, drive and reset groups
Remove unused module drivers from build as the drivers
are integrated with client driver as single module.
Drivers which are getting removed are:
         clk-group
         device-group
         reset-group

These drivers was restored due to packaging error in
release branch which is fixed now.

Change-Id: I094e62ae2a83eb7816c98bf113c5a74f2636a41f
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2929127
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-30 13:05:59 -07:00
Laxman Dewangan
821e738ecc rtcpu: Add drivers for clk, drive and reset groups
Add the following driver back into build to avoid
the packaging error in release branch to avoid
package error:
     clk-group
     device-group
     reset-group

These drivers will be deleted after release branch is updated
with proper packaging.

Change-Id: I128a3fee5d0fb19c78321845b06deb023f233a59
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2926512
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-27 09:28:50 -07:00
Matti Ryttylainen
f19d5372b4 camera: Switch VI/ISP events to ftrace
* Switch VI frame_begin and frame_end events to produce ftrace traces
instead of eventlib events.
* Switch ISP task_begin and task_end events to produce ftrace traces
instead of eventlib events.
* Add class IDs for VI/ISP
* Switch VI/ISP task_submit events to ftrace

Bug 4080214

Signed-off-by: Matti Ryttylainen <mryttylainen@nvidia.com>
Change-Id: I7776005bb89eaed168c65c62d8aa19c553559fdb
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2911804
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: Jukka Kaartinen <jkaartinen@nvidia.com>
Reviewed-by: Oleg Sikorskiy <osikorskiy@nvidia.com>
Reviewed-by: Ajith Kumar <ajithk@nvidia.com>
Reviewed-by: Sudhir Vyas <svyas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-19 12:28:58 -07:00
Jon Hunter
d20bc7c188 platform: tegra: rtcpu: Combine drivers
The RTCPU driver has a dependency of the following kernel modules:

 clk-group
 device-group
 reset-group

Rather that builds all these source files as individual drivers, which
is bloating the number of kernel modules required, compile these source
files into the main RTCPU kernel module.

Finally, remove any unneeded header files from the ivc-bus driver.

Bug 4078936

Change-Id: I0981a716db7a91556d8c00a291b81dec01dda2e3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2890896
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Matti Ryttylainen <mryttylainen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-15 12:10:26 -07:00
Jon Hunter
19de9797ba platform: tegra: rtcpu: Consolidate Makefiles
Consolidate the RTCPU drivers under a single sub-directory so that a
single Makefile is used to build all these drivers. This also simplifies
the paths for finding the necessary header files.

Bug 4078936

Change-Id: I88e45a2954f759ee0bc8a359bfdf3ef09a55617a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2897318
(cherry picked from commit 320cf14261d1cf8bcf76cbb030186e7391ca8670)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2898616
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-31 11:29:05 -07:00
Jon Hunter
05bfbdef14 platform: tegra: rtcpu: Rename debug driver
The name of rtcpu's debug kernel module, debug.ko, is not very
descriptive and for users it is unclear what subsystem this 'debug'
kernel module is used by. So rename this to 'rtcpu-debug.ko' so that it
is clear this belongs to the camera subsystem.

Bug 4078936

Change-Id: I77da43fb0d54d1ea058f4c3d6c313f49a85b7cfa
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2890897
Reviewed-by: Matti Ryttylainen <mryttylainen@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Tested-by: Ankur Pawar <ankurp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-24 02:47:39 -07:00
Laxman Dewangan
d2b61aaee0 rtcpu: Get rid of explicit header inclusion
The required headers for rtcpu driver are already
included in the master makefile. Hence, it is not
required to add include path explicitly.

Bug 4087103

Change-Id: I9f0e9ea7b951be95bddbbb310c9cbf15cd972775
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2894621
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Pekka Pessi <ppessi@nvidia.com>
Reviewed-by: Matti Ryttylainen <mryttylainen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-27 08:15:10 -07:00
Ankur Pawar
82d83f4250 platform: rtcpu: fix coverity defect
Unchecked return value
CID: 10165906

Bug 3952896

Change-Id: Ie2fc93ed97bbeac57bd210a84222da4102e84478
Signed-off-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2886444
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Matti Ryttylainen <mryttylainen@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-13 22:20:38 -07:00
Frank Chen
be31fa8edb nvidia-oot: Fix sparse errors for camera
Fix below sparse errors:
1. Unused variable.
2. Defined but not used function.
3. Symbol was not declared, should set it to static.
4. No newline at end of file.

Bug 3954363

Change-Id: I3395b66f9acfbf5206713e87063d0e70ad28b4d0
Signed-off-by: Frank Chen <frankc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2878138
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-30 10:32:18 -07:00
Jon Hunter
4630f1b6d9 rtcpu: capture-ivc: Disable for Linux v6.2+
Upstream Linux commit 4c1e0a97351a ("firmware: tegra: bpmp: Use
iosys-map helpers") updated the Tegra IVC driver to use the
iosys-map helpers for Linux v6.2. This causes the Tegra capture-ivc
driver build to fail. Temporarily disable the building of this driver
while this build issue is fixed. Stub functions are added to permit
other drivers that use this driver to build.

Bug 3936429
Bug 3974855

Change-Id: I7a381fa90d92f11ee01d37f0ee7ab230162c5a62
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2861312
Reviewed-by: Rohit Khanna <rokhanna@nvidia.com>
Tested-by: Rohit Khanna <rokhanna@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-28 01:58:45 -08:00
Frank Chen
dd1d0b6c70 drivers: camera: fix Coverity warnings
Fix camera kernel drivers for the below warnings:

CID 10165214: Unchecked return value (CHECKED_RETURN)
CID 10165215: Unchecked return value (CHECKED_RETURN)
CID 10160154: Unsigned compared against 0 (NO_EFFECT)

Bug 3952896

Change-Id: I82727b5c298d0c39ebba2ae60f6ed76321272ff5
Signed-off-by: Frank Chen <frankc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2858894
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vincent Chung <vincentc@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2023-02-22 00:43:56 -08:00
Pekka Pessi
8c3deebf44 rtcpu: export capture tracepoints
Bug 3960871

Signed-off-by: Pekka Pessi <ppessi@nvidia.com>
Change-Id: If805ddaf94fb2a22f056ed450414f449b601fcc7
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2855234
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Matti Ryttylainen <mryttylainen@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-17 07:25:14 -08:00
Ashish Mhetre
ff7d0cc87c platform: tegra: rtcpu: Fix cache sync APIs
For dma mappings done with dma_map_sg() calls, dma_sync_sg* calls are
required in order to make sure that caches for all the scattered
addresses are synced. Using dma_sync_single* call for syncing caches
can access address which is not mapped by dma_sync_sg() and cause kernel
exceptions.
Fix this by using correct cache sync calls for appropriate dma mapping
APIs.

Bug 3879036

Change-Id: I30afcf17806c505d94ff4eb7faefab5fbbf9e7b9
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
Signed-off-by: Matti Ryttylainen <mryttylainen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2839838
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Pekka Pessi <ppessi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-04 00:55:14 -08:00
Pekka Pessi
14032c34fb rtcpu: capture-ivc: fix NULL check in tx
Move NULL check away from tracing wrapper.

CID 587876

Bug 3745813
Bug 3597603

Signed-off-by: Pekka Pessi <ppessi@nvidia.com>
Change-Id: Ibbdc4eae796f8633ab1c731d6dcaf49fd1d7023a
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2844424
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-01-17 10:56:20 -08:00