firmware-utils: bump to git HEAD
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0791-media-irs1125-Refactoring-and-debug-messages.patch
1 From 6ba58915e8c2f884d17b651d68535959f9eff97d Mon Sep 17 00:00:00 2001
2 From: Markus Proeller <markus.proeller@pieye.org>
3 Date: Tue, 16 Jun 2020 13:27:42 +0200
4 Subject: [PATCH] media: irs1125: Refactoring and debug messages
5
6 Changed some variable names to comply with checkpatch --strict mode.
7 Debug messages added.
8
9 Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
10 ---
11 drivers/media/i2c/irs1125.c | 36 ++++++++++++++++++++----------------
12 1 file changed, 20 insertions(+), 16 deletions(-)
13
14 --- a/drivers/media/i2c/irs1125.c
15 +++ b/drivers/media/i2c/irs1125.c
16 @@ -15,6 +15,7 @@
17 #include "irs1125.h"
18 #include <linux/clk.h>
19 #include <linux/delay.h>
20 +#include <linux/firmware.h>
21 #include <linux/gpio/consumer.h>
22 #include <linux/i2c.h>
23 #include <linux/init.h>
24 @@ -22,13 +23,13 @@
25 #include <linux/module.h>
26 #include <linux/of_graph.h>
27 #include <linux/slab.h>
28 +#include <linux/types.h>
29 #include <linux/videodev2.h>
30 -#include <linux/firmware.h>
31 +#include <media/v4l2-ctrls.h>
32 #include <media/v4l2-device.h>
33 #include <media/v4l2-fwnode.h>
34 #include <media/v4l2-image-sizes.h>
35 #include <media/v4l2-mediabus.h>
36 -#include <media/v4l2-ctrls.h>
37
38 #define CHECK_BIT(val, pos) ((val) & BIT(pos))
39
40 @@ -38,18 +39,19 @@
41
42 #define IRS1125_ALTERNATE_FW "irs1125_af.bin"
43
44 -#define IRS1125_REG_CSICFG 0xA882
45 -#define IRS1125_REG_DESIGN_STEP 0xB0AD
46 -#define IRS1125_REG_EFUSEVAL2 0xB09F
47 -#define IRS1125_REG_EFUSEVAL3 0xB0A0
48 -#define IRS1125_REG_EFUSEVAL4 0xB0A1
49 -#define IRS1125_REG_DMEM_SHADOW 0xC320
50 +#define IRS1125_REG_SAFE_RECONFIG 0xA850
51 +#define IRS1125_REG_CSICFG 0xA882
52 +#define IRS1125_REG_DESIGN_STEP 0xB0AD
53 +#define IRS1125_REG_EFUSEVAL2 0xB09F
54 +#define IRS1125_REG_EFUSEVAL3 0xB0A0
55 +#define IRS1125_REG_EFUSEVAL4 0xB0A1
56 +#define IRS1125_REG_DMEM_SHADOW 0xC320
57
58 -#define IRS1125_DESIGN_STEP_EXPECTED 0x0a12
59 +#define IRS1125_DESIGN_STEP_EXPECTED 0x0a12
60
61 #define IRS1125_ROW_START_DEF 0
62 #define IRS1125_COLUMN_START_DEF 0
63 -#define IRS1125_WINDOW_HEIGHT_DEF 288
64 +#define IRS1125_WINDOW_HEIGHT_DEF 288
65 #define IRS1125_WINDOW_WIDTH_DEF 352
66
67 struct regval_list {
68 @@ -87,7 +89,7 @@ static inline struct irs1125 *to_state(s
69 return container_of(sd, struct irs1125, sd);
70 }
71
72 -static struct regval_list irs1125_26MHz[] = {
73 +static struct regval_list irs1125_26mhz[] = {
74 {0xB017, 0x0413},
75 {0xB086, 0x3535},
76 {0xB0AE, 0xEF02},
77 @@ -153,7 +155,7 @@ static struct regval_list irs1125_26MHz[
78 {0xFFFF, 100}
79 };
80
81 -static struct regval_list irs1125_seq_cfg[] = {
82 +static struct regval_list irs1125_seq_cfg_init[] = {
83 {0xC3A0, 0x823D},
84 {0xC3A1, 0xB13B},
85 {0xC3A2, 0x0313},
86 @@ -243,6 +245,7 @@ static int irs1125_write(struct v4l2_sub
87 dev_err(&client->dev, "%s: i2c write error, reg: %x\n",
88 __func__, reg);
89
90 + dev_dbg(&client->dev, "write addr 0x%04x, val 0x%04x\n", reg, val);
91 return ret;
92 }
93
94 @@ -364,8 +367,8 @@ static int __sensor_init(struct v4l2_sub
95 cnt++;
96 }
97
98 - ret = irs1125_write_array(sd, irs1125_26MHz,
99 - ARRAY_SIZE(irs1125_26MHz));
100 + ret = irs1125_write_array(sd, irs1125_26mhz,
101 + ARRAY_SIZE(irs1125_26mhz));
102 if (ret < 0) {
103 dev_err(&client->dev, "write sensor default regs error\n");
104 return ret;
105 @@ -415,8 +418,8 @@ static int __sensor_init(struct v4l2_sub
106 }
107 release_firmware(fw);
108
109 - ret = irs1125_write_array(sd, irs1125_seq_cfg,
110 - ARRAY_SIZE(irs1125_seq_cfg));
111 + ret = irs1125_write_array(sd, irs1125_seq_cfg_init,
112 + ARRAY_SIZE(irs1125_seq_cfg_init));
113 if (ret < 0) {
114 dev_err(&client->dev, "write default sequence failed\n");
115 return ret;
116 @@ -1037,6 +1040,7 @@ static int irs1125_probe(struct i2c_clie
117 }
118
119 gpio_num = desc_to_gpio(sensor->reset);
120 + dev_dbg(&client->dev, "reset on GPIO num %d\n", gpio_num);
121
122 mutex_init(&sensor->lock);
123