bcm27xx: 6.1: add kernel patches
[openwrt/staging/nbd.git] / target / linux / bcm27xx / patches-6.1 / 950-0596-media-i2c-imx296-Disable-binning-for-colour-variant.patch
1 From 6e52a6d45d5296b5396b0b8ad27bbe6dfc3db235 Mon Sep 17 00:00:00 2001
2 From: Naushir Patuck <naush@raspberrypi.com>
3 Date: Tue, 14 Mar 2023 12:55:14 +0000
4 Subject: [PATCH] media: i2c: imx296: Disable binning for colour
5 variant
6
7 Binning is only supported on the mono variant of the IMX296 sensor.
8 Disable reporting of the binning mode for the colour variant.
9
10 Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
11 ---
12 drivers/media/i2c/imx296.c | 5 ++++-
13 1 file changed, 4 insertions(+), 1 deletion(-)
14
15 --- a/drivers/media/i2c/imx296.c
16 +++ b/drivers/media/i2c/imx296.c
17 @@ -674,11 +674,14 @@ static int imx296_enum_frame_size(struct
18 struct v4l2_subdev_state *state,
19 struct v4l2_subdev_frame_size_enum *fse)
20 {
21 + const struct imx296 *sensor = to_imx296(sd);
22 const struct v4l2_mbus_framefmt *format;
23 + /* Binning only works on the mono sensor variant */
24 + unsigned int max_index = sensor->mono ? 2 : 1;
25
26 format = v4l2_subdev_get_pad_format(sd, state, fse->pad);
27
28 - if (fse->index >= 2 || fse->code != format->code)
29 + if (fse->index >= max_index || fse->code != format->code)
30 return -EINVAL;
31
32 fse->min_width = IMX296_PIXEL_ARRAY_WIDTH / (fse->index + 1);