On Tue Sep 8 09:33:06 2026 +0300, Tomi Valkeinen wrote:
> The stream routing will be fully configurable when we add full streams
> support to the rcar pipeline. Thus there is no need for the user to be
> able to link VINs to different CSI-2 channels. In fact, allowing e.g.
> VIN0 to be connected to CSI-2 channel 3 would be wrong, as the hardware
> doesn't allow that.
> 
> Change rvin_csi2_create_link() so that it creates media links only
> between matching VINs and CSI-2 channels (VIN0 - channel 0, VIN1 -
> channel 1, etc.).
> 
> Reviewed-by: Niklas Söderlund <[email protected]>
> Tested-by: Niklas Söderlund <[email protected]>
> Signed-off-by: Tomi Valkeinen <[email protected]>
> Signed-off-by: Sakari Ailus <[email protected]>

Patch committed.

Thanks,
Sakari Ailus

 .../media/platform/renesas/rcar-vin/rcar-core.c    | 27 ++++++++++++----------
 1 file changed, 15 insertions(+), 12 deletions(-)

---

diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c 
b/drivers/media/platform/renesas/rcar-vin/rcar-core.c
index c8d564aa1eba..2fcea715101c 100644
--- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c
@@ -673,23 +673,26 @@ static int rvin_csi2_create_link(struct rvin_group 
*group, unsigned int id,
        struct media_entity *source = 
&group->remotes[route->csi].subdev->entity;
        struct media_entity *sink = &group->vin[id]->vdev.entity;
        struct media_pad *sink_pad = &sink->pads[0];
+       struct media_pad *source_pad;
+       unsigned int source_idx;
        unsigned int channel;
-       int ret;
 
-       for (channel = 0; channel < 4; channel++) {
-               unsigned int source_idx = 
rvin_group_csi_channel_to_pad(channel);
-               struct media_pad *source_pad = &source->pads[source_idx];
+       /*
+        * The channels from CSI-2 blocks and the VIN groups have a set of
+        * hardcoded routing options to choose from. We only support the routing
+        * where all VINs in a group are connected to the same CSI-2 block,
+        * and the Nth VIN in the group is connected to the Nth CSI-2 channel.
+        */
 
-               /* Skip if link already exists. */
-               if (media_entity_find_link(source_pad, sink_pad))
-                       continue;
+       channel = id % 4;
+       source_idx = rvin_group_csi_channel_to_pad(channel);
+       source_pad = &source->pads[source_idx];
 
-               ret = media_create_pad_link(source, source_idx, sink, 0, 0);
-               if (ret)
-                       return ret;
-       }
+       /* Skip if link already exists. */
+       if (media_entity_find_link(source_pad, sink_pad))
+               return 0;
 
-       return 0;
+       return media_create_pad_link(source, source_idx, sink, 0, 0);
 }
 
 static int rvin_parallel_setup_links(struct rvin_group *group)
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to