Merge remote-tracking branches 'asoc/topic/simple', 'asoc/topic/spear', 'asoc/topic...
[sfrench/cifs-2.6.git] / drivers / staging / media / atomisp / i2c / ov8858.h
1 /*
2  * Support for the Omnivision OV8858 camera sensor.
3  *
4  * Copyright (c) 2014 Intel Corporation. All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License version
8  * 2 as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301, USA.
19  *
20  */
21
22 #ifndef __OV8858_H__
23 #define __OV8858_H__
24 #include "../include/linux/atomisp_platform.h"
25 #include <media/v4l2-ctrls.h>
26
27 #define I2C_MSG_LENGTH          0x2
28
29 /*
30  * This should be added into include/linux/videodev2.h
31  * NOTE: This is most likely not used anywhere.
32  */
33 #define V4L2_IDENT_OV8858       V4L2_IDENT_UNKNOWN
34
35 /*
36  * Indexes for VCM driver lists
37  */
38 #define OV8858_ID_DEFAULT       0
39 #define OV8858_SUNNY            1
40
41 #define OV8858_OTP_START_ADDR   0x7010
42 #define OV8858_OTP_END_ADDR     0x7186
43
44 /*
45  * ov8858 System control registers
46  */
47
48 #define OV8858_OTP_LOAD_CTRL            0x3D81
49 #define OV8858_OTP_MODE_CTRL            0x3D84
50 #define OV8858_OTP_START_ADDR_REG       0x3D88
51 #define OV8858_OTP_END_ADDR_REG         0x3D8A
52 #define OV8858_OTP_ISP_CTRL2            0x5002
53
54 #define OV8858_OTP_MODE_MANUAL          BIT(6)
55 #define OV8858_OTP_MODE_PROGRAM_DISABLE BIT(7)
56 #define OV8858_OTP_LOAD_ENABLE          BIT(0)
57 #define OV8858_OTP_DPC_ENABLE           BIT(3)
58
59 #define OV8858_PLL1_PREDIV0             0x030A
60 #define OV8858_PLL1_PREDIV              0x0300
61 #define OV8858_PLL1_MULTIPLIER          0x0301
62 #define OV8858_PLL1_SYS_PRE_DIV         0x0305
63 #define OV8858_PLL1_SYS_DIVIDER         0x0306
64
65 #define OV8858_PLL1_PREDIV0_MASK        BIT(0)
66 #define OV8858_PLL1_PREDIV_MASK         (BIT(0) | BIT(1) | BIT(2))
67 #define OV8858_PLL1_MULTIPLIER_MASK     0x01FF
68 #define OV8858_PLL1_SYS_PRE_DIV_MASK    (BIT(0) | BIT(1))
69 #define OV8858_PLL1_SYS_DIVIDER_MASK    BIT(0)
70
71 #define OV8858_PLL2_PREDIV0             0x0312
72 #define OV8858_PLL2_PREDIV              0x030B
73 #define OV8858_PLL2_MULTIPLIER          0x030C
74 #define OV8858_PLL2_DAC_DIVIDER         0x0312
75 #define OV8858_PLL2_SYS_PRE_DIV         0x030F
76 #define OV8858_PLL2_SYS_DIVIDER         0x030E
77
78 #define OV8858_PLL2_PREDIV0_MASK        BIT(4)
79 #define OV8858_PLL2_PREDIV_MASK         (BIT(0) | BIT(1) | BIT(2))
80 #define OV8858_PLL2_MULTIPLIER_MASK     0x01FF
81 #define OV8858_PLL2_DAC_DIVIDER_MASK    (BIT(0) | BIT(1) | BIT(2) | BIT(3))
82 #define OV8858_PLL2_SYS_PRE_DIV_MASK    (BIT(0) | BIT(1) | BIT(2) | BIT(3))
83 #define OV8858_PLL2_SYS_DIVIDER_MASK    (BIT(0) | BIT(1) | BIT(2))
84
85 #define OV8858_PLL_SCLKSEL1             0x3032
86 #define OV8858_PLL_SCLKSEL2             0x3033
87 #define OV8858_SRB_HOST_INPUT_DIS       0x3106
88
89 #define OV8858_PLL_SCLKSEL1_MASK        BIT(7)
90 #define OV8858_PLL_SCLKSEL2_MASK        BIT(1)
91
92 #define OV8858_SYS_PRE_DIV_OFFSET       2
93 #define OV8858_SYS_PRE_DIV_MASK         (BIT(2) | BIT(3))
94 #define OV8858_SCLK_PDIV_OFFSET         4
95 #define OV8858_SCLK_PDIV_MASK           (BIT(4) | BIT(5) | BIT(6) | BIT(7))
96
97 #define OV8858_TIMING_HTS                       0x380C
98 #define OV8858_TIMING_VTS                       0x380E
99
100 #define OV8858_HORIZONTAL_START_H               0x3800
101 #define OV8858_VERTICAL_START_H                 0x3802
102 #define OV8858_HORIZONTAL_END_H                 0x3804
103 #define OV8858_VERTICAL_END_H                   0x3806
104 #define OV8858_HORIZONTAL_OUTPUT_SIZE_H         0x3808
105 #define OV8858_VERTICAL_OUTPUT_SIZE_H           0x380A
106
107 #define OV8858_GROUP_ACCESS                     0x3208
108 #define OV8858_GROUP_ZERO                       0x00
109 #define OV8858_GROUP_ACCESS_HOLD_START          0x00
110 #define OV8858_GROUP_ACCESS_HOLD_END            0x10
111 #define OV8858_GROUP_ACCESS_DELAY_LAUNCH        0xA0
112 #define OV8858_GROUP_ACCESS_QUICK_LAUNCH        0xE0
113
114 #define OV_SUBDEV_PREFIX                        "ov"
115 #define OV_ID_DEFAULT                           0x0000
116 #define OV8858_NAME                             "ov8858"
117 #define OV8858_CHIP_ID                          0x8858
118
119 #define OV8858_LONG_EXPO                        0x3500
120 #define OV8858_LONG_GAIN                        0x3508
121 #define OV8858_LONG_DIGI_GAIN                   0x350A
122 #define OV8858_SHORT_GAIN                       0x350C
123 #define OV8858_SHORT_DIGI_GAIN                  0x350E
124
125 #define OV8858_FORMAT1                          0x3820
126 #define OV8858_FORMAT2                          0x3821
127
128 #define OV8858_FLIP_ENABLE                      0x06
129
130 #define OV8858_MWB_RED_GAIN_H                   0x5032
131 #define OV8858_MWB_GREEN_GAIN_H                 0x5034
132 #define OV8858_MWB_BLUE_GAIN_H                  0x5036
133 #define OV8858_MWB_GAIN_MAX                     0x0FFF
134
135 #define OV8858_CHIP_ID_HIGH                     0x300B
136 #define OV8858_CHIP_ID_LOW                      0x300C
137 #define OV8858_STREAM_MODE                      0x0100
138
139 #define OV8858_FOCAL_LENGTH_NUM                 294     /* 2.94mm */
140 #define OV8858_FOCAL_LENGTH_DEM                 100
141 #define OV8858_F_NUMBER_DEFAULT_NUM             24      /* 2.4 */
142 #define OV8858_F_NUMBER_DEM                     10
143
144 #define OV8858_H_INC_ODD                        0x3814
145 #define OV8858_H_INC_EVEN                       0x3815
146 #define OV8858_V_INC_ODD                        0x382A
147 #define OV8858_V_INC_EVEN                       0x382B
148
149 #define OV8858_READ_MODE_BINNING_ON             0x0400 /* ToDo: Check this */
150 #define OV8858_READ_MODE_BINNING_OFF            0x00   /* ToDo: Check this */
151 #define OV8858_BIN_FACTOR_MAX                   2
152 #define OV8858_INTEGRATION_TIME_MARGIN          14
153
154 #define OV8858_MAX_VTS_VALUE                    0xFFFF
155 #define OV8858_MAX_EXPOSURE_VALUE \
156                 (OV8858_MAX_VTS_VALUE - OV8858_INTEGRATION_TIME_MARGIN)
157 #define OV8858_MAX_GAIN_VALUE                   0x07FF
158
159 #define OV8858_MAX_FOCUS_POS                    1023
160
161 #define OV8858_TEST_PATTERN_REG                 0x5E00
162
163 struct ov8858_vcm {
164         int (*power_up)(struct v4l2_subdev *sd);
165         int (*power_down)(struct v4l2_subdev *sd);
166         int (*init)(struct v4l2_subdev *sd);
167         int (*t_focus_vcm)(struct v4l2_subdev *sd, u16 val);
168         int (*t_focus_abs)(struct v4l2_subdev *sd, s32 value);
169         int (*t_focus_rel)(struct v4l2_subdev *sd, s32 value);
170         int (*q_focus_status)(struct v4l2_subdev *sd, s32 *value);
171         int (*q_focus_abs)(struct v4l2_subdev *sd, s32 *value);
172         int (*t_vcm_slew)(struct v4l2_subdev *sd, s32 value);
173         int (*t_vcm_timing)(struct v4l2_subdev *sd, s32 value);
174 };
175
176 /*
177  * Defines for register writes and register array processing
178  * */
179 #define OV8858_BYTE_MAX                         32
180 #define OV8858_SHORT_MAX                        16
181 #define OV8858_TOK_MASK                         0xFFF0
182
183 #define MAX_FPS_OPTIONS_SUPPORTED               3
184
185 #define OV8858_DEPTH_COMP_CONST                 2200
186 #define OV8858_DEPTH_VTS_CONST                  2573
187
188 enum ov8858_tok_type {
189         OV8858_8BIT  = 0x0001,
190         OV8858_16BIT = 0x0002,
191         OV8858_TOK_TERM   = 0xF000,     /* terminating token for reg list */
192         OV8858_TOK_DELAY  = 0xFE00      /* delay token for reg list */
193 };
194
195 /*
196  * If register address or register width is not 32 bit width,
197  * user needs to convert it manually
198  */
199 struct s_register_setting {
200         u32 reg;
201         u32 val;
202 };
203
204 /**
205  * struct ov8858_reg - MI sensor register format
206  * @type: type of the register
207  * @reg: 16-bit offset to register
208  * @val: 8/16/32-bit register value
209  *
210  * Define a structure for sensor register initialization values
211  */
212 struct ov8858_reg {
213         enum ov8858_tok_type type;
214         u16 sreg;
215         u32 val;        /* @set value for read/mod/write, @mask */
216 };
217
218 struct ov8858_fps_setting {
219         int fps;
220         unsigned short pixels_per_line;
221         unsigned short lines_per_frame;
222         const struct ov8858_reg *regs; /* regs that the fps setting needs */
223 };
224
225 struct ov8858_resolution {
226         u8 *desc;
227         const struct ov8858_reg *regs;
228         int res;
229         int width;
230         int height;
231         bool used;
232         u8 bin_factor_x;
233         u8 bin_factor_y;
234         unsigned short skip_frames;
235         const struct ov8858_fps_setting fps_options[MAX_FPS_OPTIONS_SUPPORTED];
236 };
237
238 /*
239  * ov8858 device structure
240  * */
241 struct ov8858_device {
242         struct v4l2_subdev sd;
243         struct media_pad pad;
244         struct v4l2_mbus_framefmt format;
245
246         struct camera_sensor_platform_data *platform_data;
247         struct mutex input_lock; /* serialize sensor's ioctl */
248         int fmt_idx;
249         int streaming;
250         int vt_pix_clk_freq_mhz;
251         int fps_index;
252         u16 sensor_id;                  /* Sensor id from registers */
253         u16 i2c_id;                     /* Sensor id from i2c_device_id */
254         int exposure;
255         int gain;
256         u16 digital_gain;
257         u16 pixels_per_line;
258         u16 lines_per_frame;
259         u8 fps;
260         u8 *otp_data;
261         /* Prevent the framerate from being lowered in low light scenes. */
262         int limit_exposure_flag;
263         bool hflip;
264         bool vflip;
265
266         const struct ov8858_reg *regs;
267         struct ov8858_vcm *vcm_driver;
268         const struct ov8858_resolution *curr_res_table;
269         unsigned long entries_curr_table;
270
271         struct v4l2_ctrl_handler ctrl_handler;
272         struct v4l2_ctrl *run_mode;
273 };
274
275 #define to_ov8858_sensor(x) container_of(x, struct ov8858_device, sd)
276
277 #define OV8858_MAX_WRITE_BUF_SIZE       32
278 struct ov8858_write_buffer {
279         u16 addr;
280         u8 data[OV8858_MAX_WRITE_BUF_SIZE];
281 };
282
283 struct ov8858_write_ctrl {
284         int index;
285         struct ov8858_write_buffer buffer;
286 };
287
288 static const struct ov8858_reg ov8858_soft_standby[] = {
289         {OV8858_8BIT, 0x0100, 0x00},
290         {OV8858_TOK_TERM, 0, 0}
291 };
292
293 static const struct ov8858_reg ov8858_streaming[] = {
294         {OV8858_8BIT, 0x0100, 0x01},
295         {OV8858_TOK_TERM, 0, 0}
296 };
297
298 static const struct ov8858_reg ov8858_param_hold[] = {
299         {OV8858_8BIT, OV8858_GROUP_ACCESS,
300                         OV8858_GROUP_ZERO | OV8858_GROUP_ACCESS_HOLD_START},
301         {OV8858_TOK_TERM, 0, 0}
302 };
303
304 static const struct ov8858_reg ov8858_param_update[] = {
305         {OV8858_8BIT, OV8858_GROUP_ACCESS,
306                         OV8858_GROUP_ZERO | OV8858_GROUP_ACCESS_HOLD_END},
307         {OV8858_8BIT, OV8858_GROUP_ACCESS,
308                         OV8858_GROUP_ZERO | OV8858_GROUP_ACCESS_DELAY_LAUNCH},
309         {OV8858_TOK_TERM, 0, 0}
310 };
311
312 extern int dw9718_vcm_power_up(struct v4l2_subdev *sd);
313 extern int dw9718_vcm_power_down(struct v4l2_subdev *sd);
314 extern int dw9718_vcm_init(struct v4l2_subdev *sd);
315 extern int dw9718_t_focus_vcm(struct v4l2_subdev *sd, u16 val);
316 extern int dw9718_t_focus_abs(struct v4l2_subdev *sd, s32 value);
317 extern int dw9718_t_focus_rel(struct v4l2_subdev *sd, s32 value);
318 extern int dw9718_q_focus_status(struct v4l2_subdev *sd, s32 *value);
319 extern int dw9718_q_focus_abs(struct v4l2_subdev *sd, s32 *value);
320 extern int dw9718_t_vcm_slew(struct v4l2_subdev *sd, s32 value);
321 extern int dw9718_t_vcm_timing(struct v4l2_subdev *sd, s32 value);
322
323 extern int vcm_power_up(struct v4l2_subdev *sd);
324 extern int vcm_power_down(struct v4l2_subdev *sd);
325
326 static struct ov8858_vcm ov8858_vcms[] = {
327         [OV8858_SUNNY] = {
328                 .power_up = dw9718_vcm_power_up,
329                 .power_down = dw9718_vcm_power_down,
330                 .init = dw9718_vcm_init,
331                 .t_focus_vcm = dw9718_t_focus_vcm,
332                 .t_focus_abs = dw9718_t_focus_abs,
333                 .t_focus_rel = dw9718_t_focus_rel,
334                 .q_focus_status = dw9718_q_focus_status,
335                 .q_focus_abs = dw9718_q_focus_abs,
336                 .t_vcm_slew = dw9718_t_vcm_slew,
337                 .t_vcm_timing = dw9718_t_vcm_timing,
338         },
339         [OV8858_ID_DEFAULT] = {
340                 .power_up = NULL,
341                 .power_down = NULL,
342         },
343 };
344
345
346 #define OV8858_RES_WIDTH_MAX    3280
347 #define OV8858_RES_HEIGHT_MAX   2464
348
349 static struct ov8858_reg ov8858_BasicSettings[] = {
350         {OV8858_8BIT, 0x0103, 0x01}, /* software_reset */
351         {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */
352         /* PLL settings */
353         {OV8858_8BIT, 0x0300, 0x05}, /* pll1_pre_div = /4 */
354         {OV8858_8BIT, 0x0302, 0xAF}, /* pll1_multiplier = 175 */
355         {OV8858_8BIT, 0x0303, 0x00}, /* pll1_divm = /(1 + 0) */
356         {OV8858_8BIT, 0x0304, 0x03}, /* pll1_div_mipi = /8 */
357         {OV8858_8BIT, 0x030B, 0x02}, /* pll2_pre_div = /2 */
358         {OV8858_8BIT, 0x030D, 0x4E}, /* pll2_r_divp = 78 */
359         {OV8858_8BIT, 0x030E, 0x00}, /* pll2_r_divs = /1 */
360         {OV8858_8BIT, 0x030F, 0x04}, /* pll2_r_divsp = /(1 + 4) */
361         /* pll2_pre_div0 = /1, pll2_r_divdac = /(1 + 1) */
362         {OV8858_8BIT, 0x0312, 0x01},
363         {OV8858_8BIT, 0x031E, 0x0C}, /* pll1_no_lat = 1, mipi_bitsel_man = 0 */
364
365         /* PAD OEN2, VSYNC out enable=0x80, disable=0x00 */
366         {OV8858_8BIT, 0x3002, 0x80},
367         /* PAD OUT2, VSYNC pulse direction low-to-high = 1 */
368         {OV8858_8BIT, 0x3007, 0x01},
369         /* PAD SEL2, VSYNC out value = 0 */
370         {OV8858_8BIT, 0x300D, 0x00},
371         /* PAD OUT2, VSYNC out select = 0 */
372         {OV8858_8BIT, 0x3010, 0x00},
373
374         /* Npump clock div = /2, Ppump clock div = /4 */
375         {OV8858_8BIT, 0x3015, 0x01},
376         /*
377          * mipi_lane_mode = 1+3, mipi_lvds_sel = 1 = MIPI enable,
378          * r_phy_pd_mipi_man = 0, lane_dis_option = 0
379          */
380         {OV8858_8BIT, 0x3018, 0x72},
381         /* Clock switch output = normal, pclk_div = /1 */
382         {OV8858_8BIT, 0x3020, 0x93},
383         /*
384          * lvds_mode_o = 0, clock lane disable when pd_mipi = 0,
385          * pd_mipi enable when rst_sync = 1
386          */
387         {OV8858_8BIT, 0x3022, 0x01},
388         {OV8858_8BIT, 0x3031, 0x0A}, /* mipi_bit_sel = 10 */
389         {OV8858_8BIT, 0x3034, 0x00}, /* Unknown */
390         /* sclk_div = /1, sclk_pre_div = /1, chip debug = 1 */
391         {OV8858_8BIT, 0x3106, 0x01},
392
393         {OV8858_8BIT, 0x3305, 0xF1}, /* Unknown */
394         {OV8858_8BIT, 0x3307, 0x04}, /* Unknown */
395         {OV8858_8BIT, 0x3308, 0x00}, /* Unknown */
396         {OV8858_8BIT, 0x3309, 0x28}, /* Unknown */
397         {OV8858_8BIT, 0x330A, 0x00}, /* Unknown */
398         {OV8858_8BIT, 0x330B, 0x20}, /* Unknown */
399         {OV8858_8BIT, 0x330C, 0x00}, /* Unknown */
400         {OV8858_8BIT, 0x330D, 0x00}, /* Unknown */
401         {OV8858_8BIT, 0x330E, 0x00}, /* Unknown */
402         {OV8858_8BIT, 0x330F, 0x40}, /* Unknown */
403
404         {OV8858_8BIT, 0x3500, 0x00}, /* long exposure = 0x9A20 */
405         {OV8858_8BIT, 0x3501, 0x9A}, /* long exposure = 0x9A20 */
406         {OV8858_8BIT, 0x3502, 0x20}, /* long exposure = 0x9A20 */
407         /*
408          * Digital fraction gain delay option = Delay 1 frame,
409          * Gain change delay option = Delay 1 frame,
410          * Gain delay option = Delay 1 frame,
411          * Gain manual as sensor gain = Input gain as real gain format,
412          * Exposure delay option (must be 0 = Delay 1 frame,
413          * Exposure change delay option (must be 0) = Delay 1 frame
414          */
415         {OV8858_8BIT, 0x3503, 0x00},
416         {OV8858_8BIT, 0x3505, 0x80}, /* gain conversation option */
417         /*
418          * [10:7] are integer gain, [6:0] are fraction gain. For example:
419          * 0x80 is 1x gain, 0x100 is 2x gain, 0x1C0 is 3.5x gain
420          */
421         {OV8858_8BIT, 0x3508, 0x02}, /* long gain = 0x0200 */
422         {OV8858_8BIT, 0x3509, 0x00}, /* long gain = 0x0200 */
423         {OV8858_8BIT, 0x350C, 0x00}, /* short gain = 0x0080 */
424         {OV8858_8BIT, 0x350D, 0x80}, /* short gain = 0x0080 */
425         {OV8858_8BIT, 0x3510, 0x00}, /* short exposure = 0x000200 */
426         {OV8858_8BIT, 0x3511, 0x02}, /* short exposure = 0x000200 */
427         {OV8858_8BIT, 0x3512, 0x00}, /* short exposure = 0x000200 */
428
429         {OV8858_8BIT, 0x3600, 0x00}, /* Unknown */
430         {OV8858_8BIT, 0x3601, 0x00}, /* Unknown */
431         {OV8858_8BIT, 0x3602, 0x00}, /* Unknown */
432         {OV8858_8BIT, 0x3603, 0x00}, /* Unknown */
433         {OV8858_8BIT, 0x3604, 0x22}, /* Unknown */
434         {OV8858_8BIT, 0x3605, 0x30}, /* Unknown */
435         {OV8858_8BIT, 0x3606, 0x00}, /* Unknown */
436         {OV8858_8BIT, 0x3607, 0x20}, /* Unknown */
437         {OV8858_8BIT, 0x3608, 0x11}, /* Unknown */
438         {OV8858_8BIT, 0x3609, 0x28}, /* Unknown */
439         {OV8858_8BIT, 0x360A, 0x00}, /* Unknown */
440         {OV8858_8BIT, 0x360B, 0x06}, /* Unknown */
441         {OV8858_8BIT, 0x360C, 0xDC}, /* Unknown */
442         {OV8858_8BIT, 0x360D, 0x40}, /* Unknown */
443         {OV8858_8BIT, 0x360E, 0x0C}, /* Unknown */
444         {OV8858_8BIT, 0x360F, 0x20}, /* Unknown */
445         {OV8858_8BIT, 0x3610, 0x07}, /* Unknown */
446         {OV8858_8BIT, 0x3611, 0x20}, /* Unknown */
447         {OV8858_8BIT, 0x3612, 0x88}, /* Unknown */
448         {OV8858_8BIT, 0x3613, 0x80}, /* Unknown */
449         {OV8858_8BIT, 0x3614, 0x58}, /* Unknown */
450         {OV8858_8BIT, 0x3615, 0x00}, /* Unknown */
451         {OV8858_8BIT, 0x3616, 0x4A}, /* Unknown */
452         {OV8858_8BIT, 0x3617, 0x90}, /* Unknown */
453         {OV8858_8BIT, 0x3618, 0x56}, /* Unknown */
454         {OV8858_8BIT, 0x3619, 0x70}, /* Unknown */
455         {OV8858_8BIT, 0x361A, 0x99}, /* Unknown */
456         {OV8858_8BIT, 0x361B, 0x00}, /* Unknown */
457         {OV8858_8BIT, 0x361C, 0x07}, /* Unknown */
458         {OV8858_8BIT, 0x361D, 0x00}, /* Unknown */
459         {OV8858_8BIT, 0x361E, 0x00}, /* Unknown */
460         {OV8858_8BIT, 0x361F, 0x00}, /* Unknown */
461         {OV8858_8BIT, 0x3633, 0x0C}, /* Unknown */
462         {OV8858_8BIT, 0x3634, 0x0C}, /* Unknown */
463         {OV8858_8BIT, 0x3635, 0x0C}, /* Unknown */
464         {OV8858_8BIT, 0x3636, 0x0C}, /* Unknown */
465         {OV8858_8BIT, 0x3638, 0xFF}, /* Unknown */
466         {OV8858_8BIT, 0x3645, 0x13}, /* Unknown */
467         {OV8858_8BIT, 0x3646, 0x83}, /* Unknown */
468         {OV8858_8BIT, 0x364A, 0x07}, /* Unknown */
469
470         {OV8858_8BIT, 0x3700, 0x30}, /* Unknown */
471         {OV8858_8BIT, 0x3701, 0x18}, /* Unknown */
472         {OV8858_8BIT, 0x3702, 0x50}, /* Unknown */
473         {OV8858_8BIT, 0x3703, 0x32}, /* Unknown */
474         {OV8858_8BIT, 0x3704, 0x28}, /* Unknown */
475         {OV8858_8BIT, 0x3705, 0x00}, /* Unknown */
476         {OV8858_8BIT, 0x3706, 0x6A}, /* Unknown */
477         {OV8858_8BIT, 0x3707, 0x08}, /* Unknown */
478         {OV8858_8BIT, 0x3708, 0x48}, /* Unknown */
479         {OV8858_8BIT, 0x3709, 0x66}, /* Unknown */
480         {OV8858_8BIT, 0x370A, 0x01}, /* Unknown */
481         {OV8858_8BIT, 0x370B, 0x6A}, /* Unknown */
482         {OV8858_8BIT, 0x370C, 0x07}, /* Unknown */
483         {OV8858_8BIT, 0x3712, 0x44}, /* Unknown */
484         {OV8858_8BIT, 0x3714, 0x24}, /* Unknown */
485         {OV8858_8BIT, 0x3718, 0x14}, /* Unknown */
486         {OV8858_8BIT, 0x3719, 0x31}, /* Unknown */
487         {OV8858_8BIT, 0x371E, 0x31}, /* Unknown */
488         {OV8858_8BIT, 0x371F, 0x7F}, /* Unknown */
489         {OV8858_8BIT, 0x3720, 0x0A}, /* Unknown */
490         {OV8858_8BIT, 0x3721, 0x0A}, /* Unknown */
491         {OV8858_8BIT, 0x3724, 0x0C}, /* Unknown */
492         {OV8858_8BIT, 0x3725, 0x02}, /* Unknown */
493         {OV8858_8BIT, 0x3726, 0x0C}, /* Unknown */
494         {OV8858_8BIT, 0x3728, 0x0A}, /* Unknown */
495         {OV8858_8BIT, 0x3729, 0x03}, /* Unknown */
496         {OV8858_8BIT, 0x372A, 0x06}, /* Unknown */
497         {OV8858_8BIT, 0x372B, 0xA6}, /* Unknown */
498         {OV8858_8BIT, 0x372C, 0xA6}, /* Unknown */
499         {OV8858_8BIT, 0x372D, 0xA6}, /* Unknown */
500         {OV8858_8BIT, 0x372E, 0x0C}, /* Unknown */
501         {OV8858_8BIT, 0x372F, 0x20}, /* Unknown */
502         {OV8858_8BIT, 0x3730, 0x02}, /* Unknown */
503         {OV8858_8BIT, 0x3731, 0x0C}, /* Unknown */
504         {OV8858_8BIT, 0x3732, 0x28}, /* Unknown */
505         {OV8858_8BIT, 0x3733, 0x10}, /* Unknown */
506         {OV8858_8BIT, 0x3734, 0x40}, /* Unknown */
507         {OV8858_8BIT, 0x3736, 0x30}, /* Unknown */
508         {OV8858_8BIT, 0x373A, 0x0A}, /* Unknown */
509         {OV8858_8BIT, 0x373B, 0x0B}, /* Unknown */
510         {OV8858_8BIT, 0x373C, 0x14}, /* Unknown */
511         {OV8858_8BIT, 0x373E, 0x06}, /* Unknown */
512         {OV8858_8BIT, 0x3755, 0x10}, /* Unknown */
513         {OV8858_8BIT, 0x3758, 0x00}, /* Unknown */
514         {OV8858_8BIT, 0x3759, 0x4C}, /* Unknown */
515         {OV8858_8BIT, 0x375A, 0x0C}, /* Unknown */
516         {OV8858_8BIT, 0x375B, 0x26}, /* Unknown */
517         {OV8858_8BIT, 0x375C, 0x20}, /* Unknown */
518         {OV8858_8BIT, 0x375D, 0x04}, /* Unknown */
519         {OV8858_8BIT, 0x375E, 0x00}, /* Unknown */
520         {OV8858_8BIT, 0x375F, 0x28}, /* Unknown */
521         {OV8858_8BIT, 0x3760, 0x00}, /* Unknown */
522         {OV8858_8BIT, 0x3761, 0x00}, /* Unknown */
523         {OV8858_8BIT, 0x3762, 0x00}, /* Unknown */
524         {OV8858_8BIT, 0x3763, 0x00}, /* Unknown */
525         {OV8858_8BIT, 0x3766, 0xFF}, /* Unknown */
526         {OV8858_8BIT, 0x3768, 0x22}, /* Unknown */
527         {OV8858_8BIT, 0x3769, 0x44}, /* Unknown */
528         {OV8858_8BIT, 0x376A, 0x44}, /* Unknown */
529         {OV8858_8BIT, 0x376B, 0x00}, /* Unknown */
530         {OV8858_8BIT, 0x376F, 0x01}, /* Unknown */
531         {OV8858_8BIT, 0x3772, 0x46}, /* Unknown */
532         {OV8858_8BIT, 0x3773, 0x04}, /* Unknown */
533         {OV8858_8BIT, 0x3774, 0x2C}, /* Unknown */
534         {OV8858_8BIT, 0x3775, 0x13}, /* Unknown */
535         {OV8858_8BIT, 0x3776, 0x08}, /* Unknown */
536         {OV8858_8BIT, 0x3777, 0x00}, /* Unknown */
537         {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */
538         {OV8858_8BIT, 0x37A0, 0x88}, /* Unknown */
539         {OV8858_8BIT, 0x37A1, 0x7A}, /* Unknown */
540         {OV8858_8BIT, 0x37A2, 0x7A}, /* Unknown */
541         {OV8858_8BIT, 0x37A3, 0x00}, /* Unknown */
542         {OV8858_8BIT, 0x37A4, 0x00}, /* Unknown */
543         {OV8858_8BIT, 0x37A5, 0x00}, /* Unknown */
544         {OV8858_8BIT, 0x37A6, 0x00}, /* Unknown */
545         {OV8858_8BIT, 0x37A7, 0x88}, /* Unknown */
546         {OV8858_8BIT, 0x37A8, 0x98}, /* Unknown */
547         {OV8858_8BIT, 0x37A9, 0x98}, /* Unknown */
548         {OV8858_8BIT, 0x37AA, 0x88}, /* Unknown */
549         {OV8858_8BIT, 0x37AB, 0x5C}, /* Unknown */
550         {OV8858_8BIT, 0x37AC, 0x5C}, /* Unknown */
551         {OV8858_8BIT, 0x37AD, 0x55}, /* Unknown */
552         {OV8858_8BIT, 0x37AE, 0x19}, /* Unknown */
553         {OV8858_8BIT, 0x37AF, 0x19}, /* Unknown */
554         {OV8858_8BIT, 0x37B0, 0x00}, /* Unknown */
555         {OV8858_8BIT, 0x37B1, 0x00}, /* Unknown */
556         {OV8858_8BIT, 0x37B2, 0x00}, /* Unknown */
557         {OV8858_8BIT, 0x37B3, 0x84}, /* Unknown */
558         {OV8858_8BIT, 0x37B4, 0x84}, /* Unknown */
559         {OV8858_8BIT, 0x37B5, 0x66}, /* Unknown */
560         {OV8858_8BIT, 0x37B6, 0x00}, /* Unknown */
561         {OV8858_8BIT, 0x37B7, 0x00}, /* Unknown */
562         {OV8858_8BIT, 0x37B8, 0x00}, /* Unknown */
563         {OV8858_8BIT, 0x37B9, 0xFF}, /* Unknown */
564
565         {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */
566         {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low */
567         {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */
568         {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */
569         {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */
570         {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */
571         {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */
572         {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */
573         {OV8858_8BIT, 0x3808, 0x0C}, /* h_output_size high */
574         {OV8858_8BIT, 0x3809, 0xC0}, /* h_output_size low */
575         {OV8858_8BIT, 0x380A, 0x09}, /* v_output_size high */
576         {OV8858_8BIT, 0x380B, 0x90}, /* v_output_size low */
577         {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */
578         {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */
579         {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */
580         {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */
581         {OV8858_8BIT, 0x3810, 0x00}, /* h_win offset high */
582         {OV8858_8BIT, 0x3811, 0x04}, /* h_win offset low */
583         {OV8858_8BIT, 0x3812, 0x00}, /* v_win offset high */
584         {OV8858_8BIT, 0x3813, 0x02}, /* v_win offset low */
585         {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */
586         {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */
587         {OV8858_8BIT, 0x3820, 0x00}, /* format1 */
588         {OV8858_8BIT, 0x3821, 0x40}, /* format2 */
589         {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */
590         {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */
591
592         {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */
593         {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */
594         {OV8858_8BIT, 0x3837, 0x18}, /* Unknown */
595         {OV8858_8BIT, 0x3841, 0xFF}, /* AUTO_SIZE_CTRL */
596         {OV8858_8BIT, 0x3846, 0x48}, /* Unknown */
597
598         {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */
599         {OV8858_8BIT, 0x3D8C, 0x73}, /* OTP_SETTING_STT_ADDRESS */
600         {OV8858_8BIT, 0x3D8D, 0xDE}, /* OTP_SETTING_STT_ADDRESS */
601         {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */
602         {OV8858_8BIT, 0x3F0A, 0x80}, /* PSRAM control register */
603
604         {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */
605         {OV8858_8BIT, 0x4001, 0x00}, /* BLC CTRL01 */
606         {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */
607         {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */
608         {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */
609         {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */
610         {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */
611         {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */
612         {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */
613         {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */
614         {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */
615         {OV8858_8BIT, 0x4022, 0x0B}, /* Anchor left end = 0x0BC3 */
616         {OV8858_8BIT, 0x4023, 0xC3}, /* Anchor left end = 0x0BC3 */
617         {OV8858_8BIT, 0x4024, 0x0C}, /* Anchor right start = 0x0C36 */
618         {OV8858_8BIT, 0x4025, 0x36}, /* Anchor right start = 0x0C36 */
619         {OV8858_8BIT, 0x4026, 0x0C}, /* Anchor right end = 0x0C37 */
620         {OV8858_8BIT, 0x4027, 0x37}, /* Anchor right end = 0x0C37 */
621         {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */
622         {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */
623         {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */
624         {OV8858_8BIT, 0x402B, 0x08}, /* Top black line number = 8 */
625         {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */
626         {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */
627         {OV8858_8BIT, 0x402E, 0x0C}, /* Bottom black line start = 12 */
628         {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */
629
630         {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */
631         {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */
632         {OV8858_8BIT, 0x4300, 0xFF}, /* clip_max[11:4] = 0xFFF */
633         {OV8858_8BIT, 0x4301, 0x00}, /* clip_min[11:4] = 0 */
634         {OV8858_8BIT, 0x4302, 0x0F}, /* clip_min/max[3:0] */
635         {OV8858_8BIT, 0x4307, 0x01}, /* Unknown */
636         {OV8858_8BIT, 0x4316, 0x00}, /* CTRL16 = default */
637         {OV8858_8BIT, 0x4503, 0x18}, /* Unknown */
638         {OV8858_8BIT, 0x4500, 0x38}, /* Unknown */
639         {OV8858_8BIT, 0x4600, 0x01}, /* Unknown */
640         {OV8858_8BIT, 0x4601, 0x97}, /* Unknown */
641         /* wkup_dly = Mark1 wakeup delay/2^10 = 0x25 */
642         {OV8858_8BIT, 0x4808, 0x25},
643         {OV8858_8BIT, 0x4816, 0x52}, /* Embedded data type*/
644         {OV8858_8BIT, 0x481F, 0x32}, /* clk_prepare_min = 0x32 */
645         {OV8858_8BIT, 0x4825, 0x3A}, /* lpx_p_min = 0x3A */
646         {OV8858_8BIT, 0x4826, 0x40}, /* hs_prepare_min = 0x40 */
647         {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */
648         {OV8858_8BIT, 0x4850, 0x10}, /* LANE SEL01 */
649         {OV8858_8BIT, 0x4851, 0x32}, /* LANE SEL02 */
650
651         {OV8858_8BIT, 0x4B00, 0x2A}, /* Unknown */
652         {OV8858_8BIT, 0x4B0D, 0x00}, /* Unknown */
653         {OV8858_8BIT, 0x4D00, 0x04}, /* TPM_CTRL_REG */
654         {OV8858_8BIT, 0x4D01, 0x18}, /* TPM_CTRL_REG */
655         {OV8858_8BIT, 0x4D02, 0xC3}, /* TPM_CTRL_REG */
656         {OV8858_8BIT, 0x4D03, 0xFF}, /* TPM_CTRL_REG */
657         {OV8858_8BIT, 0x4D04, 0xFF}, /* TPM_CTRL_REG */
658         {OV8858_8BIT, 0x4D05, 0xFF}, /* TPM_CTRL_REG */
659
660         /*
661          * Lens correction (LENC) function enable = 0
662          * Slave sensor AWB Gain function enable = 1
663          * Slave sensor AWB Statistics function enable = 1
664          * Master sensor AWB Gain function enable = 1
665          * Master sensor AWB Statistics function enable = 1
666          * Black DPC function enable = 1
667          * White DPC function enable =1
668          */
669         {OV8858_8BIT, 0x5000, 0x7E},
670         {OV8858_8BIT, 0x5001, 0x01}, /* BLC function enable = 1 */
671         /*
672          * Horizontal scale function enable = 0
673          * WBMATCH bypass mode = Select slave sensor's gain
674          * WBMATCH function enable = 0
675          * Master MWB gain support RGBC = 0
676          * OTP_DPC function enable = 1
677          * Manual mode of VarioPixel function enable = 0
678          * Manual enable of VarioPixel function enable = 0
679          * Use VSYNC to latch ISP modules's function enable signals = 0
680          */
681         {OV8858_8BIT, 0x5002, 0x08},
682         /*
683          * Bypass all ISP modules after BLC module = 0
684          * DPC_DBC buffer control enable = 1
685          * WBMATCH VSYNC selection = Select master sensor's VSYNC fall
686          * Select master AWB gain to embed line = AWB gain before manual mode
687          * Enable BLC's input flip_i signal = 0
688          */
689         {OV8858_8BIT, 0x5003, 0x20},
690         {OV8858_8BIT, 0x5041, 0x1D}, /* ISP CTRL41 - embedded data=on */
691         {OV8858_8BIT, 0x5046, 0x12}, /* ISP CTRL46 = default */
692         /*
693          * Tail enable = 1
694          * Saturate cross cluster enable = 1
695          * Remove cross cluster enable = 1
696          * Enable to remove connected defect pixels in same channel = 1
697          * Enable to remove connected defect pixels in different channel = 1
698          * Smooth enable, use average G for recovery = 1
699          * Black/white sensor mode enable = 0
700          * Manual mode enable = 0
701          */
702         {OV8858_8BIT, 0x5780, 0xFC},
703         {OV8858_8BIT, 0x5784, 0x0C}, /* DPC CTRL04 */
704         {OV8858_8BIT, 0x5787, 0x40}, /* DPC CTRL07 */
705         {OV8858_8BIT, 0x5788, 0x08}, /* DPC CTRL08 */
706         {OV8858_8BIT, 0x578A, 0x02}, /* DPC CTRL0A */
707         {OV8858_8BIT, 0x578B, 0x01}, /* DPC CTRL0B */
708         {OV8858_8BIT, 0x578C, 0x01}, /* DPC CTRL0C */
709         {OV8858_8BIT, 0x578E, 0x02}, /* DPC CTRL0E */
710         {OV8858_8BIT, 0x578F, 0x01}, /* DPC CTRL0F */
711         {OV8858_8BIT, 0x5790, 0x01}, /* DPC CTRL10 */
712         {OV8858_8BIT, 0x5901, 0x00}, /* VAP CTRL01 = default */
713         /* WINC CTRL08 = embedded data in 1st line*/
714         {OV8858_8BIT, 0x5A08, 0x00},
715         {OV8858_8BIT, 0x5B00, 0x02}, /* OTP CTRL00 */
716         {OV8858_8BIT, 0x5B01, 0x10}, /* OTP CTRL01 */
717         {OV8858_8BIT, 0x5B02, 0x03}, /* OTP CTRL02 */
718         {OV8858_8BIT, 0x5B03, 0xCF}, /* OTP CTRL03 */
719         {OV8858_8BIT, 0x5B05, 0x6C}, /* OTP CTRL05 = default */
720         {OV8858_8BIT, 0x5E00, 0x00}, /* PRE CTRL00 = default */
721         {OV8858_8BIT, 0x5E01, 0x41}, /* PRE_CTRL01 = default */
722
723         {OV8858_TOK_TERM, 0, 0}
724 };
725
726 /*****************************STILL********************************/
727
728 static const struct ov8858_reg ov8858_8M[] = {
729         {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */
730         {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */
731         {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */
732         {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low 12 */
733         {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */
734         {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */
735         {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */
736         {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low 3283 */
737         {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */
738         {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */
739         {OV8858_8BIT, 0x3808, 0x0C}, /* h_output_size high 3280 x 2464 */
740         {OV8858_8BIT, 0x3809, 0xD0}, /* h_output_size low */
741         {OV8858_8BIT, 0x380A, 0x09}, /* v_output_size high */
742         {OV8858_8BIT, 0x380B, 0xa0}, /* v_output_size low */
743         {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */
744         {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */
745         {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */
746         {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */
747         {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */
748         {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */
749         {OV8858_8BIT, 0x3820, 0x00}, /* format1 */
750         {OV8858_8BIT, 0x3821, 0x40}, /* format2 */
751         {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */
752         {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */
753         {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */
754         {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */
755         {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */
756         {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */
757         {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */
758         {OV8858_8BIT, 0x4001, 0x00}, /* BLC CTRL01 */
759         {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */
760         {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */
761         {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */
762         {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */
763         {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */
764         {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */
765         {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */
766         {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */
767         {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */
768         {OV8858_8BIT, 0x4022, 0x0B}, /* Anchor left end = 0x0BC3 */
769         {OV8858_8BIT, 0x4023, 0xC3}, /* Anchor left end = 0x0BC3 */
770         {OV8858_8BIT, 0x4024, 0x0C}, /* Anchor right start = 0x0C36 */
771         {OV8858_8BIT, 0x4025, 0x36}, /* Anchor right start = 0x0C36 */
772         {OV8858_8BIT, 0x4026, 0x0C}, /* Anchor right end = 0x0C37 */
773         {OV8858_8BIT, 0x4027, 0x37}, /* Anchor right end = 0x0C37 */
774         {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */
775         {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */
776         {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */
777         {OV8858_8BIT, 0x402B, 0x08}, /* Top black line number = 8 */
778         {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */
779         {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */
780         {OV8858_8BIT, 0x402E, 0x0C}, /* Bottom black line start = 12 */
781         {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */
782         {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */
783         {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */
784         {OV8858_8BIT, 0x4600, 0x01}, /* Unknown */
785         {OV8858_8BIT, 0x4601, 0x97}, /* Unknown */
786         {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */
787         {OV8858_TOK_TERM, 0, 0}
788 };
789
790 static const struct ov8858_reg ov8858_3276x1848[] = {
791         {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */
792         {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */
793         {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */
794         {OV8858_8BIT, 0x3801, 0x10}, /* h_crop_start low  0c->10*/
795         {OV8858_8BIT, 0x3802, 0x01}, /* v_crop_start high */
796         {OV8858_8BIT, 0x3803, 0x42}, /* v_crop_start low 3e->42*/
797         {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */
798         {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */
799         {OV8858_8BIT, 0x3806, 0x08}, /* v_crop_end high */
800         {OV8858_8BIT, 0x3807, 0x71}, /* v_crop_end low */
801         {OV8858_8BIT, 0x3808, 0x0C}, /* h_output_size high 3276 x 1848 */
802         {OV8858_8BIT, 0x3809, 0xCC}, /* h_output_size low d0->cc*/
803         {OV8858_8BIT, 0x380A, 0x07}, /* v_output_size high */
804         {OV8858_8BIT, 0x380B, 0x38}, /* v_output_size low 3c->38*/
805         {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */
806         {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */
807         {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */
808         {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */
809         {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */
810         {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */
811         {OV8858_8BIT, 0x3820, 0x00}, /* format1 */
812         {OV8858_8BIT, 0x3821, 0x40}, /* format2 */
813         {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */
814         {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */
815         {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */
816         {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */
817         {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */
818         {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */
819         {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */
820         {OV8858_8BIT, 0x4001, 0x00}, /* BLC CTRL01 */
821         {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */
822         {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */
823         {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */
824         {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */
825         {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */
826         {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */
827         {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */
828         {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */
829         {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */
830         {OV8858_8BIT, 0x4022, 0x0B}, /* Anchor left end = 0x0BC3 */
831         {OV8858_8BIT, 0x4023, 0xC3}, /* Anchor left end = 0x0BC3 */
832         {OV8858_8BIT, 0x4024, 0x0C}, /* Anchor right start = 0x0C36 */
833         {OV8858_8BIT, 0x4025, 0x36}, /* Anchor right start = 0x0C36 */
834         {OV8858_8BIT, 0x4026, 0x0C}, /* Anchor right end = 0x0C37 */
835         {OV8858_8BIT, 0x4027, 0x37}, /* Anchor right end = 0x0C37 */
836         {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */
837         {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */
838         {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */
839         {OV8858_8BIT, 0x402B, 0x08}, /* Top black line number = 8 */
840         {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */
841         {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */
842         {OV8858_8BIT, 0x402E, 0x0C}, /* Bottom black line start = 12 */
843         {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */
844         {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */
845         {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */
846         {OV8858_8BIT, 0x4600, 0x01}, /* Unknown */
847         {OV8858_8BIT, 0x4601, 0x97}, /* Unknown */
848         {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */
849         {OV8858_TOK_TERM, 0, 0}
850 };
851
852 static const struct ov8858_reg ov8858_6M[] = {
853         {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */
854         {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */
855         {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */
856         {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low */
857         {OV8858_8BIT, 0x3802, 0x01}, /* v_crop_start high */
858         {OV8858_8BIT, 0x3803, 0x3E}, /* v_crop_start low */
859         {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */
860         {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */
861         {OV8858_8BIT, 0x3806, 0x08}, /* v_crop_end high */
862         {OV8858_8BIT, 0x3807, 0x71}, /* v_crop_end low */
863         {OV8858_8BIT, 0x3808, 0x0C}, /* h_output_size high 3280 x 1852 */
864         {OV8858_8BIT, 0x3809, 0xD0}, /* h_output_size low */
865         {OV8858_8BIT, 0x380A, 0x07}, /* v_output_size high */
866         {OV8858_8BIT, 0x380B, 0x3C}, /* v_output_size low */
867         {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */
868         {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */
869         {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */
870         {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */
871         {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */
872         {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */
873         {OV8858_8BIT, 0x3820, 0x00}, /* format1 */
874         {OV8858_8BIT, 0x3821, 0x40}, /* format2 */
875         {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */
876         {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */
877         {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */
878         {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */
879         {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */
880         {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */
881         {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */
882         {OV8858_8BIT, 0x4001, 0x00}, /* BLC CTRL01 */
883         {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */
884         {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */
885         {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */
886         {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */
887         {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */
888         {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */
889         {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */
890         {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */
891         {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */
892         {OV8858_8BIT, 0x4022, 0x0B}, /* Anchor left end = 0x0BC3 */
893         {OV8858_8BIT, 0x4023, 0xC3}, /* Anchor left end = 0x0BC3 */
894         {OV8858_8BIT, 0x4024, 0x0C}, /* Anchor right start = 0x0C36 */
895         {OV8858_8BIT, 0x4025, 0x36}, /* Anchor right start = 0x0C36 */
896         {OV8858_8BIT, 0x4026, 0x0C}, /* Anchor right end = 0x0C37 */
897         {OV8858_8BIT, 0x4027, 0x37}, /* Anchor right end = 0x0C37 */
898         {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */
899         {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */
900         {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */
901         {OV8858_8BIT, 0x402B, 0x08}, /* Top black line number = 8 */
902         {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */
903         {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */
904         {OV8858_8BIT, 0x402E, 0x0C}, /* Bottom black line start = 12 */
905         {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */
906         {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */
907         {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */
908         {OV8858_8BIT, 0x4600, 0x01}, /* Unknown */
909         {OV8858_8BIT, 0x4601, 0x97}, /* Unknown */
910         {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */
911         {OV8858_TOK_TERM, 0, 0}
912 };
913
914 static const struct ov8858_reg ov8858_1080P_60[] = {
915         {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */
916         {OV8858_8BIT, 0x3778, 0x17}, /* Unknown */
917         {OV8858_8BIT, 0x3800, 0x02}, /* h_crop_start high */
918         {OV8858_8BIT, 0x3801, 0x26}, /* h_crop_start low */
919         {OV8858_8BIT, 0x3802, 0x02}, /* v_crop_start high */
920         {OV8858_8BIT, 0x3803, 0x8C}, /* v_crop_start low */
921         {OV8858_8BIT, 0x3804, 0x0A}, /* h_crop_end high */
922         {OV8858_8BIT, 0x3805, 0x9D}, /* h_crop_end low */
923         {OV8858_8BIT, 0x3806, 0x07}, /* v_crop_end high */
924         {OV8858_8BIT, 0x3807, 0x0A}, /* v_crop_end low */
925         {OV8858_8BIT, 0x3808, 0x07}, /* h_output_size high*/
926         {OV8858_8BIT, 0x3809, 0x90}, /* h_output_size low */
927         {OV8858_8BIT, 0x380A, 0x04}, /* v_output_size high */
928         {OV8858_8BIT, 0x380B, 0x48}, /* v_output_size low */
929         {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */
930         {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */
931         {OV8858_8BIT, 0x380E, 0x04}, /* vertical timing size high */
932         {OV8858_8BIT, 0x380F, 0xEC}, /* vertical timing size low */
933         {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */
934         {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */
935         {OV8858_8BIT, 0x3820, 0x00}, /* format1 */
936         {OV8858_8BIT, 0x3821, 0x40}, /* format2 */
937         {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */
938         {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */
939         {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */
940         {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */
941         {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */
942         {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */
943         {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */
944         {OV8858_8BIT, 0x4001, 0x00}, /* BLC CTRL01 */
945         {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */
946         {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */
947         {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */
948         {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */
949         {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */
950         {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */
951         {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */
952         {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */
953         {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */
954         {OV8858_8BIT, 0x4022, 0x07}, /* Anchor left end = 0x072D */
955         {OV8858_8BIT, 0x4023, 0x2D}, /* Anchor left end = 0x072D */
956         {OV8858_8BIT, 0x4024, 0x07}, /* Anchor right start = 0x079E */
957         {OV8858_8BIT, 0x4025, 0x9E}, /* Anchor right start = 0x079E */
958         {OV8858_8BIT, 0x4026, 0x07}, /* Anchor right end = 0x079F */
959         {OV8858_8BIT, 0x4027, 0x9F}, /* Anchor right end = 0x079F */
960         {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */
961         {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */
962         {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */
963         {OV8858_8BIT, 0x402B, 0x08}, /* Top black line number = 8 */
964         {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */
965         {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */
966         {OV8858_8BIT, 0x402E, 0x0C}, /* Bottom black line start = 12 */
967         {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */
968         {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */
969         {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */
970         {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */
971         {OV8858_8BIT, 0x4601, 0xef}, /* Unknown */
972         {OV8858_8BIT, 0x4837, 0x16}, /* pclk_period = 0x16 */
973         {OV8858_TOK_TERM, 0, 0}
974 };
975
976 static const struct ov8858_reg ov8858_1080P_30[] = {
977         {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */
978         {OV8858_8BIT, 0x3778, 0x17}, /* Unknown */
979         {OV8858_8BIT, 0x3800, 0x02}, /* h_crop_start high */
980         {OV8858_8BIT, 0x3801, 0x26}, /* h_crop_start low */
981         {OV8858_8BIT, 0x3802, 0x02}, /* v_crop_start high */
982         {OV8858_8BIT, 0x3803, 0x8C}, /* v_crop_start low */
983         {OV8858_8BIT, 0x3804, 0x0A}, /* h_crop_end high */
984         {OV8858_8BIT, 0x3805, 0x9D}, /* h_crop_end low */
985         {OV8858_8BIT, 0x3806, 0x07}, /* v_crop_end high */
986         {OV8858_8BIT, 0x3807, 0x0A}, /* v_crop_end low */
987         {OV8858_8BIT, 0x3808, 0x07}, /* h_output_size high*/
988         {OV8858_8BIT, 0x3809, 0x90}, /* h_output_size low */
989         {OV8858_8BIT, 0x380A, 0x04}, /* v_output_size high */
990         {OV8858_8BIT, 0x380B, 0x48}, /* v_output_size low */
991         {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */
992         {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */
993         {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */
994         {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */
995         {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */
996         {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */
997         {OV8858_8BIT, 0x3820, 0x00}, /* format1 */
998         {OV8858_8BIT, 0x3821, 0x40}, /* format2 */
999         {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */
1000         {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */
1001         {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */
1002         {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */
1003         {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */
1004         {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */
1005         {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */
1006         {OV8858_8BIT, 0x4001, 0x00}, /* BLC CTRL01 */
1007         {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */
1008         {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */
1009         {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */
1010         {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */
1011         {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */
1012         {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */
1013         {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */
1014         {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */
1015         {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */
1016         {OV8858_8BIT, 0x4022, 0x07}, /* Anchor left end = 0x072D */
1017         {OV8858_8BIT, 0x4023, 0x2D}, /* Anchor left end = 0x072D */
1018         {OV8858_8BIT, 0x4024, 0x07}, /* Anchor right start = 0x079E */
1019         {OV8858_8BIT, 0x4025, 0x9E}, /* Anchor right start = 0x079E */
1020         {OV8858_8BIT, 0x4026, 0x07}, /* Anchor right end = 0x079F */
1021         {OV8858_8BIT, 0x4027, 0x9F}, /* Anchor right end = 0x079F */
1022         {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */
1023         {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */
1024         {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */
1025         {OV8858_8BIT, 0x402B, 0x08}, /* Top black line number = 8 */
1026         {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */
1027         {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */
1028         {OV8858_8BIT, 0x402E, 0x0C}, /* Bottom black line start = 12 */
1029         {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */
1030         {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */
1031         {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */
1032         {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */
1033         {OV8858_8BIT, 0x4601, 0xef}, /* Unknown */
1034         {OV8858_8BIT, 0x4837, 0x16}, /* pclk_period = 0x16 */
1035         {OV8858_TOK_TERM, 0, 0}
1036 };
1037
1038 static const struct ov8858_reg ov8858_1640x1232[] = {
1039         {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */
1040         {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */
1041         {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */
1042         {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low 12 */
1043         {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */
1044         {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */
1045         {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high 3283 */
1046         {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */
1047         {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */
1048         {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */
1049         {OV8858_8BIT, 0x3808, 0x06}, /* h_output_size high 1640 x 1232 */
1050         {OV8858_8BIT, 0x3809, 0x68}, /* h_output_size low */
1051         {OV8858_8BIT, 0x380A, 0x04}, /* v_output_size high */
1052         {OV8858_8BIT, 0x380B, 0xD0}, /* v_output_size low */
1053         {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */
1054         {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */
1055         {OV8858_8BIT, 0x380E, 0x09}, /* vertical timing size high */
1056         {OV8858_8BIT, 0x380F, 0xAA}, /* vertical timing size low */
1057         {OV8858_8BIT, 0x3814, 0x03}, /* h_odd_inc */
1058         {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */
1059         {OV8858_8BIT, 0x3820, 0x00}, /* format1 */
1060         {OV8858_8BIT, 0x3821, 0x67}, /* format2 */
1061         {OV8858_8BIT, 0x382A, 0x03}, /* v_odd_inc */
1062         {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */
1063         {OV8858_8BIT, 0x3830, 0x08}, /* Unknown */
1064         {OV8858_8BIT, 0x3836, 0x02}, /* Unknown */
1065         {OV8858_8BIT, 0x3D85, 0x16}, /* OTP_REG85 */
1066         {OV8858_8BIT, 0x3F08, 0x08}, /* PSRAM control register */
1067         {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */
1068         {OV8858_8BIT, 0x4001, 0x10}, /* BLC CTRL01 */
1069         {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */
1070         {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */
1071         {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */
1072         {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */
1073         {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */
1074         {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */
1075         {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */
1076         {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */
1077         {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */
1078         {OV8858_8BIT, 0x4022, 0x04}, /* Anchor left end = 0x04B9 */
1079         {OV8858_8BIT, 0x4023, 0xB9}, /* Anchor left end = 0x04B9 */
1080         {OV8858_8BIT, 0x4024, 0x05}, /* Anchor right start = 0x052A */
1081         {OV8858_8BIT, 0x4025, 0x2A}, /* Anchor right start = 0x052A */
1082         {OV8858_8BIT, 0x4026, 0x05}, /* Anchor right end = 0x052B */
1083         {OV8858_8BIT, 0x4027, 0x2B}, /* Anchor right end = 0x052B */
1084         {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */
1085         {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */
1086         {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */
1087         {OV8858_8BIT, 0x402B, 0x04}, /* Top black line number = 8 */
1088         {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */
1089         {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */
1090         {OV8858_8BIT, 0x402E, 0x08}, /* Bottom black line start = 8 */
1091         {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */
1092         {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */
1093         {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */
1094         {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */
1095         {OV8858_8BIT, 0x4601, 0xCB}, /* Unknown */
1096         {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */
1097         {OV8858_TOK_TERM, 0, 0}
1098 };
1099
1100 static const struct ov8858_reg ov8858_1640x1096[] = {
1101         {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */
1102         {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */
1103         {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */
1104         {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low 12 */
1105         {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */
1106         {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */
1107         {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high 3283 */
1108         {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */
1109         {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */
1110         {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */
1111         {OV8858_8BIT, 0x3808, 0x06}, /* h_output_size high 1640 x 1096 */
1112         {OV8858_8BIT, 0x3809, 0x68}, /* h_output_size low */
1113         {OV8858_8BIT, 0x380A, 0x04}, /* v_output_size high */
1114         {OV8858_8BIT, 0x380B, 0x48}, /* v_output_size low */
1115         {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */
1116         {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */
1117         {OV8858_8BIT, 0x380E, 0x09}, /* vertical timing size high */
1118         {OV8858_8BIT, 0x380F, 0xAA}, /* vertical timing size low */
1119         {OV8858_8BIT, 0x3814, 0x03}, /* h_odd_inc */
1120         {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */
1121         {OV8858_8BIT, 0x3820, 0x00}, /* format1 */
1122         {OV8858_8BIT, 0x3821, 0x67}, /* format2 */
1123         {OV8858_8BIT, 0x382A, 0x03}, /* v_odd_inc */
1124         {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */
1125         {OV8858_8BIT, 0x3830, 0x08}, /* Unknown */
1126         {OV8858_8BIT, 0x3836, 0x02}, /* Unknown */
1127         {OV8858_8BIT, 0x3D85, 0x16}, /* OTP_REG85 */
1128         {OV8858_8BIT, 0x3F08, 0x08}, /* PSRAM control register */
1129         {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */
1130         {OV8858_8BIT, 0x4001, 0x10}, /* BLC CTRL01 */
1131         {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */
1132         {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */
1133         {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */
1134         {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */
1135         {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */
1136         {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */
1137         {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */
1138         {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */
1139         {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */
1140         {OV8858_8BIT, 0x4022, 0x04}, /* Anchor left end = 0x04B9 */
1141         {OV8858_8BIT, 0x4023, 0xB9}, /* Anchor left end = 0x04B9 */
1142         {OV8858_8BIT, 0x4024, 0x05}, /* Anchor right start = 0x052A */
1143         {OV8858_8BIT, 0x4025, 0x2A}, /* Anchor right start = 0x052A */
1144         {OV8858_8BIT, 0x4026, 0x05}, /* Anchor right end = 0x052B */
1145         {OV8858_8BIT, 0x4027, 0x2B}, /* Anchor right end = 0x052B */
1146         {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */
1147         {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */
1148         {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */
1149         {OV8858_8BIT, 0x402B, 0x04}, /* Top black line number = 8 */
1150         {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */
1151         {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */
1152         {OV8858_8BIT, 0x402E, 0x08}, /* Bottom black line start = 8 */
1153         {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */
1154         {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */
1155         {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */
1156         {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */
1157         {OV8858_8BIT, 0x4601, 0xCB}, /* Unknown */
1158         {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */
1159         {OV8858_TOK_TERM, 0, 0}
1160 };
1161
1162
1163 static const struct ov8858_reg ov8858_1640x926[] = {
1164         {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */
1165         {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */
1166         {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */
1167         {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low */
1168         {OV8858_8BIT, 0x3802, 0x00},  /* v_crop_start high */
1169         {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */
1170         {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */
1171         {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */
1172         {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */
1173         {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */
1174         {OV8858_8BIT, 0x3808, 0x06}, /* h_output_size high 1640 x 926 */
1175         {OV8858_8BIT, 0x3809, 0x68}, /* h_output_size low */
1176         {OV8858_8BIT, 0x380A, 0x03}, /* v_output_size high */
1177         {OV8858_8BIT, 0x380B, 0x9E}, /* v_output_size low */
1178         {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */
1179         {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */
1180         {OV8858_8BIT, 0x380E, 0x09}, /* vertical timing size high */
1181         {OV8858_8BIT, 0x380F, 0xAA}, /* vertical timing size low */
1182         {OV8858_8BIT, 0x3814, 0x03}, /* h_odd_inc */
1183         {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */
1184         {OV8858_8BIT, 0x3820, 0x00}, /* format1 */
1185         {OV8858_8BIT, 0x3821, 0x67}, /* format2 */
1186         {OV8858_8BIT, 0x382A, 0x03}, /* v_odd_inc */
1187         {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */
1188         {OV8858_8BIT, 0x3830, 0x08}, /* Unknown */
1189         {OV8858_8BIT, 0x3836, 0x02}, /* Unknown */
1190         {OV8858_8BIT, 0x3D85, 0x16}, /* OTP_REG85 */
1191         {OV8858_8BIT, 0x3F08, 0x08}, /* PSRAM control register */
1192         {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */
1193         {OV8858_8BIT, 0x4001, 0x10}, /* BLC CTRL01 */
1194         {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */
1195         {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */
1196         {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */
1197         {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */
1198         {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */
1199         {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */
1200         {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */
1201         {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */
1202         {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */
1203         {OV8858_8BIT, 0x4022, 0x04}, /* Anchor left end = 0x04B9 */
1204         {OV8858_8BIT, 0x4023, 0xB9}, /* Anchor left end = 0x04B9 */
1205         {OV8858_8BIT, 0x4024, 0x05}, /* Anchor right start = 0x052A */
1206         {OV8858_8BIT, 0x4025, 0x2A}, /* Anchor right start = 0x052A */
1207         {OV8858_8BIT, 0x4026, 0x05}, /* Anchor right end = 0x052B */
1208         {OV8858_8BIT, 0x4027, 0x2B}, /* Anchor right end = 0x052B */
1209         {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */
1210         {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */
1211         {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */
1212         {OV8858_8BIT, 0x402B, 0x04}, /* Top black line number = 8 */
1213         {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */
1214         {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */
1215         {OV8858_8BIT, 0x402E, 0x08}, /* Bottom black line start = 8 */
1216         {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */
1217         {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */
1218         {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */
1219         {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */
1220         {OV8858_8BIT, 0x4601, 0xCB}, /* Unknown */
1221         {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */
1222         {OV8858_TOK_TERM, 0, 0}
1223 };
1224
1225 static struct ov8858_resolution ov8858_res_preview[] = {
1226         {
1227                 .desc = "ov8858_1640x926_PREVIEW",
1228                 .width = 1640,
1229                 .height = 926,
1230                 .used = 0,
1231                 .regs = ov8858_1640x926,
1232                 .bin_factor_x = 0,
1233                 .bin_factor_y = 0,
1234                 .skip_frames = 0,
1235                 .fps_options = {
1236                         {
1237                                 .fps = 30,
1238                                 .pixels_per_line = 3880,
1239                                 .lines_per_frame = 2573,
1240                         },
1241                         {
1242                         }
1243                 },
1244         },
1245         {
1246                 .desc = "ov8858_1640x1232_PREVIEW",
1247                 .width = 1640,
1248                 .height = 1232,
1249                 .used = 0,
1250                 .regs = ov8858_1640x1232,
1251                 .bin_factor_x = 0,
1252                 .bin_factor_y = 0,
1253                 .skip_frames = 0,
1254                 .fps_options = {
1255                         {
1256                                 .fps = 30,
1257                                 .pixels_per_line = 3880,
1258                                 .lines_per_frame = 2573,
1259                         },
1260                         {
1261                         }
1262                 },
1263         },
1264         {
1265                 .desc = "ov8858_3276x1848_PREVIEW",
1266                 .width = 3276,
1267                 .height = 1848,
1268                 .used = 0,
1269                 .regs = ov8858_3276x1848,
1270                 .bin_factor_x = 0,
1271                 .bin_factor_y = 0,
1272                 .skip_frames = 0,
1273                 .fps_options = {
1274                         {
1275                                 .fps = 30,
1276                                 .pixels_per_line = 3880,
1277                                 .lines_per_frame = 2573,
1278                         },
1279                         {
1280                         }
1281                 },
1282         },
1283         {
1284                 .desc = "ov8858_8M_PREVIEW",
1285                 .width = 3280,
1286                 .height = 2464,
1287                 .used = 0,
1288                 .regs = ov8858_8M,
1289                 .bin_factor_x = 0,
1290                 .bin_factor_y = 0,
1291                 .skip_frames = 0,
1292                 .fps_options = {
1293                         {
1294                                 .fps = 30,
1295                                 .pixels_per_line = 3880,
1296                                 .lines_per_frame = 2573,
1297                         },
1298                         {
1299                         }
1300                 },
1301         },
1302 };
1303
1304 static struct ov8858_resolution ov8858_res_still[] = {
1305         {
1306                 .desc = "ov8858_1640x1232_STILL",
1307                 .width = 1640,
1308                 .height = 1232,
1309                 .used = 0,
1310                 .regs = ov8858_1640x1232,
1311                 .bin_factor_x = 0,
1312                 .bin_factor_y = 0,
1313                 .skip_frames = 0,
1314                 .fps_options = {
1315                         {
1316                                 .fps = 30,
1317                                 .pixels_per_line = 3880,
1318                                 .lines_per_frame = 2573,
1319                         },
1320                         {
1321                         }
1322                 },
1323         },
1324         {
1325                 .desc = "ov8858_1640x926_STILL",
1326                 .width = 1640,
1327                 .height = 926,
1328                 .used = 0,
1329                 .regs = ov8858_1640x926,
1330                 .bin_factor_x = 0,
1331                 .bin_factor_y = 0,
1332                 .skip_frames = 1,
1333                 .fps_options = {
1334                         {
1335                                 .fps = 30,
1336                                 .pixels_per_line = 3880,
1337                                 .lines_per_frame = 2573,
1338                         },
1339                         {
1340                         }
1341                 },
1342         },
1343         {
1344                 .desc = "ov8858_3276X1848_STILL",
1345                 .width = 3276,
1346                 .height = 1848,
1347                 .used = 0,
1348                 .regs = ov8858_3276x1848,
1349                 .bin_factor_x = 0,
1350                 .bin_factor_y = 0,
1351                 .skip_frames = 1,
1352                 .fps_options =  {
1353                         {
1354                                 .fps = 30,
1355                                 .pixels_per_line = 3880,
1356                                 .lines_per_frame = 2573,
1357                         },
1358                         {
1359                         }
1360                 },
1361         },
1362         {
1363                 .desc = "ov8858_8M_STILL",
1364                 .width = 3280,
1365                 .height = 2464,
1366                 .used = 0,
1367                 .regs = ov8858_8M,
1368                 .bin_factor_x = 0,
1369                 .bin_factor_y = 0,
1370                 .skip_frames = 1,
1371                 .fps_options = {
1372                         {
1373                                 /* Pixel clock: 149.76MHZ */
1374                                 .fps = 10,
1375                                 .pixels_per_line = 3880,
1376                                 .lines_per_frame = 3859,
1377                         },
1378                         {
1379                         }
1380                 },
1381         },
1382 };
1383
1384 static struct ov8858_resolution ov8858_res_video[] = {
1385         {
1386                 .desc = "ov8858_1640x926_VIDEO",
1387                 .width = 1640,
1388                 .height = 926,
1389                 .used = 0,
1390                 .regs = ov8858_1640x926,
1391                 .bin_factor_x = 0,
1392                 .bin_factor_y = 0,
1393                 .skip_frames = 1,
1394                 .fps_options = {
1395                         {
1396                                 .fps = 30,
1397                                 .pixels_per_line = 3880,
1398                                 .lines_per_frame = 2573,
1399                         },
1400                         {
1401                         }
1402                 },
1403         },
1404         {
1405                 .desc = "ov8858_1640x1232_VIDEO",
1406                 .width = 1640,
1407                 .height = 1232,
1408                 .used = 0,
1409                 .regs = ov8858_1640x1232,
1410                 .bin_factor_x = 0,
1411                 .bin_factor_y = 0,
1412                 .skip_frames = 1,
1413                 .fps_options = {
1414                         {
1415                                 .fps = 30,
1416                                 .pixels_per_line = 3880,
1417                                 .lines_per_frame = 2573,
1418                         },
1419                         {
1420                         }
1421                 },
1422         },
1423         {
1424                 .desc = "ov8858_1640x1096_VIDEO",
1425                 .width = 1640,
1426                 .height = 1096,
1427                 .used = 0,
1428                 .regs = ov8858_1640x1096,
1429                 .bin_factor_x = 0,
1430                 .bin_factor_y = 0,
1431                 .skip_frames = 1,
1432                 .fps_options = {
1433                         {
1434                                 .fps = 30,
1435                                 .pixels_per_line = 3880,
1436                                 .lines_per_frame = 2573,
1437                         },
1438                         {
1439                         }
1440                 },
1441         },
1442         {
1443                 .desc = "ov8858_6M_VIDEO",
1444                 .width = 3280,
1445                 .height = 1852,
1446                 .used = 0,
1447                 .regs = ov8858_6M,
1448                 .bin_factor_x = 0,
1449                 .bin_factor_y = 0,
1450                 .skip_frames = 1,
1451                 .fps_options =  {
1452                         {
1453                                 .fps = 30,
1454                                 .pixels_per_line = 3880,
1455                                 .lines_per_frame = 2573,
1456                         },
1457                         {
1458                         }
1459                 },
1460         },
1461         {
1462                 .desc = "ov8858_8M_VIDEO",
1463                 .width = 3280,
1464                 .height = 2464,
1465                 .used = 0,
1466                 .regs = ov8858_8M,
1467                 .bin_factor_x = 0,
1468                 .bin_factor_y = 0,
1469                 .skip_frames = 1,
1470                 .fps_options = {
1471                         {
1472                                 .fps = 30,
1473                                 .pixels_per_line = 3880,
1474                                 .lines_per_frame = 2573,
1475                         },
1476                         {
1477                         }
1478                 },
1479         },
1480 };
1481
1482 #endif /* __OV8858_H__ */