debe37b8f3c02f873ad32c9da84a51151f948118
[openwrt/staging/blogic.git] /
1 From 4207b34a5b5831d5fea177a1a005eec692cc3722 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 31 Mar 2022 17:12:12 +0100
4 Subject: [PATCH] media: i2c: imx258: Issue reset before starting
5 streaming
6
7 Whilst not documented, register 0x0103 bit 0 is the soft
8 reset for the sensor, so send it before trying to configure
9 the sensor.
10
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
12 ---
13 drivers/media/i2c/imx258.c | 10 ++++++++++
14 1 file changed, 10 insertions(+)
15
16 --- a/drivers/media/i2c/imx258.c
17 +++ b/drivers/media/i2c/imx258.c
18 @@ -20,6 +20,8 @@
19 #define IMX258_MODE_STANDBY 0x00
20 #define IMX258_MODE_STREAMING 0x01
21
22 +#define IMX258_REG_RESET 0x0103
23 +
24 /* Chip ID */
25 #define IMX258_REG_CHIP_ID 0x0016
26 #define IMX258_CHIP_ID 0x0258
27 @@ -1319,6 +1321,14 @@ static int imx258_start_streaming(struct
28 const struct imx258_link_freq_config *link_freq_cfg;
29 int ret, link_freq_index;
30
31 + ret = imx258_write_reg(imx258, IMX258_REG_RESET, IMX258_REG_VALUE_08BIT,
32 + 0x01);
33 + if (ret) {
34 + dev_err(&client->dev, "%s failed to reset sensor\n", __func__);
35 + return ret;
36 + }
37 + usleep_range(10000, 15000);
38 +
39 /* Setup PLL */
40 link_freq_index = imx258->cur_mode->link_freq_index;
41 link_freq_cfg = &imx258->link_freq_configs[link_freq_index];