]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/staging/media/atomisp/i2c/ov5693/ov5693.h
Merge tag 'for-linus-20170825' of git://git.infradead.org/linux-mtd
[mirror_ubuntu-artful-kernel.git] / drivers / staging / media / atomisp / i2c / ov5693 / ov5693.h
1 /*
2 * Support for OmniVision OV5693 5M camera sensor.
3 *
4 * Copyright (c) 2013 Intel Corporation. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 *
20 */
21
22 #ifndef __OV5693_H__
23 #define __OV5693_H__
24 #include <linux/kernel.h>
25 #include <linux/types.h>
26 #include <linux/i2c.h>
27 #include <linux/delay.h>
28 #include <linux/videodev2.h>
29 #include <linux/spinlock.h>
30 #include <media/v4l2-subdev.h>
31 #include <media/v4l2-device.h>
32 #include <media/v4l2-ctrls.h>
33 #include <linux/v4l2-mediabus.h>
34 #include <media/media-entity.h>
35
36 #include "../../include/linux/atomisp_platform.h"
37
38 #define OV5693_NAME "ov5693"
39
40 #define OV5693_POWER_UP_RETRY_NUM 5
41
42 /* Defines for register writes and register array processing */
43 #define I2C_MSG_LENGTH 0x2
44 #define I2C_RETRY_COUNT 5
45
46 #define OV5693_FOCAL_LENGTH_NUM 334 /*3.34mm*/
47 #define OV5693_FOCAL_LENGTH_DEM 100
48 #define OV5693_F_NUMBER_DEFAULT_NUM 24
49 #define OV5693_F_NUMBER_DEM 10
50
51 #define MAX_FMTS 1
52
53 /* sensor_mode_data read_mode adaptation */
54 #define OV5693_READ_MODE_BINNING_ON 0x0400
55 #define OV5693_READ_MODE_BINNING_OFF 0x00
56 #define OV5693_INTEGRATION_TIME_MARGIN 8
57
58 #define OV5693_MAX_EXPOSURE_VALUE 0xFFF1
59 #define OV5693_MAX_GAIN_VALUE 0xFF
60
61 /*
62 * focal length bits definition:
63 * bits 31-16: numerator, bits 15-0: denominator
64 */
65 #define OV5693_FOCAL_LENGTH_DEFAULT 0x1B70064
66
67 /*
68 * current f-number bits definition:
69 * bits 31-16: numerator, bits 15-0: denominator
70 */
71 #define OV5693_F_NUMBER_DEFAULT 0x18000a
72
73 /*
74 * f-number range bits definition:
75 * bits 31-24: max f-number numerator
76 * bits 23-16: max f-number denominator
77 * bits 15-8: min f-number numerator
78 * bits 7-0: min f-number denominator
79 */
80 #define OV5693_F_NUMBER_RANGE 0x180a180a
81 #define OV5693_ID 0x5690
82
83 #define OV5693_FINE_INTG_TIME_MIN 0
84 #define OV5693_FINE_INTG_TIME_MAX_MARGIN 0
85 #define OV5693_COARSE_INTG_TIME_MIN 1
86 #define OV5693_COARSE_INTG_TIME_MAX_MARGIN 6
87
88 #define OV5693_BIN_FACTOR_MAX 4
89 /*
90 * OV5693 System control registers
91 */
92 #define OV5693_SW_SLEEP 0x0100
93 #define OV5693_SW_RESET 0x0103
94 #define OV5693_SW_STREAM 0x0100
95
96 #define OV5693_SC_CMMN_CHIP_ID_H 0x300A
97 #define OV5693_SC_CMMN_CHIP_ID_L 0x300B
98 #define OV5693_SC_CMMN_SCCB_ID 0x300C
99 #define OV5693_SC_CMMN_SUB_ID 0x302A /* process, version*/
100 /*Bit[7:4] Group control, Bit[3:0] Group ID*/
101 #define OV5693_GROUP_ACCESS 0x3208
102 /*
103 *Bit[3:0] Bit[19:16] of exposure,
104 *remaining 16 bits lies in Reg0x3501&Reg0x3502
105 */
106 #define OV5693_EXPOSURE_H 0x3500
107 #define OV5693_EXPOSURE_M 0x3501
108 #define OV5693_EXPOSURE_L 0x3502
109 /*Bit[1:0] means Bit[9:8] of gain*/
110 #define OV5693_AGC_H 0x350A
111 #define OV5693_AGC_L 0x350B /*Bit[7:0] of gain*/
112
113 #define OV5693_HORIZONTAL_START_H 0x3800 /*Bit[11:8]*/
114 #define OV5693_HORIZONTAL_START_L 0x3801 /*Bit[7:0]*/
115 #define OV5693_VERTICAL_START_H 0x3802 /*Bit[11:8]*/
116 #define OV5693_VERTICAL_START_L 0x3803 /*Bit[7:0]*/
117 #define OV5693_HORIZONTAL_END_H 0x3804 /*Bit[11:8]*/
118 #define OV5693_HORIZONTAL_END_L 0x3805 /*Bit[7:0]*/
119 #define OV5693_VERTICAL_END_H 0x3806 /*Bit[11:8]*/
120 #define OV5693_VERTICAL_END_L 0x3807 /*Bit[7:0]*/
121 #define OV5693_HORIZONTAL_OUTPUT_SIZE_H 0x3808 /*Bit[3:0]*/
122 #define OV5693_HORIZONTAL_OUTPUT_SIZE_L 0x3809 /*Bit[7:0]*/
123 #define OV5693_VERTICAL_OUTPUT_SIZE_H 0x380a /*Bit[3:0]*/
124 #define OV5693_VERTICAL_OUTPUT_SIZE_L 0x380b /*Bit[7:0]*/
125 /*High 8-bit, and low 8-bit HTS address is 0x380d*/
126 #define OV5693_TIMING_HTS_H 0x380C
127 /*High 8-bit, and low 8-bit HTS address is 0x380d*/
128 #define OV5693_TIMING_HTS_L 0x380D
129 /*High 8-bit, and low 8-bit HTS address is 0x380f*/
130 #define OV5693_TIMING_VTS_H 0x380e
131 /*High 8-bit, and low 8-bit HTS address is 0x380f*/
132 #define OV5693_TIMING_VTS_L 0x380f
133
134 #define OV5693_MWB_RED_GAIN_H 0x3400
135 #define OV5693_MWB_GREEN_GAIN_H 0x3402
136 #define OV5693_MWB_BLUE_GAIN_H 0x3404
137 #define OV5693_MWB_GAIN_MAX 0x0fff
138
139 #define OV5693_START_STREAMING 0x01
140 #define OV5693_STOP_STREAMING 0x00
141
142 #define VCM_ADDR 0x0c
143 #define VCM_CODE_MSB 0x04
144
145 #define OV5693_INVALID_CONFIG 0xffffffff
146
147 #define OV5693_VCM_SLEW_STEP 0x30F0
148 #define OV5693_VCM_SLEW_STEP_MAX 0x7
149 #define OV5693_VCM_SLEW_STEP_MASK 0x7
150 #define OV5693_VCM_CODE 0x30F2
151 #define OV5693_VCM_SLEW_TIME 0x30F4
152 #define OV5693_VCM_SLEW_TIME_MAX 0xffff
153 #define OV5693_VCM_ENABLE 0x8000
154
155 #define OV5693_VCM_MAX_FOCUS_NEG -1023
156 #define OV5693_VCM_MAX_FOCUS_POS 1023
157
158 #define DLC_ENABLE 1
159 #define DLC_DISABLE 0
160 #define VCM_PROTECTION_OFF 0xeca3
161 #define VCM_PROTECTION_ON 0xdc51
162 #define VCM_DEFAULT_S 0x0
163 #define vcm_step_s(a) (u8)(a & 0xf)
164 #define vcm_step_mclk(a) (u8)((a >> 4) & 0x3)
165 #define vcm_dlc_mclk(dlc, mclk) (u16)((dlc << 3) | mclk | 0xa104)
166 #define vcm_tsrc(tsrc) (u16)(tsrc << 3 | 0xf200)
167 #define vcm_val(data, s) (u16)(data << 4 | s)
168 #define DIRECT_VCM vcm_dlc_mclk(0, 0)
169
170 /* Defines for OTP Data Registers */
171 #define OV5693_FRAME_OFF_NUM 0x4202
172 #define OV5693_OTP_BYTE_MAX 32 //change to 32 as needed by otpdata
173 #define OV5693_OTP_SHORT_MAX 16
174 #define OV5693_OTP_START_ADDR 0x3D00
175 #define OV5693_OTP_END_ADDR 0x3D0F
176 #define OV5693_OTP_DATA_SIZE 320
177 #define OV5693_OTP_PROGRAM_REG 0x3D80
178 #define OV5693_OTP_READ_REG 0x3D81 // 1:Enable 0:disable
179 #define OV5693_OTP_BANK_REG 0x3D84 //otp bank and mode
180 #define OV5693_OTP_READY_REG_DONE 1
181 #define OV5693_OTP_BANK_MAX 28
182 #define OV5693_OTP_BANK_SIZE 16 //16 bytes per bank
183 #define OV5693_OTP_READ_ONETIME 16
184 #define OV5693_OTP_MODE_READ 1
185
186 struct regval_list {
187 u16 reg_num;
188 u8 value;
189 };
190
191 struct ov5693_resolution {
192 u8 *desc;
193 const struct ov5693_reg *regs;
194 int res;
195 int width;
196 int height;
197 int fps;
198 int pix_clk_freq;
199 u16 pixels_per_line;
200 u16 lines_per_frame;
201 u8 bin_factor_x;
202 u8 bin_factor_y;
203 u8 bin_mode;
204 bool used;
205 };
206
207 struct ov5693_format {
208 u8 *desc;
209 u32 pixelformat;
210 struct ov5693_reg *regs;
211 };
212
213 enum vcm_type {
214 VCM_UNKNOWN,
215 VCM_AD5823,
216 VCM_DW9714,
217 };
218
219 /*
220 * ov5693 device structure.
221 */
222 struct ov5693_device {
223 struct v4l2_subdev sd;
224 struct media_pad pad;
225 struct v4l2_mbus_framefmt format;
226 struct mutex input_lock;
227 struct v4l2_ctrl_handler ctrl_handler;
228
229 struct camera_sensor_platform_data *platform_data;
230 struct timespec timestamp_t_focus_abs;
231 int vt_pix_clk_freq_mhz;
232 int fmt_idx;
233 int run_mode;
234 int otp_size;
235 u8 *otp_data;
236 u32 focus;
237 s16 number_of_steps;
238 u8 res;
239 u8 type;
240 bool vcm_update;
241 enum vcm_type vcm;
242 };
243
244 enum ov5693_tok_type {
245 OV5693_8BIT = 0x0001,
246 OV5693_16BIT = 0x0002,
247 OV5693_32BIT = 0x0004,
248 OV5693_TOK_TERM = 0xf000, /* terminating token for reg list */
249 OV5693_TOK_DELAY = 0xfe00, /* delay token for reg list */
250 OV5693_TOK_MASK = 0xfff0
251 };
252
253 /**
254 * struct ov5693_reg - MI sensor register format
255 * @type: type of the register
256 * @reg: 16-bit offset to register
257 * @val: 8/16/32-bit register value
258 *
259 * Define a structure for sensor register initialization values
260 */
261 struct ov5693_reg {
262 enum ov5693_tok_type type;
263 u16 reg;
264 u32 val; /* @set value for read/mod/write, @mask */
265 };
266
267 #define to_ov5693_sensor(x) container_of(x, struct ov5693_device, sd)
268
269 #define OV5693_MAX_WRITE_BUF_SIZE 30
270
271 struct ov5693_write_buffer {
272 u16 addr;
273 u8 data[OV5693_MAX_WRITE_BUF_SIZE];
274 };
275
276 struct ov5693_write_ctrl {
277 int index;
278 struct ov5693_write_buffer buffer;
279 };
280
281 static const struct i2c_device_id ov5693_id[] = {
282 {OV5693_NAME, 0},
283 {}
284 };
285
286 static struct ov5693_reg const ov5693_global_setting[] = {
287 {OV5693_8BIT, 0x0103, 0x01},
288 {OV5693_8BIT, 0x3001, 0x0a},
289 {OV5693_8BIT, 0x3002, 0x80},
290 {OV5693_8BIT, 0x3006, 0x00},
291 {OV5693_8BIT, 0x3011, 0x21},
292 {OV5693_8BIT, 0x3012, 0x09},
293 {OV5693_8BIT, 0x3013, 0x10},
294 {OV5693_8BIT, 0x3014, 0x00},
295 {OV5693_8BIT, 0x3015, 0x08},
296 {OV5693_8BIT, 0x3016, 0xf0},
297 {OV5693_8BIT, 0x3017, 0xf0},
298 {OV5693_8BIT, 0x3018, 0xf0},
299 {OV5693_8BIT, 0x301b, 0xb4},
300 {OV5693_8BIT, 0x301d, 0x02},
301 {OV5693_8BIT, 0x3021, 0x00},
302 {OV5693_8BIT, 0x3022, 0x01},
303 {OV5693_8BIT, 0x3028, 0x44},
304 {OV5693_8BIT, 0x3098, 0x02},
305 {OV5693_8BIT, 0x3099, 0x19},
306 {OV5693_8BIT, 0x309a, 0x02},
307 {OV5693_8BIT, 0x309b, 0x01},
308 {OV5693_8BIT, 0x309c, 0x00},
309 {OV5693_8BIT, 0x30a0, 0xd2},
310 {OV5693_8BIT, 0x30a2, 0x01},
311 {OV5693_8BIT, 0x30b2, 0x00},
312 {OV5693_8BIT, 0x30b3, 0x7d},
313 {OV5693_8BIT, 0x30b4, 0x03},
314 {OV5693_8BIT, 0x30b5, 0x04},
315 {OV5693_8BIT, 0x30b6, 0x01},
316 {OV5693_8BIT, 0x3104, 0x21},
317 {OV5693_8BIT, 0x3106, 0x00},
318 {OV5693_8BIT, 0x3400, 0x04},
319 {OV5693_8BIT, 0x3401, 0x00},
320 {OV5693_8BIT, 0x3402, 0x04},
321 {OV5693_8BIT, 0x3403, 0x00},
322 {OV5693_8BIT, 0x3404, 0x04},
323 {OV5693_8BIT, 0x3405, 0x00},
324 {OV5693_8BIT, 0x3406, 0x01},
325 {OV5693_8BIT, 0x3500, 0x00},
326 {OV5693_8BIT, 0x3503, 0x07},
327 {OV5693_8BIT, 0x3504, 0x00},
328 {OV5693_8BIT, 0x3505, 0x00},
329 {OV5693_8BIT, 0x3506, 0x00},
330 {OV5693_8BIT, 0x3507, 0x02},
331 {OV5693_8BIT, 0x3508, 0x00},
332 {OV5693_8BIT, 0x3509, 0x10},
333 {OV5693_8BIT, 0x350a, 0x00},
334 {OV5693_8BIT, 0x350b, 0x40},
335 {OV5693_8BIT, 0x3601, 0x0a},
336 {OV5693_8BIT, 0x3602, 0x38},
337 {OV5693_8BIT, 0x3612, 0x80},
338 {OV5693_8BIT, 0x3620, 0x54},
339 {OV5693_8BIT, 0x3621, 0xc7},
340 {OV5693_8BIT, 0x3622, 0x0f},
341 {OV5693_8BIT, 0x3625, 0x10},
342 {OV5693_8BIT, 0x3630, 0x55},
343 {OV5693_8BIT, 0x3631, 0xf4},
344 {OV5693_8BIT, 0x3632, 0x00},
345 {OV5693_8BIT, 0x3633, 0x34},
346 {OV5693_8BIT, 0x3634, 0x02},
347 {OV5693_8BIT, 0x364d, 0x0d},
348 {OV5693_8BIT, 0x364f, 0xdd},
349 {OV5693_8BIT, 0x3660, 0x04},
350 {OV5693_8BIT, 0x3662, 0x10},
351 {OV5693_8BIT, 0x3663, 0xf1},
352 {OV5693_8BIT, 0x3665, 0x00},
353 {OV5693_8BIT, 0x3666, 0x20},
354 {OV5693_8BIT, 0x3667, 0x00},
355 {OV5693_8BIT, 0x366a, 0x80},
356 {OV5693_8BIT, 0x3680, 0xe0},
357 {OV5693_8BIT, 0x3681, 0x00},
358 {OV5693_8BIT, 0x3700, 0x42},
359 {OV5693_8BIT, 0x3701, 0x14},
360 {OV5693_8BIT, 0x3702, 0xa0},
361 {OV5693_8BIT, 0x3703, 0xd8},
362 {OV5693_8BIT, 0x3704, 0x78},
363 {OV5693_8BIT, 0x3705, 0x02},
364 {OV5693_8BIT, 0x370a, 0x00},
365 {OV5693_8BIT, 0x370b, 0x20},
366 {OV5693_8BIT, 0x370c, 0x0c},
367 {OV5693_8BIT, 0x370d, 0x11},
368 {OV5693_8BIT, 0x370e, 0x00},
369 {OV5693_8BIT, 0x370f, 0x40},
370 {OV5693_8BIT, 0x3710, 0x00},
371 {OV5693_8BIT, 0x371a, 0x1c},
372 {OV5693_8BIT, 0x371b, 0x05},
373 {OV5693_8BIT, 0x371c, 0x01},
374 {OV5693_8BIT, 0x371e, 0xa1},
375 {OV5693_8BIT, 0x371f, 0x0c},
376 {OV5693_8BIT, 0x3721, 0x00},
377 {OV5693_8BIT, 0x3724, 0x10},
378 {OV5693_8BIT, 0x3726, 0x00},
379 {OV5693_8BIT, 0x372a, 0x01},
380 {OV5693_8BIT, 0x3730, 0x10},
381 {OV5693_8BIT, 0x3738, 0x22},
382 {OV5693_8BIT, 0x3739, 0xe5},
383 {OV5693_8BIT, 0x373a, 0x50},
384 {OV5693_8BIT, 0x373b, 0x02},
385 {OV5693_8BIT, 0x373c, 0x41},
386 {OV5693_8BIT, 0x373f, 0x02},
387 {OV5693_8BIT, 0x3740, 0x42},
388 {OV5693_8BIT, 0x3741, 0x02},
389 {OV5693_8BIT, 0x3742, 0x18},
390 {OV5693_8BIT, 0x3743, 0x01},
391 {OV5693_8BIT, 0x3744, 0x02},
392 {OV5693_8BIT, 0x3747, 0x10},
393 {OV5693_8BIT, 0x374c, 0x04},
394 {OV5693_8BIT, 0x3751, 0xf0},
395 {OV5693_8BIT, 0x3752, 0x00},
396 {OV5693_8BIT, 0x3753, 0x00},
397 {OV5693_8BIT, 0x3754, 0xc0},
398 {OV5693_8BIT, 0x3755, 0x00},
399 {OV5693_8BIT, 0x3756, 0x1a},
400 {OV5693_8BIT, 0x3758, 0x00},
401 {OV5693_8BIT, 0x3759, 0x0f},
402 {OV5693_8BIT, 0x376b, 0x44},
403 {OV5693_8BIT, 0x375c, 0x04},
404 {OV5693_8BIT, 0x3774, 0x10},
405 {OV5693_8BIT, 0x3776, 0x00},
406 {OV5693_8BIT, 0x377f, 0x08},
407 {OV5693_8BIT, 0x3780, 0x22},
408 {OV5693_8BIT, 0x3781, 0x0c},
409 {OV5693_8BIT, 0x3784, 0x2c},
410 {OV5693_8BIT, 0x3785, 0x1e},
411 {OV5693_8BIT, 0x378f, 0xf5},
412 {OV5693_8BIT, 0x3791, 0xb0},
413 {OV5693_8BIT, 0x3795, 0x00},
414 {OV5693_8BIT, 0x3796, 0x64},
415 {OV5693_8BIT, 0x3797, 0x11},
416 {OV5693_8BIT, 0x3798, 0x30},
417 {OV5693_8BIT, 0x3799, 0x41},
418 {OV5693_8BIT, 0x379a, 0x07},
419 {OV5693_8BIT, 0x379b, 0xb0},
420 {OV5693_8BIT, 0x379c, 0x0c},
421 {OV5693_8BIT, 0x37c5, 0x00},
422 {OV5693_8BIT, 0x37c6, 0x00},
423 {OV5693_8BIT, 0x37c7, 0x00},
424 {OV5693_8BIT, 0x37c9, 0x00},
425 {OV5693_8BIT, 0x37ca, 0x00},
426 {OV5693_8BIT, 0x37cb, 0x00},
427 {OV5693_8BIT, 0x37de, 0x00},
428 {OV5693_8BIT, 0x37df, 0x00},
429 {OV5693_8BIT, 0x3800, 0x00},
430 {OV5693_8BIT, 0x3801, 0x00},
431 {OV5693_8BIT, 0x3802, 0x00},
432 {OV5693_8BIT, 0x3804, 0x0a},
433 {OV5693_8BIT, 0x3805, 0x3f},
434 {OV5693_8BIT, 0x3810, 0x00},
435 {OV5693_8BIT, 0x3812, 0x00},
436 {OV5693_8BIT, 0x3823, 0x00},
437 {OV5693_8BIT, 0x3824, 0x00},
438 {OV5693_8BIT, 0x3825, 0x00},
439 {OV5693_8BIT, 0x3826, 0x00},
440 {OV5693_8BIT, 0x3827, 0x00},
441 {OV5693_8BIT, 0x382a, 0x04},
442 {OV5693_8BIT, 0x3a04, 0x06},
443 {OV5693_8BIT, 0x3a05, 0x14},
444 {OV5693_8BIT, 0x3a06, 0x00},
445 {OV5693_8BIT, 0x3a07, 0xfe},
446 {OV5693_8BIT, 0x3b00, 0x00},
447 {OV5693_8BIT, 0x3b02, 0x00},
448 {OV5693_8BIT, 0x3b03, 0x00},
449 {OV5693_8BIT, 0x3b04, 0x00},
450 {OV5693_8BIT, 0x3b05, 0x00},
451 {OV5693_8BIT, 0x3e07, 0x20},
452 {OV5693_8BIT, 0x4000, 0x08},
453 {OV5693_8BIT, 0x4001, 0x04},
454 {OV5693_8BIT, 0x4002, 0x45},
455 {OV5693_8BIT, 0x4004, 0x08},
456 {OV5693_8BIT, 0x4005, 0x18},
457 {OV5693_8BIT, 0x4006, 0x20},
458 {OV5693_8BIT, 0x4008, 0x24},
459 {OV5693_8BIT, 0x4009, 0x10},
460 {OV5693_8BIT, 0x400c, 0x00},
461 {OV5693_8BIT, 0x400d, 0x00},
462 {OV5693_8BIT, 0x4058, 0x00},
463 {OV5693_8BIT, 0x404e, 0x37},
464 {OV5693_8BIT, 0x404f, 0x8f},
465 {OV5693_8BIT, 0x4058, 0x00},
466 {OV5693_8BIT, 0x4101, 0xb2},
467 {OV5693_8BIT, 0x4303, 0x00},
468 {OV5693_8BIT, 0x4304, 0x08},
469 {OV5693_8BIT, 0x4307, 0x31},
470 {OV5693_8BIT, 0x4311, 0x04},
471 {OV5693_8BIT, 0x4315, 0x01},
472 {OV5693_8BIT, 0x4511, 0x05},
473 {OV5693_8BIT, 0x4512, 0x01},
474 {OV5693_8BIT, 0x4806, 0x00},
475 {OV5693_8BIT, 0x4816, 0x52},
476 {OV5693_8BIT, 0x481f, 0x30},
477 {OV5693_8BIT, 0x4826, 0x2c},
478 {OV5693_8BIT, 0x4831, 0x64},
479 {OV5693_8BIT, 0x4d00, 0x04},
480 {OV5693_8BIT, 0x4d01, 0x71},
481 {OV5693_8BIT, 0x4d02, 0xfd},
482 {OV5693_8BIT, 0x4d03, 0xf5},
483 {OV5693_8BIT, 0x4d04, 0x0c},
484 {OV5693_8BIT, 0x4d05, 0xcc},
485 {OV5693_8BIT, 0x4837, 0x0a},
486 {OV5693_8BIT, 0x5000, 0x06},
487 {OV5693_8BIT, 0x5001, 0x01},
488 {OV5693_8BIT, 0x5003, 0x20},
489 {OV5693_8BIT, 0x5046, 0x0a},
490 {OV5693_8BIT, 0x5013, 0x00},
491 {OV5693_8BIT, 0x5046, 0x0a},
492 {OV5693_8BIT, 0x5780, 0x1c},
493 {OV5693_8BIT, 0x5786, 0x20},
494 {OV5693_8BIT, 0x5787, 0x10},
495 {OV5693_8BIT, 0x5788, 0x18},
496 {OV5693_8BIT, 0x578a, 0x04},
497 {OV5693_8BIT, 0x578b, 0x02},
498 {OV5693_8BIT, 0x578c, 0x02},
499 {OV5693_8BIT, 0x578e, 0x06},
500 {OV5693_8BIT, 0x578f, 0x02},
501 {OV5693_8BIT, 0x5790, 0x02},
502 {OV5693_8BIT, 0x5791, 0xff},
503 {OV5693_8BIT, 0x5842, 0x01},
504 {OV5693_8BIT, 0x5843, 0x2b},
505 {OV5693_8BIT, 0x5844, 0x01},
506 {OV5693_8BIT, 0x5845, 0x92},
507 {OV5693_8BIT, 0x5846, 0x01},
508 {OV5693_8BIT, 0x5847, 0x8f},
509 {OV5693_8BIT, 0x5848, 0x01},
510 {OV5693_8BIT, 0x5849, 0x0c},
511 {OV5693_8BIT, 0x5e00, 0x00},
512 {OV5693_8BIT, 0x5e10, 0x0c},
513 {OV5693_8BIT, 0x0100, 0x00},
514 {OV5693_TOK_TERM, 0, 0}
515 };
516
517 /*
518 * 654x496 30fps 17ms VBlanking 2lane 10Bit (Scaling)
519 */
520 static struct ov5693_reg const ov5693_654x496[] = {
521 {OV5693_8BIT, 0x3501, 0x3d},
522 {OV5693_8BIT, 0x3502, 0x00},
523 {OV5693_8BIT, 0x3708, 0xe6},
524 {OV5693_8BIT, 0x3709, 0xc7},
525 {OV5693_8BIT, 0x3803, 0x00},
526 {OV5693_8BIT, 0x3806, 0x07},
527 {OV5693_8BIT, 0x3807, 0xa3},
528 {OV5693_8BIT, 0x3808, 0x02},
529 {OV5693_8BIT, 0x3809, 0x90},
530 {OV5693_8BIT, 0x380a, 0x01},
531 {OV5693_8BIT, 0x380b, 0xf0},
532 {OV5693_8BIT, 0x380c, 0x0a},
533 {OV5693_8BIT, 0x380d, 0x80},
534 {OV5693_8BIT, 0x380e, 0x07},
535 {OV5693_8BIT, 0x380f, 0xc0},
536 {OV5693_8BIT, 0x3811, 0x08},
537 {OV5693_8BIT, 0x3813, 0x02},
538 {OV5693_8BIT, 0x3814, 0x31},
539 {OV5693_8BIT, 0x3815, 0x31},
540 {OV5693_8BIT, 0x3820, 0x04},
541 {OV5693_8BIT, 0x3821, 0x1f},
542 {OV5693_8BIT, 0x5002, 0x80},
543 {OV5693_8BIT, 0x0100, 0x01},
544 {OV5693_TOK_TERM, 0, 0}
545 };
546
547 /*
548 * 1296x976 30fps 17ms VBlanking 2lane 10Bit (Scaling)
549 *DS from 2592x1952
550 */
551 static struct ov5693_reg const ov5693_1296x976[] = {
552 {OV5693_8BIT, 0x3501, 0x7b},
553 {OV5693_8BIT, 0x3502, 0x00},
554 {OV5693_8BIT, 0x3708, 0xe2},
555 {OV5693_8BIT, 0x3709, 0xc3},
556
557 {OV5693_8BIT, 0x3800, 0x00},
558 {OV5693_8BIT, 0x3801, 0x00},
559 {OV5693_8BIT, 0x3802, 0x00},
560 {OV5693_8BIT, 0x3803, 0x00},
561
562 {OV5693_8BIT, 0x3804, 0x0a},
563 {OV5693_8BIT, 0x3805, 0x3f},
564 {OV5693_8BIT, 0x3806, 0x07},
565 {OV5693_8BIT, 0x3807, 0xA3},
566
567 {OV5693_8BIT, 0x3808, 0x05},
568 {OV5693_8BIT, 0x3809, 0x10},
569 {OV5693_8BIT, 0x380a, 0x03},
570 {OV5693_8BIT, 0x380b, 0xD0},
571
572 {OV5693_8BIT, 0x380c, 0x0a},
573 {OV5693_8BIT, 0x380d, 0x80},
574 {OV5693_8BIT, 0x380e, 0x07},
575 {OV5693_8BIT, 0x380f, 0xc0},
576
577 {OV5693_8BIT, 0x3810, 0x00},
578 {OV5693_8BIT, 0x3811, 0x10},
579 {OV5693_8BIT, 0x3812, 0x00},
580 {OV5693_8BIT, 0x3813, 0x02},
581
582 {OV5693_8BIT, 0x3814, 0x11}, /*X subsample control*/
583 {OV5693_8BIT, 0x3815, 0x11}, /*Y subsample control*/
584 {OV5693_8BIT, 0x3820, 0x00},
585 {OV5693_8BIT, 0x3821, 0x1e},
586 {OV5693_8BIT, 0x5002, 0x00},
587 {OV5693_8BIT, 0x5041, 0x84}, /* scale is auto enabled */
588 {OV5693_8BIT, 0x0100, 0x01},
589 {OV5693_TOK_TERM, 0, 0}
590
591 };
592
593
594 /*
595 * 336x256 30fps 17ms VBlanking 2lane 10Bit (Scaling)
596 DS from 2564x1956
597 */
598 static struct ov5693_reg const ov5693_336x256[] = {
599 {OV5693_8BIT, 0x3501, 0x3d},
600 {OV5693_8BIT, 0x3502, 0x00},
601 {OV5693_8BIT, 0x3708, 0xe6},
602 {OV5693_8BIT, 0x3709, 0xc7},
603 {OV5693_8BIT, 0x3806, 0x07},
604 {OV5693_8BIT, 0x3807, 0xa3},
605 {OV5693_8BIT, 0x3808, 0x01},
606 {OV5693_8BIT, 0x3809, 0x50},
607 {OV5693_8BIT, 0x380a, 0x01},
608 {OV5693_8BIT, 0x380b, 0x00},
609 {OV5693_8BIT, 0x380c, 0x0a},
610 {OV5693_8BIT, 0x380d, 0x80},
611 {OV5693_8BIT, 0x380e, 0x07},
612 {OV5693_8BIT, 0x380f, 0xc0},
613 {OV5693_8BIT, 0x3811, 0x1E},
614 {OV5693_8BIT, 0x3814, 0x31},
615 {OV5693_8BIT, 0x3815, 0x31},
616 {OV5693_8BIT, 0x3820, 0x04},
617 {OV5693_8BIT, 0x3821, 0x1f},
618 {OV5693_8BIT, 0x5002, 0x80},
619 {OV5693_8BIT, 0x0100, 0x01},
620 {OV5693_TOK_TERM, 0, 0}
621 };
622
623 /*
624 * 336x256 30fps 17ms VBlanking 2lane 10Bit (Scaling)
625 DS from 2368x1956
626 */
627 static struct ov5693_reg const ov5693_368x304[] = {
628 {OV5693_8BIT, 0x3501, 0x3d},
629 {OV5693_8BIT, 0x3502, 0x00},
630 {OV5693_8BIT, 0x3708, 0xe6},
631 {OV5693_8BIT, 0x3709, 0xc7},
632 {OV5693_8BIT, 0x3808, 0x01},
633 {OV5693_8BIT, 0x3809, 0x70},
634 {OV5693_8BIT, 0x380a, 0x01},
635 {OV5693_8BIT, 0x380b, 0x30},
636 {OV5693_8BIT, 0x380c, 0x0a},
637 {OV5693_8BIT, 0x380d, 0x80},
638 {OV5693_8BIT, 0x380e, 0x07},
639 {OV5693_8BIT, 0x380f, 0xc0},
640 {OV5693_8BIT, 0x3811, 0x80},
641 {OV5693_8BIT, 0x3814, 0x31},
642 {OV5693_8BIT, 0x3815, 0x31},
643 {OV5693_8BIT, 0x3820, 0x04},
644 {OV5693_8BIT, 0x3821, 0x1f},
645 {OV5693_8BIT, 0x5002, 0x80},
646 {OV5693_8BIT, 0x0100, 0x01},
647 {OV5693_TOK_TERM, 0, 0}
648 };
649
650 /*
651 * ov5693_192x160 30fps 17ms VBlanking 2lane 10Bit (Scaling)
652 DS from 2460x1956
653 */
654 static struct ov5693_reg const ov5693_192x160[] = {
655 {OV5693_8BIT, 0x3501, 0x7b},
656 {OV5693_8BIT, 0x3502, 0x80},
657 {OV5693_8BIT, 0x3708, 0xe2},
658 {OV5693_8BIT, 0x3709, 0xc3},
659 {OV5693_8BIT, 0x3804, 0x0a},
660 {OV5693_8BIT, 0x3805, 0x3f},
661 {OV5693_8BIT, 0x3806, 0x07},
662 {OV5693_8BIT, 0x3807, 0xA3},
663 {OV5693_8BIT, 0x3808, 0x00},
664 {OV5693_8BIT, 0x3809, 0xC0},
665 {OV5693_8BIT, 0x380a, 0x00},
666 {OV5693_8BIT, 0x380b, 0xA0},
667 {OV5693_8BIT, 0x380c, 0x0a},
668 {OV5693_8BIT, 0x380d, 0x80},
669 {OV5693_8BIT, 0x380e, 0x07},
670 {OV5693_8BIT, 0x380f, 0xc0},
671 {OV5693_8BIT, 0x3811, 0x40},
672 {OV5693_8BIT, 0x3813, 0x00},
673 {OV5693_8BIT, 0x3814, 0x31},
674 {OV5693_8BIT, 0x3815, 0x31},
675 {OV5693_8BIT, 0x3820, 0x04},
676 {OV5693_8BIT, 0x3821, 0x1f},
677 {OV5693_8BIT, 0x5002, 0x80},
678 {OV5693_8BIT, 0x0100, 0x01},
679 {OV5693_TOK_TERM, 0, 0}
680 };
681
682
683 static struct ov5693_reg const ov5693_736x496[] = {
684 {OV5693_8BIT, 0x3501, 0x3d},
685 {OV5693_8BIT, 0x3502, 0x00},
686 {OV5693_8BIT, 0x3708, 0xe6},
687 {OV5693_8BIT, 0x3709, 0xc7},
688 {OV5693_8BIT, 0x3803, 0x68},
689 {OV5693_8BIT, 0x3806, 0x07},
690 {OV5693_8BIT, 0x3807, 0x3b},
691 {OV5693_8BIT, 0x3808, 0x02},
692 {OV5693_8BIT, 0x3809, 0xe0},
693 {OV5693_8BIT, 0x380a, 0x01},
694 {OV5693_8BIT, 0x380b, 0xf0},
695 {OV5693_8BIT, 0x380c, 0x0a}, /*hts*/
696 {OV5693_8BIT, 0x380d, 0x80},
697 {OV5693_8BIT, 0x380e, 0x07}, /*vts*/
698 {OV5693_8BIT, 0x380f, 0xc0},
699 {OV5693_8BIT, 0x3811, 0x08},
700 {OV5693_8BIT, 0x3813, 0x02},
701 {OV5693_8BIT, 0x3814, 0x31},
702 {OV5693_8BIT, 0x3815, 0x31},
703 {OV5693_8BIT, 0x3820, 0x04},
704 {OV5693_8BIT, 0x3821, 0x1f},
705 {OV5693_8BIT, 0x5002, 0x80},
706 {OV5693_8BIT, 0x0100, 0x01},
707 {OV5693_TOK_TERM, 0, 0}
708 };
709
710 /*
711 static struct ov5693_reg const ov5693_736x496[] = {
712 {OV5693_8BIT, 0x3501, 0x7b},
713 {OV5693_8BIT, 0x3502, 0x00},
714 {OV5693_8BIT, 0x3708, 0xe6},
715 {OV5693_8BIT, 0x3709, 0xc3},
716 {OV5693_8BIT, 0x3803, 0x00},
717 {OV5693_8BIT, 0x3806, 0x07},
718 {OV5693_8BIT, 0x3807, 0xa3},
719 {OV5693_8BIT, 0x3808, 0x02},
720 {OV5693_8BIT, 0x3809, 0xe0},
721 {OV5693_8BIT, 0x380a, 0x01},
722 {OV5693_8BIT, 0x380b, 0xf0},
723 {OV5693_8BIT, 0x380c, 0x0d},
724 {OV5693_8BIT, 0x380d, 0xb0},
725 {OV5693_8BIT, 0x380e, 0x05},
726 {OV5693_8BIT, 0x380f, 0xf2},
727 {OV5693_8BIT, 0x3811, 0x08},
728 {OV5693_8BIT, 0x3813, 0x02},
729 {OV5693_8BIT, 0x3814, 0x31},
730 {OV5693_8BIT, 0x3815, 0x31},
731 {OV5693_8BIT, 0x3820, 0x01},
732 {OV5693_8BIT, 0x3821, 0x1f},
733 {OV5693_8BIT, 0x5002, 0x00},
734 {OV5693_8BIT, 0x0100, 0x01},
735 {OV5693_TOK_TERM, 0, 0}
736 };
737 */
738 /*
739 * 976x556 30fps 8.8ms VBlanking 2lane 10Bit (Scaling)
740 */
741 static struct ov5693_reg const ov5693_976x556[] = {
742 {OV5693_8BIT, 0x3501, 0x7b},
743 {OV5693_8BIT, 0x3502, 0x00},
744 {OV5693_8BIT, 0x3708, 0xe2},
745 {OV5693_8BIT, 0x3709, 0xc3},
746 {OV5693_8BIT, 0x3803, 0xf0},
747 {OV5693_8BIT, 0x3806, 0x06},
748 {OV5693_8BIT, 0x3807, 0xa7},
749 {OV5693_8BIT, 0x3808, 0x03},
750 {OV5693_8BIT, 0x3809, 0xd0},
751 {OV5693_8BIT, 0x380a, 0x02},
752 {OV5693_8BIT, 0x380b, 0x2C},
753 {OV5693_8BIT, 0x380c, 0x0a},
754 {OV5693_8BIT, 0x380d, 0x80},
755 {OV5693_8BIT, 0x380e, 0x07},
756 {OV5693_8BIT, 0x380f, 0xc0},
757 {OV5693_8BIT, 0x3811, 0x10},
758 {OV5693_8BIT, 0x3813, 0x02},
759 {OV5693_8BIT, 0x3814, 0x11},
760 {OV5693_8BIT, 0x3815, 0x11},
761 {OV5693_8BIT, 0x3820, 0x00},
762 {OV5693_8BIT, 0x3821, 0x1e},
763 {OV5693_8BIT, 0x5002, 0x80},
764 {OV5693_8BIT, 0x0100, 0x01},
765 {OV5693_TOK_TERM, 0, 0}
766 };
767
768 /*DS from 2624x1492*/
769 static struct ov5693_reg const ov5693_1296x736[] = {
770 {OV5693_8BIT, 0x3501, 0x7b},
771 {OV5693_8BIT, 0x3502, 0x00},
772 {OV5693_8BIT, 0x3708, 0xe2},
773 {OV5693_8BIT, 0x3709, 0xc3},
774
775 {OV5693_8BIT, 0x3800, 0x00},
776 {OV5693_8BIT, 0x3801, 0x00},
777 {OV5693_8BIT, 0x3802, 0x00},
778 {OV5693_8BIT, 0x3803, 0x00},
779
780 {OV5693_8BIT, 0x3804, 0x0a},
781 {OV5693_8BIT, 0x3805, 0x3f},
782 {OV5693_8BIT, 0x3806, 0x07},
783 {OV5693_8BIT, 0x3807, 0xA3},
784
785 {OV5693_8BIT, 0x3808, 0x05},
786 {OV5693_8BIT, 0x3809, 0x10},
787 {OV5693_8BIT, 0x380a, 0x02},
788 {OV5693_8BIT, 0x380b, 0xe0},
789
790 {OV5693_8BIT, 0x380c, 0x0a},
791 {OV5693_8BIT, 0x380d, 0x80},
792 {OV5693_8BIT, 0x380e, 0x07},
793 {OV5693_8BIT, 0x380f, 0xc0},
794
795 {OV5693_8BIT, 0x3813, 0xE8},
796
797 {OV5693_8BIT, 0x3814, 0x11}, /*X subsample control*/
798 {OV5693_8BIT, 0x3815, 0x11}, /*Y subsample control*/
799 {OV5693_8BIT, 0x3820, 0x00},
800 {OV5693_8BIT, 0x3821, 0x1e},
801 {OV5693_8BIT, 0x5002, 0x00},
802 {OV5693_8BIT, 0x5041, 0x84}, /* scale is auto enabled */
803 {OV5693_8BIT, 0x0100, 0x01},
804 {OV5693_TOK_TERM, 0, 0}
805 };
806
807 static struct ov5693_reg const ov5693_1636p_30fps[] = {
808 {OV5693_8BIT, 0x3501, 0x7b},
809 {OV5693_8BIT, 0x3502, 0x00},
810 {OV5693_8BIT, 0x3708, 0xe2},
811 {OV5693_8BIT, 0x3709, 0xc3},
812 {OV5693_8BIT, 0x3803, 0xf0},
813 {OV5693_8BIT, 0x3806, 0x06},
814 {OV5693_8BIT, 0x3807, 0xa7},
815 {OV5693_8BIT, 0x3808, 0x06},
816 {OV5693_8BIT, 0x3809, 0x64},
817 {OV5693_8BIT, 0x380a, 0x04},
818 {OV5693_8BIT, 0x380b, 0x48},
819 {OV5693_8BIT, 0x380c, 0x0a}, /*hts*/
820 {OV5693_8BIT, 0x380d, 0x80},
821 {OV5693_8BIT, 0x380e, 0x07}, /*vts*/
822 {OV5693_8BIT, 0x380f, 0xc0},
823 {OV5693_8BIT, 0x3811, 0x02},
824 {OV5693_8BIT, 0x3813, 0x02},
825 {OV5693_8BIT, 0x3814, 0x11},
826 {OV5693_8BIT, 0x3815, 0x11},
827 {OV5693_8BIT, 0x3820, 0x00},
828 {OV5693_8BIT, 0x3821, 0x1e},
829 {OV5693_8BIT, 0x5002, 0x80},
830 {OV5693_8BIT, 0x0100, 0x01},
831 {OV5693_TOK_TERM, 0, 0}
832 };
833
834 static struct ov5693_reg const ov5693_1616x1216_30fps[] = {
835 {OV5693_8BIT, 0x3501, 0x7b},
836 {OV5693_8BIT, 0x3502, 0x80},
837 {OV5693_8BIT, 0x3708, 0xe2},
838 {OV5693_8BIT, 0x3709, 0xc3},
839 {OV5693_8BIT, 0x3800, 0x00}, /*{3800,3801} Array X start*/
840 {OV5693_8BIT, 0x3801, 0x08}, /* 04 //{3800,3801} Array X start*/
841 {OV5693_8BIT, 0x3802, 0x00}, /*{3802,3803} Array Y start*/
842 {OV5693_8BIT, 0x3803, 0x04}, /* 00 //{3802,3803} Array Y start*/
843 {OV5693_8BIT, 0x3804, 0x0a}, /*{3804,3805} Array X end*/
844 {OV5693_8BIT, 0x3805, 0x37}, /* 3b //{3804,3805} Array X end*/
845 {OV5693_8BIT, 0x3806, 0x07}, /*{3806,3807} Array Y end*/
846 {OV5693_8BIT, 0x3807, 0x9f}, /* a3 //{3806,3807} Array Y end*/
847 {OV5693_8BIT, 0x3808, 0x06}, /*{3808,3809} Final output H size*/
848 {OV5693_8BIT, 0x3809, 0x50}, /*{3808,3809} Final output H size*/
849 {OV5693_8BIT, 0x380a, 0x04}, /*{380a,380b} Final output V size*/
850 {OV5693_8BIT, 0x380b, 0xc0}, /*{380a,380b} Final output V size*/
851 {OV5693_8BIT, 0x380c, 0x0a}, /*{380c,380d} HTS*/
852 {OV5693_8BIT, 0x380d, 0x80}, /*{380c,380d} HTS*/
853 {OV5693_8BIT, 0x380e, 0x07}, /*{380e,380f} VTS*/
854 {OV5693_8BIT, 0x380f, 0xc0}, /* bc //{380e,380f} VTS*/
855 {OV5693_8BIT, 0x3810, 0x00}, /*{3810,3811} windowing X offset*/
856 {OV5693_8BIT, 0x3811, 0x10}, /*{3810,3811} windowing X offset*/
857 {OV5693_8BIT, 0x3812, 0x00}, /*{3812,3813} windowing Y offset*/
858 {OV5693_8BIT, 0x3813, 0x06}, /*{3812,3813} windowing Y offset*/
859 {OV5693_8BIT, 0x3814, 0x11}, /*X subsample control*/
860 {OV5693_8BIT, 0x3815, 0x11}, /*Y subsample control*/
861 {OV5693_8BIT, 0x3820, 0x00}, /*FLIP/Binnning control*/
862 {OV5693_8BIT, 0x3821, 0x1e}, /*MIRROR control*/
863 {OV5693_8BIT, 0x5002, 0x00},
864 {OV5693_8BIT, 0x5041, 0x84},
865 {OV5693_8BIT, 0x0100, 0x01},
866 {OV5693_TOK_TERM, 0, 0}
867 };
868
869
870 /*
871 * 1940x1096 30fps 8.8ms VBlanking 2lane 10bit (Scaling)
872 */
873 static struct ov5693_reg const ov5693_1940x1096[] = {
874 {OV5693_8BIT, 0x3501, 0x7b},
875 {OV5693_8BIT, 0x3502, 0x00},
876 {OV5693_8BIT, 0x3708, 0xe2},
877 {OV5693_8BIT, 0x3709, 0xc3},
878 {OV5693_8BIT, 0x3803, 0xf0},
879 {OV5693_8BIT, 0x3806, 0x06},
880 {OV5693_8BIT, 0x3807, 0xa7},
881 {OV5693_8BIT, 0x3808, 0x07},
882 {OV5693_8BIT, 0x3809, 0x94},
883 {OV5693_8BIT, 0x380a, 0x04},
884 {OV5693_8BIT, 0x380b, 0x48},
885 {OV5693_8BIT, 0x380c, 0x0a},
886 {OV5693_8BIT, 0x380d, 0x80},
887 {OV5693_8BIT, 0x380e, 0x07},
888 {OV5693_8BIT, 0x380f, 0xc0},
889 {OV5693_8BIT, 0x3811, 0x02},
890 {OV5693_8BIT, 0x3813, 0x02},
891 {OV5693_8BIT, 0x3814, 0x11},
892 {OV5693_8BIT, 0x3815, 0x11},
893 {OV5693_8BIT, 0x3820, 0x00},
894 {OV5693_8BIT, 0x3821, 0x1e},
895 {OV5693_8BIT, 0x5002, 0x80},
896 {OV5693_8BIT, 0x0100, 0x01},
897 {OV5693_TOK_TERM, 0, 0}
898 };
899
900 static struct ov5693_reg const ov5693_2592x1456_30fps[] = {
901 {OV5693_8BIT, 0x3501, 0x7b},
902 {OV5693_8BIT, 0x3502, 0x00},
903 {OV5693_8BIT, 0x3708, 0xe2},
904 {OV5693_8BIT, 0x3709, 0xc3},
905 {OV5693_8BIT, 0x3800, 0x00},
906 {OV5693_8BIT, 0x3801, 0x00},
907 {OV5693_8BIT, 0x3802, 0x00},
908 {OV5693_8BIT, 0x3803, 0xf0},
909 {OV5693_8BIT, 0x3804, 0x0a},
910 {OV5693_8BIT, 0x3805, 0x3f},
911 {OV5693_8BIT, 0x3806, 0x06},
912 {OV5693_8BIT, 0x3807, 0xa4},
913 {OV5693_8BIT, 0x3808, 0x0a},
914 {OV5693_8BIT, 0x3809, 0x20},
915 {OV5693_8BIT, 0x380a, 0x05},
916 {OV5693_8BIT, 0x380b, 0xb0},
917 {OV5693_8BIT, 0x380c, 0x0a},
918 {OV5693_8BIT, 0x380d, 0x80},
919 {OV5693_8BIT, 0x380e, 0x07},
920 {OV5693_8BIT, 0x380f, 0xc0},
921 {OV5693_8BIT, 0x3811, 0x10},
922 {OV5693_8BIT, 0x3813, 0x00},
923 {OV5693_8BIT, 0x3814, 0x11},
924 {OV5693_8BIT, 0x3815, 0x11},
925 {OV5693_8BIT, 0x3820, 0x00},
926 {OV5693_8BIT, 0x3821, 0x1e},
927 {OV5693_8BIT, 0x5002, 0x00},
928 {OV5693_TOK_TERM, 0, 0}
929 };
930
931 static struct ov5693_reg const ov5693_2576x1456_30fps[] = {
932 {OV5693_8BIT, 0x3501, 0x7b},
933 {OV5693_8BIT, 0x3502, 0x00},
934 {OV5693_8BIT, 0x3708, 0xe2},
935 {OV5693_8BIT, 0x3709, 0xc3},
936 {OV5693_8BIT, 0x3800, 0x00},
937 {OV5693_8BIT, 0x3801, 0x00},
938 {OV5693_8BIT, 0x3802, 0x00},
939 {OV5693_8BIT, 0x3803, 0xf0},
940 {OV5693_8BIT, 0x3804, 0x0a},
941 {OV5693_8BIT, 0x3805, 0x3f},
942 {OV5693_8BIT, 0x3806, 0x06},
943 {OV5693_8BIT, 0x3807, 0xa4},
944 {OV5693_8BIT, 0x3808, 0x0a},
945 {OV5693_8BIT, 0x3809, 0x10},
946 {OV5693_8BIT, 0x380a, 0x05},
947 {OV5693_8BIT, 0x380b, 0xb0},
948 {OV5693_8BIT, 0x380c, 0x0a},
949 {OV5693_8BIT, 0x380d, 0x80},
950 {OV5693_8BIT, 0x380e, 0x07},
951 {OV5693_8BIT, 0x380f, 0xc0},
952 {OV5693_8BIT, 0x3811, 0x18},
953 {OV5693_8BIT, 0x3813, 0x00},
954 {OV5693_8BIT, 0x3814, 0x11},
955 {OV5693_8BIT, 0x3815, 0x11},
956 {OV5693_8BIT, 0x3820, 0x00},
957 {OV5693_8BIT, 0x3821, 0x1e},
958 {OV5693_8BIT, 0x5002, 0x00},
959 {OV5693_TOK_TERM, 0, 0}
960 };
961
962 /*
963 * 2592x1944 30fps 0.6ms VBlanking 2lane 10Bit
964 */
965 static struct ov5693_reg const ov5693_2592x1944_30fps[] = {
966 {OV5693_8BIT, 0x3501, 0x7b},
967 {OV5693_8BIT, 0x3502, 0x00},
968 {OV5693_8BIT, 0x3708, 0xe2},
969 {OV5693_8BIT, 0x3709, 0xc3},
970 {OV5693_8BIT, 0x3803, 0x00},
971 {OV5693_8BIT, 0x3806, 0x07},
972 {OV5693_8BIT, 0x3807, 0xa3},
973 {OV5693_8BIT, 0x3808, 0x0a},
974 {OV5693_8BIT, 0x3809, 0x20},
975 {OV5693_8BIT, 0x380a, 0x07},
976 {OV5693_8BIT, 0x380b, 0x98},
977 {OV5693_8BIT, 0x380c, 0x0a},
978 {OV5693_8BIT, 0x380d, 0x80},
979 {OV5693_8BIT, 0x380e, 0x07},
980 {OV5693_8BIT, 0x380f, 0xc0},
981 {OV5693_8BIT, 0x3811, 0x10},
982 {OV5693_8BIT, 0x3813, 0x00},
983 {OV5693_8BIT, 0x3814, 0x11},
984 {OV5693_8BIT, 0x3815, 0x11},
985 {OV5693_8BIT, 0x3820, 0x00},
986 {OV5693_8BIT, 0x3821, 0x1e},
987 {OV5693_8BIT, 0x5002, 0x00},
988 {OV5693_8BIT, 0x0100, 0x01},
989 {OV5693_TOK_TERM, 0, 0}
990 };
991
992 /*
993 * 11:9 Full FOV Output, expected FOV Res: 2346x1920
994 * ISP Effect Res: 1408x1152
995 * Sensor out: 1424x1168, DS From: 2380x1952
996 *
997 * WA: Left Offset: 8, Hor scal: 64
998 */
999 static struct ov5693_reg const ov5693_1424x1168_30fps[] = {
1000 {OV5693_8BIT, 0x3501, 0x3b}, /* long exposure[15:8] */
1001 {OV5693_8BIT, 0x3502, 0x80}, /* long exposure[7:0] */
1002 {OV5693_8BIT, 0x3708, 0xe2},
1003 {OV5693_8BIT, 0x3709, 0xc3},
1004 {OV5693_8BIT, 0x3800, 0x00}, /* TIMING_X_ADDR_START */
1005 {OV5693_8BIT, 0x3801, 0x50}, /* 80 */
1006 {OV5693_8BIT, 0x3802, 0x00}, /* TIMING_Y_ADDR_START */
1007 {OV5693_8BIT, 0x3803, 0x02}, /* 2 */
1008 {OV5693_8BIT, 0x3804, 0x09}, /* TIMING_X_ADDR_END */
1009 {OV5693_8BIT, 0x3805, 0xdd}, /* 2525 */
1010 {OV5693_8BIT, 0x3806, 0x07}, /* TIMING_Y_ADDR_END */
1011 {OV5693_8BIT, 0x3807, 0xa1}, /* 1953 */
1012 {OV5693_8BIT, 0x3808, 0x05}, /* TIMING_X_OUTPUT_SIZE */
1013 {OV5693_8BIT, 0x3809, 0x90}, /* 1424 */
1014 {OV5693_8BIT, 0x380a, 0x04}, /* TIMING_Y_OUTPUT_SIZE */
1015 {OV5693_8BIT, 0x380b, 0x90}, /* 1168 */
1016 {OV5693_8BIT, 0x380c, 0x0a}, /* TIMING_HTS */
1017 {OV5693_8BIT, 0x380d, 0x80},
1018 {OV5693_8BIT, 0x380e, 0x07}, /* TIMING_VTS */
1019 {OV5693_8BIT, 0x380f, 0xc0},
1020 {OV5693_8BIT, 0x3810, 0x00}, /* TIMING_ISP_X_WIN */
1021 {OV5693_8BIT, 0x3811, 0x02}, /* 2 */
1022 {OV5693_8BIT, 0x3812, 0x00}, /* TIMING_ISP_Y_WIN */
1023 {OV5693_8BIT, 0x3813, 0x00}, /* 0 */
1024 {OV5693_8BIT, 0x3814, 0x11}, /* TIME_X_INC */
1025 {OV5693_8BIT, 0x3815, 0x11}, /* TIME_Y_INC */
1026 {OV5693_8BIT, 0x3820, 0x00},
1027 {OV5693_8BIT, 0x3821, 0x1e},
1028 {OV5693_8BIT, 0x5002, 0x00},
1029 {OV5693_8BIT, 0x5041, 0x84}, /* scale is auto enabled */
1030 {OV5693_8BIT, 0x0100, 0x01},
1031 {OV5693_TOK_TERM, 0, 0}
1032 };
1033
1034 /*
1035 * 3:2 Full FOV Output, expected FOV Res: 2560x1706
1036 * ISP Effect Res: 720x480
1037 * Sensor out: 736x496, DS From 2616x1764
1038 */
1039 static struct ov5693_reg const ov5693_736x496_30fps[] = {
1040 {OV5693_8BIT, 0x3501, 0x3b}, /* long exposure[15:8] */
1041 {OV5693_8BIT, 0x3502, 0x80}, /* long exposure[7:0] */
1042 {OV5693_8BIT, 0x3708, 0xe2},
1043 {OV5693_8BIT, 0x3709, 0xc3},
1044 {OV5693_8BIT, 0x3800, 0x00}, /* TIMING_X_ADDR_START */
1045 {OV5693_8BIT, 0x3801, 0x02}, /* 2 */
1046 {OV5693_8BIT, 0x3802, 0x00}, /* TIMING_Y_ADDR_START */
1047 {OV5693_8BIT, 0x3803, 0x62}, /* 98 */
1048 {OV5693_8BIT, 0x3804, 0x0a}, /* TIMING_X_ADDR_END */
1049 {OV5693_8BIT, 0x3805, 0x3b}, /* 2619 */
1050 {OV5693_8BIT, 0x3806, 0x07}, /* TIMING_Y_ADDR_END */
1051 {OV5693_8BIT, 0x3807, 0x43}, /* 1859 */
1052 {OV5693_8BIT, 0x3808, 0x02}, /* TIMING_X_OUTPUT_SIZE */
1053 {OV5693_8BIT, 0x3809, 0xe0}, /* 736 */
1054 {OV5693_8BIT, 0x380a, 0x01}, /* TIMING_Y_OUTPUT_SIZE */
1055 {OV5693_8BIT, 0x380b, 0xf0}, /* 496 */
1056 {OV5693_8BIT, 0x380c, 0x0a}, /* TIMING_HTS */
1057 {OV5693_8BIT, 0x380d, 0x80},
1058 {OV5693_8BIT, 0x380e, 0x07}, /* TIMING_VTS */
1059 {OV5693_8BIT, 0x380f, 0xc0},
1060 {OV5693_8BIT, 0x3810, 0x00}, /* TIMING_ISP_X_WIN */
1061 {OV5693_8BIT, 0x3811, 0x02}, /* 2 */
1062 {OV5693_8BIT, 0x3812, 0x00}, /* TIMING_ISP_Y_WIN */
1063 {OV5693_8BIT, 0x3813, 0x00}, /* 0 */
1064 {OV5693_8BIT, 0x3814, 0x11}, /* TIME_X_INC */
1065 {OV5693_8BIT, 0x3815, 0x11}, /* TIME_Y_INC */
1066 {OV5693_8BIT, 0x3820, 0x00},
1067 {OV5693_8BIT, 0x3821, 0x1e},
1068 {OV5693_8BIT, 0x5002, 0x00},
1069 {OV5693_8BIT, 0x5041, 0x84}, /* scale is auto enabled */
1070 {OV5693_8BIT, 0x0100, 0x01},
1071 {OV5693_TOK_TERM, 0, 0}
1072 };
1073
1074 static struct ov5693_reg const ov5693_2576x1936_30fps[] = {
1075 {OV5693_8BIT, 0x3501, 0x7b},
1076 {OV5693_8BIT, 0x3502, 0x00},
1077 {OV5693_8BIT, 0x3708, 0xe2},
1078 {OV5693_8BIT, 0x3709, 0xc3},
1079 {OV5693_8BIT, 0x3803, 0x00},
1080 {OV5693_8BIT, 0x3806, 0x07},
1081 {OV5693_8BIT, 0x3807, 0xa3},
1082 {OV5693_8BIT, 0x3808, 0x0a},
1083 {OV5693_8BIT, 0x3809, 0x10},
1084 {OV5693_8BIT, 0x380a, 0x07},
1085 {OV5693_8BIT, 0x380b, 0x90},
1086 {OV5693_8BIT, 0x380c, 0x0a},
1087 {OV5693_8BIT, 0x380d, 0x80},
1088 {OV5693_8BIT, 0x380e, 0x07},
1089 {OV5693_8BIT, 0x380f, 0xc0},
1090 {OV5693_8BIT, 0x3811, 0x18},
1091 {OV5693_8BIT, 0x3813, 0x00},
1092 {OV5693_8BIT, 0x3814, 0x11},
1093 {OV5693_8BIT, 0x3815, 0x11},
1094 {OV5693_8BIT, 0x3820, 0x00},
1095 {OV5693_8BIT, 0x3821, 0x1e},
1096 {OV5693_8BIT, 0x5002, 0x00},
1097 {OV5693_8BIT, 0x0100, 0x01},
1098 {OV5693_TOK_TERM, 0, 0}
1099 };
1100
1101 struct ov5693_resolution ov5693_res_preview[] = {
1102 {
1103 .desc = "ov5693_736x496_30fps",
1104 .width = 736,
1105 .height = 496,
1106 .pix_clk_freq = 160,
1107 .fps = 30,
1108 .used = 0,
1109 .pixels_per_line = 2688,
1110 .lines_per_frame = 1984,
1111 .bin_factor_x = 1,
1112 .bin_factor_y = 1,
1113 .bin_mode = 0,
1114 .regs = ov5693_736x496_30fps,
1115 },
1116 {
1117 .desc = "ov5693_1616x1216_30fps",
1118 .width = 1616,
1119 .height = 1216,
1120 .pix_clk_freq = 160,
1121 .fps = 30,
1122 .used = 0,
1123 .pixels_per_line = 2688,
1124 .lines_per_frame = 1984,
1125 .bin_factor_x = 1,
1126 .bin_factor_y = 1,
1127 .bin_mode = 0,
1128 .regs = ov5693_1616x1216_30fps,
1129 },
1130 {
1131 .desc = "ov5693_5M_30fps",
1132 .width = 2576,
1133 .height = 1456,
1134 .pix_clk_freq = 160,
1135 .fps = 30,
1136 .used = 0,
1137 .pixels_per_line = 2688,
1138 .lines_per_frame = 1984,
1139 .bin_factor_x = 1,
1140 .bin_factor_y = 1,
1141 .bin_mode = 0,
1142 .regs = ov5693_2576x1456_30fps,
1143 },
1144 {
1145 .desc = "ov5693_5M_30fps",
1146 .width = 2576,
1147 .height = 1936,
1148 .pix_clk_freq = 160,
1149 .fps = 30,
1150 .used = 0,
1151 .pixels_per_line = 2688,
1152 .lines_per_frame = 1984,
1153 .bin_factor_x = 1,
1154 .bin_factor_y = 1,
1155 .bin_mode = 0,
1156 .regs = ov5693_2576x1936_30fps,
1157 },
1158 };
1159 #define N_RES_PREVIEW (ARRAY_SIZE(ov5693_res_preview))
1160
1161 struct ov5693_resolution ov5693_res_still[] = {
1162 {
1163 .desc = "ov5693_736x496_30fps",
1164 .width = 736,
1165 .height = 496,
1166 .pix_clk_freq = 160,
1167 .fps = 30,
1168 .used = 0,
1169 .pixels_per_line = 2688,
1170 .lines_per_frame = 1984,
1171 .bin_factor_x = 1,
1172 .bin_factor_y = 1,
1173 .bin_mode = 0,
1174 .regs = ov5693_736x496_30fps,
1175 },
1176 {
1177 .desc = "ov5693_1424x1168_30fps",
1178 .width = 1424,
1179 .height = 1168,
1180 .pix_clk_freq = 160,
1181 .fps = 30,
1182 .used = 0,
1183 .pixels_per_line = 2688,
1184 .lines_per_frame = 1984,
1185 .bin_factor_x = 1,
1186 .bin_factor_y = 1,
1187 .bin_mode = 0,
1188 .regs = ov5693_1424x1168_30fps,
1189 },
1190 {
1191 .desc = "ov5693_1616x1216_30fps",
1192 .width = 1616,
1193 .height = 1216,
1194 .pix_clk_freq = 160,
1195 .fps = 30,
1196 .used = 0,
1197 .pixels_per_line = 2688,
1198 .lines_per_frame = 1984,
1199 .bin_factor_x = 1,
1200 .bin_factor_y = 1,
1201 .bin_mode = 0,
1202 .regs = ov5693_1616x1216_30fps,
1203 },
1204 {
1205 .desc = "ov5693_5M_30fps",
1206 .width = 2592,
1207 .height = 1456,
1208 .pix_clk_freq = 160,
1209 .fps = 30,
1210 .used = 0,
1211 .pixels_per_line = 2688,
1212 .lines_per_frame = 1984,
1213 .bin_factor_x = 1,
1214 .bin_factor_y = 1,
1215 .bin_mode = 0,
1216 .regs = ov5693_2592x1456_30fps,
1217 },
1218 {
1219 .desc = "ov5693_5M_30fps",
1220 .width = 2592,
1221 .height = 1944,
1222 .pix_clk_freq = 160,
1223 .fps = 30,
1224 .used = 0,
1225 .pixels_per_line = 2688,
1226 .lines_per_frame = 1984,
1227 .bin_factor_x = 1,
1228 .bin_factor_y = 1,
1229 .bin_mode = 0,
1230 .regs = ov5693_2592x1944_30fps,
1231 },
1232 };
1233 #define N_RES_STILL (ARRAY_SIZE(ov5693_res_still))
1234
1235 struct ov5693_resolution ov5693_res_video[] = {
1236 {
1237 .desc = "ov5693_736x496_30fps",
1238 .width = 736,
1239 .height = 496,
1240 .fps = 30,
1241 .pix_clk_freq = 160,
1242 .used = 0,
1243 .pixels_per_line = 2688,
1244 .lines_per_frame = 1984,
1245 .bin_factor_x = 2,
1246 .bin_factor_y = 2,
1247 .bin_mode = 1,
1248 .regs = ov5693_736x496,
1249 },
1250 {
1251 .desc = "ov5693_336x256_30fps",
1252 .width = 336,
1253 .height = 256,
1254 .fps = 30,
1255 .pix_clk_freq = 160,
1256 .used = 0,
1257 .pixels_per_line = 2688,
1258 .lines_per_frame = 1984,
1259 .bin_factor_x = 2,
1260 .bin_factor_y = 2,
1261 .bin_mode = 1,
1262 .regs = ov5693_336x256,
1263 },
1264 {
1265 .desc = "ov5693_368x304_30fps",
1266 .width = 368,
1267 .height = 304,
1268 .fps = 30,
1269 .pix_clk_freq = 160,
1270 .used = 0,
1271 .pixels_per_line = 2688,
1272 .lines_per_frame = 1984,
1273 .bin_factor_x = 2,
1274 .bin_factor_y = 2,
1275 .bin_mode = 1,
1276 .regs = ov5693_368x304,
1277 },
1278 {
1279 .desc = "ov5693_192x160_30fps",
1280 .width = 192,
1281 .height = 160,
1282 .fps = 30,
1283 .pix_clk_freq = 160,
1284 .used = 0,
1285 .pixels_per_line = 2688,
1286 .lines_per_frame = 1984,
1287 .bin_factor_x = 2,
1288 .bin_factor_y = 2,
1289 .bin_mode = 1,
1290 .regs = ov5693_192x160,
1291 },
1292 {
1293 .desc = "ov5693_1296x736_30fps",
1294 .width = 1296,
1295 .height = 736,
1296 .fps = 30,
1297 .pix_clk_freq = 160,
1298 .used = 0,
1299 .pixels_per_line = 2688,
1300 .lines_per_frame = 1984,
1301 .bin_factor_x = 2,
1302 .bin_factor_y = 2,
1303 .bin_mode = 0,
1304 .regs = ov5693_1296x736,
1305 },
1306 {
1307 .desc = "ov5693_1296x976_30fps",
1308 .width = 1296,
1309 .height = 976,
1310 .fps = 30,
1311 .pix_clk_freq = 160,
1312 .used = 0,
1313 .pixels_per_line = 2688,
1314 .lines_per_frame = 1984,
1315 .bin_factor_x = 2,
1316 .bin_factor_y = 2,
1317 .bin_mode = 0,
1318 .regs = ov5693_1296x976,
1319 },
1320 {
1321 .desc = "ov5693_1636P_30fps",
1322 .width = 1636,
1323 .height = 1096,
1324 .fps = 30,
1325 .pix_clk_freq = 160,
1326 .used = 0,
1327 .pixels_per_line = 2688,
1328 .lines_per_frame = 1984,
1329 .bin_factor_x = 1,
1330 .bin_factor_y = 1,
1331 .bin_mode = 0,
1332 .regs = ov5693_1636p_30fps,
1333 },
1334 {
1335 .desc = "ov5693_1080P_30fps",
1336 .width = 1940,
1337 .height = 1096,
1338 .fps = 30,
1339 .pix_clk_freq = 160,
1340 .used = 0,
1341 .pixels_per_line = 2688,
1342 .lines_per_frame = 1984,
1343 .bin_factor_x = 1,
1344 .bin_factor_y = 1,
1345 .bin_mode = 0,
1346 .regs = ov5693_1940x1096,
1347 },
1348 {
1349 .desc = "ov5693_5M_30fps",
1350 .width = 2592,
1351 .height = 1456,
1352 .pix_clk_freq = 160,
1353 .fps = 30,
1354 .used = 0,
1355 .pixels_per_line = 2688,
1356 .lines_per_frame = 1984,
1357 .bin_factor_x = 1,
1358 .bin_factor_y = 1,
1359 .bin_mode = 0,
1360 .regs = ov5693_2592x1456_30fps,
1361 },
1362 {
1363 .desc = "ov5693_5M_30fps",
1364 .width = 2592,
1365 .height = 1944,
1366 .pix_clk_freq = 160,
1367 .fps = 30,
1368 .used = 0,
1369 .pixels_per_line = 2688,
1370 .lines_per_frame = 1984,
1371 .bin_factor_x = 1,
1372 .bin_factor_y = 1,
1373 .bin_mode = 0,
1374 .regs = ov5693_2592x1944_30fps,
1375 },
1376 };
1377 #define N_RES_VIDEO (ARRAY_SIZE(ov5693_res_video))
1378
1379 static struct ov5693_resolution *ov5693_res = ov5693_res_preview;
1380 static unsigned long N_RES = N_RES_PREVIEW;
1381 #endif