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>
This commit is contained in:
Mohit Ingale
2025-02-19 23:31:48 +00:00
committed by Jon Hunter
parent 2cc3c99c6e
commit 794163ce8e
14 changed files with 194 additions and 36 deletions

View File

@@ -1,9 +1,20 @@
# SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: GPL-2.0-only
# SPDX-FileCopyrightText: Copyright (c) 2023-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/>.
subdir-ccflags-y += -Werror
ifneq ($(NV_BUILD_SYSTEM_TYPE),embedded-linux)
obj-m += max9295.o
obj-m += max9296.o
ifndef CONFIG_TEGRA_SYSTEM_TYPE_ACK
@@ -27,3 +38,4 @@ endif
obj-m += pca9570.o
obj-m += virtual_i2c_mux.o
endif
endif

View File

@@ -1,5 +1,17 @@
# SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2022-2024, NVIDIA CORPORATION. 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/>.
ifdef CONFIG_MEDIA_SUPPORT
ifndef CONFIG_TEGRA_SYSTEM_TYPE_ACK
@@ -8,12 +20,13 @@ LINUXINCLUDE += -I$(srctree.nvidia-oot)/drivers/media/platform/tegra
LINUXINCLUDE += -DCONFIG_TEGRA_HOST1X
LINUXINCLUDE += -Werror
ifneq ($(NV_BUILD_SYSTEM_TYPE),embedded-linux)
LINUXINCLUDE += -DNV_IS_L4T
tegra-camera-objs := regmap_util.o
tegra-camera-objs += camera_common.o
tegra-camera-objs += camera_gpio.o
tegra-camera-objs += sensor_common.o
tegra-camera-objs += camera_version_utils.o
tegra-camera-objs += nvcamera_log.o
tegra-camera-objs += tegracam_v4l2.o
tegra-camera-objs += tegracam_core.o
tegra-camera-objs += tegracam_ctrls.o
@@ -25,6 +38,9 @@ tegra-camera-objs += vi/channel.o
tegra-camera-objs += vi/core.o
tegra-camera-objs += csi/csi.o
tegra-camera-objs += nvcsi/csi5_fops.o
endif
tegra-camera-objs += nvcamera_log.o
tegra-camera-objs += fusa-capture/capture-vi.o
tegra-camera-objs += fusa-capture/capture-common.o
tegra-camera-objs += fusa-capture/capture-vi-channel.o

View File

@@ -29,6 +29,10 @@
#include <linux/vmalloc.h>
#include <linux/tegra-capture-ivc.h>
#include <linux/tegra-camera-rtcpu.h>
#include <linux/io.h>
#include <linux/iosys-map.h>
#include <linux/dma-buf.h>
#include <linux/of.h>
#include <asm/arch_timer.h>
#include <soc/tegra/fuse.h>
@@ -36,7 +40,6 @@
#include <uapi/linux/nvhost_events.h>
#include "soc/tegra/camrtc-capture.h"
#include "soc/tegra/camrtc-capture-messages.h"
#include <media/mc_common.h>
#include <media/fusa-capture/capture-isp-channel.h>
#include <media/fusa-capture/capture-common.h>
#include <media/fusa-capture/capture-isp.h>

View File

@@ -1,6 +1,17 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2017-2025 NVIDIA CORPORATION & AFFILIATES.
// All rights reserved.
/* SPDX-FileCopyrightText: Copyright (c) 2017-2025 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.
*/
/**
* @file drivers/media/platform/tegra/camera/fusa-capture/capture-vi.c
@@ -16,6 +27,8 @@
#include <linux/of_platform.h>
#include <linux/printk.h>
#include <linux/vmalloc.h>
#include <linux/dma-mapping.h>
#include <linux/of.h>
#include <linux/tegra-capture-ivc.h>
#include <linux/tegra-camera-rtcpu.h>
@@ -28,10 +41,12 @@
#include <media/fusa-capture/capture-common.h>
#include <media/fusa-capture/capture-vi.h>
#ifdef NV_IS_L4T
#include <media/vi.h>
#include <media/mc_common.h>
#include <media/tegra_camera_platform.h>
#include "camera/vi/vi5_fops.h"
#endif
/**
* @brief Invalid VI channel ID; the channel is not initialized.
@@ -100,7 +115,9 @@ static const char * const vi_mapping_elements[] = {
* @brief The Capture-VI standalone driver context.
*/
struct tegra_capture_vi_data {
#ifdef NV_IS_L4T
struct vi vi_common; /**< VI device context */
#endif
uint32_t num_vi_devices; /**< Number of available VI devices */
struct platform_device *vi_pdevices[MAX_VI_UNITS];
/**< VI nvhost client platform device for each VI instance */
@@ -1806,7 +1823,7 @@ static int capture_vi_probe(struct platform_device *pdev)
vi_channel_drv_exit();
goto cleanup;
}
#ifdef NV_IS_L4T
info->vi_common.mc_vi.vi = &info->vi_common;
info->vi_common.mc_vi.fops = &vi5_fops;
err = tegra_capture_vi_media_controller_init(
@@ -1815,7 +1832,7 @@ static int capture_vi_probe(struct platform_device *pdev)
dev_warn(&pdev->dev, "media controller init failed\n");
err = 0;
}
#endif
memset(channels, 0 , sizeof(channels));
return 0;
@@ -1842,7 +1859,9 @@ static int capture_vi_remove(struct platform_device *pdev)
put_device(&info->vi_pdevices[ii]->dev);
vi_channel_drv_unregister(&pdev->dev);
#ifdef NV_IS_L4T
tegra_vi_media_controller_cleanup(&info->vi_common.mc_vi);
#endif
vi_channel_drv_exit();
return 0;

View File

@@ -1,12 +1,21 @@
// SPDX-License-Identifier: GPL-2.0
/*
* nvcamera_log.c - general tracing function for vi and isp API calls
// SPDX-License-Identifier: GPL-2.0-only
/* SPDX-FileCopyrightText: Copyright (c) 2018-2025 NVIDIA CORPORATION & AFFILIATES.
* All rights reserved.
*
* Copyright (c) 2018-2023, NVIDIA CORPORATION. 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.
*/
#include "nvcamera_log.h"
#define CREATE_TRACE_POINTS
#include "trace/events/camera_common.h"
#include <linux/nvhost.h>
#include <linux/platform_device.h>

View File

@@ -1,7 +1,20 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: GPL-2.0-only
#
# 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/>.
# Free-standing Tegra Camera Kernel Tests
ifneq ($(NV_BUILD_SYSTEM_TYPE),embedded-linux)
sensor_kernel_tests-m += sensor_dt_test.o
sensor_kernel_tests-m += sensor_dt_test_nodes.o
@@ -12,3 +25,4 @@ obj-m += utils/tegracam_log.o
obj-m += sensor_kernel_tests.o
sensor_kernel_tests-m += modules/sensor_kernel_tests_core.o
sensor_kernel_tests-m += modules/sensor_kernel_tests_runner.o
endif

View File

@@ -1,5 +1,17 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2015-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/* SPDX-FileCopyrightText: Copyright (c) 2015-2025 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.
*/
/*
* NVIDIA Tegra Video Input Device
*/
@@ -36,7 +48,6 @@
#include <media/vi.h>
#include <linux/clk/tegra.h>
#define CREATE_TRACE_POINTS
#include <trace/events/camera_common.h>
#include "mipical/mipi_cal.h"

View File

@@ -1,10 +1,24 @@
# SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2022-2023, 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/>.
obj-m += cdi_gpio.o
obj-m += cdi_mgr.o
obj-m += cdi_dev.o
ifneq ($(NV_BUILD_SYSTEM_TYPE),embedded-linux)
obj-m += cdi_pwm.o
ifndef CONFIG_TEGRA_SYSTEM_TYPE_ACK
obj-m += cam_cdi_tsc.o
endif
endif

View File

@@ -2153,4 +2153,4 @@ MODULE_DESCRIPTION("tegra auto cdi manager driver");
MODULE_AUTHOR("Songhee Baek <sbeak@nvidia.com>");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:cdi_mgr");
MODULE_SOFTDEP("pre: cdi_pwm");
MODULE_SOFTDEP("pre: cdi_dev");

View File

@@ -1,9 +1,22 @@
# SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2023, 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/>.
GCOV_PROFILE := y
ifneq ($(NV_BUILD_SYSTEM_TYPE),embedded-linux)
obj-m += isc_gpio.o
obj-m += isc_mgr.o
obj-m += isc_dev.o
obj-m += isc_pwm.o
endif

View File

@@ -1,10 +1,23 @@
# SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2023 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/>.
ccflags-y += -Werror
ifneq ($(NV_BUILD_SYSTEM_TYPE),embedded-linux)
nvhost-vi-tpg-t19x-objs += tpg_t19x.o
ifndef CONFIG_TEGRA_SYSTEM_TYPE_ACK
obj-m += nvhost-vi-tpg-t19x.o
endif
endif

View File

@@ -1,5 +1,17 @@
# SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2022-2023, NVIDIA CORPORATION. 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/>.
LINUXINCLUDE += -I$(srctree.nvidia-oot)/drivers/media/platform/tegra
@@ -8,8 +20,9 @@ nvhost-nvcsi-objs = \
deskew.o
obj-m += nvhost-nvcsi.o
ifneq ($(NV_BUILD_SYSTEM_TYPE),embedded-linux)
nvhost-nvcsi-t194-objs = nvcsi-t194.o
ifndef CONFIG_TEGRA_SYSTEM_TYPE_ACK
obj-m += nvhost-nvcsi-t194.o
endif
endif

View File

@@ -1,19 +1,23 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2022 NVIDIA Corporation. All rights reserved.
*/
/**
* @file include/media/fusa-capture/capture-common.h
/* SPDX-FileCopyrightText: Copyright (c) 2017-2025 NVIDIA CORPORATION & AFFILIATES.
* All rights reserved.
*
* @brief VI/ISP channel common operations header for the T186/T194 Camera RTCPU
* platform.
*
* 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.
*/
#ifndef __FUSA_CAPTURE_COMMON_H__
#define __FUSA_CAPTURE_COMMON_H__
#ifdef NV_IS_L4T
#include <media/mc_common.h>
#endif
struct capture_buffer_table;
struct capture_mapping;

View File

@@ -1,5 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
/* SPDX-FileCopyrightText: Copyright (c) 2017-2025 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.
*/
#include <nvidia/conftest.h>
@@ -12,6 +24,9 @@
#include <linux/version.h>
#include <linux/tracepoint.h>
#ifdef NV_IS_L4T
#include <media/mc_common.h>
struct tegra_channel;
struct timespec64;
@@ -140,6 +155,8 @@ DEFINE_EVENT(frame, tegra_channel_capture_done,
TP_ARGS(str, ts)
);
#endif /* NV_IS_L4T */
TRACE_EVENT(vi_task_submit,
TP_PROTO(u32 class_id, u32 channel_id, u32 syncpt_id,
u32 syncpt_thresh, u32 pid, u32 tid),