From 91751dfb742dfd488301fa8cc00bc6c604684e12 Mon Sep 17 00:00:00 2001 From: Santosh BS Date: Tue, 28 Jan 2025 13:50:27 +0000 Subject: [PATCH] drm/tegra: move disply related code under CONFIG_DRM_TEGRA_HAVE_DISPLAY As Tegra DRM driver display support is not needed for recent chips, move the related codes under CONFIG_DRM_TEGRA_HAVE_DISPLAY and enable that flag based on legacy chip configs accordingly. Jira HOSTX-5833 Change-Id: Iddf884f5abdfe2500e7195778bc77f9423acc2d3 Signed-off-by: Santosh BS Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3292246 Reviewed-by: Mikko Perttunen GVS: buildbot_gerritrpt --- drivers/gpu/Makefile | 7 +++++++ drivers/gpu/drm/tegra/Makefile | 6 ++---- drivers/gpu/drm/tegra/dc.c | 4 +++- drivers/gpu/drm/tegra/drm.c | 24 ++++++------------------ drivers/gpu/drm/tegra/drm.h | 22 ++++++---------------- 5 files changed, 24 insertions(+), 39 deletions(-) diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile index 8004ce80..3a390785 100644 --- a/drivers/gpu/Makefile +++ b/drivers/gpu/Makefile @@ -8,6 +8,13 @@ export CONFIG_HOST1X_HAVE_SYNCPT_BASE=y subdir-ccflags-y += -DCONFIG_HOST1X_HAVE_SYNCPT_BASE endif +ifneq ($(filter y, $(CONFIG_ARCH_TEGRA_2x_SOC) $(CONFIG_ARCH_TEGRA_3x_SOC) \ + $(CONFIG_ARCH_TEGRA_114_SOC) $(CONFIG_ARCH_TEGRA_124_SOC) $(CONFIG_ARCH_TEGRA_132_SOC) \ + $(CONFIG_ARCH_TEGRA_210_SOC) $(CONFIG_ARCH_TEGRA_186_SOC) $(CONFIG_ARCH_TEGRA_194_SOC)),) +export CONFIG_DRM_TEGRA_HAVE_DISPLAY=y +subdir-ccflags-y += -DCONFIG_DRM_TEGRA_HAVE_DISPLAY +endif + ifdef CONFIG_DRM obj-m += drm/tegra/ endif diff --git a/drivers/gpu/drm/tegra/Makefile b/drivers/gpu/drm/tegra/Makefile index a1d6e092..604c1da8 100644 --- a/drivers/gpu/drm/tegra/Makefile +++ b/drivers/gpu/drm/tegra/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -# Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. +# Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved. ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG ccflags-y += -I$(srctree.nvidia-oot)/drivers/gpu/drm/tegra/include @@ -14,9 +14,7 @@ tegra-drm-y := \ fb.o \ virt.o -ifneq ($(filter y, $(CONFIG_ARCH_TEGRA_2x_SOC) $(CONFIG_ARCH_TEGRA_3x_SOC) \ - $(CONFIG_ARCH_TEGRA_114_SOC) $(CONFIG_ARCH_TEGRA_124_SOC) $(CONFIG_ARCH_TEGRA_132_SOC) \ - $(CONFIG_ARCH_TEGRA_210_SOC) $(CONFIG_ARCH_TEGRA_186_SOC) $(CONFIG_ARCH_TEGRA_194_SOC)),) +ifeq ($(CONFIG_DRM_TEGRA_HAVE_DISPLAY),y) tegra-drm-y += \ dp.o \ hub.o \ diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 7affaed0..179c8ac0 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2012 Avionic Design GmbH - * SPDX-FileCopyrightText: Copyright (c) 2012-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2012-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #include @@ -2624,7 +2624,9 @@ static int tegra_dc_init(struct host1x_client *client) * DC has been reset by now, so VBLANK syncpoint can be released * for general use. */ +#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY host1x_syncpt_release_vblank_reservation(client, 26 + dc->pipe); +#endif /* * XXX do not register DCs with no window groups because we cannot diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 3641e118..c185f354 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -60,9 +60,7 @@ static int tegra_atomic_check(struct drm_device *drm, if (err < 0) return err; -#if IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_132_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) +#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY return tegra_display_hub_atomic_check(drm, state); #else return 0; @@ -75,9 +73,7 @@ static const struct drm_mode_config_funcs tegra_drm_mode_config_funcs = { .atomic_commit = drm_atomic_helper_commit, }; -#if IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_132_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) +#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY static void tegra_atomic_post_commit(struct drm_device *drm, struct drm_atomic_state *old_state) { @@ -1308,9 +1304,7 @@ static int host1x_drm_probe(struct host1x_device *dev) iova_cache_put(); } -#if IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_132_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) +#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY if (tegra->hub) { err = tegra_display_hub_prepare(tegra->hub); if (err < 0) @@ -1359,9 +1353,7 @@ static int host1x_drm_probe(struct host1x_device *dev) return 0; hub: -#if IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_132_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) +#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY if (tegra->hub) tegra_display_hub_cleanup(tegra->hub); device: @@ -1399,9 +1391,7 @@ static int host1x_drm_remove(struct host1x_device *dev) drm_atomic_helper_shutdown(drm); drm_mode_config_cleanup(drm); -#if IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_132_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) +#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY if (tegra->hub) tegra_display_hub_cleanup(tegra->hub); #endif @@ -1526,9 +1516,7 @@ static struct host1x_driver host1x_drm_driver = { }; static struct platform_driver * const drivers[] = { -#if IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_132_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) +#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY &tegra_display_hub_driver, &tegra_dc_driver, &tegra_hdmi_driver, diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index fd999240..c43330d4 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (C) 2012 Avionic Design GmbH - * Copyright (C) 2012-2024 NVIDIA CORPORATION. All rights reserved. + * Copyright (C) 2012-2025 NVIDIA CORPORATION. All rights reserved. */ #ifndef HOST1X_DRM_H @@ -12,9 +12,7 @@ #include #include -#if IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_132_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) +#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY #include #include #include @@ -24,9 +22,7 @@ #include #include "gem.h" -#if IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_132_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) +#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY #include "hub.h" #endif #include @@ -57,9 +53,7 @@ struct tegra_drm { unsigned int pitch_align; unsigned int num_crtcs; -#if IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_132_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) +#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY struct tegra_display_hub *hub; #endif }; @@ -150,9 +144,7 @@ void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size, dma_addr_t *iova); void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt, dma_addr_t iova); -#if IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_132_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) +#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY struct cec_notifier; struct tegra_output { @@ -226,9 +218,7 @@ static inline void tegra_fbdev_setup(struct drm_device *drm) { } #endif -#if IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_132_SOC) || \ - IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) +#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY extern struct platform_driver tegra_display_hub_driver; extern struct platform_driver tegra_dc_driver; extern struct platform_driver tegra_hdmi_driver;