From 8b04ed92cb71d8877a016012825f8b3c7781c5cf Mon Sep 17 00:00:00 2001 From: Ankur Pawar Date: Thu, 9 Feb 2023 11:10:56 +0000 Subject: [PATCH] camera: set CSI port-index when preparing graph When preparing graph, device tree endpoints are are found to be in reverse order. This leads to incorrect csi port index associated with video nodes. Read csi port while preparing graph and assign it to tegra_channel struct. Bug 3898807 Change-Id: I39af68386d85bc6299b164864e4503850d606e69 Signed-off-by: Ankur Pawar Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2855852 Reviewed-by: svcacv Reviewed-by: Frank Chen Reviewed-by: Sudhir Vyas Reviewed-by: Laxman Dewangan GVS: Gerrit_Virtual_Submit --- drivers/media/platform/tegra/camera/vi/graph.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/tegra/camera/vi/graph.c b/drivers/media/platform/tegra/camera/vi/graph.c index 6d1349c8..e6a2afb0 100644 --- a/drivers/media/platform/tegra/camera/vi/graph.c +++ b/drivers/media/platform/tegra/camera/vi/graph.c @@ -2,7 +2,7 @@ /* * NVIDIA Media controller graph management * - * Copyright (c) 2015-2022, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2015-2023, NVIDIA CORPORATION. All rights reserved. */ #include #include @@ -403,6 +403,7 @@ static int tegra_vi_graph_parse_one(struct tegra_channel *chan, struct device_node *next; struct device_node *remote = NULL; struct tegra_vi_graph_entity *entity; + int value = 0; int ret = 0; dev_dbg(chan->vi->dev, "parsing node %s\n", node->full_name); @@ -427,6 +428,10 @@ static int tegra_vi_graph_parse_one(struct tegra_channel *chan, !of_device_is_available(remote)) continue; + ret = of_property_read_u32(ep, "port-index", &value); + if (!ret) + chan->port[0] = value; + entity = devm_kzalloc(chan->vi->dev, sizeof(*entity), GFP_KERNEL); if (entity == NULL) {