camera: rockchip: porting ov8858&ov4689&ov2710 driver
[firefly-linux-kernel-4.4.55.git] / drivers / media / i2c / soc_camera / rockchip / ov8858_v4l2-i2c-subdev.c
1 /*
2  * drivers/media/i2c/soc_camera/xgold/ov8858.c
3  *
4  * ov8858 sensor driver
5  *
6  * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd.
7  *
8  * Copyright (C) 2012-2014 Intel Mobile Communications GmbH
9  *
10  * Copyright (C) 2008 Texas Instruments.
11  *
12  * This file is licensed under the terms of the GNU General Public License
13  * version 2. This program is licensed "as is" without any warranty of any
14  * kind, whether express or implied.
15  *
16  * Note:
17  *    07/01/2014: new implementation using v4l2-subdev
18  *                        instead of v4l2-int-device.
19  */
20
21 #include <linux/i2c.h>
22 #include <linux/io.h>
23 #include <linux/delay.h>
24 #include <linux/module.h>
25 #include <media/v4l2-subdev.h>
26 #include <media/videobuf-core.h>
27 #include <linux/slab.h>
28 #include "ov_camera_module.h"
29
30 #define ov8858_DRIVER_NAME "ov8858"
31
32 #define ov8858_FETCH_LSB_GAIN(VAL) ((VAL) & 0x00ff)
33 #define ov8858_FETCH_MSB_GAIN(VAL) (((VAL) >> 8) & 0xff)
34 #define ov8858_AEC_PK_LONG_GAIN_HIGH_REG 0x3508 /* Bit 6-13 */
35 #define ov8858_AEC_PK_LONG_GAIN_LOW_REG  0x3509 /* Bits 0 -5 */
36
37 #define ov8858_AEC_PK_LONG_EXPO_3RD_REG 0x3500  /* Exposure Bits 16-19 */
38 #define ov8858_AEC_PK_LONG_EXPO_2ND_REG 0x3501  /* Exposure Bits 8-15 */
39 #define ov8858_AEC_PK_LONG_EXPO_1ST_REG 0x3502  /* Exposure Bits 0-7 */
40
41 #define ov8858_AEC_GROUP_UPDATE_ADDRESS 0x3208
42 #define ov8858_AEC_GROUP_UPDATE_START_DATA 0x00
43 #define ov8858_AEC_GROUP_UPDATE_END_DATA 0x10
44 #define ov8858_AEC_GROUP_UPDATE_END_LAUNCH 0xA0
45
46 #define ov8858_FETCH_3RD_BYTE_EXP(VAL) (((VAL) >> 16) & 0xF)    /* 4 Bits */
47 #define ov8858_FETCH_2ND_BYTE_EXP(VAL) (((VAL) >> 8) & 0xFF)    /* 8 Bits */
48 #define ov8858_FETCH_1ST_BYTE_EXP(VAL) ((VAL) & 0xFF)   /* 8 Bits */
49
50 #define ov8858_PIDH_ADDR     0x300B
51 #define ov8858_PIDL_ADDR     0x300C
52
53 #define ov8858_TIMING_VTS_HIGH_REG 0x380e
54 #define ov8858_TIMING_VTS_LOW_REG 0x380f
55 #define ov8858_TIMING_HTS_HIGH_REG 0x380c
56 #define ov8858_TIMING_HTS_LOW_REG 0x380d
57 #define ov8858_INTEGRATION_TIME_MARGIN 8
58 #define ov8858_FINE_INTG_TIME_MIN 0
59 #define ov8858_FINE_INTG_TIME_MAX_MARGIN 0
60 #define ov8858_COARSE_INTG_TIME_MIN 16
61 #define ov8858_COARSE_INTG_TIME_MAX_MARGIN 4
62 #define ov8858_TIMING_X_INC             0x3814
63 #define ov8858_TIMING_Y_INC             0x3815
64 #define ov8858_HORIZONTAL_START_HIGH_REG 0x3800
65 #define ov8858_HORIZONTAL_START_LOW_REG 0x3801
66 #define ov8858_VERTICAL_START_HIGH_REG 0x3802
67 #define ov8858_VERTICAL_START_LOW_REG 0x3803
68 #define ov8858_HORIZONTAL_END_HIGH_REG 0x3804
69 #define ov8858_HORIZONTAL_END_LOW_REG 0x3805
70 #define ov8858_VERTICAL_END_HIGH_REG 0x3806
71 #define ov8858_VERTICAL_END_LOW_REG 0x3807
72 #define ov8858_HORIZONTAL_OUTPUT_SIZE_HIGH_REG 0x3808
73 #define ov8858_HORIZONTAL_OUTPUT_SIZE_LOW_REG 0x3809
74 #define ov8858_VERTICAL_OUTPUT_SIZE_HIGH_REG 0x380a
75 #define ov8858_VERTICAL_OUTPUT_SIZE_LOW_REG 0x380b
76 #define ov8858_FLIP_REG                      0x3820
77 #define ov8858_MIRROR_REG                      0x3821
78
79 #define ov8858_EXT_CLK 26000000
80
81 #define ov8858_FULL_SIZE_RESOLUTION_WIDTH 3264
82 #define ov8858_BINING_SIZE_RESOLUTION_WIDTH 1632
83 #define ov8858_VIDEO_SIZE_RESOLUTION_WIDTH 3200
84
85 #define ov8858_EXP_VALID_FRAMES         4
86 /* High byte of product ID */
87 #define ov8858_PIDH_MAGIC 0x88
88 /* Low byte of product ID  */
89 #define ov8858_PIDL_MAGIC 0x58
90
91 bool is_R1A_module;
92
93 #define BG_RATIO_TYPICAL  0x129
94 #define RG_RATIO_TYPICAL  0x11f
95
96 struct ov8858_otp_struct {
97         int otp_en;
98         int flag;
99         int module_integrator_id;
100         int lens_id;
101         int production_year;
102         int production_month;
103         int production_day;
104         int rg_ratio;
105         int bg_ratio;
106         int lenc[240];
107         int checksum;
108         int VCM_start;
109         int VCM_end;
110         int VCM_dir;
111         int R_gain;
112         int G_gain;
113         int B_gain;
114 };
115
116 static struct ov8858_otp_struct *otp_ptr;
117 static struct ov_camera_module ov8858;
118 static struct ov_camera_module_custom_config ov8858_custom_config;
119
120 /* ======================================================================== */
121 /* Base sensor configs */
122 /* ======================================================================== */
123
124 /* MCLK:26MHz  3264x2448  18fps   mipi 4lane   481Mbps/lane */
125 static struct ov_camera_module_reg
126         ov8858_init_tab_3264_2448_18fps[] = {
127         /* global setting */
128         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0103, 0x01},
129         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0100, 0x00},
130         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0300, 0x05},
131         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0301, 0x00},
132         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0302, 0x94},
133         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0303, 0x01},
134         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0304, 0x03},
135         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0305, 0x01},
136         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0306, 0x01},
137         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030a, 0x00},
138         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030b, 0x05},
139         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030c, 0x00},
140         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030e, 0x00},
141         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030d, 0x6f},
142         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030f, 0x04},
143         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0312, 0x01},
144         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x031e, 0x0c},
145         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3033, 0x24},
146         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3600, 0x00},
147         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3601, 0x00},
148         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3602, 0x00},
149         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3603, 0x00},
150         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3604, 0x22},
151         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3605, 0x20},
152         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3606, 0x00},
153         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3607, 0x20},
154         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3608, 0x11},
155         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3609, 0x28},
156         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360a, 0x00},
157         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360b, 0x05},
158         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360c, 0xd4},
159         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360d, 0x40},
160         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360e, 0x0c},
161         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360f, 0x20},
162         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3610, 0x07},
163         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3611, 0x20},
164         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3612, 0x88},
165         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3613, 0x80},
166         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3614, 0x58},
167         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3615, 0x00},
168         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3616, 0x4a},
169         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3617, 0x40},
170         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3618, 0x5a},
171         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3619, 0x70},
172         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361a, 0x99},
173         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361b, 0x0a},
174         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361c, 0x07},
175         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361d, 0x00},
176         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361e, 0x00},
177         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361f, 0x00},
178         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3638, 0xff},
179         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3633, 0x0f},
180         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3634, 0x0f},
181         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3635, 0x0f},
182         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3636, 0x12},
183         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3645, 0x13},
184         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3646, 0x83},
185         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x364a, 0x07},
186         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3015, 0x01},
187         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3018, 0x72},
188         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3020, 0x93},
189         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3022, 0x01},
190         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3031, 0x0a},
191         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3034, 0x00},
192         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3106, 0x01},
193         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3305, 0xf1},
194         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3308, 0x00},
195         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3309, 0x28},
196         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330a, 0x00},
197         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330b, 0x20},
198         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330c, 0x00},
199         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330d, 0x00},
200         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330e, 0x00},
201         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330f, 0x40},
202         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3307, 0x04},
203         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3500, 0x00},
204         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3501, 0x4d},
205         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3502, 0x40},
206         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3503, 0x80},
207         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3505, 0x80},
208         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3508, 0x04},
209         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3509, 0x00},
210         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x350c, 0x00},
211         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x350d, 0x80},
212         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3510, 0x00},
213         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3511, 0x02},
214         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3512, 0x00},
215         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3700, 0x30},
216         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3701, 0x18},
217         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3702, 0x50},
218         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3703, 0x32},
219         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3704, 0x28},
220         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3705, 0x00},
221         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3706, 0x82},
222         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3707, 0x08},
223         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3708, 0x48},
224         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3709, 0x66},
225         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x370a, 0x01},
226         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x370b, 0x82},
227         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x370c, 0x07},
228         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3718, 0x14},
229         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3719, 0x31},
230         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3712, 0x44},
231         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3714, 0x24},
232         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x371e, 0x31},
233         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x371f, 0x7f},
234         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3720, 0x0a},
235         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3721, 0x0a},
236         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3724, 0x0c},
237         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3725, 0x02},
238         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3726, 0x0c},
239         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3728, 0x0a},
240         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3729, 0x03},
241         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372a, 0x06},
242         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372b, 0xa6},
243         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372c, 0xa6},
244         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372d, 0xa6},
245         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372e, 0x0c},
246         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372f, 0x20},
247         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3730, 0x02},
248         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3731, 0x0c},
249         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3732, 0x28},
250         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3733, 0x10},
251         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3734, 0x40},
252         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3736, 0x30},
253         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x373a, 0x0a},
254         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x373b, 0x0b},
255         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x373c, 0x14},
256         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x373e, 0x06},
257         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3750, 0x0a},
258         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3751, 0x0e},
259         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3755, 0x10},
260         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3758, 0x00},
261         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3759, 0x4c},
262         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375a, 0x0c},
263         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375b, 0x26},
264         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375c, 0x20},
265         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375d, 0x04},
266         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375e, 0x00},
267         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375f, 0x28},
268         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3768, 0x22},
269         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3769, 0x44},
270         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x376a, 0x44},
271         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3761, 0x00},
272         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3762, 0x00},
273         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3763, 0x00},
274         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3766, 0xff},
275         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x376b, 0x00},
276         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3772, 0x46},
277         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3773, 0x04},
278         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3774, 0x2c},
279         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3775, 0x13},
280         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3776, 0x08},
281         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3777, 0x00},
282         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3778, 0x17},
283         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a0, 0x88},
284         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a1, 0x7a},
285         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a2, 0x7a},
286         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a3, 0x00},
287         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a4, 0x00},
288         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a5, 0x00},
289         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a6, 0x00},
290         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a7, 0x88},
291         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a8, 0x98},
292         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a9, 0x98},
293         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3760, 0x00},
294         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x376f, 0x01},
295         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37aa, 0x88},
296         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37ab, 0x5c},
297         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37ac, 0x5c},
298         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37ad, 0x55},
299         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37ae, 0x19},
300         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37af, 0x19},
301         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b0, 0x00},
302         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b1, 0x00},
303         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b2, 0x00},
304         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b3, 0x84},
305         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b4, 0x84},
306         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b5, 0x60},
307         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b6, 0x00},
308         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b7, 0x00},
309         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b8, 0x00},
310         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b9, 0xff},
311         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3800, 0x00},
312         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3801, 0x0c},
313         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3802, 0x00},
314         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3803, 0x0c},
315         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3804, 0x0c},
316         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3805, 0xd3},
317         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3806, 0x09},
318         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3807, 0xa3},
319         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3808, 0x06},
320         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3809, 0x60},
321         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380a, 0x04},
322         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380b, 0xc8},
323         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380c, 0x0b},
324         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380d, 0x64},
325         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380e, 0x04},
326         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380f, 0xdc},
327         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3810, 0x00},
328         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3811, 0x04},
329         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3813, 0x02},
330         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3814, 0x03},
331         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3815, 0x01},
332         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3820, 0x06},
333         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3821, 0x40},
334         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382a, 0x03},
335         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382b, 0x01},
336         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3830, 0x08},
337         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3836, 0x02},
338         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3837, 0x18},
339         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3841, 0xff},
340         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3846, 0x48},
341         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3d85, 0x16},
342         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3d8c, 0x73},
343         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3d8d, 0xde},
344         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3f08, 0x10},
345         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3f0a, 0x00},
346         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4000, 0xf1},
347         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4001, 0x10},
348         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4005, 0x10},
349         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4002, 0x27},
350         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4009, 0x81},
351         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x400b, 0x0c},
352         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4011, 0x20},
353         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x401b, 0x00},
354         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x401d, 0x00},
355         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4020, 0x00},
356         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4021, 0x04},
357         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4022, 0x06},
358         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4023, 0x00},
359         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4024, 0x0f},
360         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4025, 0x2a},
361         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4026, 0x0f},
362         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4027, 0x2b},
363         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4028, 0x00},
364         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4029, 0x02},
365         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402a, 0x04},
366         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402b, 0x04},
367         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402c, 0x00},
368         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402d, 0x02},
369         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402e, 0x04},
370         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402f, 0x04},
371         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x401f, 0x00},
372         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4034, 0x3f},
373         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x403d, 0x04},
374         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4300, 0xff},
375         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4301, 0x00},
376         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4302, 0x0f},
377         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4316, 0x00},
378         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4500, 0x58},
379         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4503, 0x18},
380         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4600, 0x00},
381         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4601, 0xcb},
382         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x481f, 0x32},
383         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4821, 0x5f},
384         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4837, 0x21},
385         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4850, 0x10},
386         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4851, 0x32},
387         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4b00, 0x2a},
388         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4b0d, 0x00},
389         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d00, 0x04},
390         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d01, 0x18},
391         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d02, 0xc3},
392         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d03, 0xff},
393         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d04, 0xff},
394         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d05, 0xff},
395         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5000, 0xfe},
396         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5001, 0x01},
397         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5002, 0x08},
398         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5003, 0x20},
399         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5046, 0x12},
400         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5780, 0x3e},
401         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5781, 0x0f},
402         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5782, 0x44},
403         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5783, 0x02},
404         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5784, 0x01},
405         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5785, 0x00},
406         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5786, 0x00},
407         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5787, 0x04},
408         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5788, 0x02},
409         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5789, 0x0f},
410         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x578a, 0xfd},
411         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x578b, 0xf5},
412         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x578c, 0xf5},
413         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x578d, 0x03},
414         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x578e, 0x08},
415         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x578f, 0x0c},
416         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5790, 0x08},
417         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5791, 0x04},
418         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5792, 0x00},
419         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5793, 0x52},
420         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5794, 0xa3},
421         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5871, 0x0d},
422         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5870, 0x18},
423         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x586e, 0x10},
424         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x586f, 0x08},
425         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x58f8, 0x3d},
426         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5901, 0x00},
427         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5b00, 0x02},
428         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5b01, 0x10},
429         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5b02, 0x03},
430         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5b03, 0xcf},
431         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5b05, 0x6c},
432         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5e00, 0x00},
433         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5e01, 0x41},
434         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382d, 0x7f},
435         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4825, 0x3a},
436         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4826, 0x40},
437         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4808, 0x25},
438         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3763, 0x18},
439         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3768, 0xcc},
440         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x470b, 0x28},
441         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4202, 0x00},
442         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x400d, 0x10},
443         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4040, 0x07},
444         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x403e, 0x08},
445         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4041, 0xc6},
446         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3007, 0x80},
447         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x400a, 0x01},
448         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4500, 0x58},
449         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3021, 0x23},
450         /* @@ SIZE_3264X2448_15FPS_MIPI_4LANE based on R2A_EN_AM22 version db */
451         /* ;;pll2_VCO= 721.5, SYSclk=144.3, Dac_clk =360.75 */
452         /* ;;pll1_VCO= 962, pll_MIPIclk=481Mbps */
453         /* mipi_Pclk =60.125, Sclk1=120.25 */
454         /* ;;fps=15, 10bit,4lane, Vblanking=7.251ms */
455         /* update on 2015/06/25.*/
456         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3808, 0x0c},
457         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3809, 0xc0},
458         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380a, 0x09},
459         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380b, 0x90},
460         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380c, 0x0d},
461         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380d, 0xa0},
462         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380e, 0x0a},
463         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380f, 0xbc},
464         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3814, 0x01},
465         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3821, 0x46},
466         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382a, 0x01},
467         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382d, 0xff},
468         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3830, 0x06},
469         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3836, 0x01},
470         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3f0a, 0x00},
471         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4001, 0x00},
472         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4022, 0x0c},
473         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4023, 0x60},
474         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4025, 0x36},
475         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4027, 0x37},
476         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402b, 0x08},
477         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402f, 0x08},
478         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4500, 0x58},
479         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4600, 0x01},
480         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4601, 0x97}
481 };
482
483 static const struct ov_camera_module_reg
484         ov8858_init_tab_1632_1224_30fps_R1A[] = {
485         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0103, 0x01},
486         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0100, 0x00},
487         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0100, 0x00},
488         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0100, 0x00},
489         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0100, 0x00},
490         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0302, 0x1e},
491         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0303, 0x00},
492         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0304, 0x03},
493         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030e, 0x00},
494         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030f, 0x09},
495         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0312, 0x01},
496         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x031e, 0x0c},
497         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3600, 0x00},
498         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3601, 0x00},
499         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3602, 0x00},
500         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3603, 0x00},
501         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3604, 0x22},
502         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3605, 0x30},
503         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3606, 0x00},
504         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3607, 0x20},
505         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3608, 0x11},
506         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3609, 0x28},
507         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360a, 0x00},
508         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360b, 0x06},
509         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360c, 0xdc},
510         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360d, 0x40},
511         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360e, 0x0c},
512         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360f, 0x20},
513         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3610, 0x07},
514         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3611, 0x20},
515         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3612, 0x88},
516         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3613, 0x80},
517         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3614, 0x58},
518         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3615, 0x00},
519         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3616, 0x4a},
520         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3617, 0xb0},
521         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3618, 0x56},
522         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3619, 0x70},
523         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361a, 0x99},
524         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361b, 0x00},
525         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361c, 0x07},
526         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361d, 0x00},
527         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361e, 0x00},
528         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361f, 0x00},
529         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3638, 0xff},
530         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3633, 0x0c},
531         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3634, 0x0c},
532         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3635, 0x0c},
533         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3636, 0x0c},
534         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3645, 0x13},
535         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3646, 0x83},
536         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x364a, 0x07},
537         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3015, 0x01},
538         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3018, 0x32},
539         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3020, 0x93},
540         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3022, 0x01},
541         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3031, 0x0a},
542         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3034, 0x00},
543         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3106, 0x01},
544         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3305, 0xf1},
545         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3308, 0x00},
546         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3309, 0x28},
547         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330a, 0x00},
548         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330b, 0x20},
549         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330c, 0x00},
550         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330d, 0x00},
551         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330e, 0x00},
552         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330f, 0x40},
553         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3307, 0x04},
554         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3500, 0x00},
555         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3501, 0x4d},
556         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3502, 0x40},
557         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3503, 0x00},
558         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3505, 0x80},
559         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3508, 0x04},
560         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3509, 0x00},
561         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x350c, 0x00},
562         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x350d, 0x80},
563         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3510, 0x00},
564         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3511, 0x02},
565         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3512, 0x00},
566         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3700, 0x18},
567         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3701, 0x0c},
568         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3702, 0x28},
569         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3703, 0x19},
570         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3704, 0x14},
571         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3705, 0x00},
572         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3706, 0x35},
573         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3707, 0x04},
574         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3708, 0x24},
575         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3709, 0x33},
576         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x370a, 0x00},
577         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x370b, 0xb5},
578         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x370c, 0x04},
579         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3718, 0x12},
580         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3719, 0x31},
581         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3712, 0x42},
582         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3714, 0x24},
583         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x371e, 0x19},
584         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x371f, 0x40},
585         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3720, 0x05},
586         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3721, 0x05},
587         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3724, 0x06},
588         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3725, 0x01},
589         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3726, 0x06},
590         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3728, 0x05},
591         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3729, 0x02},
592         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372a, 0x03},
593         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372b, 0x53},
594         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372c, 0xa3},
595         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372d, 0x53},
596         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372e, 0x06},
597         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372f, 0x10},
598         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3730, 0x01},
599         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3731, 0x06},
600         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3732, 0x14},
601         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3733, 0x10},
602         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3734, 0x40},
603         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3736, 0x20},
604         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x373a, 0x05},
605         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x373b, 0x06},
606         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x373c, 0x0a},
607         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x373e, 0x03},
608         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3755, 0x10},
609         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3758, 0x00},
610         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3759, 0x4c},
611         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375a, 0x06},
612         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375b, 0x13},
613         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375c, 0x20},
614         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375d, 0x02},
615         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375e, 0x00},
616         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375f, 0x14},
617         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3768, 0x22},
618         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3769, 0x44},
619         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x376a, 0x44},
620         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3761, 0x00},
621         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3762, 0x00},
622         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3763, 0x00},
623         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3766, 0xff},
624         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x376b, 0x00},
625         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3772, 0x23},
626         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3773, 0x02},
627         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3774, 0x16},
628         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3775, 0x12},
629         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3776, 0x04},
630         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3777, 0x00},
631         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3778, 0x1b},
632         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a0, 0x44},
633         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a1, 0x3d},
634         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a2, 0x3d},
635         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a3, 0x00},
636         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a4, 0x00},
637         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a5, 0x00},
638         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a6, 0x00},
639         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a7, 0x44},
640         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a8, 0x4c},
641         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a9, 0x4c},
642         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3760, 0x00},
643         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x376f, 0x01},
644         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37aa, 0x44},
645         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37ab, 0x2e},
646         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37ac, 0x2e},
647         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37ad, 0x33},
648         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37ae, 0x0d},
649         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37af, 0x0d},
650         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b0, 0x00},
651         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b1, 0x00},
652         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b2, 0x00},
653         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b3, 0x42},
654         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b4, 0x42},
655         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b5, 0x33},
656         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b6, 0x00},
657         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b7, 0x00},
658         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b8, 0x00},
659         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b9, 0xff},
660         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3800, 0x00},
661         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3801, 0x0c},
662         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3802, 0x00},
663         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3803, 0x0c},
664         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3804, 0x0c},
665         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3805, 0xd3},
666         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3806, 0x09},
667         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3807, 0xa3},
668         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3808, 0x06},
669         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3809, 0x60},
670         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380a, 0x04},
671         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380b, 0xc8},
672         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380c, 0x07},
673         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380d, 0x88},
674         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380e, 0x04},
675         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380f, 0xdc},
676         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3810, 0x00},
677         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3811, 0x04},
678         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3813, 0x02},
679         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3814, 0x03},
680         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3815, 0x01},
681         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3820, 0x00},
682         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3821, 0x67},
683         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382a, 0x03},
684         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382b, 0x01},
685         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3830, 0x08},
686         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3836, 0x02},
687         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3837, 0x18},
688         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3841, 0xff},
689         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3846, 0x48},
690         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3d85, 0x14},
691         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3f08, 0x08},
692         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3f0a, 0x80},
693         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4000, 0xf1},
694         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4001, 0x10},
695         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4005, 0x10},
696         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4002, 0x27},
697         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4009, 0x81},
698         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x400b, 0x0c},
699         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x401b, 0x00},
700         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x401d, 0x00},
701         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4020, 0x00},
702         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4021, 0x04},
703         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4022, 0x04},
704         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4023, 0xb9},
705         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4024, 0x05},
706         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4025, 0x2a},
707         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4026, 0x05},
708         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4027, 0x2b},
709         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4028, 0x00},
710         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4029, 0x02},
711         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402a, 0x04},
712         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402b, 0x04},
713         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402c, 0x02},
714         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402d, 0x02},
715         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402e, 0x08},
716         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402f, 0x02},
717         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x401f, 0x00},
718         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4034, 0x3f},
719         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x403d, 0x04},
720         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4300, 0xff},
721         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4301, 0x00},
722         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4302, 0x0f},
723         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4316, 0x00},
724         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4500, 0x38},
725         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4503, 0x18},
726         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4600, 0x00},
727         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4601, 0xcb},
728         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x481f, 0x32},
729         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4837, 0x16},
730         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4850, 0x10},
731         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4851, 0x32},
732         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4b00, 0x2a},
733         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4b0d, 0x00},
734         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d00, 0x04},
735         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d01, 0x18},
736         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d02, 0xc3},
737         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d03, 0xff},
738         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d04, 0xff},
739         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d05, 0xff},
740         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5000, 0x7e},
741         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5001, 0x01},
742         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5002, 0x08},
743         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5003, 0x20},
744         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5046, 0x12},
745         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5901, 0x00},
746         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5e00, 0x00},
747         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5e01, 0x41},
748         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382d, 0x7f},
749         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4825, 0x3a},
750         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4826, 0x40},
751         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4808, 0x25},
752         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030e, 0x00},
753         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030f, 0x09},
754         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0312, 0x01},
755         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3015, 0x01},
756         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3501, 0x4d},
757         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3502, 0x40},
758         /* {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3508, 0x04}, */
759         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3706, 0x35},
760         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x370a, 0x00},
761         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x370b, 0xb5},
762         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3778, 0x1b},
763         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3808, 0x06},
764         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3809, 0x60},
765         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380a, 0x04},
766         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380b, 0xc8},
767         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380c, 0x07},
768         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380d, 0x88},
769         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380e, 0x04},
770         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380f, 0xdc},
771         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3814, 0x03},
772         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3821, 0x67},
773         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382a, 0x03},
774         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3830, 0x08},
775         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3836, 0x02},
776         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3f0a, 0x80},
777         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4001, 0x10},
778         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4022, 0x04},
779         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4023, 0xb9},
780         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4024, 0x05},
781         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4025, 0x2a},
782         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4026, 0x05},
783         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4027, 0x2b},
784         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402b, 0x04},
785         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402e, 0x08},
786         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4500, 0x38},
787         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4600, 0x00},
788         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4601, 0xcb},
789         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382d, 0x7f}
790 };
791
792 static const struct ov_camera_module_reg
793         ov8858_init_tab_3264_2448_15fps_R1A[] =  {
794         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0103, 0x01},
795         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0100, 0x00},
796         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0100, 0x00},
797         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0100, 0x00},
798         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0100, 0x00},
799         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0302, 0x1e},
800         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0303, 0x00},
801         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0304, 0x03},
802         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030e, 0x00},
803         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030f, 0x09},
804         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0312, 0x01},
805         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x031e, 0x0c},
806         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3600, 0x00},
807         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3601, 0x00},
808         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3602, 0x00},
809         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3603, 0x00},
810         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3604, 0x22},
811         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3605, 0x30},
812         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3606, 0x00},
813         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3607, 0x20},
814         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3608, 0x11},
815         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3609, 0x28},
816         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360a, 0x00},
817         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360b, 0x06},
818         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360c, 0xdc},
819         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360d, 0x40},
820         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360e, 0x0c},
821         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x360f, 0x20},
822         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3610, 0x07},
823         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3611, 0x20},
824         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3612, 0x88},
825         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3613, 0x80},
826         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3614, 0x58},
827         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3615, 0x00},
828         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3616, 0x4a},
829         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3617, 0xb0},
830         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3618, 0x56},
831         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3619, 0x70},
832         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361a, 0x99},
833         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361b, 0x00},
834         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361c, 0x07},
835         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361d, 0x00},
836         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361e, 0x00},
837         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x361f, 0x00},
838         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3638, 0xff},
839         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3633, 0x0c},
840         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3634, 0x0c},
841         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3635, 0x0c},
842         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3636, 0x0c},
843         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3645, 0x13},
844         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3646, 0x83},
845         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x364a, 0x07},
846         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3015, 0x01},
847         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3018, 0x32},
848         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3020, 0x93},
849         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3022, 0x01},
850         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3031, 0x0a},
851         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3034, 0x00},
852         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3106, 0x01},
853         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3305, 0xf1},
854         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3308, 0x00},
855         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3309, 0x28},
856         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330a, 0x00},
857         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330b, 0x20},
858         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330c, 0x00},
859         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330d, 0x00},
860         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330e, 0x00},
861         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x330f, 0x40},
862         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3307, 0x04},
863         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3500, 0x00},
864         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3501, 0x4d},
865         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3502, 0x40},
866         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3503, 0x00},
867         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3505, 0x80},
868         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3508, 0x04},
869         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3509, 0x00},
870         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x350c, 0x00},
871         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x350d, 0x80},
872         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3510, 0x00},
873         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3511, 0x02},
874         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3512, 0x00},
875         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3700, 0x18},
876         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3701, 0x0c},
877         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3702, 0x28},
878         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3703, 0x19},
879         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3704, 0x14},
880         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3705, 0x00},
881         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3706, 0x35},
882         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3707, 0x04},
883         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3708, 0x24},
884         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3709, 0x33},
885         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x370a, 0x00},
886         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x370b, 0xb5},
887         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x370c, 0x04},
888         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3718, 0x12},
889         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3719, 0x31},
890         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3712, 0x42},
891         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3714, 0x24},
892         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x371e, 0x19},
893         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x371f, 0x40},
894         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3720, 0x05},
895         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3721, 0x05},
896         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3724, 0x06},
897         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3725, 0x01},
898         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3726, 0x06},
899         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3728, 0x05},
900         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3729, 0x02},
901         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372a, 0x03},
902         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372b, 0x53},
903         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372c, 0xa3},
904         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372d, 0x53},
905         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372e, 0x06},
906         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x372f, 0x10},
907         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3730, 0x01},
908         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3731, 0x06},
909         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3732, 0x14},
910         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3733, 0x10},
911         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3734, 0x40},
912         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3736, 0x20},
913         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x373a, 0x05},
914         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x373b, 0x06},
915         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x373c, 0x0a},
916         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x373e, 0x03},
917         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3755, 0x10},
918         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3758, 0x00},
919         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3759, 0x4c},
920         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375a, 0x06},
921         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375b, 0x13},
922         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375c, 0x20},
923         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375d, 0x02},
924         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375e, 0x00},
925         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x375f, 0x14},
926         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3768, 0x22},
927         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3769, 0x44},
928         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x376a, 0x44},
929         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3761, 0x00},
930         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3762, 0x00},
931         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3763, 0x00},
932         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3766, 0xff},
933         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x376b, 0x00},
934         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3772, 0x23},
935         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3773, 0x02},
936         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3774, 0x16},
937         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3775, 0x12},
938         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3776, 0x04},
939         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3777, 0x00},
940         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3778, 0x1b},
941         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a0, 0x44},
942         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a1, 0x3d},
943         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a2, 0x3d},
944         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a3, 0x00},
945         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a4, 0x00},
946         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a5, 0x00},
947         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a6, 0x00},
948         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a7, 0x44},
949         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a8, 0x4c},
950         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37a9, 0x4c},
951         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3760, 0x00},
952         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x376f, 0x01},
953         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37aa, 0x44},
954         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37ab, 0x2e},
955         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37ac, 0x2e},
956         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37ad, 0x33},
957         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37ae, 0x0d},
958         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37af, 0x0d},
959         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b0, 0x00},
960         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b1, 0x00},
961         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b2, 0x00},
962         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b3, 0x42},
963         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b4, 0x42},
964         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b5, 0x33},
965         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b6, 0x00},
966         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b7, 0x00},
967         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b8, 0x00},
968         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x37b9, 0xff},
969         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3800, 0x00},
970         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3801, 0x0c},
971         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3802, 0x00},
972         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3803, 0x0c},
973         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3804, 0x0c},
974         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3805, 0xd3},
975         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3806, 0x09},
976         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3807, 0xa3},
977         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3808, 0x06},
978         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3809, 0x60},
979         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380a, 0x04},
980         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380b, 0xc8},
981         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380c, 0x07},
982         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380d, 0x88},
983         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380e, 0x04},
984         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380f, 0xdc},
985         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3810, 0x00},
986         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3811, 0x04},
987         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3813, 0x02},
988         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3814, 0x03},
989         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3815, 0x01},
990         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3820, 0x00},
991         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3821, 0x67},
992         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382a, 0x03},
993         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382b, 0x01},
994         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3830, 0x08},
995         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3836, 0x02},
996         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3837, 0x18},
997         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3841, 0xff},
998         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3846, 0x48},
999         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3d85, 0x14},
1000         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3f08, 0x08},
1001         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3f0a, 0x80},
1002         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4000, 0xf1},
1003         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4001, 0x10},
1004         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4005, 0x10},
1005         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4002, 0x27},
1006         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4009, 0x81},
1007         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x400b, 0x0c},
1008         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x401b, 0x00},
1009         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x401d, 0x00},
1010         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4020, 0x00},
1011         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4021, 0x04},
1012         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4022, 0x04},
1013         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4023, 0xb9},
1014         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4024, 0x05},
1015         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4025, 0x2a},
1016         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4026, 0x05},
1017         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4027, 0x2b},
1018         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4028, 0x00},
1019         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4029, 0x02},
1020         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402a, 0x04},
1021         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402b, 0x04},
1022         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402c, 0x02},
1023         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402d, 0x02},
1024         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402e, 0x08},
1025         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402f, 0x02},
1026         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x401f, 0x00},
1027         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4034, 0x3f},
1028         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x403d, 0x04},
1029         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4300, 0xff},
1030         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4301, 0x00},
1031         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4302, 0x0f},
1032         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4316, 0x00},
1033         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4500, 0x38},
1034         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4503, 0x18},
1035         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4600, 0x00},
1036         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4601, 0xcb},
1037         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x481f, 0x32},
1038         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4837, 0x16},
1039         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4850, 0x10},
1040         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4851, 0x32},
1041         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4b00, 0x2a},
1042         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4b0d, 0x00},
1043         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d00, 0x04},
1044         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d01, 0x18},
1045         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d02, 0xc3},
1046         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d03, 0xff},
1047         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d04, 0xff},
1048         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4d05, 0xff},
1049         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5000, 0x7e},
1050         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5001, 0x01},
1051         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5002, 0x08},
1052         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5003, 0x20},
1053         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5046, 0x12},
1054         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5901, 0x00},
1055         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5e00, 0x00},
1056         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x5e01, 0x41},
1057         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382d, 0x7f},
1058         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4825, 0x3a},
1059         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4826, 0x40},
1060         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4808, 0x25},
1061         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030e, 0x02},
1062         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x030f, 0x04},
1063         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x0312, 0x03},
1064         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3015, 0x00},
1065         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3501, 0x9a},
1066         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3502, 0x20},
1067         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3706, 0x6a},
1068         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x370a, 0x01},
1069         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x370b, 0x6a},
1070         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3778, 0x32},
1071         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3808, 0x0c},
1072         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3809, 0xc0},
1073         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380a, 0x09},
1074         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380b, 0x90},
1075         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380c, 0x07},
1076         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380d, 0x94},
1077         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380e, 0x09},
1078         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x380f, 0xaa},
1079         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3814, 0x01},
1080         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3821, 0x46},
1081         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382a, 0x01},
1082         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3830, 0x06},
1083         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3836, 0x01},
1084         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x3f0a, 0x00},
1085         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4001, 0x00},
1086         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4022, 0x0b},
1087         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4023, 0xc3},
1088         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4024, 0x0c},
1089         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4025, 0x36},
1090         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4026, 0x0c},
1091         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4027, 0x37},
1092         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402b, 0x08},
1093         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x402e, 0x0c},
1094         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4500, 0x58},
1095         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4600, 0x01},
1096         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x4601, 0x97},
1097         {OV_CAMERA_MODULE_REG_TYPE_DATA, 0x382d, 0xff}
1098 };
1099
1100 /* ======================================================================== */
1101 static struct ov_camera_module_config ov8858_configs[] = {
1102 {
1103                 .name = "3264x2448_18fps",
1104                 .frm_fmt = {
1105                         .width = 3264,
1106                         .height = 2448,
1107                         .code = MEDIA_BUS_FMT_SBGGR10_1X10
1108                 },
1109                 .frm_intrvl = {
1110                         .interval = {
1111                                 .numerator = 1,
1112                                 .denominator = 18
1113                         }
1114                 },
1115                 .auto_exp_enabled = false,
1116                 .auto_gain_enabled = false,
1117                 .auto_wb_enabled = false,
1118                 .reg_table = (void *)ov8858_init_tab_3264_2448_18fps,
1119                 .reg_table_num_entries =
1120                         sizeof(ov8858_init_tab_3264_2448_18fps) /
1121                         sizeof(ov8858_init_tab_3264_2448_18fps[0]),
1122                 .reg_diff_table = NULL,
1123                 .reg_diff_table_num_entries = 0,
1124                 .v_blanking_time_us = 7251,
1125                 PLTFRM_CAM_ITF_MIPI_CFG(0, 4, 481, 24000000)
1126         }
1127 };
1128
1129 static struct ov_camera_module_config ov8858_configs_R1A[] = {
1130         {
1131                 .name = "1632x1224_30fps",
1132                 .frm_fmt = {
1133                         .width = 1632,
1134                         .height = 1224,
1135                         .code = MEDIA_BUS_FMT_SBGGR10_1X10
1136                 },
1137                 .frm_intrvl = {
1138                         .interval = {
1139                                 .numerator = 1,
1140                                 .denominator = 30
1141                         }
1142                 },
1143                 .auto_exp_enabled = false,
1144                 .auto_gain_enabled = false,
1145                 .auto_wb_enabled = false,
1146                 .reg_table = (void *)ov8858_init_tab_1632_1224_30fps_R1A,
1147                 .reg_table_num_entries =
1148                         sizeof(ov8858_init_tab_1632_1224_30fps_R1A) /
1149                         sizeof(ov8858_init_tab_1632_1224_30fps_R1A[0]),
1150                 .v_blanking_time_us = 6579,
1151                 PLTFRM_CAM_ITF_MIPI_CFG(0, 2, 720, 24000000)
1152         },
1153         {
1154                 .name = "3264x2448_15fps",
1155                 .frm_fmt = {
1156                         .width = 3264,
1157                         .height = 2448,
1158                         .code = MEDIA_BUS_FMT_SBGGR10_1X10
1159                 },
1160                 .frm_intrvl = {
1161                         .interval = {
1162                                 .numerator = 1,
1163                                 .denominator = 15
1164                         }
1165                 },
1166                 .auto_exp_enabled = false,
1167                 .auto_gain_enabled = false,
1168                 .auto_wb_enabled = false,
1169                 .reg_table = (void *)ov8858_init_tab_3264_2448_15fps_R1A,
1170                 .reg_table_num_entries =
1171                         sizeof(ov8858_init_tab_3264_2448_15fps_R1A) /
1172                         sizeof(ov8858_init_tab_3264_2448_15fps_R1A[0]),
1173                 .v_blanking_time_us = 6579,
1174                 PLTFRM_CAM_ITF_MIPI_CFG(0, 2, 720, 24000000)
1175         }
1176 };
1177
1178 /*--------------------------------------------------------------------------*/
1179
1180 static int ov8858_g_VTS(struct ov_camera_module *cam_mod, u32 *vts)
1181 {
1182         u32 msb, lsb;
1183         int ret;
1184
1185         ret = ov_camera_module_read_reg_table(
1186                 cam_mod,
1187                 ov8858_TIMING_VTS_HIGH_REG,
1188                 &msb);
1189         if (IS_ERR_VALUE(ret))
1190                 goto err;
1191
1192         ret = ov_camera_module_read_reg_table(
1193                 cam_mod,
1194                 ov8858_TIMING_VTS_LOW_REG,
1195                 &lsb);
1196         if (IS_ERR_VALUE(ret))
1197                 goto err;
1198
1199         *vts = (msb << 8) | lsb;
1200         cam_mod->vts_cur = *vts;
1201
1202         return 0;
1203 err:
1204         ov_camera_module_pr_err(cam_mod,
1205                         "failed with error (%d)\n", ret);
1206         return ret;
1207 }
1208
1209 /*--------------------------------------------------------------------------*/
1210
1211 static int ov8858_auto_adjust_fps(struct ov_camera_module *cam_mod,
1212         u32 exp_time)
1213 {
1214         int ret;
1215         u32 vts;
1216
1217         if ((cam_mod->exp_config.exp_time + ov8858_COARSE_INTG_TIME_MAX_MARGIN)
1218                 > cam_mod->vts_min)
1219                 vts = cam_mod->exp_config.exp_time +
1220                         ov8858_COARSE_INTG_TIME_MAX_MARGIN;
1221         else
1222                 vts = cam_mod->vts_min;
1223         ret = ov_camera_module_write_reg(cam_mod,
1224                 ov8858_TIMING_VTS_LOW_REG,
1225                 vts & 0xFF);
1226         ret |= ov_camera_module_write_reg(cam_mod,
1227                 ov8858_TIMING_VTS_HIGH_REG,
1228                 (vts >> 8) & 0xFF);
1229
1230         if (IS_ERR_VALUE(ret)) {
1231                 ov_camera_module_pr_err(cam_mod,
1232                         "failed with error (%d)\n", ret);
1233         } else {
1234                 ov_camera_module_pr_debug(cam_mod,
1235                         "updated vts = %d,vts_min=%d\n", vts, cam_mod->vts_min);
1236                 cam_mod->vts_cur = vts;
1237         }
1238
1239         return ret;
1240 }
1241
1242 /*--------------------------------------------------------------------------*/
1243 static int ov8858_write_aec(struct ov_camera_module *cam_mod)
1244 {
1245         int ret = 0;
1246
1247         ov_camera_module_pr_debug(cam_mod,
1248                                   "exp_time = %d, gain = %d, flash_mode = %d\n",
1249                                   cam_mod->exp_config.exp_time,
1250                                   cam_mod->exp_config.gain,
1251                                   cam_mod->exp_config.flash_mode);
1252
1253         /*
1254          * if the sensor is already streaming, write to shadow registers,
1255          * if the sensor is in SW standby, write to active registers,
1256          * if the sensor is off/registers are not writeable, do nothing
1257          */
1258         if ((cam_mod->state == OV_CAMERA_MODULE_SW_STANDBY) ||
1259                 (cam_mod->state == OV_CAMERA_MODULE_STREAMING)) {
1260                 u32 a_gain = cam_mod->exp_config.gain;
1261                 u32 exp_time;
1262
1263                 a_gain = a_gain > 0x7ff ? 0x7ff : a_gain;
1264                 a_gain = a_gain * cam_mod->exp_config.gain_percent / 100;
1265                 exp_time = cam_mod->exp_config.exp_time << 4;
1266                 if (cam_mod->state == OV_CAMERA_MODULE_STREAMING)
1267                         ret = ov_camera_module_write_reg(cam_mod,
1268                         ov8858_AEC_GROUP_UPDATE_ADDRESS,
1269                         ov8858_AEC_GROUP_UPDATE_START_DATA);
1270                 if (!IS_ERR_VALUE(ret) && cam_mod->auto_adjust_fps)
1271                         ret = ov8858_auto_adjust_fps(cam_mod,
1272                                                 cam_mod->exp_config.exp_time);
1273                 ret |= ov_camera_module_write_reg(cam_mod,
1274                         ov8858_AEC_PK_LONG_GAIN_HIGH_REG,
1275                         ov8858_FETCH_MSB_GAIN(a_gain));
1276                 ret |= ov_camera_module_write_reg(cam_mod,
1277                         ov8858_AEC_PK_LONG_GAIN_LOW_REG,
1278                         ov8858_FETCH_LSB_GAIN(a_gain));
1279                 ret = ov_camera_module_write_reg(cam_mod,
1280                         ov8858_AEC_PK_LONG_EXPO_3RD_REG,
1281                         ov8858_FETCH_3RD_BYTE_EXP(exp_time));
1282                 ret |= ov_camera_module_write_reg(cam_mod,
1283                         ov8858_AEC_PK_LONG_EXPO_2ND_REG,
1284                         ov8858_FETCH_2ND_BYTE_EXP(exp_time));
1285                 ret |= ov_camera_module_write_reg(cam_mod,
1286                         ov8858_AEC_PK_LONG_EXPO_1ST_REG,
1287                         ov8858_FETCH_1ST_BYTE_EXP(exp_time));
1288                 if (cam_mod->state == OV_CAMERA_MODULE_STREAMING) {
1289                         ret = ov_camera_module_write_reg(cam_mod,
1290                                 ov8858_AEC_GROUP_UPDATE_ADDRESS,
1291                                 ov8858_AEC_GROUP_UPDATE_END_DATA);
1292                         ret = ov_camera_module_write_reg(cam_mod,
1293                                 ov8858_AEC_GROUP_UPDATE_ADDRESS,
1294                                 ov8858_AEC_GROUP_UPDATE_END_LAUNCH);
1295                 }
1296         }
1297
1298         if (IS_ERR_VALUE(ret))
1299                 ov_camera_module_pr_err(cam_mod,
1300                         "failed with error (%d)\n", ret);
1301         return ret;
1302 }
1303
1304 /*--------------------------------------------------------------------------*/
1305
1306 static int ov8858_g_ctrl(struct ov_camera_module *cam_mod, u32 ctrl_id)
1307 {
1308         int ret = 0;
1309
1310         ov_camera_module_pr_debug(cam_mod, "\n");
1311
1312         switch (ctrl_id) {
1313         case V4L2_CID_GAIN:
1314         case V4L2_CID_EXPOSURE:
1315         case V4L2_CID_FLASH_LED_MODE:
1316                 /* nothing to be done here */
1317                 break;
1318         default:
1319                 ret = -EINVAL;
1320                 break;
1321         }
1322
1323         if (IS_ERR_VALUE(ret))
1324                 ov_camera_module_pr_debug(cam_mod,
1325                         "failed with error (%d)\n", ret);
1326         return ret;
1327 }
1328
1329 /*--------------------------------------------------------------------------*/
1330 static int ov8858_filltimings(struct ov_camera_module_custom_config *custom)
1331 {
1332         int i, j;
1333         struct ov_camera_module_config *config;
1334         struct ov_camera_module_timings *timings;
1335         struct ov_camera_module_reg *reg_table;
1336         int reg_table_num_entries;
1337
1338         for (i = 0; i < custom->num_configs; i++) {
1339                 config = &custom->configs[i];
1340                 reg_table = config->reg_table;
1341                 reg_table_num_entries = config->reg_table_num_entries;
1342                 timings = &config->timings;
1343
1344                 memset(timings, 0x00, sizeof(*timings));
1345                 for (j = 0; j < reg_table_num_entries; j++) {
1346                         switch (reg_table[j].reg) {
1347                         case ov8858_TIMING_VTS_HIGH_REG:
1348                                 timings->frame_length_lines =
1349                                         ((reg_table[j].val << 8) |
1350                                         (timings->frame_length_lines & 0xff));
1351                                 break;
1352                         case ov8858_TIMING_VTS_LOW_REG:
1353                                 timings->frame_length_lines =
1354                                         (reg_table[j].val |
1355                                         (timings->frame_length_lines & 0xff00));
1356                                 break;
1357                         case ov8858_TIMING_HTS_HIGH_REG:
1358                                 timings->line_length_pck =
1359                                         ((reg_table[j].val << 8) |
1360                                         timings->line_length_pck);
1361                                 break;
1362                         case ov8858_TIMING_HTS_LOW_REG:
1363                                 timings->line_length_pck =
1364                                         (reg_table[j].val |
1365                                         (timings->line_length_pck & 0xff00));
1366                                 break;
1367                         case ov8858_TIMING_X_INC:
1368                                 timings->binning_factor_x =
1369                                 ((reg_table[j].val >> 4) + 1) / 2;
1370                                 if (timings->binning_factor_x == 0)
1371                                         timings->binning_factor_x = 1;
1372                                 break;
1373                         case ov8858_TIMING_Y_INC:
1374                                 timings->binning_factor_y =
1375                                 ((reg_table[j].val >> 4) + 1) / 2;
1376                                 if (timings->binning_factor_y == 0)
1377                                         timings->binning_factor_y = 1;
1378                                 break;
1379                         case ov8858_HORIZONTAL_START_HIGH_REG:
1380                                 timings->crop_horizontal_start =
1381                                         ((reg_table[j].val << 8) |
1382                                         (timings->crop_horizontal_start &
1383                                         0xff));
1384                                 break;
1385                         case ov8858_HORIZONTAL_START_LOW_REG:
1386                                 timings->crop_horizontal_start =
1387                                         (reg_table[j].val |
1388                                         (timings->crop_horizontal_start &
1389                                         0xff00));
1390                                 break;
1391                         case ov8858_VERTICAL_START_HIGH_REG:
1392                                 timings->crop_vertical_start =
1393                                         ((reg_table[j].val << 8) |
1394                                         (timings->crop_vertical_start & 0xff));
1395                                 break;
1396                         case ov8858_VERTICAL_START_LOW_REG:
1397                                 timings->crop_vertical_start =
1398                                         ((reg_table[j].val) |
1399                                         (timings->crop_vertical_start &
1400                                         0xff00));
1401                                 break;
1402                         case ov8858_HORIZONTAL_END_HIGH_REG:
1403                                 timings->crop_horizontal_end =
1404                                         ((reg_table[j].val << 8) |
1405                                         (timings->crop_horizontal_end & 0xff));
1406                                 break;
1407                         case ov8858_HORIZONTAL_END_LOW_REG:
1408                                 timings->crop_horizontal_end =
1409                                         (reg_table[j].val |
1410                                         (timings->crop_horizontal_end &
1411                                         0xff00));
1412                                 break;
1413                         case ov8858_VERTICAL_END_HIGH_REG:
1414                                 timings->crop_vertical_end =
1415                                         ((reg_table[j].val << 8) |
1416                                         (timings->crop_vertical_end & 0xff));
1417                                 break;
1418                         case ov8858_VERTICAL_END_LOW_REG:
1419                                 timings->crop_vertical_end =
1420                                         (reg_table[j].val |
1421                                         (timings->crop_vertical_end & 0xff00));
1422                                 break;
1423                         case ov8858_HORIZONTAL_OUTPUT_SIZE_HIGH_REG:
1424                                 timings->sensor_output_width =
1425                                         ((reg_table[j].val << 8) |
1426                                         (timings->sensor_output_width & 0xff));
1427                                 break;
1428                         case ov8858_HORIZONTAL_OUTPUT_SIZE_LOW_REG:
1429                                 timings->sensor_output_width =
1430                                         (reg_table[j].val |
1431                                         (timings->sensor_output_width &
1432                                         0xff00));
1433                                 break;
1434                         case ov8858_VERTICAL_OUTPUT_SIZE_HIGH_REG:
1435                                 timings->sensor_output_height =
1436                                         ((reg_table[j].val << 8) |
1437                                         (timings->sensor_output_height & 0xff));
1438                                 break;
1439                         case ov8858_VERTICAL_OUTPUT_SIZE_LOW_REG:
1440                                 timings->sensor_output_height =
1441                                         (reg_table[j].val |
1442                                         (timings->sensor_output_height &
1443                                         0xff00));
1444                                 break;
1445                         case ov8858_AEC_PK_LONG_EXPO_1ST_REG:
1446                                 timings->exp_time =
1447                                         ((reg_table[j].val) |
1448                                         (timings->exp_time & 0xffff00));
1449                                 break;
1450                         case ov8858_AEC_PK_LONG_EXPO_2ND_REG:
1451                                 timings->exp_time =
1452                                         ((reg_table[j].val << 8) |
1453                                         (timings->exp_time & 0x00ff00));
1454                                 break;
1455                         case ov8858_AEC_PK_LONG_EXPO_3RD_REG:
1456                                 timings->exp_time =
1457                                         (((reg_table[j].val & 0x0f) << 16) |
1458                                         (timings->exp_time & 0xff0000));
1459                                 break;
1460                         case ov8858_AEC_PK_LONG_GAIN_LOW_REG:
1461                                 timings->gain =
1462                                         (reg_table[j].val |
1463                                         (timings->gain & 0x0700));
1464                                 break;
1465                         case ov8858_AEC_PK_LONG_GAIN_HIGH_REG:
1466                                 timings->gain =
1467                                         (((reg_table[j].val & 0x07) << 8) |
1468                                         (timings->gain & 0xff));
1469                                 break;
1470                         }
1471                 }
1472
1473                 timings->exp_time >>= 4;
1474                 timings->vt_pix_clk_freq_hz =
1475                         config->frm_intrvl.interval.denominator
1476                         * timings->frame_length_lines
1477                         * timings->line_length_pck;
1478
1479                 timings->coarse_integration_time_min =
1480                         ov8858_COARSE_INTG_TIME_MIN;
1481                 timings->coarse_integration_time_max_margin =
1482                         ov8858_COARSE_INTG_TIME_MAX_MARGIN;
1483
1484                 /* OV Sensor do not use fine integration time. */
1485                 timings->fine_integration_time_min =
1486                         ov8858_FINE_INTG_TIME_MIN;
1487                 timings->fine_integration_time_max_margin =
1488                         ov8858_FINE_INTG_TIME_MAX_MARGIN;
1489         }
1490
1491         return 0;
1492 }
1493
1494 static int ov8858_g_timings(struct ov_camera_module *cam_mod,
1495         struct ov_camera_module_timings *timings)
1496 {
1497         int ret = 0;
1498         unsigned int vts;
1499
1500         if (IS_ERR_OR_NULL(cam_mod->active_config))
1501                 goto err;
1502
1503         *timings = cam_mod->active_config->timings;
1504
1505         vts = (!cam_mod->vts_cur) ?
1506                 timings->frame_length_lines :
1507                 cam_mod->vts_cur;
1508         if (cam_mod->frm_intrvl_valid)
1509                 timings->vt_pix_clk_freq_hz =
1510                         cam_mod->frm_intrvl.interval.denominator *
1511                         vts * timings->line_length_pck;
1512         else
1513                 timings->vt_pix_clk_freq_hz =
1514                 cam_mod->active_config->frm_intrvl.interval.denominator *
1515                 vts * timings->line_length_pck;
1516
1517         return ret;
1518 err:
1519         ov_camera_module_pr_err(cam_mod,
1520                         "failed with error (%d)\n", ret);
1521         return ret;
1522 }
1523
1524 /*--------------------------------------------------------------------------*/
1525
1526 static int ov8858_s_ctrl(struct ov_camera_module *cam_mod, u32 ctrl_id)
1527 {
1528         int ret = 0;
1529
1530         ov_camera_module_pr_debug(cam_mod, "\n");
1531
1532         switch (ctrl_id) {
1533         case V4L2_CID_GAIN:
1534         case V4L2_CID_EXPOSURE:
1535                 ret = ov8858_write_aec(cam_mod);
1536                 break;
1537         case V4L2_CID_FLASH_LED_MODE:
1538                 /* nothing to be done here */
1539                 break;
1540         default:
1541                 ret = -EINVAL;
1542                 break;
1543         }
1544
1545         if (IS_ERR_VALUE(ret))
1546                 ov_camera_module_pr_debug(cam_mod,
1547                         "failed with error (%d) 0x%x\n", ret, ctrl_id);
1548         return ret;
1549 }
1550
1551 /*--------------------------------------------------------------------------*/
1552
1553 static int ov8858_s_ext_ctrls(struct ov_camera_module *cam_mod,
1554                                  struct ov_camera_module_ext_ctrls *ctrls)
1555 {
1556         int ret = 0;
1557
1558         /* Handles only exposure and gain together special case. */
1559         if (ctrls->count == 1)
1560                 ret = ov8858_s_ctrl(cam_mod, ctrls->ctrls[0].id);
1561         else if ((ctrls->count == 3) &&
1562                  ((ctrls->ctrls[0].id == V4L2_CID_GAIN &&
1563                    ctrls->ctrls[1].id == V4L2_CID_EXPOSURE) ||
1564                   (ctrls->ctrls[1].id == V4L2_CID_GAIN &&
1565                    ctrls->ctrls[0].id == V4L2_CID_EXPOSURE)))
1566                 ret = ov8858_write_aec(cam_mod);
1567         else
1568                 ret = -EINVAL;
1569
1570         if (IS_ERR_VALUE(ret))
1571                 ov_camera_module_pr_debug(cam_mod,
1572                         "failed with error (%d)\n", ret);
1573         return ret;
1574 }
1575
1576 /*--------------------------------------------------------------------------*/
1577 int update_awb_gain(struct ov_camera_module *cam_mod)
1578 {
1579         int R_gain = otp_ptr->R_gain;
1580         int G_gain = otp_ptr->G_gain;
1581         int B_gain = otp_ptr->B_gain;
1582         int ret = 0;
1583
1584         if (R_gain > 0x400) {
1585                 ret |= ov_camera_module_write_reg(cam_mod, 0x5032,
1586                                                         R_gain >> 8);
1587                 ret |= ov_camera_module_write_reg(cam_mod, 0x5033,
1588                                                         R_gain & 0x00ff);
1589         }
1590         if (G_gain > 0x400) {
1591                 ret |= ov_camera_module_write_reg(cam_mod, 0x5034,
1592                                                         G_gain >> 8);
1593                 ret |= ov_camera_module_write_reg(cam_mod, 0x5035,
1594                                                         G_gain & 0x00ff);
1595         }
1596         if (B_gain > 0x400) {
1597                 ret |= ov_camera_module_write_reg(cam_mod, 0x5036,
1598                                                         B_gain >> 8);
1599                 ret |= ov_camera_module_write_reg(cam_mod, 0x5037,
1600                                                         B_gain & 0x00ff);
1601         }
1602
1603         if (IS_ERR_VALUE(ret))
1604                 ov_camera_module_pr_err(cam_mod, "otp awb gain apply failed\n");
1605         else
1606                 ov_camera_module_pr_debug(cam_mod,
1607                                         "ov8858_update:%s, rgain:%x ggain %x bgain %x\n",
1608                                         __func__, R_gain, G_gain, B_gain);
1609
1610         return ret;
1611 }
1612
1613 int update_lenc(struct ov_camera_module *cam_mod)
1614 {
1615         int i, temp = 0, ret = 0;
1616
1617         ret |= ov_camera_module_read_reg(cam_mod, 1, 0x5000, &temp);
1618         temp = 0x80 | temp;
1619         ret |= ov_camera_module_write_reg(cam_mod, 0x5000, temp);
1620
1621         if (IS_ERR_VALUE(ret)) {
1622                 ov_camera_module_pr_err(cam_mod,
1623                                         "otp lenc apply failed at beginning\n");
1624                 return ret;
1625         }
1626
1627         for (i = 0; i < 240; i++) {
1628                 ret |= ov_camera_module_write_reg(cam_mod, (0x5800 + i),
1629                                                 otp_ptr->lenc[i]);
1630                 if (IS_ERR_VALUE(ret)) {
1631                         ov_camera_module_pr_err(cam_mod,
1632                                                 "otp lenc apply failed during procesing\n");
1633                         break;
1634                 }
1635         }
1636
1637         return ret;
1638 }
1639
1640 static int ov8858_start_streaming(struct ov_camera_module *cam_mod)
1641 {
1642         int ret = 0;
1643
1644         ov_camera_module_pr_debug(cam_mod,
1645                 "active config=%s\n", cam_mod->active_config->name);
1646
1647         if (otp_ptr && otp_ptr->otp_en == 1 &&
1648         cam_mod->update_config &&
1649         cam_mod->active_config->soft_reset) {
1650                 ov_camera_module_pr_debug(cam_mod,
1651                                         "apply otp data for R2A module...\n");
1652                 update_awb_gain(cam_mod);
1653                 update_lenc(cam_mod);
1654         }
1655         ret = ov8858_g_VTS(cam_mod, &cam_mod->vts_min);
1656         if (IS_ERR_VALUE(ret))
1657                 goto err;
1658
1659         if (IS_ERR_VALUE(ov_camera_module_write_reg(cam_mod, 0x0100, 1)))
1660                 goto err;
1661
1662         msleep(25);
1663
1664         return 0;
1665 err:
1666         ov_camera_module_pr_err(cam_mod, "failed with error (%d)\n",
1667                 ret);
1668         return ret;
1669 }
1670
1671 /*--------------------------------------------------------------------------*/
1672
1673 static int ov8858_stop_streaming(struct ov_camera_module *cam_mod)
1674 {
1675         int ret = 0;
1676
1677         ov_camera_module_pr_debug(cam_mod, "\n");
1678
1679         ret = ov_camera_module_write_reg(cam_mod, 0x0100, 0);
1680         if (IS_ERR_VALUE(ret))
1681                 goto err;
1682
1683         msleep(25);
1684
1685         return 0;
1686 err:
1687         ov_camera_module_pr_err(cam_mod, "failed with error (%d)\n", ret);
1688         return ret;
1689 }
1690
1691 /*--------------------------------------------------------------------------*/
1692 /*
1693  * call this function after ov8858 initialization
1694  * return value: 0 update success
1695  * 1, no OTP
1696  */
1697 int  __ov8858_read_otp_wb(struct ov_camera_module *cam_mod)
1698 {
1699         int otp_flag = 0;
1700         int addr = 0;
1701         int ret = 0;
1702         int temp1 = 0, temp2 = 0;
1703
1704         ret = ov_camera_module_read_reg(cam_mod, 1, 0x7010, &otp_flag);
1705         if (IS_ERR_VALUE(ret)) {
1706                 ov_camera_module_pr_err(cam_mod,
1707                         "otp wb flag read failed\n");
1708                 return ret;
1709         }
1710         ov_camera_module_pr_debug(cam_mod, "otp wb flag is %0x\n", otp_flag);
1711
1712         if ((otp_flag & 0xc0) == 0x40)
1713                 addr = 0x7011; /* set addr to group 1 base */
1714         else if ((otp_flag & 0x30) == 0x10)
1715                 addr = 0x7019; /* set addr to group 2 base */
1716
1717         if (addr != 0) {
1718                 ov_camera_module_pr_debug(cam_mod,
1719                                         "otp wb addr is %0x\n", addr);
1720                 otp_ptr->flag = 0xc0;
1721                 ret |= ov_camera_module_read_reg(cam_mod, 1, addr,
1722                                         &otp_ptr->module_integrator_id);
1723                 ret |= ov_camera_module_read_reg(cam_mod, 1, (addr + 1),
1724                                         &otp_ptr->lens_id);
1725                 ret |= ov_camera_module_read_reg(cam_mod, 1, (addr + 2),
1726                                         &otp_ptr->production_year);
1727                 ret |= ov_camera_module_read_reg(cam_mod, 1, (addr + 3),
1728                                         &otp_ptr->production_month);
1729                 ret |= ov_camera_module_read_reg(cam_mod, 1, (addr + 4),
1730                                         &otp_ptr->production_day);
1731                 ret |= ov_camera_module_read_reg(cam_mod, 1,
1732                                         (addr + 5), &temp1);
1733                 ret |= ov_camera_module_read_reg(cam_mod, 1,
1734                                         (addr + 7), &temp2);
1735                 otp_ptr->rg_ratio = (temp1 << 2) + (temp2 >> 6 & 0x03);
1736                 ret |= ov_camera_module_read_reg(cam_mod, 1,
1737                                         (addr + 6), &temp1);
1738                 otp_ptr->bg_ratio = (temp1 << 2) + (temp2 >> 4 & 0x03);
1739
1740                 if (IS_ERR_VALUE(ret)) {
1741                         ov_camera_module_pr_err(cam_mod,
1742                                 "otp wb data read failed\n");
1743                         return 1;
1744                 }
1745
1746         } else {
1747                 ov_camera_module_pr_debug(cam_mod,
1748                         "no valid module info and awb data in otp\n");
1749                 otp_ptr->flag = 0;
1750                 otp_ptr->module_integrator_id = 0;
1751                 otp_ptr->lens_id = 0;
1752                 otp_ptr->production_year = 0;
1753                 otp_ptr->production_month = 0;
1754                 otp_ptr->production_day = 0;
1755                 otp_ptr->rg_ratio = 0;
1756                 otp_ptr->bg_ratio = 0;
1757                 return 1;
1758         }
1759
1760         otp_ptr->R_gain = (RG_RATIO_TYPICAL * 1000) / otp_ptr->rg_ratio;
1761         otp_ptr->B_gain = (BG_RATIO_TYPICAL * 1000) / otp_ptr->bg_ratio;
1762         otp_ptr->G_gain = 1000;
1763
1764         if (otp_ptr->R_gain < 1000 || otp_ptr->B_gain < 1000) {
1765                 if (otp_ptr->R_gain < otp_ptr->B_gain)
1766                         temp1 = otp_ptr->R_gain;
1767                 else
1768                         temp1 = otp_ptr->B_gain;
1769         } else {
1770                 temp1 = otp_ptr->G_gain;
1771         }
1772
1773         otp_ptr->R_gain = 0x400 * otp_ptr->R_gain / temp1;
1774         otp_ptr->B_gain = 0x400 * otp_ptr->B_gain / temp1;
1775         otp_ptr->G_gain = 0x400 * otp_ptr->G_gain / temp1;
1776
1777         return ret;
1778 }
1779
1780 int  __ov8858_read_otp_vcm(struct ov_camera_module *cam_mod)
1781 {
1782         int otp_flag = 0;
1783         int addr = 0;
1784         int ret = 0;
1785         int temp1 = 0, temp2 = 0;
1786
1787         ret = ov_camera_module_read_reg(cam_mod, 1, 0x7021, &otp_flag);
1788         if (IS_ERR_VALUE(ret)) {
1789                 ov_camera_module_pr_err(cam_mod,
1790                         "otp vcm flag read failed\n");
1791                 return ret;
1792         }
1793         ov_camera_module_pr_debug(cam_mod, "otp vcm flag is %0x\n", otp_flag);
1794
1795         if ((otp_flag & 0xc0) == 0x40)
1796                 addr = 0x7022; /* set addr to group 1 base */
1797         else if ((otp_flag & 0x30) == 0x10)
1798                 addr = 0x7025; /* set addr to group 2 base */
1799
1800         if (addr != 0) {
1801                 ov_camera_module_pr_debug(cam_mod,
1802                                         "otp vcm addr is %0x\n", addr);
1803                 otp_ptr->flag |= 0x20;
1804                 ret |= ov_camera_module_read_reg(cam_mod, 1, addr, &temp1);
1805                 ret |= ov_camera_module_read_reg(cam_mod, 1,
1806                                         (addr + 2), &temp2);
1807                 otp_ptr->VCM_start = (temp1 << 2) | (temp1 >> 6 & 0x03);
1808                 ret |= ov_camera_module_read_reg(cam_mod, 1,
1809                                         (addr + 1), &temp1);
1810                 otp_ptr->VCM_end = (temp1 << 2) + (temp2 >> 4 & 0x03);
1811                 otp_ptr->VCM_dir = (temp2 >> 2 & 0x03);
1812
1813                 if (IS_ERR_VALUE(ret))
1814                         ov_camera_module_pr_err(cam_mod,
1815                                                 "otp vcm read fail!\n");
1816         } else {
1817                 ov_camera_module_pr_debug(cam_mod,
1818                                         "no valid vcm data in otp\n");
1819                 otp_ptr->VCM_end = 0;
1820                 otp_ptr->VCM_end = 0;
1821                 otp_ptr->VCM_dir = 0;
1822                 return 1;
1823         }
1824
1825         return ret;
1826 }
1827
1828 int  __ov8858_read_otp_lenc(struct ov_camera_module *cam_mod)
1829 {
1830         int otp_flag = 0;
1831         int addr = 0;
1832         int ret = 0, i = 0;
1833         int checksum = 0;
1834
1835         ret = ov_camera_module_read_reg(cam_mod, 1, 0x7028, &otp_flag);
1836         if (IS_ERR_VALUE(ret)) {
1837                 ov_camera_module_pr_err(cam_mod,
1838                         "otp lenc flag read failed\n");
1839                 return ret;
1840         }
1841
1842         ov_camera_module_pr_debug(cam_mod,
1843                                 "otp lenc flag is 0x%0x\n", otp_flag);
1844
1845         if ((otp_flag & 0xc0) == 0x40)
1846                 addr = 0x7029; /* set addr to group 1 base */
1847         else if ((otp_flag & 0x30) == 0x10)
1848                 addr = 0x711a; /* set addr to group 2 base */
1849
1850         if (addr != 0) {
1851                 for (i = 0; i < 240; i++) {
1852                         ret |= ov_camera_module_read_reg(cam_mod, 1, (addr + i),
1853                                                         &otp_ptr->lenc[i]);
1854                         if (IS_ERR_VALUE(ret)) {
1855                                 ov_camera_module_pr_err(cam_mod,
1856                                         "otp lenc data read failed\n");
1857                                         return ret;
1858                         }
1859                         checksum += otp_ptr->lenc[i];
1860                 }
1861
1862                 checksum = (checksum) % 255 + 1;
1863                 ret |= ov_camera_module_read_reg(cam_mod, 1, (addr + 240),
1864                                                 &otp_ptr->checksum);
1865                 if (IS_ERR_VALUE(ret)) {
1866                         ov_camera_module_pr_err(cam_mod,
1867                                 "otp lenc checksum read failed\n");
1868                                 return ret;
1869                 }
1870
1871                 if (otp_ptr->checksum == checksum) {
1872                         otp_ptr->flag |= 0x10;
1873                 } else {
1874                         ov_camera_module_pr_err(cam_mod,
1875                                 "otp lenc checksum no match!\n");
1876                         return 1;
1877                 }
1878         } else {
1879                 for (i = 0; i < 240; i++) {
1880                         ov_camera_module_pr_debug(cam_mod,
1881                                 "no valid lenc data in otp\n");
1882                         otp_ptr->lenc[i] = 0;
1883                 }
1884                 return 1;
1885         }
1886
1887         return ret;
1888 }
1889
1890 static int ov8858_otp_read(struct ov_camera_module *cam_mod)
1891 {
1892         int ret = 0;
1893         int temp = 0;
1894         int reg = 0;
1895         int otp_ret = 0;
1896         struct i2c_client *client = v4l2_get_subdevdata(&cam_mod->sd);
1897
1898         ov_camera_module_pr_debug(cam_mod, "\n");
1899
1900         if (otp_ptr) {
1901                 ov_camera_module_pr_debug(cam_mod, "OTP data loaded already\n");
1902                 return 0;
1903         }
1904
1905         otp_ptr = kzalloc(sizeof(*otp_ptr), GFP_KERNEL);
1906         if (!otp_ptr) {
1907                 ov_camera_module_pr_err(cam_mod, "otp alloc fail!\n");
1908                 return -ENOMEM;
1909         }
1910
1911         ov_camera_module_write_reg(cam_mod, 0x0100, 1);
1912
1913         /* set 0x5002[3] to "0" before ops */
1914         ret = ov_camera_module_read_reg(cam_mod, 1, 0x5002, &temp);
1915         if (IS_ERR_VALUE(ret)) {
1916                 ov_camera_module_pr_err(cam_mod,
1917                         "otp read failed at phase1\n");
1918                 return ret;
1919         }
1920
1921         ov_camera_module_pr_debug(cam_mod, "otp read phase1 pass\n");
1922
1923         ret |= ov_camera_module_write_reg(cam_mod, 0x5002,
1924                         ((temp & (~0x08))));
1925
1926         ret |= ov_camera_module_write_reg(cam_mod, 0x3d84, 0xc0);
1927         /* otp start addr */
1928         ret |= ov_camera_module_write_reg(cam_mod, 0x3d88, 0x70);
1929         ret |= ov_camera_module_write_reg(cam_mod, 0x3d89, 0x10);
1930         /* otp end addr */
1931         ret |= ov_camera_module_write_reg(cam_mod, 0x3d8A, 0x72);
1932         ret |= ov_camera_module_write_reg(cam_mod, 0x3d8B, 0x0a);
1933         /* load otp into buffer */
1934         ret |= ov_camera_module_write_reg(cam_mod, 0x3d81, 0x01);
1935         if (IS_ERR_VALUE(ret)) {
1936                 ov_camera_module_pr_err(cam_mod,
1937                         "otp read failed at phase2\n");
1938                 return ret;
1939         }
1940
1941         ov_camera_module_pr_debug(cam_mod, "otp read phase2 pass\n");
1942
1943         usleep_range(10000, 15000);
1944
1945         /* otp wb read */
1946         otp_ret = __ov8858_read_otp_wb(cam_mod);
1947
1948         if (otp_ret)
1949                 ov_camera_module_pr_err(cam_mod, "fail to read OTP wb!\n");
1950         else
1951                 ov_camera_module_pr_debug(cam_mod, "read otp wb success\n");
1952
1953         /* otp vcm read */
1954         otp_ret = __ov8858_read_otp_vcm(cam_mod);
1955
1956         if (otp_ret)
1957                 ov_camera_module_pr_err(cam_mod, "fail to read OTP vcm!\n");
1958         else
1959                 ov_camera_module_pr_debug(cam_mod, "read otp vcm success\n");
1960
1961         /* otp lenc read */
1962         otp_ret = __ov8858_read_otp_lenc(cam_mod);
1963
1964         if (otp_ret) {
1965                 ov_camera_module_pr_err(cam_mod, "fail to read OTP lenc!\n");
1966                 goto readotperr;
1967         } else {
1968                 ov_camera_module_pr_debug(cam_mod, "read otp lenc success\n");
1969         }
1970         /* clear data afer read */
1971         for (reg = 0x7010; reg <= 0x720a; reg++) {
1972                 ret |= ov_camera_module_write_reg(cam_mod, reg, 0);
1973                 if (IS_ERR_VALUE(ret)) {
1974                         ov_camera_module_pr_err(cam_mod,
1975                                 "otp clear data failed at phase3\n");
1976                         return ret;
1977                 }
1978         }
1979
1980 readotperr:
1981         /* set 0x5002[3] to "1" after ops */
1982         ret = ov_camera_module_read_reg(cam_mod, 1, 0x5002, &temp);
1983         if (IS_ERR_VALUE(ret)) {
1984                 ov_camera_module_pr_err(cam_mod,
1985                         "otp exit failed at phase 4\n");
1986                 return ret;
1987         }
1988
1989         ov_camera_module_pr_debug(cam_mod, "0x5002 is 0x%0x\n", temp);
1990
1991         ret |= ov_camera_module_write_reg(cam_mod, 0x5002,
1992                                         (0x08 | (temp & (~0x08))));
1993         ov_camera_module_write_reg(cam_mod, 0x0100, 0);
1994         if (otp_ret) {
1995                 otp_ptr->otp_en = 0;
1996                 ov_camera_module_pr_err(
1997                 cam_mod,
1998                 "get otp data failed\n");
1999         } else {
2000                 otp_ptr->otp_en = 1;
2001                 dev_info(&client->dev, "get otp data success\n");
2002         }
2003         return ret;
2004 }
2005
2006 /*--------------------------------------------------------------------------*/
2007
2008 static int ov8858_check_camera_id(struct ov_camera_module *cam_mod)
2009 {
2010         u32 pidh, pidl, vid = 0;
2011         int ret = 0;
2012         struct i2c_client *client;
2013
2014         ov_camera_module_pr_debug(cam_mod, "\n");
2015
2016         ret |= ov_camera_module_read_reg(cam_mod, 1, ov8858_PIDH_ADDR, &pidh);
2017         ret |= ov_camera_module_read_reg(cam_mod, 1, ov8858_PIDL_ADDR, &pidl);
2018         if (IS_ERR_VALUE(ret)) {
2019                 ov_camera_module_pr_err(cam_mod,
2020                         "register read failed, camera module powered off?\n");
2021                 goto err;
2022         }
2023
2024         if ((pidh == ov8858_PIDH_MAGIC) && (pidl == ov8858_PIDL_MAGIC))
2025                 ov_camera_module_pr_debug(cam_mod,
2026                         "successfully detected camera ID 0x%02x%02x\n",
2027                         pidh, pidl);
2028         else {
2029                 ov_camera_module_pr_err(cam_mod,
2030                         "wrong camera ID, expected 0x%02x%02x, detected 0x%02x%02x\n",
2031                         ov8858_PIDH_MAGIC, ov8858_PIDL_MAGIC, pidh, pidl);
2032                 ret = -EINVAL;
2033                 goto err;
2034         }
2035
2036         ret |= ov_camera_module_read_reg(cam_mod, 1, 0x302a, &vid);
2037         if (IS_ERR_VALUE(ret)) {
2038                 ov_camera_module_pr_err(cam_mod,
2039                         "register read failed, camera module powered off?\n");
2040                 goto err;
2041         } else
2042                 ov_camera_module_pr_debug(cam_mod,
2043                         "ov8858 chip version is 0x%2x\n", vid);
2044
2045         client = v4l2_get_subdevdata(&cam_mod->sd);
2046         if ((vid == 0xb1) || (vid == 0xb0)) {
2047                 ov8858_custom_config.configs = ov8858_configs_R1A;
2048                 ov8858_custom_config.num_configs =
2049                         sizeof(ov8858_configs_R1A)
2050                         / sizeof(ov8858_configs_R1A[0]);
2051                 dev_info(&client->dev, "init setting for r1a\n");
2052         } else {
2053                 dev_info(&client->dev, "init setting for r2a\n");
2054         }
2055
2056         ov8858_filltimings(&ov8858_custom_config);
2057         cam_mod->custom = ov8858_custom_config;
2058
2059         ov_camera_module_pr_debug(cam_mod,
2060                 "ov8858 chip version is 0x%2x,module config no. is %d\n",
2061                 vid,
2062                 cam_mod->custom.num_configs);
2063         return 0;
2064 err:
2065         ov_camera_module_pr_err(cam_mod, "failed with error (%d)\n", ret);
2066         return ret;
2067 }
2068
2069 static int ov8858_g_exposure_valid_frame(struct ov_camera_module *cam_mod)
2070 {
2071         return ov8858_EXP_VALID_FRAMES;
2072 }
2073
2074 /* ======================================================================== */
2075 /* This part is platform dependent */
2076 /* ======================================================================== */
2077
2078 static struct v4l2_subdev_core_ops ov8858_camera_module_core_ops = {
2079         .g_ctrl = ov_camera_module_g_ctrl,
2080         .s_ctrl = ov_camera_module_s_ctrl,
2081         .s_ext_ctrls = ov_camera_module_s_ext_ctrls,
2082         .s_power = ov_camera_module_s_power,
2083         .ioctl = ov_camera_module_ioctl
2084 };
2085
2086 static struct v4l2_subdev_video_ops ov8858_camera_module_video_ops = {
2087         .s_frame_interval = ov_camera_module_s_frame_interval,
2088         .s_stream = ov_camera_module_s_stream
2089 };
2090
2091 static struct v4l2_subdev_pad_ops ov8858_camera_module_pad_ops = {
2092         .enum_frame_interval = ov_camera_module_enum_frameintervals,
2093         .get_fmt = ov_camera_module_g_fmt,
2094         .set_fmt = ov_camera_module_s_fmt,
2095 };
2096
2097 static struct v4l2_subdev_ops ov8858_camera_module_ops = {
2098         .core = &ov8858_camera_module_core_ops,
2099         .video = &ov8858_camera_module_video_ops,
2100         .pad = &ov8858_camera_module_pad_ops
2101 };
2102
2103 static struct ov_camera_module_custom_config ov8858_custom_config = {
2104         .start_streaming = ov8858_start_streaming,
2105         .stop_streaming = ov8858_stop_streaming,
2106         .s_ctrl = ov8858_s_ctrl,
2107         .s_ext_ctrls = ov8858_s_ext_ctrls,
2108         .g_ctrl = ov8858_g_ctrl,
2109         .g_timings = ov8858_g_timings,
2110         .check_camera_id = ov8858_check_camera_id,
2111         .g_exposure_valid_frame = ov8858_g_exposure_valid_frame,
2112         .read_otp = ov8858_otp_read,
2113         .configs = ov8858_configs,
2114         .num_configs = ARRAY_SIZE(ov8858_configs),
2115         .power_up_delays_ms = {5, 20, 0}
2116 };
2117
2118 static int ov8858_probe(
2119         struct i2c_client *client,
2120         const struct i2c_device_id *id)
2121 {
2122         dev_info(&client->dev, "probing...\n");
2123         ov8858_filltimings(&ov8858_custom_config);
2124         v4l2_i2c_subdev_init(&ov8858.sd, client, &ov8858_camera_module_ops);
2125         ov8858.custom = ov8858_custom_config;
2126
2127         dev_info(&client->dev, "probing successful\n");
2128
2129         return 0;
2130 }
2131
2132 static int ov8858_remove(struct i2c_client *client)
2133 {
2134         struct ov_camera_module *cam_mod = i2c_get_clientdata(client);
2135
2136         dev_info(&client->dev, "removing device...\n");
2137
2138         if (!client->adapter)
2139                 return -ENODEV; /* our client isn't attached */
2140
2141         ov_camera_module_release(cam_mod);
2142
2143         kfree(otp_ptr);
2144         dev_info(&client->dev, "removed\n");
2145         return 0;
2146 }
2147
2148 static const struct i2c_device_id ov8858_id[] = {
2149         { ov8858_DRIVER_NAME, 0 },
2150         { }
2151 };
2152
2153 static const struct of_device_id ov8858_of_match[] = {
2154         {.compatible = "omnivision,ov8858-v4l2-i2c-subdev"},
2155         {},
2156 };
2157
2158 MODULE_DEVICE_TABLE(i2c, ov8858_id);
2159
2160 static struct i2c_driver ov8858_i2c_driver = {
2161         .driver = {
2162                 .name = ov8858_DRIVER_NAME,
2163                 .owner = THIS_MODULE,
2164                 .of_match_table = ov8858_of_match
2165         },
2166         .probe = ov8858_probe,
2167         .remove = ov8858_remove,
2168         .id_table = ov8858_id,
2169 };
2170
2171 module_i2c_driver(ov8858_i2c_driver);
2172
2173 MODULE_DESCRIPTION("SoC Camera driver for ov8858");
2174 MODULE_AUTHOR("George");
2175 MODULE_LICENSE("GPL");