]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/media-ov5640-fix-wrong-binning-value-in-exposure-cal.patch
autosel fixes for 4.14
[thirdparty/kernel/stable-queue.git] / queue-4.14 / media-ov5640-fix-wrong-binning-value-in-exposure-cal.patch
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
5
6 [ Upstream commit c2c3f42df4dd9bb231d756bacb0c897f662c6d3c ]
7
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
11 similar functions.
12
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>
19 ---
20 drivers/media/i2c/ov5640.c | 8 ++++----
21 1 file changed, 4 insertions(+), 4 deletions(-)
22
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);
29 }
30
31 -static int ov5640_binning_on(struct ov5640_dev *sensor)
32 +static int ov5640_get_binning(struct ov5640_dev *sensor)
33 {
34 u8 temp;
35 int ret;
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);
38 if (ret)
39 return ret;
40 - temp &= 0xfe;
41 - return temp ? 1 : 0;
42 +
43 + return temp & BIT(0);
44 }
45
46 static int ov5640_set_virtual_channel(struct ov5640_dev *sensor)
47 @@ -1293,7 +1293,7 @@ static int ov5640_set_mode_exposure_calc(
48 if (ret < 0)
49 return ret;
50 prev_shutter = ret;
51 - ret = ov5640_binning_on(sensor);
52 + ret = ov5640_get_binning(sensor);
53 if (ret < 0)
54 return ret;
55 if (ret && mode->id != OV5640_MODE_720P_1280_720 &&
56 --
57 2.20.1
58