summaryrefslogtreecommitdiffstats
path: root/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0398-media-i2c-ar0147-add-SE-mode.patch
blob: 4a003f710c37061c9550e828460ef6ff19419d92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
From f424f98ee6a4fd3b8add8d126b340914e0643929 Mon Sep 17 00:00:00 2001
From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Date: Tue, 16 Jul 2019 12:29:00 +0300
Subject: [PATCH] media: i2c: ar0147: add SE mode

This adds super-exposure default mode

Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
 drivers/media/i2c/soc_camera/ar0147.c      |   4 ++
 drivers/media/i2c/soc_camera/ar0147_rev2.h | 111 +++++++++++++++++++++++++++++
 drivers/media/i2c/soc_camera/ar0147_rev3.h |  77 ++++++++++++++++++++
 3 files changed, 192 insertions(+)

diff --git a/drivers/media/i2c/soc_camera/ar0147.c b/drivers/media/i2c/soc_camera/ar0147.c
index 563708c..53be588 100644
--- a/drivers/media/i2c/soc_camera/ar0147.c
+++ b/drivers/media/i2c/soc_camera/ar0147.c
@@ -492,6 +492,8 @@ static int ar0147_initialize(struct i2c_client *client)
 		case 0x2:
 			if (strcmp(mode, "hdr") == 0)
 				ar0147_set_regs(client, ar0147_regs_hdr_mipi450mbps_12bit_30fps_rev2);
+			else if (strcmp(mode, "se") == 0)
+				ar0147_set_regs(client, ar0147_regs_se_mipi450mbps_12bit_30fps_rev2);
 			else if (strcmp(mode, "seplus") == 0)
 				ar0147_set_regs(client, ar0147_regs_seplus_mipi450mbps_12bit_30fps_rev2);
 			else
@@ -500,6 +502,8 @@ static int ar0147_initialize(struct i2c_client *client)
 		case 0x3:
 			if (strcmp(mode, "hdr") == 0)
 				ar0147_set_regs(client, ar0147_regs_hdr_mipi450mbps_12bit_30fps_rev3);
+			else if (strcmp(mode, "se") == 0)
+				ar0147_set_regs(client, ar0147_regs_se_mipi450mbps_12bit_30fps_rev3);
 			else if (strcmp(mode, "seplus1") == 0)
 				ar0147_set_regs(client, ar0147_regs_seplus1_mipi450mbps_12bit_30fps_rev3);
 			else if (strcmp(mode, "seplus2") == 0)
diff --git a/drivers/media/i2c/soc_camera/ar0147_rev2.h b/drivers/media/i2c/soc_camera/ar0147_rev2.h
index 04d8e5e..c7a643e 100644
--- a/drivers/media/i2c/soc_camera/ar0147_rev2.h
+++ b/drivers/media/i2c/soc_camera/ar0147_rev2.h
@@ -485,6 +485,78 @@ static const struct ar0147_reg ar0147_rev2_Sensor_Setup[] = {
 { }
 }; /* Sensor_Setup */
 
+static const struct ar0147_reg ar0147_rev2_Super_Exposure_Default_Setup[] = {
+{0x3082, 0x0004}, // OPERATION_MODE_CTRL
+{0x30BA, 0x1002}, // DIGITAL_CTRL
+{0x3C06, 0x000C},
+{0x3C08, 0x1100},
+{0x3116, 0x0000}, // HDR_CONTROL3
+{0x3088, 0x0480},
+{0x3510, 0x814F},
+{0x351E, 0x0100},
+{0x32EA, 0x3CA9},
+{0x32EC, 0x7281},
+{0x3212, 0x0000}, // COARSE_INTEGRATION_TIME2
+{0x3238, 0x8222}, // EXPOSURE_RATIO
+{0x33E2, 0x0910}, // SAMPLE_CTRL
+{0x3362, 0x0001}, // DC_GAIN
+{0x322A, 0x0539}, // FINE_INTEGRATION_CTRL
+{0x3014, 0x0123}, // FINE_INTEGRATION_TIME_
+{0x1008, 0x0123}, // FINE_INTEGRATION_TIME_MIN
+{0x3230, 0x00C7}, // FINE_CORRECTION
+{0x32D0, 0x3A02},
+{0x32D2, 0x3508},
+{0x32D4, 0x3702},
+{0x32D6, 0x3C04},
+{0x32DC, 0x370A},
+{0x3528, 0x99EE},
+{0x30FE, 0x0040}, // NOISE_PEDESTAL
+{0x3782, 0x0000},
+
+/* Other_Super_Exposure_Setup */
+{0x3536, 0xFF20},
+{0x3520, 0x0800},
+{0x3522, 0x0008},
+{0x3536, 0xFF20},
+{0x350C, 0x034A},
+{0x350E, 0x051C},
+{0x3540, 0xC62C},
+{0x3542, 0x4B4B},
+{0x3544, 0x4B46},
+{0x3546, 0x5A5A},
+{0x3548, 0x6400},
+{0x354A, 0x007F},
+{0x3524, 0x0600},
+{0x3372, 0xF40F}, // DBLC_FS0_CONTROL
+{0x3180, 0x0188},
+{0x3280, 0x0CB2}, // T1_BARRIER_C0
+{0x3282, 0x0CB2}, // T1_BARRIER_C1
+{0x3284, 0x0CB2}, // T1_BARRIER_C2
+{0x3286, 0x0CB2}, // T1_BARRIER_C3
+{0x3288, 0x0CB2}, // T2_BARRIER_C0
+{0x328A, 0x0CB2}, // T2_BARRIER_C1
+{0x328C, 0x0CB2}, // T2_BARRIER_C2
+{0x328E, 0x0CB2}, // T2_BARRIER_C3
+{0x3290, 0x0CB2}, // T3_BARRIER_C0
+{0x3292, 0x0CB2}, // T3_BARRIER_C1
+{0x3294, 0x0CB2}, // T3_BARRIER_C2
+{0x3296, 0x0CB2}, // T3_BARRIER_C3
+{0x3298, 0x0CB2}, // T4_BARRIER_C0
+{0x329A, 0x0CB2}, // T4_BARRIER_C1
+{0x329C, 0x0CB2}, // T4_BARRIER_C2
+{0x329E, 0x0CB2}, // T4_BARRIER_C3
+{0x3108, 0x0CB1},
+{0x312A, 0x83E8},
+{0x3C82, 0x0FFF},
+{0x3102, 0x6100},
+{0x3104, 0x6100},
+{0x3106, 0x6100},
+{0x3120, 0x0AF0},
+{0x3122, 0x0CB2},
+/* Other_Super_Exposure_Setup */
+{ }
+}; /* Super_Exposure_Default_Setup */
+
 static const struct ar0147_reg ar0147_rev2_Super_Exposure_Default_Plus_T2_Setup[] = {
 {0x3082, 0x0008}, // OPERATION_MODE_CTRL
 {0x30BA, 0x1003}, // DIGITAL_CTRL
@@ -651,6 +723,30 @@ static const struct ar0147_reg ar0147_rev2_3exp_30FPS_Timing_and_Exposure[] = {
 { }
 }; /* 3exp_30FPS_Timing_and_Exposure */
 
+static const struct ar0147_reg ar0147_rev2_SE_Default_Mode_30FPS_Timing_and_Exposure[] = {
+{0x3082, 0x0004}, // OPERATION_MODE_CTRL: 2exp
+{0x30BA, 0x1002}, // DIGITAL_CTRL: 3exp max
+
+/* Row and Pixel Timing */
+{0x300C, AR0147_SENSOR_WIDTH + 52}, // LINE_LENGTH_PCK_ (1396)
+{0x300A, AR0147_SENSOR_HEIGHT + 226}, // FRAME_LENGTH_LINES_
+{0x3042, 0x0000}, // EXTRA_DELAY
+
+/* Exposure Settings */
+{0x3238, 0x8222}, // EXPOSURE_RATIO: separate integartion time!?
+{0x3012, 0x0300}, // COARSE_INTEGRATION_TIME_
+
+{0x322A, 0x0139}, // FINE_INTEGRATION_CTRL
+{0x3014, 0x0123}, // FINE_INTEGRATION_TIME_
+{0x3362, 0x0001}, // DC_GAIN
+{0x3366, 0xFFF7}, // ANALOG_GAIN
+{0x3364, 0x01CF}, // DCG_TRIM
+
+{0x30B0, 0x980C}, // DIGITAL_TEST (MIPI ...)
+{0x32EC, 0x7281},
+{ }
+}; /* SE_Default_Mode_30FPS_Timing_and_Exposure */
+
 static const struct ar0147_reg ar0147_rev2_SE_Plus_T2_Default_Mode_30FPS_Timing_and_Exposure[] = {
 {0x3082, 0x0008}, // OPERATION_MODE_CTRL: 3exp
 {0x30BA, 0x1003}, // DIGITAL_CTRL: 4exp max
@@ -780,6 +876,21 @@ static const struct ar0147_reg *ar0147_regs_hdr_mipi450mbps_12bit_30fps_rev2[] =
 	NULL
 };
 
+/* Super-Exposure, Full Resolution, MIPI 450MBPS 4 lane 12-bit, 30FPS, XMCLK=24MHz */
+static const struct ar0147_reg *ar0147_regs_se_mipi450mbps_12bit_30fps_rev2[] = {
+	ar0147_rev2_Reset,
+	ar0147_rev2_Sensor_Setup,
+	ar0147_rev2_Super_Exposure_Default_Setup,
+	ar0147_rev2_Serial_12_bit_Timing_Setup,
+	ar0147_rev2_Readout_Mode_Configuration,
+	ar0147_rev2_Full_Res_FOV,
+	ar0147_rev2_SE_Default_Mode_30FPS_Timing_and_Exposure,
+	ar0147_rev2_Serial_4_Lane_20_to_12_bit_Output,
+	ar0147_rev2_MIPI_12_bit_450MBps_Settings,
+	ar0147_rev2_shutter_and_booster_settings,
+	NULL
+};
+
 /* Super-Exposure Plus T2, Full Resolution, MIPI 450MBPS 4 lane 12-bit, 30FPS, XMCLK=24MHz */
 static const struct ar0147_reg *ar0147_regs_seplus_mipi450mbps_12bit_30fps_rev2[] = {
 	ar0147_rev2_Reset,
diff --git a/drivers/media/i2c/soc_camera/ar0147_rev3.h b/drivers/media/i2c/soc_camera/ar0147_rev3.h
index 89b58da..02acf1a 100644
--- a/drivers/media/i2c/soc_camera/ar0147_rev3.h
+++ b/drivers/media/i2c/soc_camera/ar0147_rev3.h
@@ -490,6 +490,36 @@ static const struct ar0147_reg ar0147_rev3_Sensor_Setup[] = {
 { }
 }; /* Sensor_Setup */
 
+static const struct ar0147_reg ar0147_rev3_Super_Exposure_Mode_1_Setup[] = {
+{0x3082, 0x0004}, // OPERATION_MODE_CTRL
+{0x30BA, 0x1002}, // DIGITAL_CTRL
+{0x3C06, 0x000C}, //
+{0x3C08, 0x1100}, //
+{0x3116, 0x0000}, // HDR_CONTROL3
+{0x3088, 0x0480}, //
+{0x3510, 0x814F}, //
+{0x351E, 0x0100}, //
+{0x32EA, 0x3CA9}, //
+{0x32EC, 0x7281}, //
+{0x3212, 0x0000}, // COARSE_INTEGRATION_TIME2
+{0x3238, 0x8222}, // EXPOSURE_RATIO
+{0x33E2, 0x0910}, // SAMPLE_CTRL
+{0x3362, 0x0001}, // DC_GAIN
+{0x322A, 0x0539}, // FINE_INTEGRATION_CTRL
+{0x3014, 0x0137}, // FINE_INTEGRATION_TIME_
+{0x1008, 0x0137}, // FINE_INTEGRATION_TIME_MIN
+{0x3230, 0x00DB}, // FINE_CORRECTION
+{0x32D0, 0x3A02}, //
+{0x32D2, 0x3508}, //
+{0x32D4, 0x3702}, //
+{0x32D6, 0x3C04}, //
+{0x32DC, 0x370A}, //
+{0x3528, 0x99EE}, //
+{0x30FE, 0x0040}, // NOISE_PEDESTAL
+{0x3782, 0x0000}, //
+{ }
+}; /* Super_Exposure_Mode_1_Setup */
+
 static const struct ar0147_reg ar0147_rev3_Super_Exposure_Plus_T2_Mode_1_Setup[] = {
 {0x3C06, 0x2024}, // CONFIGURE_BUFFERS1
 {0x3C08, 0x2100}, // CONFIGURE_BUFFERS2
@@ -763,6 +793,29 @@ static const struct ar0147_reg ar0147_rev3_3exp_30FPS_Timing_and_Exposure[] = {
 { }
 }; /* 3exp_30FPS_Timing_and_Exposure */
 
+static const struct ar0147_reg ar0147_rev3_SE_Mode_1_30FPS_Timing_and_Exposure[] = {
+{0x3082, 0x0004}, // OPERATION_MODE_CTRL: 2exp
+{0x30BA, 0x1002}, // DIGITAL_CTRL: 3exp max
+
+/* Row and Pixel Timing */
+{0x300C, AR0147_SENSOR_WIDTH + 52}, // LINE_LENGTH_PCK_ (1396)
+{0x300A, AR0147_SENSOR_HEIGHT + 226}, // FRAME_LENGTH_LINES_
+{0x3042, 0x0000}, // EXTRA_DELAY
+
+/* Exposure Settings */
+{0x3238, 0x8222}, // EXPOSURE_RATIO: separate integartion time!?
+{0x3012, 0x0300}, // COARSE_INTEGRATION_TIME_
+
+{0x322A, 0x0139}, // FINE_INTEGRATION_CTRL
+{0x3014, 0x0123}, // FINE_INTEGRATION_TIME_
+{0x3362, 0x0001}, // DC_GAIN
+{0x3366, 0xFFF7}, // ANALOG_GAIN
+
+{0x30B0, 0x980C}, // DIGITAL_TEST (MIPI ...)
+{0x32EC, 0x7281},
+{ }
+}; /* SE_Mode_1_30FPS_Timing_and_Exposure */
+
 static const struct ar0147_reg ar0147_rev3_SE_Plus_T2_Mode_1_30FPS_Timing_and_Exposure[] = {
 {0x3082, 0x0008}, // OPERATION_MODE_CTRL: 3exp
 {0x30BA, 0x1003}, // DIGITAL_CTRL: 4exp max
@@ -813,6 +866,16 @@ static const struct ar0147_reg ar0147_rev3_SE_Plus_T2_Mode_2_50MHz_29FPS_Timing_
 { }
 }; /* SE_Plus_T2_Mode_2_30FPS_Timing_and_Exposure */
 
+static const struct ar0147_reg ar0147_rev3_Serial_4_Lane_16_to_12_bit_Output[] = {
+{0x31D0, 0x0001}, // COMPANDING
+{0x31AE, 0x0304}, // SERIAL_FORMAT: HISPI 4-lanes
+{0x31AC, 0x100C}, // DATA_FORMAT_BITS: ADC16, RAW12
+//{0x301A, 0x0118}, // RESET_REGISTER
+{0x301A, 0x0018}, // RESET_REGISTER (MIPI)
+//{0x301A, 0x11d8}, // RESET_REGISTER (DVP)
+{ }
+}; /* Serial_4_Lane_16_to_12_bit_Output */
+
 static const struct ar0147_reg ar0147_rev3_Serial_4_Lane_20_to_12_bit_Output[] = {
 {0x31D0, 0x0001}, // COMPANDING
 {0x31AE, 0x0304}, // SERIAL_FORMAT: HISPI 4-lanes
@@ -857,6 +920,20 @@ static const struct ar0147_reg *ar0147_regs_hdr_mipi450mbps_12bit_30fps_rev3[] =
 	NULL
 };
 
+/* Super-Exposure Mode 1, Full Resolution, MIPI 450MBPS 4 lane 12-bit, 30FPS, XMCLK=24MHz */
+static const struct ar0147_reg *ar0147_regs_se_mipi450mbps_12bit_30fps_rev3[] = {
+	ar0147_rev3_Reset,
+	ar0147_rev3_Sensor_Setup,
+	ar0147_rev3_Super_Exposure_Mode_1_Setup,
+	ar0147_rev3_Serial_12_bit_Timing_Setup,
+	ar0147_rev3_Readout_Mode_Configuration,
+	ar0147_rev3_Full_Res_FOV,
+	ar0147_rev3_SE_Mode_1_30FPS_Timing_and_Exposure,
+	ar0147_rev3_Serial_4_Lane_16_to_12_bit_Output,
+	ar0147_rev3_MIPI_12_bit_450MBps_Settings,
+	NULL
+};
+
 /* Super-Exposure Plus T2 Mode 1, Full Resolution, MIPI 450MBPS 4 lane 12-bit, 30FPS, XMCLK=24MHz */
 static const struct ar0147_reg *ar0147_regs_seplus1_mipi450mbps_12bit_30fps_rev3[] = {
 	ar0147_rev3_Reset,
-- 
2.7.4