openwrt/target/linux/bcm27xx/patches-6.1/950-1172-drivers-media-cfe-Find-the-source-pads-on-the-sensor.patch
Marty Jones 2e715fb4fc bcm27xx: update 6.1 patches to latest version
Add support for BCM2712 (Raspberry Pi 5).
3bb5880ab3
Patches were generated from the diff between linux kernel branch linux-6.1.y
and rpi-6.1.y from raspberry pi kernel source:
- git format-patch linux-6.1.y...rpi-6.1.y

Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2710/RPi3B, bcm2711/RPi4B

Signed-off-by: Marty Jones <mj8263788@gmail.com>
[Remove applied and reverted patches, squash patches and config commits]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-01-25 17:46:45 +01:00

56 lines
1.8 KiB
Diff

From 76b1bbf3ec3be0afdc768863ab7e9bbd2734b97b Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Fri, 24 Nov 2023 14:29:57 +0000
Subject: [PATCH] drivers: media: cfe: Find the source pads on the sensor
entity
The driver was assuming that pad 0 on the sensor entity was the
appropriate source pad, but this isn't necessarily the case.
With video-mux, it has the sink pads first, and then the source
pad as the last one.
Iterate through the sensor pads to find the relevant source pads.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/platform/raspberrypi/rp1_cfe/cfe.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
--- a/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c
+++ b/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c
@@ -1826,7 +1826,7 @@ static void cfe_unregister_nodes(struct
static int cfe_link_node_pads(struct cfe_device *cfe)
{
- unsigned int i;
+ unsigned int i, source_pad = 0;
int ret;
for (i = 0; i < CSI2_NUM_CHANNELS; i++) {
@@ -1835,14 +1835,23 @@ static int cfe_link_node_pads(struct cfe
if (!check_state(cfe, NODE_REGISTERED, i))
continue;
- if (i < cfe->sensor->entity.num_pads) {
+ /* Find next source pad */
+ while (source_pad < cfe->sensor->entity.num_pads &&
+ !(cfe->sensor->entity.pads[source_pad].flags &
+ MEDIA_PAD_FL_SOURCE))
+ source_pad++;
+
+ if (source_pad < cfe->sensor->entity.num_pads) {
/* Sensor -> CSI2 */
- ret = media_create_pad_link(&cfe->sensor->entity, i,
+ ret = media_create_pad_link(&cfe->sensor->entity, source_pad,
&cfe->csi2.sd.entity, i,
MEDIA_LNK_FL_IMMUTABLE |
MEDIA_LNK_FL_ENABLED);
if (ret)
return ret;
+
+ /* Dealt with that source_pad, look at the next one next time */
+ source_pad++;
}
/* CSI2 channel # -> /dev/video# */