mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Svyatoslav Ryhel <clamor95@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Thierry Reding <thierry.reding@kernel.org>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Sowjanya Komatineni <skomatineni@nvidia.com>,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Svyatoslav Ryhel <clamor95@gmail.com>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	Mikko Perttunen <mperttunen@nvidia.com>
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	linux-tegra@vger.kernel.org, linux-staging@lists.linux.dev
Subject: [PATCH v2 03/15] media: tegra-video: vi: Expose all sub-devices in the pipeline
Date: Sun, 29 Nov 2026 20:07:10 +0200	[thread overview]
Message-ID: <20261129180722.142186-4-clamor95@gmail.com> (raw)
In-Reply-To: <20261129180722.142186-1-clamor95@gmail.com>

Add support for exposing /dev/v4l-subdev* nodes for the CSI and VIP bridge
sub-devices to userspace by setting V4L2_SUBDEV_FL_HAS_DEVNODE flag. Call
v4l2_device_register_subdev_nodes() in the async complete notifier
callback to expose all devices in the pipeline, including auxiliary ones.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 drivers/media/platform/nvidia/tegra-video/Kconfig |  1 +
 drivers/media/platform/nvidia/tegra-video/csi.c   |  1 +
 drivers/media/platform/nvidia/tegra-video/vi.c    | 14 ++++++++++++++
 drivers/media/platform/nvidia/tegra-video/vip.c   |  1 +
 4 files changed, 17 insertions(+)

diff --git a/drivers/media/platform/nvidia/tegra-video/Kconfig b/drivers/media/platform/nvidia/tegra-video/Kconfig
index c53441822fdf2..d6cfbbb3870e1 100644
--- a/drivers/media/platform/nvidia/tegra-video/Kconfig
+++ b/drivers/media/platform/nvidia/tegra-video/Kconfig
@@ -5,6 +5,7 @@ config VIDEO_TEGRA
 	depends on VIDEO_DEV
 	select MEDIA_CONTROLLER
 	select VIDEOBUF2_DMA_CONTIG
+	select VIDEO_V4L2_SUBDEV_API
 	select V4L2_FWNODE
 	help
 	  Choose this option if you have an NVIDIA Tegra SoC.
diff --git a/drivers/media/platform/nvidia/tegra-video/csi.c b/drivers/media/platform/nvidia/tegra-video/csi.c
index 44bd53dbbf7fd..add526de536f9 100644
--- a/drivers/media/platform/nvidia/tegra-video/csi.c
+++ b/drivers/media/platform/nvidia/tegra-video/csi.c
@@ -680,6 +680,7 @@ static int tegra_csi_channel_init(struct tegra_csi_channel *chan)
 	v4l2_set_subdevdata(subdev, chan);
 	subdev->fwnode = of_fwnode_handle(chan->of_node);
 	subdev->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
+	subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
 	/* initialize media entity pads */
 	ret = media_entity_pads_init(&subdev->entity, chan->numpads,
diff --git a/drivers/media/platform/nvidia/tegra-video/vi.c b/drivers/media/platform/nvidia/tegra-video/vi.c
index 71921931457be..1df4700ab35d6 100644
--- a/drivers/media/platform/nvidia/tegra-video/vi.c
+++ b/drivers/media/platform/nvidia/tegra-video/vi.c
@@ -1392,6 +1392,12 @@ int tegra_v4l2_nodes_setup_tpg(struct tegra_video_device *vid)
 		csi_chan = list_next_entry(csi_chan, list);
 	}
 
+	ret = v4l2_device_register_subdev_nodes(&vid->v4l2_dev);
+	if (ret) {
+		dev_err(vi->dev, "failed to register subdev nodes\n");
+		goto cleanup;
+	}
+
 	return 0;
 
 cleanup:
@@ -1548,12 +1554,14 @@ static int tegra_vi_graph_notify_complete(struct v4l2_async_notifier *notifier)
 	struct tegra_vi_graph_entity *entity;
 	struct v4l2_async_connection *asd;
 	struct v4l2_subdev *subdev;
+	struct tegra_video_device *vid;
 	struct tegra_vi_channel *chan;
 	struct tegra_vi *vi;
 	int ret;
 
 	chan = container_of(notifier, struct tegra_vi_channel, notifier);
 	vi = chan->vi;
+	vid = dev_get_drvdata(vi->client.host);
 
 	dev_dbg(vi->dev, "notify complete, all subdevs registered\n");
 
@@ -1610,6 +1618,12 @@ static int tegra_vi_graph_notify_complete(struct v4l2_async_notifier *notifier)
 	subdev = tegra_channel_get_remote_source_subdev(chan);
 	v4l2_set_subdev_hostdata(subdev, chan);
 
+	ret = v4l2_device_register_subdev_nodes(&vid->v4l2_dev);
+	if (ret) {
+		dev_err(vi->dev, "failed to register subdev nodes\n");
+		goto unregister_video;
+	}
+
 	return 0;
 
 unregister_video:
diff --git a/drivers/media/platform/nvidia/tegra-video/vip.c b/drivers/media/platform/nvidia/tegra-video/vip.c
index b73ba0eab5573..040776775aacc 100644
--- a/drivers/media/platform/nvidia/tegra-video/vip.c
+++ b/drivers/media/platform/nvidia/tegra-video/vip.c
@@ -165,6 +165,7 @@ static int tegra_vip_channel_init(struct tegra_vip *vip)
 	v4l2_set_subdevdata(subdev, &vip->chan);
 	subdev->fwnode = of_fwnode_handle(vip->chan.of_node);
 	subdev->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
+	subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
 	err = media_entity_pads_init(&subdev->entity, TEGRA_VIP_PADS_NUM, vip->chan.pads);
 	if (err)
-- 
2.53.0


  parent reply	other threads:[~2026-11-29 18:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 18:07 [PATCH v2 00/15] tegra-video: Convert to media-centric pipe Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 01/15] staging: media: tegra-video: Move driver to media/platform/nvidia Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 02/15] media: tegra-video: vi: Drop controls consolidation into VI device Svyatoslav Ryhel
2026-11-29 18:07 ` Svyatoslav Ryhel [this message]
2026-11-29 18:07 ` [PATCH v2 04/15] media: tegra-video: vi: Drop subdevice passthrough and input ioctls Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 05/15] media: tegra-video: vi: Build bitmap of formats compatible with CSI/VIP instead of source Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 06/15] media: tegra-video: Expose SoC stepwise frame size limits Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 07/15] media: tegra-video: vi: Match fourcc against channel format bitmap Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 08/15] media: tegra-video: vi: Report stepwise frame sizes instead of querying subdev Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 09/15] media: tegra-video: vi: Configure capture format locally without subdev calls Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 10/15] media: tegra-video: vi: Implement link_validate for video entity Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 11/15] media: tegra-video: video: Resolve video device via media graph on notifications Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 12/15] media: tegra-video: Remove remote source subdev helper Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 13/15] media: tegra-video: csi: Scope pad and state ops to TPG mode Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 14/15] media: tegra-video: csi: Add pad and media operations for own CSI channels Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 15/15] media: tegra-video: vip: Add pad and media operations for VIP Svyatoslav Ryhel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261129180722.142186-4-clamor95@gmail.com \
    --to=clamor95@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil+cisco@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux-tegra@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=mchehab@kernel.org \
    --cc=mperttunen@nvidia.com \
    --cc=skomatineni@nvidia.com \
    --cc=thierry.reding@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®