From c86c642f5bbeb0febae0a3fe654cc29667e18dbd Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 20 Dec 2022 09:55:46 +0000 Subject: [PATCH] media: camera: Fix build for Linux v5.16+ Building the Tegra camera drivers with Linux v5.16+ kernels fail because the driver does not use the correct kernel version for handling various API changes in upstream. Update ther kernel version appropriately so that the camera drivers can build with Linux v5.16+ kernels. Change-Id: I4c110d12f554fd4aa757a1aa9a42a81be5a87ae6 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2831219 Reviewed-by: Laxman Dewangan GVS: Gerrit_Virtual_Submit --- drivers/media/platform/tegra/camera/camera_common.c | 2 +- .../platform/tegra/camera/fusa-capture/capture-common.c | 8 ++++---- .../platform/tegra/camera/fusa-capture/capture-isp.c | 4 ++-- drivers/media/platform/tegra/camera/vi/graph.c | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/tegra/camera/camera_common.c b/drivers/media/platform/tegra/camera/camera_common.c index 9dedf3d6..c7519966 100644 --- a/drivers/media/platform/tegra/camera/camera_common.c +++ b/drivers/media/platform/tegra/camera/camera_common.c @@ -940,7 +940,7 @@ 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(6, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) cfg->flags = V4L2_MBUS_CSI2_4_LANE | V4L2_MBUS_CSI2_CHANNEL_0 | V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; diff --git a/drivers/media/platform/tegra/camera/fusa-capture/capture-common.c b/drivers/media/platform/tegra/camera/fusa-capture/capture-common.c index a61c3c51..93079ba4 100644 --- a/drivers/media/platform/tegra/camera/fusa-capture/capture-common.c +++ b/drivers/media/platform/tegra/camera/fusa-capture/capture-common.c @@ -494,7 +494,7 @@ int capture_common_setup_progress_status_notifier( uint32_t mem_offset) { struct dma_buf *dmabuf; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) struct dma_buf_map map; #else struct iosys_map map; @@ -541,7 +541,7 @@ int capture_common_release_progress_status_notifier( { struct dma_buf *dmabuf = progress_status_notifier->buf; void *va = progress_status_notifier->va; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) struct dma_buf_map map = DMA_BUF_MAP_INIT_VADDR(va); #else struct iosys_map map = IOSYS_MAP_INIT_VADDR(va); @@ -597,7 +597,7 @@ int capture_common_pin_memory( struct capture_common_buf *unpin_data) { struct dma_buf *buf; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) struct dma_buf_map map; #else struct iosys_map map; @@ -650,7 +650,7 @@ EXPORT_SYMBOL_GPL(capture_common_pin_memory); void capture_common_unpin_memory( struct capture_common_buf *unpin_data) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) struct dma_buf_map map = DMA_BUF_MAP_INIT_VADDR(unpin_data->va); #else struct iosys_map map = IOSYS_MAP_INIT_VADDR(unpin_data->va); diff --git a/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c b/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c index aa9abd8b..86dde3ad 100644 --- a/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c +++ b/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c @@ -341,7 +341,7 @@ static int isp_capture_setup_inputfences( void *reloc_page_addr = NULL; struct isp_capture *capture = chan->capture_data; void *vmap_base = NULL; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) struct dma_buf_map map; #else struct iosys_map map; @@ -427,7 +427,7 @@ static int isp_capture_setup_prefences( void *reloc_page_addr = NULL; struct isp_capture *capture = chan->capture_data; void *vmap_base = NULL; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) struct dma_buf_map map; #else struct iosys_map map; diff --git a/drivers/media/platform/tegra/camera/vi/graph.c b/drivers/media/platform/tegra/camera/vi/graph.c index 8e1834cb..6d1349c8 100644 --- a/drivers/media/platform/tegra/camera/vi/graph.c +++ b/drivers/media/platform/tegra/camera/vi/graph.c @@ -382,7 +382,7 @@ void tegra_vi_graph_cleanup(struct tegra_mc_vi *vi) struct tegra_channel *chan; list_for_each_entry(chan, &vi->vi_chans, list) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) v4l2_async_notifier_unregister(&chan->notifier); #else v4l2_async_nf_unregister(&chan->notifier); @@ -613,7 +613,7 @@ int tegra_vi_graph_init(struct tegra_mc_vi *vi) num_subdevs = chan->num_subdevs; i = 0; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) v4l2_async_notifier_init(&chan->notifier); list_for_each_entry(entity, &chan->entities, list) __v4l2_async_notifier_add_subdev(&chan->notifier, &entity->asd); @@ -627,7 +627,7 @@ int tegra_vi_graph_init(struct tegra_mc_vi *vi) chan->subdevs_bound = 0; /* Register the async notifier for this channel */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) ret = v4l2_async_notifier_register(&vi->v4l2_dev, &chan->notifier); #else