From 6e52a6d45d5296b5396b0b8ad27bbe6dfc3db235 Mon Sep 17 00:00:00 2001 From: Naushir Patuck 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 --- 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);