1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-02-15 04:42:02 +00:00
openmptcprouter/6.6/target/linux/bcm27xx/patches-6.6/0473-drivers-media-imx296-Disable-2x2-binned-mode.patch
Ycarus (Yannick Chabanois) 12de1d2995 Add RPI kernel 6.6 support
2024-04-05 20:55:33 +02:00

68 lines
2.3 KiB
Diff

From 8e8e8ba6a3c05d2e01492581801f73e40e482e42 Mon Sep 17 00:00:00 2001
From: Naushir Patuck <naush@raspberrypi.com>
Date: Wed, 31 May 2023 15:51:58 +0100
Subject: [PATCH 0473/1002] drivers: media: imx296: Disable 2x2 binned mode
Disable enumerating and setting of the 2x2 binned mode entirely as it
does not seem to work for either mono or colour sensor variants.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
drivers/media/i2c/imx296.c | 34 +++++++---------------------------
1 file changed, 7 insertions(+), 27 deletions(-)
diff --git a/drivers/media/i2c/imx296.c b/drivers/media/i2c/imx296.c
index 3b4539b622b4..f942f66fa664 100644
--- a/drivers/media/i2c/imx296.c
+++ b/drivers/media/i2c/imx296.c
@@ -674,7 +674,11 @@ static int imx296_enum_frame_size(struct v4l2_subdev *sd,
format = v4l2_subdev_get_pad_format(sd, state, fse->pad);
- if (fse->index >= 2 || fse->code != format->code)
+ /*
+ * Binning does not seem to work on either mono or colour sensor
+ * variants. Disable enumerating the binned frame size for now.
+ */
+ if (fse->index >= 1 || fse->code != format->code)
return -EINVAL;
fse->min_width = IMX296_PIXEL_ARRAY_WIDTH / (fse->index + 1);
@@ -696,32 +700,8 @@ static int imx296_set_format(struct v4l2_subdev *sd,
crop = v4l2_subdev_get_pad_crop(sd, state, fmt->pad);
format = v4l2_subdev_get_pad_format(sd, state, fmt->pad);
- /*
- * Binning is only allowed when cropping is disabled according to the
- * documentation. This should be double-checked.
- */
- if (crop->width == IMX296_PIXEL_ARRAY_WIDTH &&
- crop->height == IMX296_PIXEL_ARRAY_HEIGHT) {
- unsigned int width;
- unsigned int height;
- unsigned int hratio;
- unsigned int vratio;
-
- /* Clamp the width and height to avoid dividing by zero. */
- width = clamp_t(unsigned int, fmt->format.width,
- crop->width / 2, crop->width);
- height = clamp_t(unsigned int, fmt->format.height,
- crop->height / 2, crop->height);
-
- hratio = DIV_ROUND_CLOSEST(crop->width, width);
- vratio = DIV_ROUND_CLOSEST(crop->height, height);
-
- format->width = crop->width / hratio;
- format->height = crop->height / vratio;
- } else {
- format->width = crop->width;
- format->height = crop->height;
- }
+ format->width = crop->width;
+ format->height = crop->height;
format->code = sensor->mono ? MEDIA_BUS_FMT_Y10_1X10
: MEDIA_BUS_FMT_SBGGR10_1X10;
--
2.44.0