Commit Graph

32 Commits

Author SHA1 Message Date
Jon Hunter
eaa2a1abe1 media: camera: cdi-mgr: Simplify i2c_board_info init
In Linux v6.16, the 'of_node' structure was removed from the
'i2c_board_info' structure and the 'cdi-mgr' driver fails to build.
Although it is possible to detect whether the 'i2c_board_info' structure
has the 'of_node' structure using conftest, the 'cdi-mgr' driver does
not even use this. Therefore, it is simpler to fix this by using memset
and strncpy to initialize the 'i2c_board_info' structure and this also
aligns the camera 'cdi-mgr' driver with the camera 'isc-mgr' driver that
initializes the 'i2c_board_info' structure in this way.

JIRA LINQPJ14-60

Change-Id: I1d9df0fb1ccea3d303f256f65d187a131b7352ad
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3374654
(cherry picked from commit 30cad15a2e832ad445003911a76627fb18f91b49)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3461876
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
2025-10-01 15:27:53 -07: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
Junghyun Kim
7b863e3e09 kernel: cdi: Update fsync logic
CIM version 3 for Ferrix is added in DT which can be used to select
GPIO port number of IO expander to control the multiplexer for
each deserializer

Bug 5163582

Change-Id: I3ce608be9f5c18af005e1bc6fea9c73daeef7995
Signed-off-by: Junghyun Kim <juskim@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3342728
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mohit Ingale <mohiti@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Chinmay Mahajan <cmahajan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:19 +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
mijia
5ad213c183 kernel: nvidia-oot: Fix Linux KMD coverity defects
Fix INT32-C  INT32-Cand INT08-C coverity defects
for cdi_mgr.c and tegracam_ctrls.c.

JIRA CAMERASW-32529

Change-Id: I97f915f94264d78ae8e493874ccf889c9183fc93
Signed-off-by: mijia <mijia@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3314543
Reviewed-by: Sudhir Vyas <svyas@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Tested-by: Patrick Young <payoung@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: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
ryanli
7c4412a765 kernel: nvidia-oot: Static Analysis for S01/08 P11
Fix CERT STR07-C coverity defects for cdi_mgr.c tegra_rtcpu.h

Jira CAMERASW-30850

Change-Id: I86c4cec8cdda2a1f16d5ca7ea7fbeed3a0318ad1
Signed-off-by: ryanli <ryanli@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3282774
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@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
yangxu
a972eca4b6 kernel: nvidia-oot: Fix KMD coverity defects
Fix coverity defects
ARR38-C
STR07-C
INT30-C
INT08-C
ARR30-C

Jira CAMERASW-30853

Change-Id: I2e98db911238dca46f142f108f6563321e25b588
Signed-off-by: yangxu <yangxu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3281801
Reviewed-by: Sudhir Vyas <svyas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Xiaoming Xiang <xxiang@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Praveen AC <pac@nvidia.com>
2025-07-24 10:19:14 +00:00
Zhiyuan Wang
82af289c71 kernel: nvidia-oot: Fix Linux KMD coverity defect
Fix STR31-C ad STR07-C for
- drivers/media/platform/tegra/cdi/cdi_gpio.c
- drivers/media/platform/tegra/cdi/cdi_mgr.c

Jira CAMERASW-30856

Change-Id: I40d2c1b47b83d2dbc6102229dd67225e1a9156ab
Signed-off-by: Zhiyuan Wang <zhiwang@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3281931
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Ajith Kumar <ajithk@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@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
Junghyun Kim
ea5440f147 cdi: Add fsync_ctrl_port variable
Parse fsync_ctrl_port property in DT to overwrite
FSYNC control GPIO port of IO expander

JIRA CAMERASW-29219

Change-Id: I2311739d0460ad0601e1e40990201a4c0fd01ded
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233562
Tested-by: Justin Kim (SW-TEGRA) <juskim@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Chinmay Mahajan <cmahajan@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
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
Junghyun Kim
076b6e793c media: camera: Remove power control in release API
cdi_mgr_power_down() is used to control Des's power which is dup of
the power control logic in release API.
Remove the Des's power control in release API

Bug 4704962

Change-Id: I472e5cea02f0adaab74689b4425fc08c612199b0
Signed-off-by: Junghyun Kim <juskim@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3181211
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
2024-08-01 19:05:39 -07:00
Jon Hunter
27bc2f4757 media: camera: cdi-mgr: Fix crash freeing GPIOs
When booting Linux v6.10-rc5 on Tegra234 the CDI MGR driver was failing
to setup the GPIOs. If the driver fails to setup the GPIOs then we
expect the probe of the driver to fail. However, in this case when the
probe failed, it then crashed the kernel completely and the following
crash log was observed ...

 cdi-mgr sipl_devblk_3: cdi_mgr_configure_gpios Failed to allocate gpio
  desc
 cdi-mgr sipl_devblk_3: cdi_mgr_probe(): GPIO setup failed
 Unable to handle kernel NULL pointer dereference at virtual address
  0000000000000300
 ...
 Call trace:
  rt_spin_lock+0x24/0xa8
  devres_remove+0x38/0x174
  devres_release+0x1c/0x80
  devm_gpiod_put+0x24/0x4c
  cdi_delete_lst+0x18c/0x1200 [cdi_mgr]
  cdi_mgr_debugfs_init+0x608/0x11b0 [cdi_mgr]
  platform_probe+0x64/0xec
  really_probe+0xb8/0x284
  __driver_probe_device+0x74/0x12c
  driver_probe_device+0x38/0x114
  __driver_attach+0x74/0x13c
  bus_for_each_dev+0x74/0xf0
  driver_attach+0x20/0x30
  bus_add_driver+0xe4/0x20c
  driver_register+0x5c/0x130
  __platform_driver_register+0x24/0x34
  init_module+0x1c/0x1000 [cdi_mgr]
  do_one_initcall+0x44/0x2e8
  do_init_module+0x58/0x1f8
  load_module+0x1b94/0x1cf8
  init_module_from_file+0x84/0xc8
  __arm64_sys_finit_module+0x1b8/0x270
  invoke_syscall+0x40/0x11c
  el0_svc_common.constprop.0+0xc4/0xe4
  do_el0_svc+0x18/0x28
  el0_svc+0x30/0xe0
  el0t_64_sync_handler+0xc8/0xcc
  el0t_64_sync+0x16c/0x170
 Code: b9447420 d503201f 91006262 d2800000 (c8e07c41)
 ---[ end trace 0000000000000000]---

The problem is that the CDI MGR allocated the gpio descriptors by
calling the function devm_fwnode_gpiod_get_index(). This function
returns an ERR_PTR() on failure. When this does fail and cdi_mgr_del()
is called to clean-up, this does not check to see if the descriptor
IS_ERR(), but simply check if it is NULL or not, which is not correct.
Hence, we end up calling devm_gpiod_put() for an invalid descriptor and
the above crash is observed. Given that we are calling
devm_fwnode_gpiod_get_index() to allocate the descriptor, it is not
necessary to call devm_gpiod_put() at all, because the kernel will
automtically call this for us. Therefore, fix this by removing the call
to devm_gpiod_put() completely.

Please note that although this was caught with Linux v6.10-rc5, this is
applicable to all kernel versions.

Bug 4627271

Change-Id: I576a984ebaaeea590c5acea1b489284379832ae9
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3148004
Reviewed-by: Frank Chen <frankc@nvidia.com>
2024-07-12 22:38:49 -07:00
Junghyun Kim
74316123dc media: camera: Update device creation
Use %d instead of %x to match with the number used in cdi

Bug 4704962

Change-Id: I911b6596ba1efcef3ad9a0d0c0056ac430fcea6c
Signed-off-by: Junghyun Kim <juskim@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3163825
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Chinmay Mahajan <cmahajan@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Igor Mitsyanko <imitsyanko@nvidia.com>
2024-07-03 14:05:09 -07:00
Prathamesh Shete
1a85000f63 cdi_mgr: pass parent node instead of child
Bug 4704962

Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
Change-Id: Ib18f1de8e129916036913ec25bf5300d6f19def4
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3149773
Tested-by: Justin Kim (SW-TEGRA) <juskim@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Chinmay Mahajan <cmahajan@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
2024-07-03 14:05:01 -07:00
Laxman Dewangan
6627276f82 {isc,cdi}_mgr: Use gpiod_count() for getting number of GPIO
The API gpiod_count() returns the number of the GPIO in given
property. This API is supported from long and continue to
support.

Use this API instead of of_gpio_named_count() which is deprecated
from Linux 6.2.

Bug 4387902

Change-Id: I2b647b8645e0dd8ff743515ac999fe035e636dc5
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3035503
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-15 15:06:09 -08:00
Jon Hunter
75c908beb6 media: camera: Remove devm_fwnode_get_gpiod_from_child
The function devm_fwnode_get_gpiod_from_child() was removed in Linux
v6.2. This function has always called devm_fwnode_gpiod_get_index() and
this was first introduced in Linux v5.5. Therefore, remove
devm_fwnode_get_gpiod_from_child() and always use
devm_fwnode_gpiod_get_index().

Bug 4346767

Change-Id: Ie94a20ffda67569962fa48d7104c8ff706be079d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3034777
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-15 14:54:12 -08:00
Jon Hunter
891d093a76 media: camera: Use conftest for devnode
Use confest in the camera CDI and ISC drivers to determine if the
'devnode' function pointer under the class structure to take a const
device struct.

Also fix the commit in conftest that introduced the change to the
'devnode' function pointer.

Bug 4346767

Change-Id: I66de39e079c13219e0ff3e7154c0e7ceb609a29d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3034763
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-15 14:54:00 -08:00
Laxman Dewangan
9174561352 cdi_mgr: Enable build of cdi_mgr for Linux 6.2
The build of cdi_mgr driver was disabled for Linux 6.2
as there is change in API in core kernel.

Enable build of cdi_mgr driver with appropriate modification
in driver for Linux 6.2.

Bug 4346767

Change-Id: I6315482b593926e1382a0ffc9ca8aa9a27740d11
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031551
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-12 09:15:52 -08: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
Ian Kaszubski
6e4e41ce95 media: tegra: cdi-mgr: Fix deser power down IOCTL
Add missing power down implementation for the
CDI_MGR_IOCTL_DISABLE_DES_POWER ioctl.

Bug 4148683

Change-Id: I3c25ac9cdde8c7799cd60a3a78590f24637d4c7e
Signed-off-by: Ian Kaszubski <ikaszubski@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2962131
(cherry picked from commit befa29f775ca44a058a2c460f02ac0f77807c78d)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2943106
Reviewed-by: Vincent Chung <vincentc@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
Reviewed-by: Justin Kim (SW-TEGRA) <juskim@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-01 12:50:28 -07:00
Aniket Bahadarpurkar
3e51976226 tegra: cdi: Add delay while setting gpio
On p3898 platform, VCC_CAM can't handle high
inrush current when gpios are set in parallel.
Hence, a SW WAR is required to add a delay of 5ms
after a gpio is set.

Bug 4125801

Change-Id: Ib235cb00b5ef42c7255be5d212dd9e190630d7bc
Signed-off-by: Aniket Bahadarpurkar <aniketb@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2943541
(cherry picked from commit 6e44996aae022c9e46fb431b75d60c8499bcd874)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2953356
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
2023-08-16 18:39:52 -07:00
Vincent Chung
c7f12c1ae6 media: tegra: cdi-mgr: fault code for tmr eq fail
Add the CDI_MGR_GPIO_INTR_FAULT code, and emit it when interrupt timer
enqueue fails.

Jira CAMERASW-11945

Bug 3902416

Change-Id: I7459c2bd7160cf8552007a0e299ad1f2a1f47b1f
Signed-off-by: Vincent Chung <vincentc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2901738
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-12 04:58:08 -07:00
Vincent Chung
be01df015d media: tegra: cdi-mgr: support interrupt timeouts
Add support for configurable interrupt timers and event notification
queues to SIPL Device Block to mirror the CDAC (QNX) pulse channel
interface.

The CDI_MGR_IOCTL_INTR_CONFIG IOCTL is added to set the timeout
duration at initialization, and existing GPIO interrupt code is
refactored.

Also removes the GPIO index limitation to the range of [0,31] by
returning the complete indices one at a time instead of a bit flag.

Jira CAMERASW-11100
Jira CAMERASW-11385
Jira CAMERASW-9366

Bug 3902416
Bug 3792904

Signed-off-by: Vincent Chung <vincentc@nvidia.com>
Change-Id: I62b6c0bd8be18922ab1fe5d40485a69274f2a18e
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2893327
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-28 16:37:36 -07:00
Junghyun Kim
b8817415d5 drivers: media: CDI: Add Des's power control
Add the new IOCTL command to control the deserilaizer's PWDN signal
instead of enabling it when CDI root opens

Bug 3879569

Change-Id: Ia07c3b4266e1f137d197af130fb2bf12e52a1767
Signed-off-by: Junghyun Kim <juskim@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2835141
(cherry picked from commit 29fb31dad2e63d2669a6a6eb5c2751092b7097e2)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2847959
(cherry picked from commit bd9766952be10722f4cc6a17ff582005b3138b08)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2854722
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Mohit Ingale <mohiti@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
2023-02-10 06:15:21 -08:00
Frank Chen
7514ddd6c0 media: camera: Fix CDI MGR driver for Linux v6.2
Upstream Linux kernel commit ff62b8e6588f ("driver core: make struct
class.devnode() take a const *") updated the 'devnode' function pointer
under the class structure to take a const device struct. This breaks
building the Tegra CDI MDR driver with Linux v6.2. Make the
necessary changes to the CDI MGR driver to fix the build breakage.

Also update CDI MGR GPIO code since devm_fwnode_get_gpiod_from_child()
is deprecated in Linux v6.2. Switch to use devm_fwnode_gpiod_get_index()
for Linux v6.2.

Bug 3936429

Change-Id: I327ebe1fa42d89a63e0b483d3ce1ff1b8b168532
Signed-off-by: Frank Chen <frankc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2843858
Reviewed-by: Ian Kaszubski <ikaszubski@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-01-18 10:20:02 -08:00
Junghyun Kim
9269dac3ec drivers: media: CDI: Add IO Expander support
Add IO Expander support in CDI Dev to control the FRSYNC multiplexer
with the speicific platform

Bug 3582660

Change-Id: I3ee376e7a0bccabcfa16efb228879d4df0d65748
Signed-off-by: Junghyun Kim <juskim@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2727256
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2824551
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-13 06:27:42 -08:00
Frank Chen
3c67831fe8 media: camera: fix driver errors for kstable
Fix CDI and ISC driver errors when building for kstable (6.0.0)

Bug 3831575

Change-Id: Ie37be0dbe9c579ec396006fb466125b1e7e77e3f
Signed-off-by: Frank Chen <frankc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2821524
Reviewed-by: Igor Mitsyanko <imitsyanko@nvidia.com>
Reviewed-by: Justin Kim (SW-TEGRA) <juskim@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-06 04:52:19 -08:00
Frank Chen
9ad6f3c84e media: camera: Build CDI as OOT module
Convert automotive CDI kernel driver to OOT module.

Jira CAMERASW-7592

Change-Id: Ib19ee594cc65f8041f6eba9aff7faefb753b771b
Signed-off-by: Frank Chen <frankc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2780572
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-10-04 05:17:35 -07:00