1 From 53261c968211567d5d415fc61cccdb64ccae5ffa Mon Sep 17 00:00:00 2001
2 From: Hugues Fruchet <hugues.fruchet@st.com>
3 Date: Tue, 11 Sep 2018 09:48:19 -0400
4 Subject: media: ov5640: fix wrong binning value in exposure calculation
6 [ Upstream commit c2c3f42df4dd9bb231d756bacb0c897f662c6d3c ]
8 ov5640_set_mode_exposure_calc() is checking binning value but
9 binning value read is buggy, fix this.
10 Rename ov5640_binning_on() to ov5640_get_binning() as per other
13 Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
14 Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
15 Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
16 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
17 Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
18 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
20 drivers/media/i2c/ov5640.c | 8 ++++----
21 1 file changed, 4 insertions(+), 4 deletions(-)
23 diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
24 index 39a2269c0beef..0366c8dc6ecf7 100644
25 --- a/drivers/media/i2c/ov5640.c
26 +++ b/drivers/media/i2c/ov5640.c
27 @@ -1216,7 +1216,7 @@ static int ov5640_set_ae_target(struct ov5640_dev *sensor, int target)
28 return ov5640_write_reg(sensor, OV5640_REG_AEC_CTRL1F, fast_low);
31 -static int ov5640_binning_on(struct ov5640_dev *sensor)
32 +static int ov5640_get_binning(struct ov5640_dev *sensor)
36 @@ -1224,8 +1224,8 @@ static int ov5640_binning_on(struct ov5640_dev *sensor)
37 ret = ov5640_read_reg(sensor, OV5640_REG_TIMING_TC_REG21, &temp);
41 - return temp ? 1 : 0;
43 + return temp & BIT(0);
46 static int ov5640_set_virtual_channel(struct ov5640_dev *sensor)
47 @@ -1293,7 +1293,7 @@ static int ov5640_set_mode_exposure_calc(
51 - ret = ov5640_binning_on(sensor);
52 + ret = ov5640_get_binning(sensor);
55 if (ret && mode->id != OV5640_MODE_720P_1280_720 &&