summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/imx219.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-09-24 18:32:59 +0300
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2023-10-07 10:55:47 +0200
commitc59d77be1b8349757660216e20db8cac75e6c967 (patch)
tree427fc21c1a131d3fa18b3d782914e116c3edc1c6 /drivers/media/i2c/imx219.c
parent00eb22782bb15b04dddc8471bbcee68b7613ba0f (diff)
downloadlwn-c59d77be1b8349757660216e20db8cac75e6c967.tar.gz
lwn-c59d77be1b8349757660216e20db8cac75e6c967.zip
media: i2c: imx219: Infer binning settings from format and crop
Compare the format and crop rectangle dimensions to infer binning settings, instead of storing the binning mode in the imx219_mode structure. This removes duplicate information from the mode. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media/i2c/imx219.c')
-rw-r--r--drivers/media/i2c/imx219.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
index 562cfee87b24..bc836cd13ef5 100644
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -161,9 +161,6 @@ struct imx219_mode {
/* V-timing */
unsigned int vts_def;
-
- /* 2x2 binning is used */
- bool binning;
};
static const struct cci_reg_sequence imx219_common_regs[] = {
@@ -305,7 +302,6 @@ static const struct imx219_mode supported_modes[] = {
.height = 2464
},
.vts_def = IMX219_VTS_15FPS,
- .binning = false,
},
{
/* 1080P 30fps cropped */
@@ -318,7 +314,6 @@ static const struct imx219_mode supported_modes[] = {
.height = 1080
},
.vts_def = IMX219_VTS_30FPS_1080P,
- .binning = false,
},
{
/* 2x2 binned 30fps mode */
@@ -331,7 +326,6 @@ static const struct imx219_mode supported_modes[] = {
.height = 2464
},
.vts_def = IMX219_VTS_30FPS_BINNED,
- .binning = true,
},
{
/* 640x480 30fps mode */
@@ -344,7 +338,6 @@ static const struct imx219_mode supported_modes[] = {
.height = 960
},
.vts_def = IMX219_VTS_30FPS_640x480,
- .binning = true,
},
};
@@ -648,7 +641,7 @@ static int imx219_set_framefmt(struct imx219 *imx219,
cci_write(imx219->regmap, IMX219_REG_Y_ADD_END_A,
crop->top - IMX219_PIXEL_ARRAY_TOP + crop->height - 1, &ret);
- if (!imx219->mode->binning)
+ if (format->width == crop->width && format->height == crop->height)
bin_mode = IMX219_BINNING_NONE;
else if (bpp == 8)
bin_mode = IMX219_BINNING_2X2_ANALOG;