mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
drm/tegra: Add conftest support
Instead of relying on kernel version to determine if certain functions or structure are present in the kernel, use the conftest.sh script to test which functions, structures, etc are present at compile time. This is beneficial for working with 3rd party Linux kernels that may have back-ported upstream changes into their kernel and so the kernel version checks do not work. Bug 4119327 Change-Id: If315b18af74c830e9ba3993208de3a3326c4187d Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2984415 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
040c0ad65f
commit
5a26b0ef9d
@@ -4,10 +4,11 @@
|
||||
* Copyright (C) 2015 Rob Clark
|
||||
*/
|
||||
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#if defined(NV_DRM_DISPLAY_DRM_DP_HELPER_H_PRESENT) /* Linux v5.19 */
|
||||
#include <drm/display/drm_dp_helper.h>
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
#elif defined(NV_DRM_DP_DRM_DP_HELPER_H_PRESENT) /* Linux v5.18 */
|
||||
#include <drm/dp/drm_dp_helper.h>
|
||||
#else
|
||||
#include <drm/drm_dp_helper.h>
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Copyright (C) 2013 NVIDIA Corporation
|
||||
*/
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
@@ -19,18 +21,20 @@
|
||||
#include <linux/version.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
|
||||
#if defined(NV_DRM_DISPLAY_DRM_DP_HELPER_H_PRESENT) /* Linux v5.19 */
|
||||
#include <drm/display/drm_dp_helper.h>
|
||||
#include <drm/display/drm_dp_aux_bus.h>
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
#elif defined(NV_DRM_DP_DRM_DP_HELPER_H_PRESENT) /* Linux v5.18 */
|
||||
#include <drm/dp/drm_dp_helper.h>
|
||||
#include <drm/dp/drm_dp_aux_bus.h>
|
||||
#else
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
|
||||
#include <drm/drm_dp_aux_bus.h>
|
||||
#endif
|
||||
#include <drm/drm_dp_helper.h>
|
||||
#endif
|
||||
#if defined(NV_DRM_DISPLAY_DRM_DP_AUX_BUS_H_PRESENT) /* Linux v5.19 */
|
||||
#include <drm/display/drm_dp_aux_bus.h>
|
||||
#elif defined(NV_DRM_DP_DRM_DP_AUX_BUS_H_PRESENT) /* Linux v5.18 */
|
||||
#include <drm/dp/drm_dp_aux_bus.h>
|
||||
#elif defined(NV_DRM_DRM_DP_AUX_BUS_H_PRESENT) /* Linux v5.17 */
|
||||
#include <drm/drm_dp_aux_bus.h>
|
||||
#endif
|
||||
#include <drm/drm_panel.h>
|
||||
|
||||
#include "dp.h"
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
* Copyright (C) 2012-2023 NVIDIA CORPORATION. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/file.h>
|
||||
#include <linux/host1x-next.h>
|
||||
@@ -1055,7 +1057,7 @@ void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size, dma_addr_t *dma)
|
||||
|
||||
*dma = iova_dma_addr(&tegra->carveout.domain, alloc);
|
||||
err = iommu_map(tegra->domain, *dma, virt_to_phys(virt),
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
#if defined(NV_IOMMU_MAP_HAS_GFP_ARG) /* Linux v6.3 */
|
||||
size, IOMMU_READ | IOMMU_WRITE, GFP_KERNEL);
|
||||
#else
|
||||
size, IOMMU_READ | IOMMU_WRITE);
|
||||
@@ -1279,7 +1281,7 @@ static int host1x_drm_probe(struct host1x_device *dev)
|
||||
goto device;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
|
||||
#if defined(NV_DRM_DRIVER_STRUCT_HAS_IRQ_ENABLED_ARG) /* Linux v5.15 */
|
||||
/*
|
||||
* We don't use the drm_irq_install() helpers provided by the DRM
|
||||
* core, so we need to set this manually in order to allow the
|
||||
@@ -1298,7 +1300,7 @@ static int host1x_drm_probe(struct host1x_device *dev)
|
||||
drm_mode_config_reset(drm);
|
||||
|
||||
if (drm->mode_config.num_crtc > 0) {
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
|
||||
#if defined(NV_DRM_APERTURE_REMOVE_FRAMEBUFFERS_HAS_DRM_DRIVER_ARG) /* Linux v5.15 */
|
||||
err = drm_aperture_remove_framebuffers(false, &tegra_drm_driver);
|
||||
#else
|
||||
err = drm_aperture_remove_framebuffers(false, "tegradrmfb");
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
* Copyright (C) 2012 Analog Devices Inc.
|
||||
*/
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/console.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
@@ -263,7 +265,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
|
||||
if (IS_ERR(bo))
|
||||
return PTR_ERR(bo);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)
|
||||
#if defined(NV_DRM_FB_HELPER_ALLOC_INFO_PRESENT) /* Linux v6.2 */
|
||||
info = drm_fb_helper_alloc_info(helper);
|
||||
#else
|
||||
info = drm_fb_helper_alloc_fbi(helper);
|
||||
@@ -285,7 +287,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
|
||||
|
||||
fb = fbdev->fb;
|
||||
helper->fb = fb;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)
|
||||
#if defined(NV_DRM_FB_HELPER_STRUCT_HAS_INFO_ARG) /* Linux v6.2 */
|
||||
helper->info = info;
|
||||
#else
|
||||
helper->fbdev = info;
|
||||
@@ -308,7 +310,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
|
||||
}
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)
|
||||
#if defined(NV_DRM_MODE_CONFIG_STRUCT_HAS_FB_BASE_ARG) /* Linux v6.2 */
|
||||
drm->mode_config.fb_base = (resource_size_t)bo->iova;
|
||||
#endif
|
||||
info->screen_base = (void __iomem *)bo->vaddr + offset;
|
||||
@@ -337,7 +339,7 @@ static struct tegra_fbdev *tegra_fbdev_create(struct drm_device *drm)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
#if defined(NV_DRM_FB_HELPER_PREPARE_HAS_PREFERRED_BPP_ARG) /* Linux v6.3 */
|
||||
drm_fb_helper_prepare(drm, &fbdev->base, 32, &tegra_fb_helper_funcs);
|
||||
#else
|
||||
drm_fb_helper_prepare(drm, &fbdev->base, &tegra_fb_helper_funcs);
|
||||
@@ -352,7 +354,7 @@ static void tegra_fbdev_free(struct tegra_fbdev *fbdev)
|
||||
}
|
||||
|
||||
static int tegra_fbdev_init(struct tegra_fbdev *fbdev,
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
|
||||
#if !defined(NV_DRM_FB_HELPER_PREPARE_HAS_PREFERRED_BPP_ARG) /* Linux v6.3 */
|
||||
unsigned int preferred_bpp,
|
||||
#endif
|
||||
unsigned int num_crtc,
|
||||
@@ -368,7 +370,7 @@ static int tegra_fbdev_init(struct tegra_fbdev *fbdev,
|
||||
return err;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
#if defined(NV_DRM_FB_HELPER_PREPARE_HAS_PREFERRED_BPP_ARG) /* Linux v6.3 */
|
||||
err = drm_fb_helper_initial_config(&fbdev->base);
|
||||
#else
|
||||
err = drm_fb_helper_initial_config(&fbdev->base, preferred_bpp);
|
||||
@@ -388,7 +390,7 @@ fini:
|
||||
|
||||
static void tegra_fbdev_exit(struct tegra_fbdev *fbdev)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)
|
||||
#if defined(NV_DRM_FB_HELPER_UNREGISTER_INFO_PRESENT) /* Linux v6.2 */
|
||||
drm_fb_helper_unregister_info(&fbdev->base);
|
||||
#else
|
||||
drm_fb_helper_unregister_fbi(&fbdev->base);
|
||||
@@ -439,7 +441,7 @@ int tegra_drm_fb_init(struct drm_device *drm)
|
||||
struct tegra_drm *tegra = drm->dev_private;
|
||||
int err;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
#if defined(NV_DRM_FB_HELPER_PREPARE_HAS_PREFERRED_BPP_ARG) /* Linux v6.3 */
|
||||
err = tegra_fbdev_init(tegra->fbdev, drm->mode_config.num_crtc,
|
||||
#else
|
||||
err = tegra_fbdev_init(tegra->fbdev, 32, drm->mode_config.num_crtc,
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
* Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_of.h>
|
||||
#include <drm/drm_panel.h>
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Copyright (C) 2013 NVIDIA Corporation
|
||||
*/
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/debugfs.h>
|
||||
@@ -13,18 +15,17 @@
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/reset.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include <soc/tegra/pmc.h>
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
|
||||
#if defined(NV_DRM_DISPLAY_DRM_DP_HELPER_H_PRESENT) /* Linux v5.19 */
|
||||
#include <drm/display/drm_dp_helper.h>
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
#elif defined(NV_DRM_DP_DRM_DP_HELPER_H_PRESENT) /* Linux v5.18 */
|
||||
#include <drm/dp/drm_dp_helper.h>
|
||||
#else
|
||||
#include <drm/drm_dp_helper.h>
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
|
||||
#if defined(NV_DRM_DISPLAY_DRM_SCDC_HELPER_H_PRESENT) /* Linux v5.19 */
|
||||
#include <drm/display/drm_scdc_helper.h>
|
||||
#else
|
||||
#include <drm/drm_scdc_helper.h>
|
||||
|
||||
Reference in New Issue
Block a user