openwrt/target/linux/bcm27xx/patches-6.1/950-1210-media-rp1-csi2-Use-standard-link_validate.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

76 lines
2.5 KiB
Diff

From b6316a8450d3cb99b7599175d59b1b7f710770f5 Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Date: Tue, 3 Oct 2023 13:59:02 +0300
Subject: [PATCH] media: rp1: csi2: Use standard link_validate
The current csi2_link_validate() skips some important checks. Let's
rather use the standard v4l2_subdev_link_validate_default() as the
link_validate hook.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
.../media/platform/raspberrypi/rp1_cfe/csi2.c | 41 +------------------
1 file changed, 1 insertion(+), 40 deletions(-)
--- a/drivers/media/platform/raspberrypi/rp1_cfe/csi2.c
+++ b/drivers/media/platform/raspberrypi/rp1_cfe/csi2.c
@@ -462,11 +462,6 @@ void csi2_close_rx(struct csi2_device *c
csi2_reg_write(csi2, CSI2_IRQ_MASK, 0);
}
-static struct csi2_device *to_csi2_device(struct v4l2_subdev *subdev)
-{
- return container_of(subdev, struct csi2_device, sd);
-}
-
static int csi2_init_cfg(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state)
{
@@ -554,45 +549,11 @@ static int csi2_pad_set_fmt(struct v4l2_
return 0;
}
-static int csi2_link_validate(struct v4l2_subdev *sd, struct media_link *link,
- struct v4l2_subdev_format *source_fmt,
- struct v4l2_subdev_format *sink_fmt)
-{
- struct csi2_device *csi2 = to_csi2_device(sd);
-
- csi2_dbg("%s: link \"%s\":%u -> \"%s\":%u\n", __func__,
- link->source->entity->name, link->source->index,
- link->sink->entity->name, link->sink->index);
-
- if ((link->source->entity == &csi2->sd.entity &&
- link->source->index == 1) ||
- (link->sink->entity == &csi2->sd.entity &&
- link->sink->index == 1)) {
- csi2_dbg("Ignore metadata pad for now\n");
- return 0;
- }
-
- /* The width, height and code must match. */
- if (source_fmt->format.width != sink_fmt->format.width ||
- source_fmt->format.width != sink_fmt->format.width ||
- source_fmt->format.code != sink_fmt->format.code) {
- csi2_err("%s: format does not match (source %ux%u 0x%x, sink %ux%u 0x%x)\n",
- __func__,
- source_fmt->format.width, source_fmt->format.height,
- source_fmt->format.code,
- sink_fmt->format.width, sink_fmt->format.height,
- sink_fmt->format.code);
- return -EPIPE;
- }
-
- return 0;
-}
-
static const struct v4l2_subdev_pad_ops csi2_subdev_pad_ops = {
.init_cfg = csi2_init_cfg,
.get_fmt = v4l2_subdev_get_fmt,
.set_fmt = csi2_pad_set_fmt,
- .link_validate = csi2_link_validate,
+ .link_validate = v4l2_subdev_link_validate_default,
};
static const struct media_entity_operations csi2_entity_ops = {