Commit Graph

32 Commits

Author SHA1 Message Date
fraunak
59fa283238 camera: Add ISP floorsweeping support to Linux
This commit implements T264 ISP floorsweeping functionality in the Linux
kernel driver, extending the existing RCE firmware implementation to
provide transparent ISP unit redirection at the kernel level.

Changes:
- Add isp_capture_query_availability_mask_probe() function to query ISP
  availability mask from RCE firmware during driver probe via IVC
- Add isp_capture_find_first_available() helper function to find the
  first available ISP unit from a bitmask for HW assignment
- Integrate floorsweeping logic into isp_get_nvhost_device() to handle
  SW-to-HW ISP unit mapping with thread-safe assignment
- Add isp_capture_get_capabilities() function to expose ISP availability
  to userspace via new IOCTL (ISP_CAPTURE_GET_CAPABILITIES)
- Add probe-time caching of ISP availability mask to avoid repeated IVC
  queries during runtime
- Add comprehensive error handling and safety mechanisms for unknown
  configurations

Implementation details:
- Uses CAPTURE_ISP_FUSE_QUERY_REQ/RESP IVC messages for querying RCE
- Maintains SW-to-HW ISP unit mapping array protected by mutex
- The SW-to-HW mappings persist for the driver's lifetime, given that
  multiple channels make use of the same SW unit ID's and we do not
  have tracking of all open channels during runtime
- Integrates with existing ISP setup flow before buffer allocation
- Maintains backward compatibility with non-T264 hardware
- Conservative approach: blocks requests when no ISP units are available

Floorsweeping logic (handled by RCE firmware, exposed as bitmask):
- Mask bit N set = ISP N available (not fused off)
- Mask bit N clear = ISP N fused off (unavailable)
- Examples:
  - 0x3 (0b11): Both ISP0/ISP1 available (no floorsweeping)
  - 0x1 (0b01): Only ISP0 available → all requests map to ISP0
  - 0x2 (0b10): Only ISP1 available → all requests map to ISP1
  - 0x0: No ISP units available (block all requests)

Benefits:
- Transparent operation for applications using fusacapture library
- Automatic ISP unit redirection without API changes
- Improved hardware yield by supporting single-ISP configurations
- Robust error handling and safety mechanisms
- Minimal performance overhead with probe-time caching

The implementation complements the existing RCE firmware floorsweeping
support and provides a complete end-to-end solution for T264 ISP
floorsweeping across all software layers.

Bug 5640706

Change-Id: If85ee3178e857394300479dd42e636f5f5d3bd23
Signed-off-by: fraunak <fraunak@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3491180
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Evgeny Kornev <ekornev@nvidia.com>
Reviewed-by: Kalle Jokiniemi <kjokiniemi@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Tested-by: Akihiro Mizusawa <amizusawa@nvidia.com>
2025-11-25 13:12:39 -08:00
Mark Stephen Krueger
872a72234a kmd: trigger RCE snapshot on timeout
Jira CAMERASW-32243

Change-Id: I529a0d39990f6a20ff9780089383deebe22e2741
Signed-off-by: Mark Krueger <mkrueger@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3355776
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Ying Zhou <yizhou@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Mohit Ingale <mohiti@nvidia.com>
2025-07-24 10:20:35 +00:00
zyi
c71ca8521c kernel: nvidia-oot: fix TAINTED_SCALAR
Fix TAINTED_SCALAR static analysis:
- camera/fusa-capture/capture-isp-channel.c

New violations are in
fusa_kmd: delta per rule
=======================================================
New :
=======================================================
Total new violations : 0
=======================================================
Fixed:
 -       TAINTED_SCALAR:  -3 defects
 - MISRA C-2012 Directive 4.14:  -3 defects
=======================================================
Total fixed violations : -6
=======================================================

Jira CAMERASW-33480

Change-Id: I428982ba33a26dcd5bb66e7b9a13ea689d7a8d1f
Signed-off-by: Yi Zhang <zyi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3363100
Tested-by: Mike Jia <mijia@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Yang Xu <yangxu@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: Divyash Kumar <divyashk@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mike Jia <mijia@nvidia.com>
2025-07-24 10:20:35 +00:00
Xiaoming Xiang
b081602754 fuzz: nvidia-oot: fix syzkaller fuzz test crash
fix cdi and fusa kmd module crash

Jira CAMERASW-30661

Change-Id: I78b49a5f0d65f7c69ff1f1a8b746c4091d4adeb7
Signed-off-by: Xiaoming Xiang <xxiang@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3337853
Reviewed-by: Ming Chang (SW-TEGRA) <mingchang@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Patrick Young <payoung@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
2025-07-24 10:19:19 +00:00
Mohit Ingale
a8bff2c6e5 camera:kmd replace WARN/WARN_ON usage
Replace use of WARN or WARN_ON kernel with dev_warn to improve logging
behavior. This change ensures that error conditions are reported with
clear informative messages rather than kernel stack traces that can
flood logs.

Additional information:
- The files `drivers/platform/tegra/rtcpu/debug.c` and
  `drivers/platform/tegra/rtcpu/hsp-combo.c` present in the original
  codebase were deleted as part of unrelated refactoring in the
  target repository; hence, changes related to these files in the
  patch were not applied.
- Additional changes are done to replace WARN_ON at other places.

Bug 4719119

Change-Id: Id12f1b4de77f8b007b557de140257a3bd7478b52
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/3308911
Signed-off-by: Mohit Ingale <mohiti@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3352892
Reviewed-by: Jagadeesh Kinni <jkinni@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vincent Chung <vincentc@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
2025-07-24 10:19:19 +00:00
kevixie
04fdeac230 nvidia-oot: CameraSW: KMD SWUD update
+ Use CameraDoxygenWorkflowV1_02182025 to generate
  SWUD doxygen headers for functions in FusaCap KMD
  and RTCPU
+ Use Cursor Agent to generate SWUD doxygen headers
  for FusaCap capture-vi.c

Jira CAMERASW-32271

Change-Id: Ida6b94d6ffea3df593fa793cc4b9a150c87187ba
Signed-off-by: kevixie <kevixie@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3313956
Reviewed-by: Mohit Ingale <mohiti@nvidia.com>
Reviewed-by: Jagadeesh Kinni <jkinni@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:18 +00:00
Junsheng Chen
90b244eb03 linux: kmd: static analysis TOP25 S03/05 Part 4
Under the following path:
- drivers/media/platform/tegra/camera/camera_common.c
- drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c
- drivers/media/platform/tegra/camera/fusa-capture/capture-vi.c
- drivers/media/platform/tegra/camera/sensor_common.c
- drivers/media/platform/tegra/camera/tegracam_core.c
- drivers/media/platform/tegra/camera/tegracam_utils.c
- drivers/media/platform/tegra/camera/vi/graph.c

Jira CAMERASW-32528

Change-Id: I8f3bb839dfe6e61928642f0ca32bcaf972d6c84a
Signed-off-by: Junsheng Chen <junshengc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3314084
Reviewed-by: Shan Neng Chen <snchen@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Zhiyuan Wang <zhiwang@nvidia.com>
2025-07-24 10:19:16 +00:00
Akihiro Mizusawa
cb4fd77199 host: isp: Deprecate nvhost syncpt APIs
Replace Nvhost syncpt APIs with host1x equivalents in the ISP
host1x driver and the ISP channel driver.
Note the WAR to include host1x-next.h before nvhost.h. The nvhost.h
header will be deprecated in the future.

Bug 4922416

Change-Id: I2dd298d60e1a55fe7a0cbb3ae804f5aa3b5d3610
Signed-off-by: Akihiro Mizusawa <amizusawa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3300668
Reviewed-by: Chinniah Poosapadi <cpoosapadi@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: FNU Raunak <fraunak@nvidia.com>
2025-07-24 10:19:16 +00:00
Mohit Ingale
794163ce8e media: tegra: Conditionally disable L4T-specific drivers in embedded Linux builds
This change adds conditional compilation blocks to disable L4T-specific
camera and multimedia drivers when building for embedded Linux platforms.
Key changes include:

- Add ifneq ($(NV_BUILD_SYSTEM_TYPE),embedded-linux) checks in multiple
  Makefiles to exclude L4T-specific components
- Introduce NV_IS_L4T define to conditionally include L4T functionality
- Reorganize header includes to support both L4T and embedded Linux builds
- Conditionally wrap L4T-specific struct members and function calls
- Update module dependencies (cdi_mgr now depends on cdi_dev instead of cdi_pwm)

Jira CAMERASW-32251

Change-Id: I934fdd0188e914c07b456c0f6ad379d2a08555ca
Signed-off-by: Mohit Ingale <mohiti@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3294869
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Anubhav Rai <arai@nvidia.com>
Reviewed-by: Jagadeesh Kinni <jkinni@nvidia.com>
Reviewed-by: Vincent Chung <vincentc@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
2025-07-24 10:19:15 +00:00
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
yangxu
2a4976233f kernel: nvidia-oot: Fix KMD coverity defects(6)
Fix coverity defects
NULL_RETURNS
INT08-C
INT30-C
EXP34-C

Jira CAMERASW-30853

Change-Id: If9617a18367830eaa3fa3eed102c4a2214d869d2
Signed-off-by: yangxu <yangxu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3285360
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Praveen AC <pac@nvidia.com>
Tested-by: Patrick Young <payoung@nvidia.com>
Reviewed-by: Sudhir Vyas <svyas@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
2025-07-24 10:19:14 +00:00
Junsheng Chen
6fb5af66eb linux: kmd: static analysis S01/08 part 4
Under the following path:
- drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c
- drivers/media/platform/tegra/camera/camera_common.c
- drivers/media/platform/tegra/camera/csi/csi.c

Jira CAMERASW-30848

Change-Id: If9d04481371f28d6fe962291f1f950f6b31aa635
Signed-off-by: Junsheng Chen <junshengc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3281688
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Zhiyuan Wang <zhiwang@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
2025-07-24 10:19:13 +00:00
Yuyuan Chen
ff7cf02ef2 kernel: nvidia-oot: Fix Static issues S12/11
Jira CAMERASW-30258

Change-Id: I5fd26611f6bac71ec186458a583622b55ba8735e
Signed-off-by: Yuyuan Chen <yuyuanc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3262275
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ryan Li <ryanli@nvidia.com>
2025-07-24 10:19:13 +00:00
Junsheng Chen
cd6a1c3a7d linux: kmd: static analysis S12/11 part 4
Under the following path:
- drivers/media/platform/tegra/camera/fusa-capture/capture-common.c
- drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c
- drivers/media/platform/tegra/camera/fusa-capture/capture-vi.c
- drivers/media/platform/tegra/camera/tegracam_utils.c
- drivers/media/platform/tegra/camera/vi/core.c

Jira CAMERASW-30251

Change-Id: Iec7c29a184a060b8e7f44f3614bcbc9f8182aea6
Signed-off-by: Junsheng Chen <junshengc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3270228
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>
Reviewed-by: Ankur Pawar <ankurp@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
Yuyuan Chen
188b622e75 kernel: nvidia-oot: Fix Static issues S11/27
Fix TAINTED_SCALAR and Directive 4.14

Jira CAMERASW-29899

Change-Id: I1712d392b8271be0db912d536027d960f343e3fe
Signed-off-by: Yuyuan Chen <yuyuanc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3273387
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Ryan Li <ryanli@nvidia.com>
2025-07-24 10:19:13 +00:00
Rakibul Hassan
6087c01f5d nvidia-oot: camera: isp: track stats syncpt
This change corrects the logic for tracking stats syncpoint
threshold.

In UMD, IspNg sets flag stats_aidx_flag per stats block enabled.
In RCE, this is copied over to the task descriptor as
stats_action_mask.
In Falcon, this mask is used to determine how many times the
stats syncpoint shall be incremented.

This change fixes the logic in isp_capture_request to have the
threshold be based on the same flag from IspNg, by reading it
from the program buffer.

Bug 4990722

Change-Id: I8991a2282e522d4e611e877b6be115dab27ebb63
Signed-off-by: Rakibul Hassan <rakibulh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3265594
Reviewed-by: Vincent Chung <vincentc@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jagadeesh Kinni <jkinni@nvidia.com>
2025-07-24 10:19:12 +00:00
Rakibul Hassan
652c032bb5 nvidia-oot: camera: isp: track syncpt threshold
This change does the following:
 - Keep the capture progress syncpt threshold up to date by
   incrementing it when a capture request is made
 - Fast forward the syncpoints via host1x api on reset

Bug 4882047

Change-Id: If971bf4f248bd7a0be6a79ccb0e124f2768c0af4
Signed-off-by: Rakibul Hassan <rakibulh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3248427
(cherry picked from commit cbac4a12165c2d19f9f5889cbeffffb3b63e54d0)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3253387
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
Reviewed-by: Justin Kim (SW-TEGRA) <juskim@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:11 +00:00
Jon Hunter
ff48ee63b1 drivers: Fix MODULE_IMPORT_NS for Linux v6.13
In Linux v6.13, commit cdd30ebb1b9f ("module: Convert symbol namespace
to string literal") updated the MODULE_IMPORT_NS macro to take a string
literal as an argument in Linux v6.13. Use conftest to detect if
MODULE_IMPORT_NS takes a string literal as an argument and update the
various drivers accordingly.

Bug 4991705

Change-Id: I8f34860648965dc2334e2916d5404522510778ff
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3263798
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:11 +00:00
ayush
e22e088b96 oot: Fix error handling in isp_capture_setup
This patch implements the following improvements:
1. Add proper NULL pointer checks to prevent dereferencing
   NULL pointers
2. Break down the isp_capture_setup function into smaller, more
   manageable chunks to improve readability and error handling
3. Consistently set error codes before jumping to failure handling
4. Standardize the use of goto statements for error cases
5. Improve error logging using dev_err() to provide more context
   for debugging

Bug 4778298
Jira CAMERASW-27054

Change-Id: I62ff4868b81107ac41e8561729cf1b9bede6c909
Signed-off-by: ayush <ajef@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3220092

(cherry picked from commit 905ff68fe62a42685a97402e58a1fa3cbcab28f4)

Change-Id: I7ec8f31ce058f2658d776080c62e44dd5b190463
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3250557
Tested-by: Ayush Jef <ajef@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
2025-07-24 10:19:10 +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
Aki Niemi
462a2ca50f camera: Fix ISP channel release and reset
ISP channels are not released cleanly if the IVC send for
CAPTURE_CHANNEL_ISP_RELEASE_REQ were to fail, leaving the
rest of the release steps undone, including unregistering
the capture and control callbacks. This will prevent any
new channel setups, e.g., after an app restart, because
the channel is deemed busy.

Another problem with ISP channel release is that were the
aforementioned IVC sends to fail, the driver will not
attempt an RCE reboot to recover the IVC communications.

Similarly, if the channel reset IVC request fails or
returns an error, the pending capture and program buffers
won't be unpinned and their related waits won't be
completed.

This fix always performs the cleanups regardless of the
fate of the control channel requests.

Bug 4623451
Bug 4765177

Change-Id: I41ada4bc7dcc72676170d3d30515b5e741120252
Signed-off-by: Aki Niemi <aniemi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3192586
(cherry picked from commit feb2be84d1077bec942825bf3cbffc58729f0560)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3219711
Reviewed-by: Ganesh Ram Savithri Sreenivas Murthy <ganeshrams@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vincent Chung <vincentc@nvidia.com>
Reviewed-by: Mohit Ingale <mohiti@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Tested-by: Mohit Ingale <mohiti@nvidia.com>
2025-07-24 10:19:07 +00:00
Matti Ryttylainen
5f010bd073 camera: Fix ISP prefence address calculation
If syncpoint_info is on page boundary the address
calculation for where to write syncpoint address
wraps to beginning of the page. Fix ISP prefence
syncpoint address calculation on page boundary.

Bug 4811006

Change-Id: I8b5b39c9ad55ff5b7c4d365588e27282258191d9
Signed-off-by: Matti Ryttylainen <mryttylainen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3199341
Reviewed-by: Akihiro Mizusawa <amizusawa@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:07 +00: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
Akihiro Mizusawa
1f825ee8cd oot: capture-isp: Add h2 surface
Add h2 surface pinning in the capture-isp driver.
Also add image_def_mr2 to capture descriptor.

Jira CT26X-1728
Bug 4716542

Change-Id: Ib1657e7cebb335e78fb4eed855a6dad309c397f7
Signed-off-by: Akihiro Mizusawa <amizusawa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3164329
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Chinniah Poosapadi <cpoosapadi@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
2024-07-17 06:09:19 -07:00
Akihiro Mizusawa
1f2ef6588e video: tegra: add support for T264 isp
Move capture-isp-channel registration from host to
capture-isp driver.

Make tegra-capture-isp a separate driver module.

Implement support for T264.

Add isp_unit affinity to ISP_CAPTURE_SETUP ioctl.

CT26X-468
CT26X-469
CT26X-467
CT26X-466
CT26X-464
CT26X-465

Change-Id: If644d6aa0ad1b12d34457dc94249ed09f9f9f720
Signed-off-by: Akihiro Mizusawa <amizusawa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3095788
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Chinniah Poosapadi <cpoosapadi@nvidia.com>
2024-07-16 02:04:36 -07:00
Akihiro Mizusawa
c37b941d16 fusa-capture: create standalone capture-isp driver
This change converts the capture-isp driver to
independent module which can be probed. This is
needed as per 2nd ISP Design for associating ISP
processing channels with right ISP unit.

JIRA CT26X-462
Change-Id: I720714b5221833c7df5cd56febd213ea6db02c48
Signed-off-by: Akihiro Mizusawa <amizusawa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3095787
Reviewed-by: Chinniah Poosapadi <cpoosapadi@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2024-07-16 02:04:32 -07:00
Jon Hunter
cb8b9f5a53 drivers: Fix missing vmalloc.h for Linux v6.10
Upstream commit 690da22dbfa8 ("asm-generic/io.h: kill vmalloc.h
dependency") removed the vmalloc.h header file from io.h and this breaks
building various drivers with the latest -next kernels. Fix this
by ensuring vmalloc.h is included and in most cases slab is not actually
needed and so remove this where possible. Note that it is fine to make
this change for all current supported kernels.

Bug 4593750

Change-Id: I003d1302bda226d356467e6ede99949b2716940a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3141984
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-05-22 09:19:24 -07:00
Jon Hunter
214beca091 drivers: Add compilation flag for iosys-map.h
Determining whether the header file iosys-map.h is present in the kernel
is currently determine by kernel version. However, for Linux v5.15,
iosys-map.h has been backported in order to support simple-framebuffer
for early display. Therefore, we cannot rely on the kernel version to
indicate whether iosys-map is present. This is also true for 3rd party
Linux kernels that backport changes as well. Fix this by adding a
compile time flag, that will be set accordingly by the conftest script
if this header is present.

Bug 4119327
Bug 4228080

Change-Id: Ibd814285b2a07932ede2fbe9e6dc8fd03039d0c3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2971954
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-12 22:12:04 -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
c86c642f5b media: camera: Fix build for Linux v5.16+
Building the Tegra camera drivers with Linux v5.16+ kernels fail because
the driver does not use the correct kernel version for handling various
API changes in upstream. Update ther kernel version appropriately so
that the camera drivers can build with Linux v5.16+ kernels.

Change-Id: I4c110d12f554fd4aa757a1aa9a42a81be5a87ae6
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2831219
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-01-04 06:51:52 -08:00
Frank Chen
92ac7bc35a media: camera: Build tegra-camera as OOT module
Port camera drivers below from /kenrel/nvidia to
/kernel/nvidia-oot as OOT modules:
- Fusa-capture driver
- Tegra V4L2 framework driver
- vi/csi driver
- tegra camera platform driver

Change-Id: I390af27096425bb11e0934201dd1a90f001bb3fa
Signed-off-by: Frank Chen <frankc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2780698
Reviewed-by: FNU Raunak <fraunak@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-13 06:15:42 -08:00