media: camera: v4l2-compliance fix

Fix v4l2-compliance VIDIOC_G/S_PARM failure.
Below is the function call sequence starting from
ioctl.
doioctl(VIDIOC_G_PARM)
vidioc_g_parm
tegra_channel_g_parm
v4l2_g_parm_cap
v4l2_subdev_call_state_active
v4l2_subdev_call
v4l2_subdev_call_wrappers.pad.get_frame_interval
call_get_frame_interval
check_frame_interval
check_state

In file: v4l2-subdev.c check_state() function
failed at check:
(!state || !state->pads)
Which caused the function to return -EINVAL=-22.

struct v4l2_subdev contain a member
active_state which should be initialized to
overcome the failure. To fill active_state
call v4l2_subdev_init_finalize in
tegracam_v4l2subdev_register().

This failure is seen in K6.8 because in earlier
kernel, v4l2_subdev_call() was called instead of
v4l2_subdev_call_state_active() in
v4l2_g_parm_cap(). And v4l2_subdev doesn't contain
active_state member in earlier kernel.

Bug 4449673

Change-Id: Id0fbcf9476cf6d194b721f85790e95580ff4007d
Signed-off-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3281759
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Praveen AC <pac@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Ankur Pawar
2025-01-10 02:13:51 -08:00
committed by Jon Hunter
parent 6c7b0070f8
commit 07875fbe38

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2018-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2018-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* tegracam_v4l2 - tegra camera framework for v4l2 support
*/
@@ -256,6 +256,15 @@ int tegracam_v4l2subdev_register(struct tegracam_device *tc_dev,
}
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
sd->state_lock = ctrl_hdl->ctrl_handler.lock;
err = v4l2_subdev_init_finalize(sd);
if (err < 0) {
dev_err(dev, "subdev init error: %d\n", err);
return err;
}
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0) */
#if defined(CONFIG_V4L2_ASYNC)
return v4l2_async_register_subdev(sd);
#else