mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
media: camera: Use conftest for CSI2 config
In Linux v5.18, commits 20c238dfb26c ("media: v4l2-mediabus: Drop legacy
V4L2_MBUS_CSI2_*_LANE flags"), 5a6ac3f4b46f ("media: v4l2-mediabus: Drop
legacy V4L2_MBUS_CSI2_CHANNEL_* flags") and b9f7caa7753a ("media:
v4l2-mediabus: Drop V4L2_MBUS_CSI2_CONTINUOUS_CLOCK flag") removed
various CSI2 flags. It turns out that out of these flags we only need to
actually set the number of lanes and the other flags are redundant. The
configuration was moved by commit 94d964e58ad6 ("media: v4l2-fwnode:
Move bus config structure to v4l2_mediabus.h") to the structure
v4l2_mbus_config_mipi_csi2 which itself is under the structure
v4l2_fwnode_endpoint. Use conftest to detect if the structure
v4l2_mbus_config_mipi_csi2 is present and avoid using kernel version
checks.
Bug 4425688
Change-Id: Icd597492e48831326c203a6556176ac3767472a3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3354475
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: Paritosh Dixit <paritoshd@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
3713d89fdb
commit
2f83033498
@@ -1,20 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2015-2024 NVIDIA CORPORATION & AFFILIATES.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2015-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <media/tegra-v4l2-camera.h>
|
||||
#include <media/camera_common.h>
|
||||
@@ -987,12 +975,12 @@ int camera_common_get_mbus_config(struct v4l2_subdev *sd,
|
||||
* then return an error
|
||||
*/
|
||||
cfg->type = V4L2_MBUS_CSI2_DPHY;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
|
||||
#if defined(NV_V4L2_FWNODE_ENDPOINT_STRUCT_HAS_V4L2_MBUS_CONFIG_MIPI_CSI2) /* Linux v5.18 */
|
||||
cfg->bus.mipi_csi2.num_data_lanes = 4;
|
||||
#else
|
||||
cfg->flags = V4L2_MBUS_CSI2_4_LANE |
|
||||
V4L2_MBUS_CSI2_CHANNEL_0 |
|
||||
V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
|
||||
#else
|
||||
cfg->bus.mipi_csi2.num_data_lanes = 4;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
###########################################################################
|
||||
# SPDX-License-Identifier: MIT
|
||||
# SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
#
|
||||
# Makefile file for NVIDIA Linux conftest
|
||||
###########################################################################
|
||||
@@ -193,6 +193,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_subdev_nf_init
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_notifier_init
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_nf_init_has_v4l2_dev_arg
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += __v4l2_async_nf_add_subdev
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_fwnode_endpoint_struct_has_v4l2_mbus_config_mipi_csi2
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_subdev_pad_ops_struct_has_get_set_frame_interval
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_subdev_pad_ops_struct_has_dv_timings
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += vm_area_struct_has_const_vm_flags
|
||||
|
||||
@@ -8291,6 +8291,25 @@ compile_test() {
|
||||
compile_check_conftest "$CODE" "NV_V4L2_ASYNC_NF_ADD_SUBDEV_PRESENT" "" "functions"
|
||||
;;
|
||||
|
||||
v4l2_fwnode_endpoint_struct_has_v4l2_mbus_config_mipi_csi2)
|
||||
#
|
||||
# Determine if struct 'v4l2_fwnode_endpoint' has a
|
||||
# 'v4l2_mbus_config_mipi_csi2' member.
|
||||
#
|
||||
# Commit 94d964e58ad6 ("media: v4l2-fwnode: Move bus config
|
||||
# structure to v4l2_mediabus.h") added this in Linux v5.18.
|
||||
#
|
||||
CODE="
|
||||
#define _LINUX_EFI_H
|
||||
#include <media/v4l2-fwnode.h>
|
||||
struct v4l2_mbus_config_mipi_csi2 *conftest(struct v4l2_fwnode_endpoint *endpoint) {
|
||||
return &endpoint->bus.mipi_csi2;
|
||||
}
|
||||
"
|
||||
compile_check_conftest "$CODE" \
|
||||
"NV_V4L2_FWNODE_ENDPOINT_STRUCT_HAS_V4L2_MBUS_CONFIG_MIPI_CSI2" "" "types"
|
||||
;;
|
||||
|
||||
v4l2_subdev_pad_ops_struct_has_get_set_frame_interval)
|
||||
#
|
||||
# Determine if struct v4l2_subdev_pad_ops has the 'get_frame_interval'
|
||||
|
||||
Reference in New Issue
Block a user