bcm27xx: update 6.1 patches to latest version
[openwrt/staging/dangole.git] / target / linux / bcm27xx / patches-6.1 / 950-1210-media-rp1-csi2-Use-standard-link_validate.patch
1 From b6316a8450d3cb99b7599175d59b1b7f710770f5 Mon Sep 17 00:00:00 2001
2 From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
3 Date: Tue, 3 Oct 2023 13:59:02 +0300
4 Subject: [PATCH] media: rp1: csi2: Use standard link_validate
5
6 The current csi2_link_validate() skips some important checks. Let's
7 rather use the standard v4l2_subdev_link_validate_default() as the
8 link_validate hook.
9
10 Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
11 ---
12 .../media/platform/raspberrypi/rp1_cfe/csi2.c | 41 +------------------
13 1 file changed, 1 insertion(+), 40 deletions(-)
14
15 --- a/drivers/media/platform/raspberrypi/rp1_cfe/csi2.c
16 +++ b/drivers/media/platform/raspberrypi/rp1_cfe/csi2.c
17 @@ -462,11 +462,6 @@ void csi2_close_rx(struct csi2_device *c
18 csi2_reg_write(csi2, CSI2_IRQ_MASK, 0);
19 }
20
21 -static struct csi2_device *to_csi2_device(struct v4l2_subdev *subdev)
22 -{
23 - return container_of(subdev, struct csi2_device, sd);
24 -}
25 -
26 static int csi2_init_cfg(struct v4l2_subdev *sd,
27 struct v4l2_subdev_state *state)
28 {
29 @@ -554,45 +549,11 @@ static int csi2_pad_set_fmt(struct v4l2_
30 return 0;
31 }
32
33 -static int csi2_link_validate(struct v4l2_subdev *sd, struct media_link *link,
34 - struct v4l2_subdev_format *source_fmt,
35 - struct v4l2_subdev_format *sink_fmt)
36 -{
37 - struct csi2_device *csi2 = to_csi2_device(sd);
38 -
39 - csi2_dbg("%s: link \"%s\":%u -> \"%s\":%u\n", __func__,
40 - link->source->entity->name, link->source->index,
41 - link->sink->entity->name, link->sink->index);
42 -
43 - if ((link->source->entity == &csi2->sd.entity &&
44 - link->source->index == 1) ||
45 - (link->sink->entity == &csi2->sd.entity &&
46 - link->sink->index == 1)) {
47 - csi2_dbg("Ignore metadata pad for now\n");
48 - return 0;
49 - }
50 -
51 - /* The width, height and code must match. */
52 - if (source_fmt->format.width != sink_fmt->format.width ||
53 - source_fmt->format.width != sink_fmt->format.width ||
54 - source_fmt->format.code != sink_fmt->format.code) {
55 - csi2_err("%s: format does not match (source %ux%u 0x%x, sink %ux%u 0x%x)\n",
56 - __func__,
57 - source_fmt->format.width, source_fmt->format.height,
58 - source_fmt->format.code,
59 - sink_fmt->format.width, sink_fmt->format.height,
60 - sink_fmt->format.code);
61 - return -EPIPE;
62 - }
63 -
64 - return 0;
65 -}
66 -
67 static const struct v4l2_subdev_pad_ops csi2_subdev_pad_ops = {
68 .init_cfg = csi2_init_cfg,
69 .get_fmt = v4l2_subdev_get_fmt,
70 .set_fmt = csi2_pad_set_fmt,
71 - .link_validate = csi2_link_validate,
72 + .link_validate = v4l2_subdev_link_validate_default,
73 };
74
75 static const struct media_entity_operations csi2_entity_ops = {