1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2008 Nokia Corporation
7 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
8 * Tuukka Toivonen <tuukkat76@gmail.com>
11 #include "et8ek8_reg.h"
14 * Stingray sensor mode settings for Scooby
17 /* Mode1_poweron_Mode2_16VGA_2592x1968_12.07fps */
18 static struct et8ek8_reglist mode1_poweron_mode2_16vga_2592x1968_12_07fps
= {
32 .type
= ET8EK8_REGLIST_POWERON
,
35 .sensor_height
= 1968,
36 .sensor_window_origin_x
= 0,
37 .sensor_window_origin_y
= 0,
38 .sensor_window_width
= 2592,
39 .sensor_window_height
= 1968,
45 .window_height
= 1968,
46 .pixel_clock
= 80000000,
54 .bus_format
= MEDIA_BUS_FMT_SGRBG10_1X10
,
58 /* Need to set firstly */
59 { ET8EK8_REG_8BIT
, 0x126C, 0xCC },
60 /* Strobe and Data of CCP2 delay are minimized. */
61 { ET8EK8_REG_8BIT
, 0x1269, 0x00 },
62 /* Refined value of Min H_COUNT */
63 { ET8EK8_REG_8BIT
, 0x1220, 0x89 },
64 /* Frequency of SPCK setting (SPCK=MRCK) */
65 { ET8EK8_REG_8BIT
, 0x123A, 0x07 },
66 { ET8EK8_REG_8BIT
, 0x1241, 0x94 },
67 { ET8EK8_REG_8BIT
, 0x1242, 0x02 },
68 { ET8EK8_REG_8BIT
, 0x124B, 0x00 },
69 { ET8EK8_REG_8BIT
, 0x1255, 0xFF },
70 { ET8EK8_REG_8BIT
, 0x1256, 0x9F },
71 { ET8EK8_REG_8BIT
, 0x1258, 0x00 },
72 /* From parallel out to serial out */
73 { ET8EK8_REG_8BIT
, 0x125D, 0x88 },
74 /* From w/ embedded data to w/o embedded data */
75 { ET8EK8_REG_8BIT
, 0x125E, 0xC0 },
76 /* CCP2 out is from STOP to ACTIVE */
77 { ET8EK8_REG_8BIT
, 0x1263, 0x98 },
78 { ET8EK8_REG_8BIT
, 0x1268, 0xC6 },
79 { ET8EK8_REG_8BIT
, 0x1434, 0x00 },
80 { ET8EK8_REG_8BIT
, 0x1163, 0x44 },
81 { ET8EK8_REG_8BIT
, 0x1166, 0x29 },
82 { ET8EK8_REG_8BIT
, 0x1140, 0x02 },
83 { ET8EK8_REG_8BIT
, 0x1011, 0x24 },
84 { ET8EK8_REG_8BIT
, 0x1151, 0x80 },
85 { ET8EK8_REG_8BIT
, 0x1152, 0x23 },
86 /* Initial setting for improvement2 of lower frequency noise */
87 { ET8EK8_REG_8BIT
, 0x1014, 0x05 },
88 { ET8EK8_REG_8BIT
, 0x1033, 0x06 },
89 { ET8EK8_REG_8BIT
, 0x1034, 0x79 },
90 { ET8EK8_REG_8BIT
, 0x1423, 0x3F },
91 { ET8EK8_REG_8BIT
, 0x1424, 0x3F },
92 { ET8EK8_REG_8BIT
, 0x1426, 0x00 },
93 /* Switch of Preset-White-balance (0d:disable / 1d:enable) */
94 { ET8EK8_REG_8BIT
, 0x1439, 0x00 },
95 /* Switch of blemish correction (0d:disable / 1d:enable) */
96 { ET8EK8_REG_8BIT
, 0x161F, 0x60 },
97 /* Switch of auto noise correction (0d:disable / 1d:enable) */
98 { ET8EK8_REG_8BIT
, 0x1634, 0x00 },
99 { ET8EK8_REG_8BIT
, 0x1646, 0x00 },
100 { ET8EK8_REG_8BIT
, 0x1648, 0x00 },
101 { ET8EK8_REG_8BIT
, 0x113E, 0x01 },
102 { ET8EK8_REG_8BIT
, 0x113F, 0x22 },
103 { ET8EK8_REG_8BIT
, 0x1239, 0x64 },
104 { ET8EK8_REG_8BIT
, 0x1238, 0x02 },
105 { ET8EK8_REG_8BIT
, 0x123B, 0x70 },
106 { ET8EK8_REG_8BIT
, 0x123A, 0x07 },
107 { ET8EK8_REG_8BIT
, 0x121B, 0x64 },
108 { ET8EK8_REG_8BIT
, 0x121D, 0x64 },
109 { ET8EK8_REG_8BIT
, 0x1221, 0x00 },
110 { ET8EK8_REG_8BIT
, 0x1220, 0x89 },
111 { ET8EK8_REG_8BIT
, 0x1223, 0x00 },
112 { ET8EK8_REG_8BIT
, 0x1222, 0x54 },
113 { ET8EK8_REG_8BIT
, 0x125D, 0x88 }, /* CCP_LVDS_MODE/ */
114 { ET8EK8_REG_TERM
, 0, 0}
118 /* Mode1_16VGA_2592x1968_13.12fps_DPCM10-8 */
119 static struct et8ek8_reglist mode1_16vga_2592x1968_13_12fps_dpcm10_8
= {
125 * HCOUNT = 128 (3072)
133 .type
= ET8EK8_REGLIST_MODE
,
135 .sensor_width
= 2592,
136 .sensor_height
= 1968,
137 .sensor_window_origin_x
= 0,
138 .sensor_window_origin_y
= 0,
139 .sensor_window_width
= 2592,
140 .sensor_window_height
= 1968,
143 .window_origin_x
= 0,
144 .window_origin_y
= 0,
145 .window_width
= 2592,
146 .window_height
= 1968,
147 .pixel_clock
= 80000000,
148 .ext_clock
= 9600000,
155 .bus_format
= MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8
,
159 { ET8EK8_REG_8BIT
, 0x1239, 0x57 },
160 { ET8EK8_REG_8BIT
, 0x1238, 0x82 },
161 { ET8EK8_REG_8BIT
, 0x123B, 0x70 },
162 { ET8EK8_REG_8BIT
, 0x123A, 0x06 },
163 { ET8EK8_REG_8BIT
, 0x121B, 0x64 },
164 { ET8EK8_REG_8BIT
, 0x121D, 0x64 },
165 { ET8EK8_REG_8BIT
, 0x1221, 0x00 },
166 { ET8EK8_REG_8BIT
, 0x1220, 0x80 }, /* <-changed to v14 7E->80 */
167 { ET8EK8_REG_8BIT
, 0x1223, 0x00 },
168 { ET8EK8_REG_8BIT
, 0x1222, 0x54 },
169 { ET8EK8_REG_8BIT
, 0x125D, 0x83 }, /* CCP_LVDS_MODE/ */
170 { ET8EK8_REG_TERM
, 0, 0}
174 /* Mode3_4VGA_1296x984_29.99fps_DPCM10-8 */
175 static struct et8ek8_reglist mode3_4vga_1296x984_29_99fps_dpcm10_8
= {
177 * SPCK = 96.5333333333333 MHz
181 * HCOUNT = 133 (3192)
189 .type
= ET8EK8_REGLIST_MODE
,
191 .sensor_width
= 2592,
192 .sensor_height
= 1968,
193 .sensor_window_origin_x
= 0,
194 .sensor_window_origin_y
= 0,
195 .sensor_window_width
= 2592,
196 .sensor_window_height
= 1968,
199 .window_origin_x
= 0,
200 .window_origin_y
= 0,
201 .window_width
= 1296,
202 .window_height
= 984,
203 .pixel_clock
= 96533333,
204 .ext_clock
= 9600000,
211 .bus_format
= MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8
,
215 { ET8EK8_REG_8BIT
, 0x1239, 0x5A },
216 { ET8EK8_REG_8BIT
, 0x1238, 0x82 },
217 { ET8EK8_REG_8BIT
, 0x123B, 0x70 },
218 { ET8EK8_REG_8BIT
, 0x123A, 0x05 },
219 { ET8EK8_REG_8BIT
, 0x121B, 0x63 },
220 { ET8EK8_REG_8BIT
, 0x1220, 0x85 },
221 { ET8EK8_REG_8BIT
, 0x1221, 0x00 },
222 { ET8EK8_REG_8BIT
, 0x1222, 0x54 },
223 { ET8EK8_REG_8BIT
, 0x1223, 0x00 },
224 { ET8EK8_REG_8BIT
, 0x121D, 0x63 },
225 { ET8EK8_REG_8BIT
, 0x125D, 0x83 }, /* CCP_LVDS_MODE/ */
226 { ET8EK8_REG_TERM
, 0, 0}
230 /* Mode4_SVGA_864x656_29.88fps */
231 static struct et8ek8_reglist mode4_svga_864x656_29_88fps
= {
237 * HCOUNT = 166 (3984)
245 .type
= ET8EK8_REGLIST_MODE
,
247 .sensor_width
= 2592,
248 .sensor_height
= 1968,
249 .sensor_window_origin_x
= 0,
250 .sensor_window_origin_y
= 0,
251 .sensor_window_width
= 2592,
252 .sensor_window_height
= 1968,
255 .window_origin_x
= 0,
256 .window_origin_y
= 0,
258 .window_height
= 656,
259 .pixel_clock
= 80000000,
260 .ext_clock
= 9600000,
267 .bus_format
= MEDIA_BUS_FMT_SGRBG10_1X10
,
271 { ET8EK8_REG_8BIT
, 0x1239, 0x64 },
272 { ET8EK8_REG_8BIT
, 0x1238, 0x02 },
273 { ET8EK8_REG_8BIT
, 0x123B, 0x71 },
274 { ET8EK8_REG_8BIT
, 0x123A, 0x07 },
275 { ET8EK8_REG_8BIT
, 0x121B, 0x62 },
276 { ET8EK8_REG_8BIT
, 0x121D, 0x62 },
277 { ET8EK8_REG_8BIT
, 0x1221, 0x00 },
278 { ET8EK8_REG_8BIT
, 0x1220, 0xA6 },
279 { ET8EK8_REG_8BIT
, 0x1223, 0x00 },
280 { ET8EK8_REG_8BIT
, 0x1222, 0x54 },
281 { ET8EK8_REG_8BIT
, 0x125D, 0x88 }, /* CCP_LVDS_MODE/ */
282 { ET8EK8_REG_TERM
, 0, 0}
286 /* Mode5_VGA_648x492_29.93fps */
287 static struct et8ek8_reglist mode5_vga_648x492_29_93fps
= {
293 * HCOUNT = 221 (5304)
301 .type
= ET8EK8_REGLIST_MODE
,
303 .sensor_width
= 2592,
304 .sensor_height
= 1968,
305 .sensor_window_origin_x
= 0,
306 .sensor_window_origin_y
= 0,
307 .sensor_window_width
= 2592,
308 .sensor_window_height
= 1968,
311 .window_origin_x
= 0,
312 .window_origin_y
= 0,
314 .window_height
= 492,
315 .pixel_clock
= 80000000,
316 .ext_clock
= 9600000,
323 .bus_format
= MEDIA_BUS_FMT_SGRBG10_1X10
,
327 { ET8EK8_REG_8BIT
, 0x1239, 0x64 },
328 { ET8EK8_REG_8BIT
, 0x1238, 0x02 },
329 { ET8EK8_REG_8BIT
, 0x123B, 0x71 },
330 { ET8EK8_REG_8BIT
, 0x123A, 0x07 },
331 { ET8EK8_REG_8BIT
, 0x121B, 0x61 },
332 { ET8EK8_REG_8BIT
, 0x121D, 0x61 },
333 { ET8EK8_REG_8BIT
, 0x1221, 0x00 },
334 { ET8EK8_REG_8BIT
, 0x1220, 0xDD },
335 { ET8EK8_REG_8BIT
, 0x1223, 0x00 },
336 { ET8EK8_REG_8BIT
, 0x1222, 0x54 },
337 { ET8EK8_REG_8BIT
, 0x125D, 0x88 }, /* CCP_LVDS_MODE/ */
338 { ET8EK8_REG_TERM
, 0, 0}
342 /* Mode2_16VGA_2592x1968_3.99fps */
343 static struct et8ek8_reglist mode2_16vga_2592x1968_3_99fps
= {
348 * VCOUNT = 254 (6096)
349 * HCOUNT = 137 (3288)
357 .type
= ET8EK8_REGLIST_MODE
,
359 .sensor_width
= 2592,
360 .sensor_height
= 1968,
361 .sensor_window_origin_x
= 0,
362 .sensor_window_origin_y
= 0,
363 .sensor_window_width
= 2592,
364 .sensor_window_height
= 1968,
367 .window_origin_x
= 0,
368 .window_origin_y
= 0,
369 .window_width
= 2592,
370 .window_height
= 1968,
371 .pixel_clock
= 80000000,
372 .ext_clock
= 9600000,
379 .bus_format
= MEDIA_BUS_FMT_SGRBG10_1X10
,
383 { ET8EK8_REG_8BIT
, 0x1239, 0x64 },
384 { ET8EK8_REG_8BIT
, 0x1238, 0x02 },
385 { ET8EK8_REG_8BIT
, 0x123B, 0x70 },
386 { ET8EK8_REG_8BIT
, 0x123A, 0x07 },
387 { ET8EK8_REG_8BIT
, 0x121B, 0x64 },
388 { ET8EK8_REG_8BIT
, 0x121D, 0x64 },
389 { ET8EK8_REG_8BIT
, 0x1221, 0x00 },
390 { ET8EK8_REG_8BIT
, 0x1220, 0x89 },
391 { ET8EK8_REG_8BIT
, 0x1223, 0x00 },
392 { ET8EK8_REG_8BIT
, 0x1222, 0xFE },
393 { ET8EK8_REG_TERM
, 0, 0}
397 /* Mode_648x492_5fps */
398 static struct et8ek8_reglist mode_648x492_5fps
= {
400 * SPCK = 13.3333333333333 MHz
401 * CCP2 = 53.3333333333333 MHz
404 * HCOUNT = 221 (5304)
412 .type
= ET8EK8_REGLIST_MODE
,
414 .sensor_width
= 2592,
415 .sensor_height
= 1968,
416 .sensor_window_origin_x
= 0,
417 .sensor_window_origin_y
= 0,
418 .sensor_window_width
= 2592,
419 .sensor_window_height
= 1968,
422 .window_origin_x
= 0,
423 .window_origin_y
= 0,
425 .window_height
= 492,
426 .pixel_clock
= 13333333,
427 .ext_clock
= 9600000,
434 .bus_format
= MEDIA_BUS_FMT_SGRBG10_1X10
,
438 { ET8EK8_REG_8BIT
, 0x1239, 0x64 },
439 { ET8EK8_REG_8BIT
, 0x1238, 0x02 },
440 { ET8EK8_REG_8BIT
, 0x123B, 0x71 },
441 { ET8EK8_REG_8BIT
, 0x123A, 0x57 },
442 { ET8EK8_REG_8BIT
, 0x121B, 0x61 },
443 { ET8EK8_REG_8BIT
, 0x121D, 0x61 },
444 { ET8EK8_REG_8BIT
, 0x1221, 0x00 },
445 { ET8EK8_REG_8BIT
, 0x1220, 0xDD },
446 { ET8EK8_REG_8BIT
, 0x1223, 0x00 },
447 { ET8EK8_REG_8BIT
, 0x1222, 0x54 },
448 { ET8EK8_REG_8BIT
, 0x125D, 0x88 }, /* CCP_LVDS_MODE/ */
449 { ET8EK8_REG_TERM
, 0, 0}
453 /* Mode3_4VGA_1296x984_5fps */
454 static struct et8ek8_reglist mode3_4vga_1296x984_5fps
= {
459 * VCOUNT = 250 (6000)
460 * HCOUNT = 137 (3288)
468 .type
= ET8EK8_REGLIST_MODE
,
470 .sensor_width
= 2592,
471 .sensor_height
= 1968,
472 .sensor_window_origin_x
= 0,
473 .sensor_window_origin_y
= 0,
474 .sensor_window_width
= 2592,
475 .sensor_window_height
= 1968,
478 .window_origin_x
= 0,
479 .window_origin_y
= 0,
480 .window_width
= 1296,
481 .window_height
= 984,
482 .pixel_clock
= 49400000,
483 .ext_clock
= 9600000,
490 .bus_format
= MEDIA_BUS_FMT_SGRBG10_1X10
,
494 { ET8EK8_REG_8BIT
, 0x1239, 0x7B },
495 { ET8EK8_REG_8BIT
, 0x1238, 0x82 },
496 { ET8EK8_REG_8BIT
, 0x123B, 0x70 },
497 { ET8EK8_REG_8BIT
, 0x123A, 0x17 },
498 { ET8EK8_REG_8BIT
, 0x121B, 0x63 },
499 { ET8EK8_REG_8BIT
, 0x121D, 0x63 },
500 { ET8EK8_REG_8BIT
, 0x1221, 0x00 },
501 { ET8EK8_REG_8BIT
, 0x1220, 0x89 },
502 { ET8EK8_REG_8BIT
, 0x1223, 0x00 },
503 { ET8EK8_REG_8BIT
, 0x1222, 0xFA },
504 { ET8EK8_REG_8BIT
, 0x125D, 0x88 }, /* CCP_LVDS_MODE/ */
505 { ET8EK8_REG_TERM
, 0, 0}
509 /* Mode_4VGA_1296x984_25fps_DPCM10-8 */
510 static struct et8ek8_reglist mode_4vga_1296x984_25fps_dpcm10_8
= {
512 * SPCK = 84.2666666666667 MHz
516 * HCOUNT = 133 (3192)
524 .type
= ET8EK8_REGLIST_MODE
,
526 .sensor_width
= 2592,
527 .sensor_height
= 1968,
528 .sensor_window_origin_x
= 0,
529 .sensor_window_origin_y
= 0,
530 .sensor_window_width
= 2592,
531 .sensor_window_height
= 1968,
534 .window_origin_x
= 0,
535 .window_origin_y
= 0,
536 .window_width
= 1296,
537 .window_height
= 984,
538 .pixel_clock
= 84266667,
539 .ext_clock
= 9600000,
546 .bus_format
= MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8
,
550 { ET8EK8_REG_8BIT
, 0x1239, 0x4F },
551 { ET8EK8_REG_8BIT
, 0x1238, 0x02 },
552 { ET8EK8_REG_8BIT
, 0x123B, 0x70 },
553 { ET8EK8_REG_8BIT
, 0x123A, 0x05 },
554 { ET8EK8_REG_8BIT
, 0x121B, 0x63 },
555 { ET8EK8_REG_8BIT
, 0x1220, 0x85 },
556 { ET8EK8_REG_8BIT
, 0x1221, 0x00 },
557 { ET8EK8_REG_8BIT
, 0x1222, 0x58 },
558 { ET8EK8_REG_8BIT
, 0x1223, 0x00 },
559 { ET8EK8_REG_8BIT
, 0x121D, 0x63 },
560 { ET8EK8_REG_8BIT
, 0x125D, 0x83 },
561 { ET8EK8_REG_TERM
, 0, 0}
565 struct et8ek8_meta_reglist meta_reglist
= {
566 .version
= "V14 03-June-2008",
568 { .ptr
= &mode1_poweron_mode2_16vga_2592x1968_12_07fps
},
569 { .ptr
= &mode1_16vga_2592x1968_13_12fps_dpcm10_8
},
570 { .ptr
= &mode3_4vga_1296x984_29_99fps_dpcm10_8
},
571 { .ptr
= &mode4_svga_864x656_29_88fps
},
572 { .ptr
= &mode5_vga_648x492_29_93fps
},
573 { .ptr
= &mode2_16vga_2592x1968_3_99fps
},
574 { .ptr
= &mode_648x492_5fps
},
575 { .ptr
= &mode3_4vga_1296x984_5fps
},
576 { .ptr
= &mode_4vga_1296x984_25fps_dpcm10_8
},