lede/target/linux/bcm27xx/patches-6.12/950-0138-drivers-media-imx296-Disable-2x2-binned-mode.patch
=?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= d81c03f05e bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-06-20 17:01:06 +08:00

64 lines
2.2 KiB
Diff

From ef5ec7e945c9602a155598e55ed4c9447fbc5fd3 Mon Sep 17 00:00:00 2001
From: Naushir Patuck <naush@raspberrypi.com>
Date: Wed, 31 May 2023 15:51:58 +0100
Subject: [PATCH] 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(-)
--- a/drivers/media/i2c/imx296.c
+++ b/drivers/media/i2c/imx296.c
@@ -664,7 +664,11 @@ static int imx296_enum_frame_size(struct
format = v4l2_subdev_state_get_format(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);
@@ -686,32 +690,8 @@ static int imx296_set_format(struct v4l2
crop = v4l2_subdev_state_get_crop(state, fmt->pad);
format = v4l2_subdev_state_get_format(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;