aboutsummaryrefslogtreecommitdiff
path: root/target/linux/bcm27xx/patches-6.1/950-0596-media-i2c-imx296-Disable-binning-for-colour-variant.patch
blob: 01ab02df943e3e5071741f4ea45599308c80eab4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From 6e52a6d45d5296b5396b0b8ad27bbe6dfc3db235 Mon Sep 17 00:00:00 2001
From: Naushir Patuck <naush@raspberrypi.com>
Date: Tue, 14 Mar 2023 12:55:14 +0000
Subject: [PATCH] media: i2c: imx296: Disable binning for colour
 variant

Binning is only supported on the mono variant of the IMX296 sensor.
Disable reporting of the binning mode for the colour variant.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 drivers/media/i2c/imx296.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/media/i2c/imx296.c
+++ b/drivers/media/i2c/imx296.c
@@ -674,11 +674,14 @@ static int imx296_enum_frame_size(struct
 				  struct v4l2_subdev_state *state,
 				  struct v4l2_subdev_frame_size_enum *fse)
 {
+	const struct imx296 *sensor = to_imx296(sd);
 	const struct v4l2_mbus_framefmt *format;
+	/* Binning only works on the mono sensor variant */
+	unsigned int max_index = sensor->mono ? 2 : 1;
 
 	format = v4l2_subdev_get_pad_format(sd, state, fse->pad);
 
-	if (fse->index >= 2 || fse->code != format->code)
+	if (fse->index >= max_index || fse->code != format->code)
 		return -EINVAL;
 
 	fse->min_width = IMX296_PIXEL_ARRAY_WIDTH / (fse->index + 1);