From 1cae6bd4d7af7bbe7841662cc58aae2dcd43f861 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Wed, 1 Nov 2023 05:52:15 +0000 Subject: [PATCH] media: camera: vi: Rename v4l2_async_notifier_init to v4l2_async_subdev_nf_init() The API v4l2_async_notifier_init() changed to v4l2_async_subdev_nf_init() in Linux 6.6 with below kernel change: --- commit bda8953e8c3e7ecbbf6cb1be11790496300e3961 Author: Jacopo Mondi Date: Tue Apr 18 11:52:07 2023 +0200 media: v4l: async: Drop v4l2_async_nf_parse_fwnode_endpoints() --- Use the new API. Bug 4346767 Change-Id: Iff3137d07cd270300c4b9a90974a4dd81fb53740 Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3008087 GVS: Gerrit_Virtual_Submit --- Makefile | 3 +++ drivers/media/platform/tegra/camera/vi/graph.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/Makefile b/Makefile index 24c89e3e..d1732e11 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,9 @@ subdir-ccflags-y += -DNV_V4L2_ASYNC_SUBDEV_RENAME # Rename V4L2_ASYNC_MATCH_FWNODE to V4L2_ASYNC_MATCH_TYPE_FWNODE subdir-ccflags-y += -DNV_V4L2_ASYNC_MATCH_FWNODE_RENAME + +# Rename async_nf_init and v4l2_async_subdev_nf_register +subdir-ccflags-y += -DNV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME endif ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y) diff --git a/drivers/media/platform/tegra/camera/vi/graph.c b/drivers/media/platform/tegra/camera/vi/graph.c index 78cf8e45..dc14fe4e 100644 --- a/drivers/media/platform/tegra/camera/vi/graph.c +++ b/drivers/media/platform/tegra/camera/vi/graph.c @@ -668,10 +668,23 @@ int tegra_vi_graph_init(struct tegra_mc_vi *vi) v4l2_async_notifier_init(&chan->notifier); list_for_each_entry(entity, &chan->entities, list) __v4l2_async_notifier_add_subdev(&chan->notifier, &entity->asd); +#else +#if defined (NV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME) + v4l2_async_subdev_nf_init(&chan->notifier, tegra_channel_find_linked_csi_subdev(chan)); + list_for_each_entry(entity, &chan->entities, list) { + struct v4l2_async_connection *asd; + asd = v4l2_async_nf_add_fwnode_remote(&chan->notifier, of_fwnode_handle(remote), + struct v4l2_async_connection); + if (IS_ERR(asd)) { + ret = PTR_ERR(asd); + goto done; + } + } #else v4l2_async_nf_init(&chan->notifier); list_for_each_entry(entity, &chan->entities, list) __v4l2_async_nf_add_subdev(&chan->notifier, &entity->asd); +#endif #endif chan->link_status = 0; @@ -681,10 +694,14 @@ int tegra_vi_graph_init(struct tegra_mc_vi *vi) #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) ret = v4l2_async_notifier_register(&vi->v4l2_dev, &chan->notifier); +#else +#if defined (NV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME) + ret = v4l2_async_nf_register(&chan->notifier); #else ret = v4l2_async_nf_register(&vi->v4l2_dev, &chan->notifier); #endif +#endif #else dev_err(vi->dev, "CONFIG_V4L2_ASYNC is not enabled!\n"); ret = -ENOTSUPP;