msm8916-openwrt/target/linux/bcm27xx/patches-6.6/950-0782-media-rp1-csi2-Use-standard-link_validate.patch
Álvaro Fernández Rojas 8c405cdccc bcm27xx: add 6.6 kernel patches
The patches were generated from the RPi repo with the following command:
git format-patch v6.6.34..rpi-6.1.y

Some patches needed rebasing and, as usual, the applied and reverted, wireless
drivers, Github workflows, READMEs and defconfigs patches were removed.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-06-18 18:52:49 +02:00

76 lines
2.5 KiB
Diff

From fc99206e967233b5460e132caa55381f20f9faae 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 0782/1085] 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 = {