[PATCH v1 05/10] media: tegra-video: vi: Use entity function to check subdev type

From: Svyatoslav Ryhel

Date: Fri Nov 13 2026 - 11:38:12 EST


The tegra_channel_get_remote_source_subdev() function relies on pad flags
to terminate the search for the initial sensor. This causes it to iterate
through devices that should be bypassed—for example, the pixel array (PA)
of the mt9m114, where the internal image signal processor (IFP) should be
the initial source instead. Switch to checking entity->function for a
sensor or ISP to terminate the search.

Signed-off-by: Svyatoslav Ryhel <clamor95@xxxxxxxxx>
---
drivers/media/platform/nvidia/tegra-video/vi.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/nvidia/tegra-video/vi.c b/drivers/media/platform/nvidia/tegra-video/vi.c
index a96ef26af89eb..5c649e3162fe3 100644
--- a/drivers/media/platform/nvidia/tegra-video/vi.c
+++ b/drivers/media/platform/nvidia/tegra-video/vi.c
@@ -189,13 +189,12 @@ tegra_channel_get_remote_source_subdev(struct tegra_vi_channel *chan)

entity = &subdev->entity;

- pad = &subdev->entity.pads[0];
- while (!(pad->flags & MEDIA_PAD_FL_SOURCE)) {
+ while (entity->function != MEDIA_ENT_F_PROC_VIDEO_ISP &&
+ entity->function != MEDIA_ENT_F_CAM_SENSOR) {
pad = media_entity_remote_source_pad_unique(entity);
if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
break;
entity = pad->entity;
- pad = &entity->pads[0];
subdev = media_entity_to_v4l2_subdev(entity);
}

--
2.53.0