From 2c01ecac9b82b28c63a7a95fa882d8f2575bc1de Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Tue, 14 Mar 2023 12:55:14 +0000 Subject: [PATCH 626/726] 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 --- drivers/media/i2c/imx296.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/imx296.c b/drivers/media/i2c/imx296.c index a5358c3743b7..29b0c229b155 100644 --- a/drivers/media/i2c/imx296.c +++ b/drivers/media/i2c/imx296.c @@ -674,11 +674,14 @@ static int imx296_enum_frame_size(struct v4l2_subdev *sd, 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); -- 2.33.1