2 * Driver for OV5642 CMOS Image Sensor from OmniVision
4 * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/videodev2.h>
12 #include <linux/slab.h>
13 #include <linux/i2c.h>
14 #include <linux/log2.h>
15 #include <linux/platform_device.h>
16 #include <linux/delay.h>
17 #include <linux/circ_buf.h>
18 #include <linux/hardirq.h>
19 #include <linux/miscdevice.h>
22 #include <media/v4l2-common.h>
23 #include <media/v4l2-chip-ident.h>
24 #include <media/soc_camera.h>
25 #include <mach/rk29_camera.h>
29 module_param(debug, int, S_IRUGO|S_IWUSR);
31 #define dprintk(level, fmt, arg...) do { \
33 printk(KERN_WARNING fmt , ## arg); } while (0)
35 #define SENSOR_TR(format, ...) printk(KERN_ERR format, ## __VA_ARGS__)
36 #define SENSOR_DG(format, ...) dprintk(1, format, ## __VA_ARGS__)
38 #define _CONS(a,b) a##b
39 #define CONS(a,b) _CONS(a,b)
42 #define _STR(x) __STR(x)
43 #define STR(x) _STR(x)
45 #define MIN(x,y) ((x<y) ? x: y)
46 #define MAX(x,y) ((x>y) ? x: y)
48 /* Sensor Driver Configuration */
49 #define SENSOR_NAME RK29_CAM_SENSOR_MT9P111
50 #define SENSOR_V4L2_IDENT V4L2_IDENT_MT9P111
51 #define SENSOR_ID SEQUENCE_END
52 #define SENSOR_ID_REG SEQUENCE_END
53 #define SENSOR_RESET_REG 0x0010
54 #define SENSOR_RESET_VAL 0x0115
55 #define SENSOR_RESET_REG_LEN WORD_LEN
56 #define SENSOR_MIN_WIDTH 176
57 #define SENSOR_MIN_HEIGHT 144
58 #define SENSOR_MAX_WIDTH 2592
59 #define SENSOR_MAX_HEIGHT 1944
60 #define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
61 #define SENSOR_INIT_HEIGHT 480
62 #define SENSOR_INIT_WINSEQADR sensor_vga
63 #define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
64 #define YUV420_BUFFER_MAX_SIZE 7558272 /* 2592*1944*1.5*/
66 #define CONFIG_SENSOR_WhiteBalance 1
67 #define CONFIG_SENSOR_Brightness 0
68 #define CONFIG_SENSOR_Contrast 0
69 #define CONFIG_SENSOR_Saturation 0
70 #define CONFIG_SENSOR_Effect 1
71 #define CONFIG_SENSOR_Scene 1
72 #define CONFIG_SENSOR_DigitalZoom 0
73 #define CONFIG_SENSOR_Exposure 0
74 #define CONFIG_SENSOR_Flash 1
75 #define CONFIG_SENSOR_Mirror 0
76 #define CONFIG_SENSOR_Flip 1
77 #define CONFIG_SENSOR_Focus 1
80 #define CONFIG_SENSOR_I2C_SPEED 100000 /* Hz */
81 //#define CONFIG_SENSOR_I2C_SPEED 350000 /* Hz */
83 /* Sensor write register continues by preempt_disable/preempt_enable for current process not be scheduled */
84 #define CONFIG_SENSOR_I2C_NOSCHED 0
85 #define CONFIG_SENSOR_I2C_RDWRCHK 0
88 #define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|\
89 SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_HIGH|\
90 SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
92 #define COLOR_TEMPERATURE_CLOUDY_DN 6500
93 #define COLOR_TEMPERATURE_CLOUDY_UP 8000
94 #define COLOR_TEMPERATURE_CLEARDAY_DN 5000
95 #define COLOR_TEMPERATURE_CLEARDAY_UP 6500
96 #define COLOR_TEMPERATURE_OFFICE_DN 3500
97 #define COLOR_TEMPERATURE_OFFICE_UP 5000
98 #define COLOR_TEMPERATURE_HOME_DN 2500
99 #define COLOR_TEMPERATURE_HOME_UP 3500
101 #define SENSOR_NAME_STRING(a) STR(CONS(SENSOR_NAME, a))
102 #define SENSOR_NAME_VARFUN(a) CONS(SENSOR_NAME, a)
104 #define SENSOR_AF_IS_ERR (0x00<<0)
105 #define SENSOR_AF_IS_OK (0x01<<0)
106 #define SENSOR_INIT_IS_ERR (0x00<<28)
107 #define SENSOR_INIT_IS_OK (0x01<<28)
111 #if CONFIG_SENSOR_Focus
112 #define SENSOR_AF_MODE_INFINITY 0
113 #define SENSOR_AF_MODE_MACRO 1
114 #define SENSOR_AF_MODE_FIXED 2
115 #define SENSOR_AF_MODE_AUTO 3
116 #define SENSOR_AF_MODE_CONTINUOUS 4
117 #define SENSOR_AF_MODE_CLOSE 5
120 /* init 640X480 VGA */
121 static struct reginfo sensor_init_data[] =
124 //for 24MHz input, VCO=MAX=768mhz
125 { 0x0010, 0x0340, WORD_LEN, 0},
126 /*sovle problem that lack of pclk during one href*/
127 #if ADJUST_PCLK_FRE_FALG
128 { 0x0012, 0x0080, WORD_LEN, 0}, //PCLK=85MHz
130 { 0x0012, 0x0090, WORD_LEN, 0}, //PCLK=76MHz
132 { 0x0014, 0x2025, WORD_LEN, 0},
133 { 0x001E, 0x0565, WORD_LEN, 0}, // PAD_SLEW_PAD_CONFIG
134 { 0x0022, 0x0030, WORD_LEN, 0}, //0x01E0// VDD_DIS_COUNTER
135 #if ADJUST_PCLK_FRE_FALG
136 { 0x002A, 0x7FFF, WORD_LEN, 0},
138 { 0x002A, 0x7F7E, WORD_LEN, 0}, //0x7F7F// PLL_P4_P5_P6_DIVIDERS By Hwang 20101104
140 { 0x002C, 0x0000, WORD_LEN, 0}, // PLL_P7_DIVIDER
141 { 0x002E, 0x0000, WORD_LEN, 0}, // SENSOR_CLOCK_DIVIDER
142 { 0x0018, 0x4008, WORD_LEN, 0}, // STANDBY_CONTROL_AND_STATUS
143 //////{ SEQUENCE_WAIT_MS,100,WORD_LEN, 0},
144 { SEQUENCE_WAIT_MS,20,WORD_LEN, 0},
146 { 0x0010, 0x0340, WORD_LEN, 0}, // PLL_DIVIDERS
147 { 0x098E, 0x483A, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [CAM_CORE_A_Y_ADDR_START]
148 { 0xC83A, 0x000C, WORD_LEN, 0}, // CAM_CORE_A_Y_ADDR_START
149 { 0xC83C, 0x0018, WORD_LEN, 0}, // CAM_CORE_A_X_ADDR_START
150 { 0xC83E, 0x07B1, WORD_LEN, 0}, // CAM_CORE_A_Y_ADDR_END
151 { 0xC840, 0x0A45, WORD_LEN, 0}, // CAM_CORE_A_X_ADDR_END
152 { 0xC842, 0x0001, WORD_LEN, 0}, // CAM_CORE_A_ROW_SPEED
153 { 0xC844, 0x0103, WORD_LEN, 0}, // CAM_CORE_A_SKIP_X_CORE
154 { 0xC846, 0x0103, WORD_LEN, 0}, // CAM_CORE_A_SKIP_Y_CORE
155 { 0xC848, 0x0103, WORD_LEN, 0}, // CAM_CORE_A_SKIP_X_PIPE
156 { 0xC84A, 0x0103, WORD_LEN, 0}, // CAM_CORE_A_SKIP_Y_PIPE
157 { 0xC84C, 0x00F6, WORD_LEN, 0}, // CAM_CORE_A_POWER_MODE
158 { 0xC84E, 0x0001, WORD_LEN, 0}, // CAM_CORE_A_BIN_MODE
159 /*lzg@rock-chips.com, FIH:preview image to be mirrored and flipped */
160 #if CONFIG_SENSOR_NONE_FLIP_MIRROR
161 { 0xC850, 0x00, BYTE_LEN, 0}, // CAM_CORE_A_ORIENTATION
162 #elif CONFIG_SENSOR_MIRROR
163 { 0xC850, 0x01, BYTE_LEN, 0}, // CAM_CORE_A_ORIENTATION
164 #elif CONFIG_SENSOR_FLIPE
165 { 0xC850, 0x02, BYTE_LEN, 0}, // CAM_CORE_A_ORIENTATION
166 #elif CONFIG_SENSOR_MIRROR_AND_FLIPE
167 { 0xC850, 0x03, BYTE_LEN, 0}, // CAM_CORE_A_ORIENTATION
169 { 0xC851, 0x00, BYTE_LEN, 0}, // CAM_CORE_A_PIXEL_ORDER
170 { 0xC852, 0x019C, WORD_LEN, 0}, // CAM_CORE_A_FINE_CORRECTION
171 { 0xC854, 0x0732, WORD_LEN, 0}, // CAM_CORE_A_FINE_ITMIN
172 { 0xC858, 0x0000, WORD_LEN, 0}, // CAM_CORE_A_COARSE_ITMIN
173 { 0xC85A, 0x0001, WORD_LEN, 0}, // CAM_CORE_A_COARSE_ITMAX_MARGIN
174 { 0xC85C, 0x0423, WORD_LEN, 0}, // CAM_CORE_A_MIN_FRAME_LENGTH_LINES
175 { 0xC85E, 0xFFFF, WORD_LEN, 0}, // CAM_CORE_A_MAX_FRAME_LENGTH_LINS
176 { 0xC860, 0x0423, WORD_LEN, 0}, // CAM_CORE_A_BASE_FRAME_LENGTH_LINES
177 { 0xC862, 0x1194, WORD_LEN, 0}, // CAM_CORE_A_MIN_LINE_LENGTH_PCLK
178 { 0xC864, 0xFFFE, WORD_LEN, 0}, // CAM_CORE_A_MAX_LINE_LENGTH_PCLK
179 { 0xC866, 0x7F7F, WORD_LEN, 0}, // CAM_CORE_A_P4_5_6_DIVIDER
180 { 0xC868, 0x0423, WORD_LEN, 0}, // CAM_CORE_A_FRAME_LENGTH_LINES
181 { 0xC86A, 0x1194, WORD_LEN, 0}, // CAM_CORE_A_LINE_LENGTH_PCK
182 { 0xC86C, 0x0518, WORD_LEN, 0}, // CAM_CORE_A_OUTPUT_SIZE_WIDTH
183 { 0xC86E, 0x03D4, WORD_LEN, 0}, // CAM_CORE_A_OUTPUT_SIZE_HEIGHT
184 { 0xC870, 0x0014, WORD_LEN, 0}, // CAM_CORE_A_RX_FIFO_TRIGGER_MARK
185 { 0xC858, 0x0003, WORD_LEN, 0}, // CAM_CORE_A_COARSE_ITMIN
186 { 0xC8B8, 0x0004, WORD_LEN, 0}, // CAM_OUTPUT_0_JPEG_CONTROL
187 { 0xC8AE, 0x0001, WORD_LEN, 0}, // CAM_OUTPUT_0_OUTPUT_FORMAT
188 { 0xC8AA, 0x0280, WORD_LEN, 0}, // CAM_OUTPUT_0_IMAGE_WIDTH
189 { 0xC8AC, 0x01E0, WORD_LEN, 0}, // CAM_OUTPUT_0_IMAGE_HEIGHT
190 { 0xC872, 0x0010, WORD_LEN, 0}, // CAM_CORE_B_Y_ADDR_START
191 { 0xC874, 0x001C, WORD_LEN, 0}, // CAM_CORE_B_X_ADDR_START
192 { 0xC876, 0x07AF, WORD_LEN, 0}, // CAM_CORE_B_Y_ADDR_END
193 { 0xC878, 0x0A43, WORD_LEN, 0}, // CAM_CORE_B_X_ADDR_END
194 { 0xC87A, 0x0001, WORD_LEN, 0}, // CAM_CORE_B_ROW_SPEED
195 { 0xC87C, 0x0101, WORD_LEN, 0}, // CAM_CORE_B_SKIP_X_CORE
196 { 0xC87E, 0x0101, WORD_LEN, 0}, // CAM_CORE_B_SKIP_Y_CORE
197 { 0xC880, 0x0101, WORD_LEN, 0}, // CAM_CORE_B_SKIP_X_PIPE
198 { 0xC882, 0x0101, WORD_LEN, 0}, // CAM_CORE_B_SKIP_Y_PIPE
199 { 0xC884, 0x00F2, WORD_LEN, 0}, // CAM_CORE_B_POWER_MODE
200 { 0xC886, 0x0000, WORD_LEN, 0}, // CAM_CORE_B_BIN_MODE
201 /*lzg@rock-chips.com, FIH:capture image to be mirrored and flipped */
202 #if CONFIG_SENSOR_NONE_FLIP_MIRROR
203 { 0xC888, 0x00, BYTE_LEN, 0}, // CAM_CORE_A_ORIENTATION
204 #elif CONFIG_SENSOR_MIRROR
205 { 0xC888, 0x01, BYTE_LEN, 0}, // CAM_CORE_A_ORIENTATION
206 #elif CONFIG_SENSOR_FLIPE
207 { 0xC888, 0x02, BYTE_LEN, 0}, // CAM_CORE_A_ORIENTATION
208 #elif CONFIG_SENSOR_MIRROR_AND_FLIPE
209 { 0xC888, 0x03, BYTE_LEN, 0}, // CAM_CORE_A_ORIENTATION
211 { 0xC889, 0x00, BYTE_LEN, 0}, // CAM_CORE_B_PIXEL_ORDER
212 { 0xC88A, 0x009C, WORD_LEN, 0}, // CAM_CORE_B_FINE_CORRECTION
213 { 0xC88C, 0x034A, WORD_LEN, 0}, // CAM_CORE_B_FINE_ITMIN
214 { 0xC890, 0x0000, WORD_LEN, 0}, // CAM_CORE_B_COARSE_ITMIN
215 { 0xC892, 0x0001, WORD_LEN, 0}, // CAM_CORE_B_COARSE_ITMAX_MARGIN
216 { 0xC894, 0x07EF, WORD_LEN, 0}, // CAM_CORE_B_MIN_FRAME_LENGTH_LINES
217 { 0xC896, 0xFFFF, WORD_LEN, 0}, // CAM_CORE_B_MAX_FRAME_LENGTH_LINES
218 { 0xC898, 0x082F, WORD_LEN, 0}, // CAM_CORE_B_BASE_FRAME_LENGTH_LINES
219 { 0xC89A, 0x1964, WORD_LEN, 0}, // CAM_CORE_B_MIN_LINE_LENGTH_PCLK
220 { 0xC89C, 0xFFFE, WORD_LEN, 0}, // CAM_CORE_B_MAX_LINE_LENGTH_PCLK
221 { 0xC89E, 0x7F7F, WORD_LEN, 0}, // CAM_CORE_B_P4_5_6_DIVIDER
222 { 0xC8A0, 0x07EF, WORD_LEN, 0}, // CAM_CORE_B_FRAME_LENGTH_LINES
223 { 0xC8A2, 0x1964, WORD_LEN, 0}, // CAM_CORE_B_LINE_LENGTH_PCK
224 { 0xC8A4, 0x0A28, WORD_LEN, 0}, // CAM_CORE_B_OUTPUT_SIZE_WIDTH
225 { 0xC8A6, 0x07A0, WORD_LEN, 0}, // CAM_CORE_B_OUTPUT_SIZE_HEIGHT
226 { 0xC8A8, 0x0124, WORD_LEN, 0}, // CAM_CORE_B_RX_FIFO_TRIGGER_MARK
227 { 0xC890, 0x0003, WORD_LEN, 0}, // CAM_CORE_B_COARSE_ITMIN
228 { 0xC8C0, 0x0A20, WORD_LEN, 0}, // CAM_OUTPUT_1_IMAGE_WIDTH
229 { 0xC8C2, 0x0798, WORD_LEN, 0}, // CAM_OUTPUT_1_IMAGE_HEIGHT
230 { 0xC89A, 0x1964, WORD_LEN, 0}, // CAM_CORE_B_MIN_LINE_LENGTH_PCLK
231 { 0xC8A2, 0x1964, WORD_LEN, 0}, // CAM_CORE_B_LINE_LENGTH_PCK
232 { 0xC8C4, 0x0001, WORD_LEN, 0}, // CAM_OUTPUT_1_OUTPUT_FORMAT
233 { 0xC8C6, 0x0000, WORD_LEN, 0}, // CAM_OUTPUT_1_OUTPUT_FORMAT_ORDER
234 { 0xC8CE, 0x0014, WORD_LEN, 0}, // CAM_OUTPUT_1_JPEG_CONTROL
235 { 0xD822, 0x4610, WORD_LEN, 0}, // JPEG_JPSS_CTRL_VAR
236 { 0x3330, 0x0000, WORD_LEN, 0}, // OUTPUT_FORMAT_TEST
237 { 0x098E, 0xA00E, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS
238 { 0xA00E, 0x32, BYTE_LEN, 0}, // FD_MAX_NUM_AUTOCOR_FUNC_VALUES_TO_CHECK
239 { 0xA010, 0x00CC, WORD_LEN, 0}, // FD_MIN_EXPECTED50HZ_FLICKER_PERIOD
240 { 0xA012, 0x00E0, WORD_LEN, 0}, // FD_MAX_EXPECTED50HZ_FLICKER_PERIOD
241 { 0xA014, 0x00A8, WORD_LEN, 0}, // FD_MIN_EXPECTED60HZ_FLICKER_PERIOD
242 { 0xA016, 0x00BC, WORD_LEN, 0}, // FD_MAX_EXPECTED60HZ_FLICKER_PERIOD
243 { 0xA018, 0x00D6, WORD_LEN, 0}, // FD_EXPECTED50HZ_FLICKER_PERIOD_IN_CONTEXT_A
244 { 0xA01A, 0x0075, WORD_LEN, 0}, // FD_EXPECTED50HZ_FLICKER_PERIOD_IN_CONTEXT_B
245 { 0xA01C, 0x00B2, WORD_LEN, 0}, // FD_EXPECTED60HZ_FLICKER_PERIOD_IN_CONTEXT_A
246 { 0xA01E, 0x0062, WORD_LEN, 0}, // FD_EXPECTED60HZ_FLICKER_PERIOD_IN_CONTEXT_B
247 { 0xA000, 0x10, BYTE_LEN, 0}, // FD_STATUS
248 { 0x8417, 0x02, BYTE_LEN, 0}, // SEQ_STATE_CFG_1_FD
249 { 0x8404, 0x06, BYTE_LEN, 0}, // SEQ_CMD
250 //////{ SEQUENCE_WAIT_MS,300, BYTE_LEN, 0},
251 { SEQUENCE_WAIT_MS,100, BYTE_LEN, 0},
252 //[Step3-Recommended]
253 //[k28a_rev3_FW_patch7]
254 // k28a_rev03_patch07_CR30221_MCNEX_AWB_AFNOISE_YOFFSET_APGA_REV1
255 { 0x0982, 0x0000, WORD_LEN, 0}, // ACCESS_CTL_STAT
256 { 0x098A, 0x0000, WORD_LEN, 0}, // PHYSICAL_ADDRESS_ACCESS
257 { 0x886C, 0xC0F1, WORD_LEN, 0},
258 { 0x886E, 0xC5E1, WORD_LEN, 0},
259 { 0x8870, 0x246A, WORD_LEN, 0},
260 { 0x8872, 0x1280, WORD_LEN, 0},
261 { 0x8874, 0xC4E1, WORD_LEN, 0},
262 { 0x8876, 0xD20F, WORD_LEN, 0},
263 { 0x8878, 0x2069, WORD_LEN, 0},
264 { 0x887A, 0x0000, WORD_LEN, 0},
265 { 0x887C, 0x6A62, WORD_LEN, 0},
266 { 0x887E, 0x1303, WORD_LEN, 0},
267 { 0x8880, 0x0084, WORD_LEN, 0},
268 { 0x8882, 0x1734, WORD_LEN, 0},
269 { 0x8884, 0x7005, WORD_LEN, 0},
270 { 0x8886, 0xD801, WORD_LEN, 0},
271 { 0x8888, 0x8A41, WORD_LEN, 0},
272 { 0x888A, 0xD900, WORD_LEN, 0},
273 { 0x888C, 0x0D5A, WORD_LEN, 0},
274 { 0x888E, 0x0664, WORD_LEN, 0},
275 { 0x8890, 0x8B61, WORD_LEN, 0},
276 { 0x8892, 0xE80B, WORD_LEN, 0},
277 { 0x8894, 0x000D, WORD_LEN, 0},
278 { 0x8896, 0x0020, WORD_LEN, 0},
279 { 0x8898, 0xD508, WORD_LEN, 0},
280 { 0x889A, 0x1504, WORD_LEN, 0},
281 { 0x889C, 0x1400, WORD_LEN, 0},
282 { 0x889E, 0x7840, WORD_LEN, 0},
283 { 0x88A0, 0xD007, WORD_LEN, 0},
284 { 0x88A2, 0x0DFB, WORD_LEN, 0},
285 { 0x88A4, 0x9004, WORD_LEN, 0},
286 { 0x88A6, 0xC4C1, WORD_LEN, 0},
287 { 0x88A8, 0x2029, WORD_LEN, 0},
288 { 0x88AA, 0x0300, WORD_LEN, 0},
289 { 0x88AC, 0x0219, WORD_LEN, 0},
290 { 0x88AE, 0x06C4, WORD_LEN, 0},
291 { 0x88B0, 0xFF80, WORD_LEN, 0},
292 { 0x88B2, 0x08C8, WORD_LEN, 0},
293 { 0x88B4, 0xFF80, WORD_LEN, 0},
294 { 0x88B6, 0x086C, WORD_LEN, 0},
295 { 0x88B8, 0xFF80, WORD_LEN, 0},
296 { 0x88BA, 0x08C0, WORD_LEN, 0},
297 { 0x88BC, 0xFF80, WORD_LEN, 0},
298 { 0x88BE, 0x08C8, WORD_LEN, 0},
299 { 0x88C0, 0xFF80, WORD_LEN, 0},
300 { 0x88C2, 0x08D0, WORD_LEN, 0},
301 { 0x88C4, 0xFF80, WORD_LEN, 0},
302 { 0x88C6, 0x0978, WORD_LEN, 0},
303 { 0x88C8, 0x0007, WORD_LEN, 0},
304 { 0x88CA, 0x0001, WORD_LEN, 0},
305 { 0x88CC, 0x0000, WORD_LEN, 0},
306 { 0x88CE, 0x0000, WORD_LEN, 0},
307 { 0x88D0, 0xC0F1, WORD_LEN, 0},
308 { 0x88D2, 0x097E, WORD_LEN, 0},
309 { 0x88D4, 0x06E4, WORD_LEN, 0},
310 { 0x88D6, 0xDA14, WORD_LEN, 0},
311 { 0x88D8, 0xD0C8, WORD_LEN, 0},
312 { 0x88DA, 0xDE00, WORD_LEN, 0},
313 { 0x88DC, 0xD1C8, WORD_LEN, 0},
314 { 0x88DE, 0x2E41, WORD_LEN, 0},
315 { 0x88E0, 0x120C, WORD_LEN, 0},
316 { 0x88E2, 0xA895, WORD_LEN, 0},
317 { 0x88E4, 0xD5C7, WORD_LEN, 0},
318 { 0x88E6, 0xA8D4, WORD_LEN, 0},
319 { 0x88E8, 0xA8D6, WORD_LEN, 0},
320 { 0x88EA, 0x0F0A, WORD_LEN, 0},
321 { 0x88EC, 0x06A4, WORD_LEN, 0},
322 { 0x88EE, 0x2555, WORD_LEN, 0},
323 { 0x88F0, 0x1440, WORD_LEN, 0},
324 { 0x88F2, 0xD0C5, WORD_LEN, 0},
325 { 0x88F4, 0x2555, WORD_LEN, 0},
326 { 0x88F6, 0x1441, WORD_LEN, 0},
327 { 0x88F8, 0x77A9, WORD_LEN, 0},
328 { 0x88FA, 0xA515, WORD_LEN, 0},
329 { 0x88FC, 0xD0C3, WORD_LEN, 0},
330 { 0x88FE, 0xA020, WORD_LEN, 0},
331 { 0x8900, 0xD1C3, WORD_LEN, 0},
332 { 0x8902, 0x70E9, WORD_LEN, 0},
333 { 0x8904, 0x0EEE, WORD_LEN, 0},
334 { 0x8906, 0x06A4, WORD_LEN, 0},
335 { 0x8908, 0xDA44, WORD_LEN, 0},
336 { 0x890A, 0xD0C2, WORD_LEN, 0},
337 { 0x890C, 0xD1C2, WORD_LEN, 0},
338 { 0x890E, 0xA502, WORD_LEN, 0},
339 { 0x8910, 0xD0C2, WORD_LEN, 0},
340 { 0x8912, 0xA0E0, WORD_LEN, 0},
341 { 0x8914, 0xD0C2, WORD_LEN, 0},
342 { 0x8916, 0xB0CB, WORD_LEN, 0},
343 { 0x8918, 0x8900, WORD_LEN, 0},
344 { 0x891A, 0xDB08, WORD_LEN, 0},
345 { 0x891C, 0xDAF0, WORD_LEN, 0},
346 { 0x891E, 0x19B0, WORD_LEN, 0},
347 { 0x8920, 0x00C2, WORD_LEN, 0},
348 { 0x8922, 0xB8A6, WORD_LEN, 0},
349 { 0x8924, 0xA900, WORD_LEN, 0},
350 { 0x8926, 0xD851, WORD_LEN, 0},
351 { 0x8928, 0x19B2, WORD_LEN, 0},
352 { 0x892A, 0x0002, WORD_LEN, 0},
353 { 0x892C, 0xD852, WORD_LEN, 0},
354 { 0x892E, 0x19B3, WORD_LEN, 0},
355 { 0x8930, 0x0002, WORD_LEN, 0},
356 { 0x8932, 0xD855, WORD_LEN, 0},
357 { 0x8934, 0x19B6, WORD_LEN, 0},
358 { 0x8936, 0x0002, WORD_LEN, 0},
359 { 0x8938, 0xD856, WORD_LEN, 0},
360 { 0x893A, 0x19B7, WORD_LEN, 0},
361 { 0x893C, 0x0002, WORD_LEN, 0},
362 { 0x893E, 0xD896, WORD_LEN, 0},
363 { 0x8940, 0x19B8, WORD_LEN, 0},
364 { 0x8942, 0x0004, WORD_LEN, 0},
365 { 0x8944, 0xD814, WORD_LEN, 0},
366 { 0x8946, 0x19BA, WORD_LEN, 0},
367 { 0x8948, 0x0004, WORD_LEN, 0},
368 { 0x894A, 0xD805, WORD_LEN, 0},
369 { 0x894C, 0xB111, WORD_LEN, 0},
370 { 0x894E, 0x19B1, WORD_LEN, 0},
371 { 0x8950, 0x0082, WORD_LEN, 0},
372 { 0x8952, 0x19B4, WORD_LEN, 0},
373 { 0x8954, 0x00C2, WORD_LEN, 0},
374 { 0x8956, 0x19B5, WORD_LEN, 0},
375 { 0x8958, 0x0082, WORD_LEN, 0},
376 { 0x895A, 0xD1B2, WORD_LEN, 0},
377 { 0x895C, 0x2556, WORD_LEN, 0},
378 { 0x895E, 0x12C0, WORD_LEN, 0},
379 { 0x8960, 0x0E92, WORD_LEN, 0},
380 { 0x8962, 0x06A4, WORD_LEN, 0},
381 { 0x8964, 0xDA2C, WORD_LEN, 0},
382 { 0x8966, 0xD0B0, WORD_LEN, 0},
383 { 0x8968, 0x2556, WORD_LEN, 0},
384 { 0x896A, 0x12C1, WORD_LEN, 0},
385 { 0x896C, 0xA519, WORD_LEN, 0},
386 { 0x896E, 0xD0AF, WORD_LEN, 0},
387 { 0x8970, 0x0145, WORD_LEN, 0},
388 { 0x8972, 0x06E4, WORD_LEN, 0},
389 { 0x8974, 0xA020, WORD_LEN, 0},
390 { 0x8976, 0x78E0, WORD_LEN, 0},
391 { 0x8978, 0xC0F1, WORD_LEN, 0},
392 { 0x897A, 0xD0AD, WORD_LEN, 0},
393 { 0x897C, 0xD1AD, WORD_LEN, 0},
394 { 0x897E, 0xD2AE, WORD_LEN, 0},
395 { 0x8980, 0xA020, WORD_LEN, 0},
396 { 0x8982, 0x8A09, WORD_LEN, 0},
397 { 0x8984, 0x8A6A, WORD_LEN, 0},
398 { 0x8986, 0xB808, WORD_LEN, 0},
399 { 0x8988, 0x7865, WORD_LEN, 0},
400 { 0x898A, 0xB880, WORD_LEN, 0},
401 { 0x898C, 0x2841, WORD_LEN, 0},
402 { 0x898E, 0x020C, WORD_LEN, 0},
403 { 0x8990, 0xAA89, WORD_LEN, 0},
404 { 0x8992, 0xAA0A, WORD_LEN, 0},
405 { 0x8994, 0xD2A9, WORD_LEN, 0},
406 { 0x8996, 0x8A00, WORD_LEN, 0},
407 { 0x8998, 0x0809, WORD_LEN, 0},
408 { 0x899A, 0x01DE, WORD_LEN, 0},
409 { 0x899C, 0xB8A7, WORD_LEN, 0},
410 { 0x899E, 0xAA00, WORD_LEN, 0},
411 { 0x89A0, 0xDBFF, WORD_LEN, 0},
412 { 0x89A2, 0x2B41, WORD_LEN, 0},
413 { 0x89A4, 0x0200, WORD_LEN, 0},
414 { 0x89A6, 0xAA0C, WORD_LEN, 0},
415 { 0x89A8, 0x1228, WORD_LEN, 0},
416 { 0x89AA, 0x0080, WORD_LEN, 0},
417 { 0x89AC, 0xAA6D, WORD_LEN, 0},
418 { 0x89AE, 0x0815, WORD_LEN, 0},
419 { 0x89B0, 0x01DE, WORD_LEN, 0},
420 { 0x89B2, 0xB8A7, WORD_LEN, 0},
421 { 0x89B4, 0x1A28, WORD_LEN, 0},
422 { 0x89B6, 0x0002, WORD_LEN, 0},
423 { 0x89B8, 0x8123, WORD_LEN, 0},
424 { 0x89BA, 0x7960, WORD_LEN, 0},
425 { 0x89BC, 0x1228, WORD_LEN, 0},
426 { 0x89BE, 0x0080, WORD_LEN, 0},
427 { 0x89C0, 0xC0D1, WORD_LEN, 0},
428 { 0x89C2, 0x7EE0, WORD_LEN, 0},
429 { 0x89C4, 0xC0F1, WORD_LEN, 0},
430 { 0x89C6, 0x088E, WORD_LEN, 0},
431 { 0x89C8, 0x06E4, WORD_LEN, 0},
432 { 0x89CA, 0xDB03, WORD_LEN, 0},
433 { 0x89CC, 0xD29B, WORD_LEN, 0},
434 { 0x89CE, 0x8A2E, WORD_LEN, 0},
435 { 0x89D0, 0x8ACF, WORD_LEN, 0},
436 { 0x89D2, 0xB908, WORD_LEN, 0},
437 { 0x89D4, 0x79C5, WORD_LEN, 0},
438 { 0x89D6, 0xDD65, WORD_LEN, 0},
439 { 0x89D8, 0x094F, WORD_LEN, 0},
440 { 0x89DA, 0x00D1, WORD_LEN, 0},
441 { 0x89DC, 0xD90A, WORD_LEN, 0},
442 { 0x89DE, 0x1A24, WORD_LEN, 0},
443 { 0x89E0, 0x0042, WORD_LEN, 0},
444 { 0x89E2, 0x8A24, WORD_LEN, 0},
445 { 0x89E4, 0xE1E5, WORD_LEN, 0},
446 { 0x89E6, 0xF6C9, WORD_LEN, 0},
447 { 0x89E8, 0xD902, WORD_LEN, 0},
448 { 0x89EA, 0x2941, WORD_LEN, 0},
449 { 0x89EC, 0x0200, WORD_LEN, 0},
450 { 0x89EE, 0xAA0E, WORD_LEN, 0},
451 { 0x89F0, 0xAA2F, WORD_LEN, 0},
452 { 0x89F2, 0x70A9, WORD_LEN, 0},
453 { 0x89F4, 0xF014, WORD_LEN, 0},
454 { 0x89F6, 0xE1C8, WORD_LEN, 0},
455 { 0x89F8, 0x0036, WORD_LEN, 0},
456 { 0x89FA, 0x000B, WORD_LEN, 0},
457 { 0x89FC, 0xE0C8, WORD_LEN, 0},
458 { 0x89FE, 0x003A, WORD_LEN, 0},
459 { 0x8A00, 0x000A, WORD_LEN, 0},
460 { 0x8A02, 0xD901, WORD_LEN, 0},
461 { 0x8A04, 0x2941, WORD_LEN, 0},
462 { 0x8A06, 0x0200, WORD_LEN, 0},
463 { 0x8A08, 0xAA0E, WORD_LEN, 0},
464 { 0x8A0A, 0xAA2F, WORD_LEN, 0},
465 { 0x8A0C, 0xD848, WORD_LEN, 0},
466 { 0x8A0E, 0xF008, WORD_LEN, 0},
467 { 0x8A10, 0xD900, WORD_LEN, 0},
468 { 0x8A12, 0x2941, WORD_LEN, 0},
469 { 0x8A14, 0x0200, WORD_LEN, 0},
470 { 0x8A16, 0xAA0E, WORD_LEN, 0},
471 { 0x8A18, 0xAA2F, WORD_LEN, 0},
472 { 0x8A1A, 0xD820, WORD_LEN, 0},
473 { 0x8A1C, 0xD288, WORD_LEN, 0},
474 { 0x8A1E, 0x8A26, WORD_LEN, 0},
475 { 0x8A20, 0xB961, WORD_LEN, 0},
476 { 0x8A22, 0xAA26, WORD_LEN, 0},
477 { 0x8A24, 0xF00D, WORD_LEN, 0},
478 { 0x8A26, 0x091F, WORD_LEN, 0},
479 { 0x8A28, 0x0091, WORD_LEN, 0},
480 { 0x8A2A, 0x8A24, WORD_LEN, 0},
481 { 0x8A2C, 0xF1E5, WORD_LEN, 0},
482 { 0x8A2E, 0x0913, WORD_LEN, 0},
483 { 0x8A30, 0x0812, WORD_LEN, 0},
484 { 0x8A32, 0x08E1, WORD_LEN, 0},
485 { 0x8A34, 0x8812, WORD_LEN, 0},
486 { 0x8A36, 0x2B41, WORD_LEN, 0},
487 { 0x8A38, 0x0201, WORD_LEN, 0},
488 { 0x8A3A, 0xAA2E, WORD_LEN, 0},
489 { 0x8A3C, 0xAA6F, WORD_LEN, 0},
490 { 0x8A3E, 0x0081, WORD_LEN, 0},
491 { 0x8A40, 0x06C4, WORD_LEN, 0},
492 { 0x8A42, 0x09F7, WORD_LEN, 0},
493 { 0x8A44, 0x8051, WORD_LEN, 0},
494 { 0x8A46, 0x8A24, WORD_LEN, 0},
495 { 0x8A48, 0xF1F3, WORD_LEN, 0},
496 { 0x8A4A, 0x78E0, WORD_LEN, 0},
497 { 0x8A4C, 0xC0F1, WORD_LEN, 0},
498 { 0x8A4E, 0x0FFA, WORD_LEN, 0},
499 { 0x8A50, 0x0684, WORD_LEN, 0},
500 { 0x8A52, 0xD67A, WORD_LEN, 0},
501 { 0x8A54, 0x7508, WORD_LEN, 0},
502 { 0x8A56, 0x8E01, WORD_LEN, 0},
503 { 0x8A58, 0xD179, WORD_LEN, 0},
504 { 0x8A5A, 0x2046, WORD_LEN, 0},
505 { 0x8A5C, 0x00C0, WORD_LEN, 0},
506 { 0x8A5E, 0xAE01, WORD_LEN, 0},
507 { 0x8A60, 0x1145, WORD_LEN, 0},
508 { 0x8A62, 0x0080, WORD_LEN, 0},
509 { 0x8A64, 0x1146, WORD_LEN, 0},
510 { 0x8A66, 0x0082, WORD_LEN, 0},
511 { 0x8A68, 0xB808, WORD_LEN, 0},
512 { 0x8A6A, 0x7845, WORD_LEN, 0},
513 { 0x8A6C, 0x0817, WORD_LEN, 0},
514 { 0x8A6E, 0x001E, WORD_LEN, 0},
515 { 0x8A70, 0x8900, WORD_LEN, 0},
516 { 0x8A72, 0x8941, WORD_LEN, 0},
517 { 0x8A74, 0xB808, WORD_LEN, 0},
518 { 0x8A76, 0x7845, WORD_LEN, 0},
519 { 0x8A78, 0x080B, WORD_LEN, 0},
520 { 0x8A7A, 0x00DE, WORD_LEN, 0},
521 { 0x8A7C, 0x70A9, WORD_LEN, 0},
522 { 0x8A7E, 0xFFD2, WORD_LEN, 0},
523 { 0x8A80, 0x7508, WORD_LEN, 0},
524 { 0x8A82, 0x1604, WORD_LEN, 0},
525 { 0x8A84, 0x1090, WORD_LEN, 0},
526 { 0x8A86, 0x0D93, WORD_LEN, 0},
527 { 0x8A88, 0x1400, WORD_LEN, 0},
528 { 0x8A8A, 0x8EEA, WORD_LEN, 0},
529 { 0x8A8C, 0x8E0B, WORD_LEN, 0},
530 { 0x8A8E, 0x214A, WORD_LEN, 0},
531 { 0x8A90, 0x2040, WORD_LEN, 0},
532 { 0x8A92, 0x8E2D, WORD_LEN, 0},
533 { 0x8A94, 0xBF08, WORD_LEN, 0},
534 { 0x8A96, 0x7F05, WORD_LEN, 0},
535 { 0x8A98, 0x8E0C, WORD_LEN, 0},
536 { 0x8A9A, 0xB808, WORD_LEN, 0},
537 { 0x8A9C, 0x7825, WORD_LEN, 0},
538 { 0x8A9E, 0x7710, WORD_LEN, 0},
539 { 0x8AA0, 0x21C2, WORD_LEN, 0},
540 { 0x8AA2, 0x244C, WORD_LEN, 0},
541 { 0x8AA4, 0x081D, WORD_LEN, 0},
542 { 0x8AA6, 0x03E3, WORD_LEN, 0},
543 { 0x8AA8, 0xD9FF, WORD_LEN, 0},
544 { 0x8AAA, 0x2702, WORD_LEN, 0},
545 { 0x8AAC, 0x1002, WORD_LEN, 0},
546 { 0x8AAE, 0x2A05, WORD_LEN, 0},
547 { 0x8AB0, 0x037E, WORD_LEN, 0},
548 { 0x8AB2, 0x0876, WORD_LEN, 0},
549 { 0x8AB4, 0x06E4, WORD_LEN, 0},
550 { 0x8AB6, 0x702F, WORD_LEN, 0},
551 { 0x8AB8, 0x7810, WORD_LEN, 0},
552 { 0x8ABA, 0x7F02, WORD_LEN, 0},
553 { 0x8ABC, 0x7FF0, WORD_LEN, 0},
554 { 0x8ABE, 0xF00B, WORD_LEN, 0},
555 { 0x8AC0, 0x78E2, WORD_LEN, 0},
556 { 0x8AC2, 0x2805, WORD_LEN, 0},
557 { 0x8AC4, 0x037E, WORD_LEN, 0},
558 { 0x8AC6, 0x0862, WORD_LEN, 0},
559 { 0x8AC8, 0x06E4, WORD_LEN, 0},
560 { 0x8ACA, 0x702F, WORD_LEN, 0},
561 { 0x8ACC, 0x7810, WORD_LEN, 0},
562 { 0x8ACE, 0x671F, WORD_LEN, 0},
563 { 0x8AD0, 0x7FF0, WORD_LEN, 0},
564 { 0x8AD2, 0x7FEF, WORD_LEN, 0},
565 { 0x8AD4, 0x8E08, WORD_LEN, 0},
566 { 0x8AD6, 0xBF06, WORD_LEN, 0},
567 { 0x8AD8, 0xD15A, WORD_LEN, 0},
568 { 0x8ADA, 0xB8C3, WORD_LEN, 0},
569 { 0x8ADC, 0x78E5, WORD_LEN, 0},
570 { 0x8ADE, 0xB88F, WORD_LEN, 0},
571 { 0x8AE0, 0x1908, WORD_LEN, 0},
572 { 0x8AE2, 0x0024, WORD_LEN, 0},
573 { 0x8AE4, 0x2841, WORD_LEN, 0},
574 { 0x8AE6, 0x0201, WORD_LEN, 0},
575 { 0x8AE8, 0x1E26, WORD_LEN, 0},
576 { 0x8AEA, 0x1042, WORD_LEN, 0},
577 { 0x8AEC, 0x0D15, WORD_LEN, 0},
578 { 0x8AEE, 0x1423, WORD_LEN, 0},
579 { 0x8AF0, 0x1E27, WORD_LEN, 0},
580 { 0x8AF2, 0x1002, WORD_LEN, 0},
581 { 0x8AF4, 0x214C, WORD_LEN, 0},
582 { 0x8AF6, 0xA000, WORD_LEN, 0},
583 { 0x8AF8, 0x214A, WORD_LEN, 0},
584 { 0x8AFA, 0x2040, WORD_LEN, 0},
585 { 0x8AFC, 0x21C2, WORD_LEN, 0},
586 { 0x8AFE, 0x2442, WORD_LEN, 0},
587 { 0x8B00, 0x8E21, WORD_LEN, 0},
588 { 0x8B02, 0x214F, WORD_LEN, 0},
589 { 0x8B04, 0x0040, WORD_LEN, 0},
590 { 0x8B06, 0x090F, WORD_LEN, 0},
591 { 0x8B08, 0x2010, WORD_LEN, 0},
592 { 0x8B0A, 0x2145, WORD_LEN, 0},
593 { 0x8B0C, 0x0181, WORD_LEN, 0},
594 { 0x8B0E, 0xAE21, WORD_LEN, 0},
595 { 0x8B10, 0xF003, WORD_LEN, 0},
596 { 0x8B12, 0xB8A2, WORD_LEN, 0},
597 { 0x8B14, 0xAE01, WORD_LEN, 0},
598 { 0x8B16, 0x0BFA, WORD_LEN, 0},
599 { 0x8B18, 0xFFE3, WORD_LEN, 0},
600 { 0x8B1A, 0x70A9, WORD_LEN, 0},
601 { 0x8B1C, 0x0789, WORD_LEN, 0},
602 { 0x8B1E, 0x0684, WORD_LEN, 0},
603 { 0x8B20, 0xD149, WORD_LEN, 0},
604 { 0x8B22, 0xD24A, WORD_LEN, 0},
605 { 0x8B24, 0x11B2, WORD_LEN, 0},
606 { 0x8B26, 0x8903, WORD_LEN, 0},
607 { 0x8B28, 0x1252, WORD_LEN, 0},
608 { 0x8B2A, 0x0100, WORD_LEN, 0},
609 { 0x8B2C, 0x7B6F, WORD_LEN, 0},
610 { 0x8B2E, 0xB808, WORD_LEN, 0},
611 { 0x8B30, 0x2004, WORD_LEN, 0},
612 { 0x8B32, 0x0F80, WORD_LEN, 0},
613 { 0x8B34, 0x0000, WORD_LEN, 0},
614 { 0x8B36, 0xFF00, WORD_LEN, 0},
615 { 0x8B38, 0x7865, WORD_LEN, 0},
616 { 0x8B3A, 0x19B2, WORD_LEN, 0},
617 { 0x8B3C, 0x8024, WORD_LEN, 0},
618 { 0x8B3E, 0xD044, WORD_LEN, 0},
619 { 0x8B40, 0x8801, WORD_LEN, 0},
620 { 0x8B42, 0xB8E1, WORD_LEN, 0},
621 { 0x8B44, 0xD800, WORD_LEN, 0},
622 { 0x8B46, 0xF404, WORD_LEN, 0},
623 { 0x8B48, 0x1234, WORD_LEN, 0},
624 { 0x8B4A, 0x0080, WORD_LEN, 0},
625 { 0x8B4C, 0x1955, WORD_LEN, 0},
626 { 0x8B4E, 0x803C, WORD_LEN, 0},
627 { 0x8B50, 0x1233, WORD_LEN, 0},
628 { 0x8B52, 0x0080, WORD_LEN, 0},
629 { 0x8B54, 0xB802, WORD_LEN, 0},
630 { 0x8B56, 0x1957, WORD_LEN, 0},
631 { 0x8B58, 0x803C, WORD_LEN, 0},
632 { 0x8B5A, 0x1958, WORD_LEN, 0},
633 { 0x8B5C, 0x803C, WORD_LEN, 0},
634 { 0x8B5E, 0x1959, WORD_LEN, 0},
635 { 0x8B60, 0x803C, WORD_LEN, 0},
636 { 0x8B62, 0x195A, WORD_LEN, 0},
637 { 0x8B64, 0x803C, WORD_LEN, 0},
638 { 0x8B66, 0x7EE0, WORD_LEN, 0},
639 { 0x8B68, 0xC0F1, WORD_LEN, 0},
640 { 0x8B6A, 0x0EE6, WORD_LEN, 0},
641 { 0x8B6C, 0x0684, WORD_LEN, 0},
642 { 0x8B6E, 0xD523, WORD_LEN, 0},
643 { 0x8B70, 0x8D2C, WORD_LEN, 0},
644 { 0x8B72, 0x0983, WORD_LEN, 0},
645 { 0x8B74, 0x0010, WORD_LEN, 0},
646 { 0x8B76, 0xD236, WORD_LEN, 0},
647 { 0x8B78, 0x123A, WORD_LEN, 0},
648 { 0x8B7A, 0x0083, WORD_LEN, 0},
649 { 0x8B7C, 0x123B, WORD_LEN, 0},
650 { 0x8B7E, 0x008F, WORD_LEN, 0},
651 { 0x8B80, 0x8D55, WORD_LEN, 0},
652 { 0x8B82, 0xBB08, WORD_LEN, 0},
653 { 0x8B84, 0x7BE5, WORD_LEN, 0},
654 { 0x8B86, 0x8DF6, WORD_LEN, 0},
655 { 0x8B88, 0xBA08, WORD_LEN, 0},
656 { 0x8B8A, 0x7AE5, WORD_LEN, 0},
657 { 0x8B8C, 0x0B0D, WORD_LEN, 0},
658 { 0x8B8E, 0x00A3, WORD_LEN, 0},
659 { 0x8B90, 0x8DC5, WORD_LEN, 0},
660 { 0x8B92, 0x8D54, WORD_LEN, 0},
661 { 0x8B94, 0xAD45, WORD_LEN, 0},
662 { 0x8B96, 0xF026, WORD_LEN, 0},
663 { 0x8B98, 0x65DB, WORD_LEN, 0},
664 { 0x8B9A, 0x8B6D, WORD_LEN, 0},
665 { 0x8B9C, 0x0815, WORD_LEN, 0},
666 { 0x8B9E, 0x00E2, WORD_LEN, 0},
667 { 0x8BA0, 0x65DA, WORD_LEN, 0},
668 { 0x8BA2, 0x8A51, WORD_LEN, 0},
669 { 0x8BA4, 0x0A0D, WORD_LEN, 0},
670 { 0x8BA6, 0x0002, WORD_LEN, 0},
671 { 0x8BA8, 0xE683, WORD_LEN, 0},
672 { 0x8BAA, 0x22CA, WORD_LEN, 0},
673 { 0x8BAC, 0x038B, WORD_LEN, 0},
674 { 0x8BAE, 0xF69A, WORD_LEN, 0},
675 { 0x8BB0, 0xDA00, WORD_LEN, 0},
676 { 0x8BB2, 0xAD45, WORD_LEN, 0},
677 { 0x8BB4, 0x2540, WORD_LEN, 0},
678 { 0x8BB6, 0x1343, WORD_LEN, 0},
679 { 0x8BB8, 0xE180, WORD_LEN, 0},
680 { 0x8BBA, 0x2540, WORD_LEN, 0},
681 { 0x8BBC, 0x144F, WORD_LEN, 0},
682 { 0x8BBE, 0xF6D2, WORD_LEN, 0},
683 { 0x8BC0, 0x719F, WORD_LEN, 0},
684 { 0x8BC2, 0x78E0, WORD_LEN, 0},
685 { 0x8BC4, 0x20A8, WORD_LEN, 0},
686 { 0x8BC6, 0x0280, WORD_LEN, 0},
687 { 0x8BC8, 0x8B20, WORD_LEN, 0},
688 { 0x8BCA, 0x0813, WORD_LEN, 0},
689 { 0x8BCC, 0x0043, WORD_LEN, 0},
690 { 0x8BCE, 0xE201, WORD_LEN, 0},
691 { 0x8BD0, 0x7A4F, WORD_LEN, 0},
692 { 0x8BD2, 0xAD45, WORD_LEN, 0},
693 { 0x8BD4, 0xE301, WORD_LEN, 0},
694 { 0x8BD6, 0xE701, WORD_LEN, 0},
695 { 0x8BD8, 0xF004, WORD_LEN, 0},
696 { 0x8BDA, 0x8F20, WORD_LEN, 0},
697 { 0x8BDC, 0x09F3, WORD_LEN, 0},
698 { 0x8BDE, 0x8002, WORD_LEN, 0},
699 { 0x8BE0, 0xD01C, WORD_LEN, 0},
700 { 0x8BE2, 0x8800, WORD_LEN, 0},
701 { 0x8BE4, 0xE803, WORD_LEN, 0},
702 { 0x8BE6, 0x0E0F, WORD_LEN, 0},
703 { 0x8BE8, 0x1080, WORD_LEN, 0},
704 { 0x8BEA, 0xD008, WORD_LEN, 0},
705 { 0x8BEC, 0x8000, WORD_LEN, 0},
706 { 0x8BEE, 0x8002, WORD_LEN, 0},
707 { 0x8BF0, 0x7840, WORD_LEN, 0},
708 { 0x8BF2, 0x06C5, WORD_LEN, 0},
709 { 0x8BF4, 0x0684, WORD_LEN, 0},
710 { 0x8BF6, 0x78E0, WORD_LEN, 0},
711 { 0x8BF8, 0xFF80, WORD_LEN, 0},
712 { 0x8BFA, 0x0644, WORD_LEN, 0},
713 { 0x8BFC, 0x0000, WORD_LEN, 0},
714 { 0x8BFE, 0xF978, WORD_LEN, 0},
715 { 0x8C00, 0xFF80, WORD_LEN, 0},
716 { 0x8C02, 0x0E00, WORD_LEN, 0},
717 { 0x8C04, 0xFF80, WORD_LEN, 0},
718 { 0x8C06, 0x0B68, WORD_LEN, 0},
719 { 0x8C08, 0x8000, WORD_LEN, 0},
720 { 0x8C0A, 0x0164, WORD_LEN, 0},
721 { 0x8C0C, 0x0000, WORD_LEN, 0},
722 { 0x8C0E, 0xF9AC, WORD_LEN, 0},
723 { 0x8C10, 0xFF80, WORD_LEN, 0},
724 { 0x8C12, 0x0B20, WORD_LEN, 0},
725 { 0x8C14, 0xFF80, WORD_LEN, 0},
726 { 0x8C16, 0x0314, WORD_LEN, 0},
727 { 0x8C18, 0x8000, WORD_LEN, 0},
728 { 0x8C1A, 0x016C, WORD_LEN, 0},
729 { 0x8C1C, 0xFF80, WORD_LEN, 0},
730 { 0x8C1E, 0x0694, WORD_LEN, 0},
731 { 0x8C20, 0x0000, WORD_LEN, 0},
732 { 0x8C22, 0xF444, WORD_LEN, 0},
733 { 0x8C24, 0xFF80, WORD_LEN, 0},
734 { 0x8C26, 0x0C54, WORD_LEN, 0},
735 { 0x8C28, 0x8000, WORD_LEN, 0},
736 { 0x8C2A, 0x009C, WORD_LEN, 0},
737 { 0x8C2C, 0x8000, WORD_LEN, 0},
738 { 0x8C2E, 0x0008, WORD_LEN, 0},
739 { 0x8C30, 0xFF80, WORD_LEN, 0},
740 { 0x8C32, 0x0DF0, WORD_LEN, 0},
741 { 0x8C34, 0xFF80, WORD_LEN, 0},
742 { 0x8C36, 0x02CC, WORD_LEN, 0},
743 { 0x8C38, 0xFF80, WORD_LEN, 0},
744 { 0x8C3A, 0x0158, WORD_LEN, 0},
745 { 0x8C3C, 0xFF80, WORD_LEN, 0},
746 { 0x8C3E, 0x0290, WORD_LEN, 0},
747 { 0x8C40, 0xFF00, WORD_LEN, 0},
748 { 0x8C42, 0x0618, WORD_LEN, 0},
749 { 0x8C44, 0xFF00, WORD_LEN, 0},
750 { 0x8C46, 0x33CC, WORD_LEN, 0},
751 { 0x8C48, 0xFF80, WORD_LEN, 0},
752 { 0x8C4A, 0x0658, WORD_LEN, 0},
753 { 0x8C4C, 0xFF80, WORD_LEN, 0},
754 { 0x8C4E, 0x0250, WORD_LEN, 0},
755 { 0x8C50, 0x8000, WORD_LEN, 0},
756 { 0x8C52, 0x0168, WORD_LEN, 0},
757 { 0x8C54, 0xC0F1, WORD_LEN, 0},
758 { 0x8C56, 0x0DFE, WORD_LEN, 0},
759 { 0x8C58, 0x0684, WORD_LEN, 0},
760 { 0x8C5A, 0x17BC, WORD_LEN, 0},
761 { 0x8C5C, 0xF00E, WORD_LEN, 0},
762 { 0x8C5E, 0x8E01, WORD_LEN, 0},
763 { 0x8C60, 0xB8A4, WORD_LEN, 0},
764 { 0x8C62, 0xAE01, WORD_LEN, 0},
765 { 0x8C64, 0x8E09, WORD_LEN, 0},
766 { 0x8C66, 0xB8E0, WORD_LEN, 0},
767 { 0x8C68, 0xF29B, WORD_LEN, 0},
768 { 0x8C6A, 0x17E4, WORD_LEN, 0},
769 { 0x8C6C, 0xF00D, WORD_LEN, 0},
770 { 0x8C6E, 0x153A, WORD_LEN, 0},
771 { 0x8C70, 0x1080, WORD_LEN, 0},
772 { 0x8C72, 0x153B, WORD_LEN, 0},
773 { 0x8C74, 0x1081, WORD_LEN, 0},
774 { 0x8C76, 0xB808, WORD_LEN, 0},
775 { 0x8C78, 0x7825, WORD_LEN, 0},
776 { 0x8C7A, 0x16B8, WORD_LEN, 0},
777 { 0x8C7C, 0x1101, WORD_LEN, 0},
778 { 0x8C7E, 0x092D, WORD_LEN, 0},
779 { 0x8C80, 0x0003, WORD_LEN, 0},
780 { 0x8C82, 0x16B0, WORD_LEN, 0},
781 { 0x8C84, 0x1082, WORD_LEN, 0},
782 { 0x8C86, 0x1E3C, WORD_LEN, 0},
783 { 0x8C88, 0x1082, WORD_LEN, 0},
784 { 0x8C8A, 0x16B1, WORD_LEN, 0},
785 { 0x8C8C, 0x1082, WORD_LEN, 0},
786 { 0x8C8E, 0x1E3D, WORD_LEN, 0},
787 { 0x8C90, 0x1082, WORD_LEN, 0},
788 { 0x8C92, 0x16B4, WORD_LEN, 0},
789 { 0x8C94, 0x1082, WORD_LEN, 0},
790 { 0x8C96, 0x1E3E, WORD_LEN, 0},
791 { 0x8C98, 0x1082, WORD_LEN, 0},
792 { 0x8C9A, 0x16B5, WORD_LEN, 0},
793 { 0x8C9C, 0x1082, WORD_LEN, 0},
794 { 0x8C9E, 0x1E3F, WORD_LEN, 0},
795 { 0x8CA0, 0x1082, WORD_LEN, 0},
796 { 0x8CA2, 0x8E40, WORD_LEN, 0},
797 { 0x8CA4, 0xBAA6, WORD_LEN, 0},
798 { 0x8CA6, 0xAE40, WORD_LEN, 0},
799 { 0x8CA8, 0x098F, WORD_LEN, 0},
800 { 0x8CAA, 0x0022, WORD_LEN, 0},
801 { 0x8CAC, 0x16BA, WORD_LEN, 0},
802 { 0x8CAE, 0x1102, WORD_LEN, 0},
803 { 0x8CB0, 0x0A87, WORD_LEN, 0},
804 { 0x8CB2, 0x0003, WORD_LEN, 0},
805 { 0x8CB4, 0x16B2, WORD_LEN, 0},
806 { 0x8CB6, 0x1084, WORD_LEN, 0},
807 { 0x8CB8, 0x0F2E, WORD_LEN, 0},
808 { 0x8CBA, 0x0664, WORD_LEN, 0},
809 { 0x8CBC, 0x16B0, WORD_LEN, 0},
810 { 0x8CBE, 0x1083, WORD_LEN, 0},
811 { 0x8CC0, 0x1E3C, WORD_LEN, 0},
812 { 0x8CC2, 0x1002, WORD_LEN, 0},
813 { 0x8CC4, 0x153A, WORD_LEN, 0},
814 { 0x8CC6, 0x1080, WORD_LEN, 0},
815 { 0x8CC8, 0x153B, WORD_LEN, 0},
816 { 0x8CCA, 0x1081, WORD_LEN, 0},
817 { 0x8CCC, 0x16B3, WORD_LEN, 0},
818 { 0x8CCE, 0x1084, WORD_LEN, 0},
819 { 0x8CD0, 0xB808, WORD_LEN, 0},
820 { 0x8CD2, 0x7825, WORD_LEN, 0},
821 { 0x8CD4, 0x16B8, WORD_LEN, 0},
822 { 0x8CD6, 0x1101, WORD_LEN, 0},
823 { 0x8CD8, 0x16BA, WORD_LEN, 0},
824 { 0x8CDA, 0x1102, WORD_LEN, 0},
825 { 0x8CDC, 0x0F0A, WORD_LEN, 0},
826 { 0x8CDE, 0x0664, WORD_LEN, 0},
827 { 0x8CE0, 0x16B1, WORD_LEN, 0},
828 { 0x8CE2, 0x1083, WORD_LEN, 0},
829 { 0x8CE4, 0x1E3D, WORD_LEN, 0},
830 { 0x8CE6, 0x1002, WORD_LEN, 0},
831 { 0x8CE8, 0x153A, WORD_LEN, 0},
832 { 0x8CEA, 0x1080, WORD_LEN, 0},
833 { 0x8CEC, 0x153B, WORD_LEN, 0},
834 { 0x8CEE, 0x1081, WORD_LEN, 0},
835 { 0x8CF0, 0x16B6, WORD_LEN, 0},
836 { 0x8CF2, 0x1084, WORD_LEN, 0},
837 { 0x8CF4, 0xB808, WORD_LEN, 0},
838 { 0x8CF6, 0x7825, WORD_LEN, 0},
839 { 0x8CF8, 0x16B8, WORD_LEN, 0},
840 { 0x8CFA, 0x1101, WORD_LEN, 0},
841 { 0x8CFC, 0x16BA, WORD_LEN, 0},
842 { 0x8CFE, 0x1102, WORD_LEN, 0},
843 { 0x8D00, 0x0EE6, WORD_LEN, 0},
844 { 0x8D02, 0x0664, WORD_LEN, 0},
845 { 0x8D04, 0x16B4, WORD_LEN, 0},
846 { 0x8D06, 0x1083, WORD_LEN, 0},
847 { 0x8D08, 0x1E3E, WORD_LEN, 0},
848 { 0x8D0A, 0x1002, WORD_LEN, 0},
849 { 0x8D0C, 0x153A, WORD_LEN, 0},
850 { 0x8D0E, 0x1080, WORD_LEN, 0},
851 { 0x8D10, 0x153B, WORD_LEN, 0},
852 { 0x8D12, 0x1081, WORD_LEN, 0},
853 { 0x8D14, 0x16B7, WORD_LEN, 0},
854 { 0x8D16, 0x1084, WORD_LEN, 0},
855 { 0x8D18, 0xB808, WORD_LEN, 0},
856 { 0x8D1A, 0x7825, WORD_LEN, 0},
857 { 0x8D1C, 0x16B8, WORD_LEN, 0},
858 { 0x8D1E, 0x1101, WORD_LEN, 0},
859 { 0x8D20, 0x16BA, WORD_LEN, 0},
860 { 0x8D22, 0x1102, WORD_LEN, 0},
861 { 0x8D24, 0x0EC2, WORD_LEN, 0},
862 { 0x8D26, 0x0664, WORD_LEN, 0},
863 { 0x8D28, 0x16B5, WORD_LEN, 0},
864 { 0x8D2A, 0x1083, WORD_LEN, 0},
865 { 0x8D2C, 0x1E3F, WORD_LEN, 0},
866 { 0x8D2E, 0x1002, WORD_LEN, 0},
867 { 0x8D30, 0x8E00, WORD_LEN, 0},
868 { 0x8D32, 0xB8A6, WORD_LEN, 0},
869 { 0x8D34, 0xAE00, WORD_LEN, 0},
870 { 0x8D36, 0x153A, WORD_LEN, 0},
871 { 0x8D38, 0x1081, WORD_LEN, 0},
872 { 0x8D3A, 0x153B, WORD_LEN, 0},
873 { 0x8D3C, 0x1080, WORD_LEN, 0},
874 { 0x8D3E, 0xB908, WORD_LEN, 0},
875 { 0x8D40, 0x7905, WORD_LEN, 0},
876 { 0x8D42, 0x16BA, WORD_LEN, 0},
877 { 0x8D44, 0x1100, WORD_LEN, 0},
878 { 0x8D46, 0x085B, WORD_LEN, 0},
879 { 0x8D48, 0x0042, WORD_LEN, 0},
880 { 0x8D4A, 0xD018, WORD_LEN, 0},
881 { 0x8D4C, 0x9E31, WORD_LEN, 0},
882 { 0x8D4E, 0x904D, WORD_LEN, 0},
883 { 0x8D50, 0x0A2B, WORD_LEN, 0},
884 { 0x8D52, 0x0063, WORD_LEN, 0},
885 { 0x8D54, 0x8E00, WORD_LEN, 0},
886 { 0x8D56, 0x16B0, WORD_LEN, 0},
887 { 0x8D58, 0x1081, WORD_LEN, 0},
888 { 0x8D5A, 0x1E3C, WORD_LEN, 0},
889 { 0x8D5C, 0x1042, WORD_LEN, 0},
890 { 0x8D5E, 0x16B1, WORD_LEN, 0},
891 { 0x8D60, 0x1081, WORD_LEN, 0},
892 { 0x8D62, 0x1E3D, WORD_LEN, 0},
893 { 0x8D64, 0x1042, WORD_LEN, 0},
894 { 0x8D66, 0x16B4, WORD_LEN, 0},
895 { 0x8D68, 0x1081, WORD_LEN, 0},
896 { 0x8D6A, 0x1E3E, WORD_LEN, 0},
897 { 0x8D6C, 0x1042, WORD_LEN, 0},
898 { 0x8D6E, 0x16B5, WORD_LEN, 0},
899 { 0x8D70, 0x1081, WORD_LEN, 0},
900 { 0x8D72, 0x1E3F, WORD_LEN, 0},
901 { 0x8D74, 0x1042, WORD_LEN, 0},
902 { 0x8D76, 0xB886, WORD_LEN, 0},
903 { 0x8D78, 0xF012, WORD_LEN, 0},
904 { 0x8D7A, 0x16B2, WORD_LEN, 0},
905 { 0x8D7C, 0x1081, WORD_LEN, 0},
906 { 0x8D7E, 0xB8A6, WORD_LEN, 0},
907 { 0x8D80, 0x1E3C, WORD_LEN, 0},
908 { 0x8D82, 0x1042, WORD_LEN, 0},
909 { 0x8D84, 0x16B3, WORD_LEN, 0},
910 { 0x8D86, 0x1081, WORD_LEN, 0},
911 { 0x8D88, 0x1E3D, WORD_LEN, 0},
912 { 0x8D8A, 0x1042, WORD_LEN, 0},
913 { 0x8D8C, 0x16B6, WORD_LEN, 0},
914 { 0x8D8E, 0x1081, WORD_LEN, 0},
915 { 0x8D90, 0x1E3E, WORD_LEN, 0},
916 { 0x8D92, 0x1042, WORD_LEN, 0},
917 { 0x8D94, 0x16B7, WORD_LEN, 0},
918 { 0x8D96, 0x1081, WORD_LEN, 0},
919 { 0x8D98, 0x1E3F, WORD_LEN, 0},
920 { 0x8D9A, 0x1042, WORD_LEN, 0},
921 { 0x8D9C, 0xAE00, WORD_LEN, 0},
922 { 0x8D9E, 0x0D92, WORD_LEN, 0},
923 { 0x8DA0, 0x0184, WORD_LEN, 0},
924 { 0x8DA2, 0x051D, WORD_LEN, 0},
925 { 0x8DA4, 0x0684, WORD_LEN, 0},
926 { 0x8DA6, 0x78E0, WORD_LEN, 0},
927 { 0x8DA8, 0xFF80, WORD_LEN, 0},
928 { 0x8DAA, 0x050C, WORD_LEN, 0},
929 { 0x8DAC, 0xE280, WORD_LEN, 0},
930 { 0x8DAE, 0x24CA, WORD_LEN, 0},
931 { 0x8DB0, 0x7082, WORD_LEN, 0},
932 { 0x8DB2, 0x78E0, WORD_LEN, 0},
933 { 0x8DB4, 0x20E8, WORD_LEN, 0},
934 { 0x8DB6, 0x01A2, WORD_LEN, 0},
935 { 0x8DB8, 0x1002, WORD_LEN, 0},
936 { 0x8DBA, 0x0D02, WORD_LEN, 0},
937 { 0x8DBC, 0x1902, WORD_LEN, 0},
938 { 0x8DBE, 0x0094, WORD_LEN, 0},
939 { 0x8DC0, 0x7FE0, WORD_LEN, 0},
940 { 0x8DC2, 0x7028, WORD_LEN, 0},
941 { 0x8DC4, 0x7308, WORD_LEN, 0},
942 { 0x8DC6, 0x1000, WORD_LEN, 0},
943 { 0x8DC8, 0x0900, WORD_LEN, 0},
944 { 0x8DCA, 0x7904, WORD_LEN, 0},
945 { 0x8DCC, 0x7947, WORD_LEN, 0},
946 { 0x8DCE, 0x1B00, WORD_LEN, 0},
947 { 0x8DD0, 0x0064, WORD_LEN, 0},
948 { 0x8DD2, 0x7EE0, WORD_LEN, 0},
949 { 0x8DD4, 0xE280, WORD_LEN, 0},
950 { 0x8DD6, 0x24CA, WORD_LEN, 0},
951 { 0x8DD8, 0x7082, WORD_LEN, 0},
952 { 0x8DDA, 0x78E0, WORD_LEN, 0},
953 { 0x8DDC, 0x20E8, WORD_LEN, 0},
954 { 0x8DDE, 0x01A2, WORD_LEN, 0},
955 { 0x8DE0, 0x1102, WORD_LEN, 0},
956 { 0x8DE2, 0x0502, WORD_LEN, 0},
957 { 0x8DE4, 0x1802, WORD_LEN, 0},
958 { 0x8DE6, 0x00B4, WORD_LEN, 0},
959 { 0x8DE8, 0x7FE0, WORD_LEN, 0},
960 { 0x8DEA, 0x7028, WORD_LEN, 0},
961 { 0x8DEC, 0x0000, WORD_LEN, 0},
962 { 0x8DEE, 0x0000, WORD_LEN, 0},
963 { 0x8DF0, 0xFF80, WORD_LEN, 0},
964 { 0x8DF2, 0x0978, WORD_LEN, 0},
965 { 0x8DF4, 0xFF80, WORD_LEN, 0},
966 { 0x8DF6, 0x0A4C, WORD_LEN, 0},
967 { 0x8DF8, 0x0000, WORD_LEN, 0},
968 { 0x8DFA, 0x08DC, WORD_LEN, 0},
969 { 0x8DFC, 0x0000, WORD_LEN, 0},
970 { 0x8DFE, 0x0998, WORD_LEN, 0},
971 { 0x098E, 0x0016, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS
972 { 0x8016, 0x086C, WORD_LEN, 0}, // MON_ADDRESS_LO
973 { 0x8002, 0x0001, WORD_LEN, 0}, // MON_CMD
974 //POLL_{0x800A,0x00,!=0x07,DELAY=10,TIMEOUT=100 //Wait for the core ready
975 ////{ SEQUENCE_WAIT_MS,300, BYTE_LEN, 0},
976 { SEQUENCE_WAIT_MS,100, BYTE_LEN, 0},
978 { 0x30D4, 0x9080, WORD_LEN, 0}, // COLUMN_CORRECTION
979 { 0x316E, 0xC400, WORD_LEN, 0}, // DAC_ECL
980 { 0x305E, 0x10A0, WORD_LEN, 0}, // GLOBAL_GAIN
981 { 0x3E00, 0x0010, WORD_LEN, 0}, // SAMP_CONTROL
982 { 0x3E02, 0xED02, WORD_LEN, 0}, // SAMP_ADDR_EN
983 { 0x3E04, 0xC88C, WORD_LEN, 0}, // SAMP_RD1_SIG
984 { 0x3E06, 0xC88C, WORD_LEN, 0}, // SAMP_RD1_SIG_BOOST
985 { 0x3E08, 0x700A, WORD_LEN, 0}, // SAMP_RD1_RST
986 { 0x3E0A, 0x701E, WORD_LEN, 0}, // SAMP_RD1_RST_BOOST
987 { 0x3E0C, 0x00FF, WORD_LEN, 0}, // SAMP_RST1_EN
988 { 0x3E0E, 0x00FF, WORD_LEN, 0}, // SAMP_RST1_BOOST
989 { 0x3E10, 0x00FF, WORD_LEN, 0}, // SAMP_RST1_CLOOP_SH
990 { 0x3E12, 0x0000, WORD_LEN, 0}, // SAMP_RST_BOOST_SEQ
991 { 0x3E14, 0xC78C, WORD_LEN, 0}, // SAMP_SAMP1_SIG
992 { 0x3E16, 0x6E06, WORD_LEN, 0}, // SAMP_SAMP1_RST
993 { 0x3E18, 0xA58C, WORD_LEN, 0}, // SAMP_TX_EN
994 { 0x3E1A, 0xA58E, WORD_LEN, 0}, // SAMP_TX_BOOST
995 { 0x3E1C, 0xA58E, WORD_LEN, 0}, // SAMP_TX_CLOOP_SH
996 { 0x3E1E, 0xC0D0, WORD_LEN, 0}, // SAMP_TX_BOOST_SEQ
997 { 0x3E20, 0xEB00, WORD_LEN, 0}, // SAMP_VLN_EN
998 { 0x3E22, 0x00FF, WORD_LEN, 0}, // SAMP_VLN_HOLD
999 { 0x3E24, 0xEB02, WORD_LEN, 0}, // SAMP_VCL_EN
1000 { 0x3E26, 0xEA02, WORD_LEN, 0}, // SAMP_COLCLAMP
1001 { 0x3E28, 0xEB0A, WORD_LEN, 0}, // SAMP_SH_VCL
1002 { 0x3E2A, 0xEC01, WORD_LEN, 0}, // SAMP_SH_VREF
1003 { 0x3E2C, 0xEB01, WORD_LEN, 0}, // SAMP_SH_VBST
1004 { 0x3E2E, 0x00FF, WORD_LEN, 0}, // SAMP_SPARE
1005 { 0x3E30, 0x00F3, WORD_LEN, 0}, // SAMP_READOUT
1006 { 0x3E32, 0x3DFA, WORD_LEN, 0}, // SAMP_RESET_DONE
1007 { 0x3E34, 0x00FF, WORD_LEN, 0}, // SAMP_VLN_CLAMP
1008 { 0x3E36, 0x00F3, WORD_LEN, 0}, // SAMP_ASC_INT
1009 { 0x3E38, 0x0000, WORD_LEN, 0}, // SAMP_RS_CLOOP_SH_R
1010 { 0x3E3A, 0xF802, WORD_LEN, 0}, // SAMP_RS_CLOOP_SH
1011 { 0x3E3C, 0x0FFF, WORD_LEN, 0}, // SAMP_RS_BOOST_SEQ
1012 { 0x3E3E, 0xEA10, WORD_LEN, 0}, // SAMP_TXLO_GND
1013 { 0x3E40, 0xEB05, WORD_LEN, 0}, // SAMP_VLN_PER_COL
1014 { 0x3E42, 0xE5C8, WORD_LEN, 0}, // SAMP_RD2_SIG
1015 { 0x3E44, 0xE5C8, WORD_LEN, 0}, // SAMP_RD2_SIG_BOOST
1016 { 0x3E46, 0x8C70, WORD_LEN, 0}, // SAMP_RD2_RST
1017 { 0x3E48, 0x8C71, WORD_LEN, 0}, // SAMP_RD2_RST_BOOST
1018 { 0x3E4A, 0x00FF, WORD_LEN, 0}, // SAMP_RST2_EN
1019 { 0x3E4C, 0x00FF, WORD_LEN, 0}, // SAMP_RST2_BOOST
1020 { 0x3E4E, 0x00FF, WORD_LEN, 0}, // SAMP_RST2_CLOOP_SH
1021 { 0x3E50, 0xE38D, WORD_LEN, 0}, // SAMP_SAMP2_SIG
1022 { 0x3E52, 0x8B0A, WORD_LEN, 0}, // SAMP_SAMP2_RST
1023 { 0x3E58, 0xEB0A, WORD_LEN, 0}, // SAMP_PIX_CLAMP_EN
1024 { 0x3E5C, 0x0A00, WORD_LEN, 0}, // SAMP_PIX_PULLUP_EN
1025 { 0x3E5E, 0x00FF, WORD_LEN, 0}, // SAMP_PIX_PULLDOWN_EN_R
1026 { 0x3E60, 0x00FF, WORD_LEN, 0}, // SAMP_PIX_PULLDOWN_EN_S
1027 { 0x3E90, 0x3C01, WORD_LEN, 0}, // RST_ADDR_EN
1028 { 0x3E92, 0x00FF, WORD_LEN, 0}, // RST_RST_EN
1029 { 0x3E94, 0x00FF, WORD_LEN, 0}, // RST_RST_BOOST
1030 { 0x3E96, 0x3C00, WORD_LEN, 0}, // RST_TX_EN
1031 { 0x3E98, 0x3C00, WORD_LEN, 0}, // RST_TX_BOOST
1032 { 0x3E9A, 0x3C00, WORD_LEN, 0}, // RST_TX_CLOOP_SH
1033 { 0x3E9C, 0xC0E0, WORD_LEN, 0}, // RST_TX_BOOST_SEQ
1034 { 0x3E9E, 0x00FF, WORD_LEN, 0}, // RST_RST_CLOOP_SH
1035 { 0x3EA0, 0x0000, WORD_LEN, 0}, // RST_RST_BOOST_SEQ
1036 { 0x3EA6, 0x3C00, WORD_LEN, 0}, // RST_PIX_PULLUP_EN
1037 { 0x3ED8, 0x3057, WORD_LEN, 0}, // DAC_LD_12_13
1038 { 0x316C, 0xB44F, WORD_LEN, 0}, // DAC_TXLO
1039 { 0x316E, 0xC6FF, WORD_LEN, 0}, // DAC_ECL
1040 { 0x3ED2, 0xEA0A, WORD_LEN, 0}, // DAC_LD_6_7
1041 { 0x3ED4, 0x00A3, WORD_LEN, 0}, // DAC_LD_8_9
1042 { 0x3EDC, 0x6020, WORD_LEN, 0}, // DAC_LD_16_17
1043 { 0x3EE6, 0xA541, WORD_LEN, 0}, // DAC_LD_26_27
1044 { 0x31E0, 0x0001, WORD_LEN, 0}, // PIX_DEF_ID
1045 { 0x3ED0, 0x2409, WORD_LEN, 0}, // DAC_LD_4_5
1046 //{ 0x3EDA, 0x6000 // DAC_LD_14_15 //
1047 { 0x3EDE, 0x0A49, WORD_LEN, 0}, // DAC_LD_18_19
1048 { 0x3EE0, 0x4910, WORD_LEN, 0}, // DAC_LD_20_21
1049 { 0x3EE2, 0x09D2, WORD_LEN, 0}, // DAC_LD_22_23
1050 { 0x30B6, 0x0008, WORD_LEN, 0}, // AUTOLR_CONTROL
1051 { 0x337C, 0x0006, WORD_LEN, 0}, // YUV_YCBCR_CONTROL
1052 { 0x3E1A, 0xA582, WORD_LEN, 0}, // SAMP_TX_BOOST
1053 { 0x3E2E, 0xEC05, WORD_LEN, 0}, // SAMP_SPARE
1054 { 0x3EE6, 0xA5C0, WORD_LEN, 0}, // DAC_LD_26_27
1055 { 0x316C, 0xB43F, WORD_LEN, 0}, // DAC_TXLO
1056 { 0x316E, 0xC6FF, WORD_LEN, 0}, // DAC_ECL
1057 //LOAD = Lens Correction 90% 04/29/10 12:58:28
1058 { 0x381C, 0x0000, WORD_LEN, 0},
1059 { 0xE02A, 0x0001, WORD_LEN, 0}, // IO_NV_MEM_COMMAND
1060 // POLL IO_NV_MEM_STATUS::IO_NVMEM_STAT_OTPM_AVAIL => 0x00
1061 { SEQUENCE_WAIT_MS,100, BYTE_LEN, 0},
1062 { 0x3812, 0x2124, WORD_LEN, 0},
1063 //POLL_FIELD= IO_NV_MEM_STATUS, IO_NV_MEM_STATUS!=0xC1,DELAY=100,TIMEOUT=50 //5 sec
1064 { SEQUENCE_WAIT_MS,100, BYTE_LEN, 0},
1065 { 0xD004, 0x04, BYTE_LEN, 0}, // PGA_SOLUTION
1066 { 0xD006, 0x0008, WORD_LEN, 0}, // PGA_ZONE_ADDR_0
1067 { 0xD005, 0x00, BYTE_LEN, 0}, // PGA_CURRENT_ZONE
1068 { 0xD002, 0x8002, WORD_LEN, 0}, // PGA_ALGO
1069 { 0x3210, 0x49B8, WORD_LEN, 0}, // COLOR_PIPELINE_CONTROL
1072 { 0xAC02, 0x00FF , WORD_LEN, 0 }, // AWB_ALGO
1073 { 0xAC01, 0x7F, BYTE_LEN, 0 }, // AWB_MODE
1075 { 0xAC3C, 0x39, BYTE_LEN, 0 }, //42 // AWB_MIN_ACCEPTED_PRE_AWB_R2G_RATIO
1076 { 0xAC3D, 0x6E, BYTE_LEN, 0 }, //50 // AWB_MAX_ACCEPTED_PRE_AWB_R2G_RATIO
1077 { 0xAC3E, 0x28, BYTE_LEN, 0 }, //13 // AWB_MIN_ACCEPTED_PRE_AWB_B2G_RATIO
1078 { 0xAC3F, 0x6B, BYTE_LEN, 0 }, //5B // AWB_MAX_ACCEPTED_PRE_AWB_B2G_RATIO
1079 { 0xAC40, 0x64, BYTE_LEN, 0 }, //52 // AWB_MIN_ACCEPTED_POST_AWB_R2G_RATIO
1080 { 0xAC41, 0x66, BYTE_LEN, 0 }, //56 // AWB_MAX_ACCEPTED_POST_AWB_R2G_RATIO
1081 { 0xAC42, 0x64, BYTE_LEN, 0 }, // AWB_MIN_ACCEPTED_POST_AWB_B2G_RATIO
1082 { 0xAC43, 0x66, BYTE_LEN, 0 }, // AWB_MAX_ACCEPTED_POST_AWB_B2G_RATIO
1084 { 0xACB0, 0x31, BYTE_LEN, 0 }, // AWB_RG_MIN
1085 { 0xACB1, 0x5B, BYTE_LEN, 0 }, //50 // AWB_RG_MAX
1086 { 0xACB4, 0x2A, BYTE_LEN, 0 }, //13 // AWB_BG_MIN
1087 { 0xACB5, 0x5B, BYTE_LEN, 0 }, // AWB_BG_MAX
1088 { 0xACB2, 0x42, BYTE_LEN, 0 }, // AWB_RG_MIN_BRIGHT
1089 { 0xACB3, 0x4B, BYTE_LEN, 0 }, // AWB_RG_MAX_BRIGHT
1090 { 0xACB6, 0x36, BYTE_LEN, 0 }, // AWB_BG_MIN_BRIGHT
1091 { 0xACB7, 0x42, BYTE_LEN, 0 }, // AWB_BG_MAX_BRIGHT
1092 { 0xACB8, 0x00D0, WORD_LEN, 0}, // 0x0100 // AWB_START_NUM_INT_LINES
1093 { 0xACBA, 0x0090, WORD_LEN, 0}, // B0 // AWB_END_NUM_INT_LINES
1095 { 0x098E, 0xAC09, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS
1096 { 0xAC09, 0x01, BYTE_LEN, 0}, // AWB_MODE_EX
1097 { 0xAC22, 0x0000, WORD_LEN, 0}, // AWB_SHARPNESS_TH
1098 //soc5140_ccm_settings
1099 { 0x098E, 0x2C46, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [AWB_LEFT_CCM_0]
1100 { 0xAC46, 0x010F, WORD_LEN, 0}, //0x015F // AWB_LEFT_CCM_0
1101 { 0xAC48, 0xFFAE, WORD_LEN, 0}, //0xFFC2 // AWB_LEFT_CCM_1
1102 { 0xAC4A, 0x0043, WORD_LEN, 0}, //0xFFDF // AWB_LEFT_CCM_2
1103 { 0xAC4C, 0xFF7E, WORD_LEN, 0}, //0xFF7F // AWB_LEFT_CCM_3
1104 { 0xAC4E, 0x01BD, WORD_LEN, 0}, //0x01BB // AWB_LEFT_CCM_4
1105 { 0xAC50, 0xFFC5, WORD_LEN, 0}, //0xFFC6 // AWB_LEFT_CCM_5
1106 { 0xAC52, 0xFFE1, WORD_LEN, 0}, //0xFFC7 // AWB_LEFT_CCM_6
1107 { 0xAC54, 0xFF34, WORD_LEN, 0}, //0xFEFA // AWB_LEFT_CCM_7
1108 { 0xAC56, 0x01EB, WORD_LEN, 0}, //0x023F // AWB_LEFT_CCM_8
1109 { 0xAC58, 0x00A8, WORD_LEN, 0}, // AWB_LEFT_CCM_R2BRATIO
1110 { 0xAC5C, 0x0233, WORD_LEN, 0}, // AWB_RIGHT_CCM_0
1111 { 0xAC5E, 0xFF23, WORD_LEN, 0}, // AWB_RIGHT_CCM_1
1112 { 0xAC60, 0xFFAA, WORD_LEN, 0}, // AWB_RIGHT_CCM_2
1113 { 0xAC62, 0xFF91, WORD_LEN, 0}, // AWB_RIGHT_CCM_3
1114 { 0xAC64, 0x01AF, WORD_LEN, 0}, // AWB_RIGHT_CCM_4
1115 { 0xAC66, 0xFFBF, WORD_LEN, 0}, // AWB_RIGHT_CCM_5
1116 { 0xAC68, 0xFFE7, WORD_LEN, 0}, // AWB_RIGHT_CCM_6
1117 { 0xAC6A, 0xFF4C, WORD_LEN, 0}, // AWB_RIGHT_CCM_7
1118 { 0xAC6C, 0x01CE, WORD_LEN, 0}, // AWB_RIGHT_CCM_8
1119 { 0xAC6E, 0x005A, WORD_LEN, 0}, // AWB_RIGHT_CCM_R2BRATIO
1120 { 0xAC72, 0x004D, WORD_LEN, 0}, // AWB_LL_CCM_0
1121 { 0xAC74, 0x0096, WORD_LEN, 0}, // AWB_LL_CCM_1
1122 { 0xAC76, 0x001D, WORD_LEN, 0}, // AWB_LL_CCM_2
1123 { 0xAC78, 0x004D, WORD_LEN, 0}, // AWB_LL_CCM_3
1124 { 0xAC7A, 0x0096, WORD_LEN, 0}, // AWB_LL_CCM_4
1125 { 0xAC7C, 0x001D, WORD_LEN, 0}, // AWB_LL_CCM_5
1126 { 0xAC7E, 0x004D, WORD_LEN, 0}, // AWB_LL_CCM_6
1127 { 0xAC80, 0x0096, WORD_LEN, 0}, // AWB_LL_CCM_7
1128 { 0xAC82, 0x001D, WORD_LEN, 0}, // AWB_LL_CCM_8
1129 { 0xAC97, 0x80, BYTE_LEN, 0}, // AWB_LEFT_TINT_COEF_FOR_CCM_ROW_0
1130 { 0xAC98, 0x80, BYTE_LEN, 0}, // AWB_LEFT_TINT_COEF_FOR_CCM_ROW_1
1131 { 0xAC99, 0x74, BYTE_LEN, 0}, //0x64 // AWB_LEFT_TINT_COEF_FOR_CCM_ROW_2
1132 { 0xAC9A, 0x7D, BYTE_LEN, 0}, //0x76 // AWB_RIGHT_TINT_COEF_FOR_CCM_ROW_0
1133 { 0xAC9B, 0x80, BYTE_LEN, 0}, // AWB_RIGHT_TINT_COEF_FOR_CCM_ROW_1
1134 { 0xAC9C, 0x7D, BYTE_LEN, 0}, //0x78 // AWB_RIGHT_TINT_COEF_FOR_CCM_ROW_2
1135 { 0xB83E, 0x10, BYTE_LEN, 0}, // STAT_AWB_WINDOW_POS_X
1136 { 0xB83F, 0x10, BYTE_LEN, 0}, // STAT_AWB_WINDOW_POS_Y
1137 { 0xB840, 0xDF, BYTE_LEN, 0}, // STAT_AWB_WINDOW_SIZE_X
1138 { 0xB841, 0xCF, BYTE_LEN, 0}, // STAT_AWB_WINDOW_SIZE_Y
1139 //soc5140_weighted2D_awb_settings
1140 { 0xB842, 0x0034, WORD_LEN, 0}, //0x0032 // STAT_AWB_GRAY_CHECKER_OFFSET_X
1141 { 0xB844, 0x003C, WORD_LEN, 0}, //0x0038 // STAT_AWB_GRAY_CHECKER_OFFSET_Y
1142 { 0x3240, 0x0024, WORD_LEN, 0}, // AWB_XY_SCALE
1143 { 0x3242, 0x0000, WORD_LEN, 0}, // AWB_WEIGHT_R0
1144 { 0x3244, 0x0000, WORD_LEN, 0}, // AWB_WEIGHT_R1
1145 { 0x3246, 0x0000, WORD_LEN, 0}, // AWB_WEIGHT_R2
1146 { 0x3248, 0x7070, WORD_LEN, 0}, // AWB_WEIGHT_R3
1147 { 0x324A, 0x38E0, WORD_LEN, 0}, // AWB_WEIGHT_R4
1148 { 0x324C, 0x70E0, WORD_LEN, 0}, // AWB_WEIGHT_R5
1149 { 0x324E, 0x01B8, WORD_LEN, 0}, // AWB_WEIGHT_R6
1150 { 0x3250, 0x00AB, WORD_LEN, 0}, // AWB_WEIGHT_R7
1151 { 0xD80F, 0x04, BYTE_LEN, 0}, // JPEG_QSCALE_0
1152 { 0xD810, 0x08, BYTE_LEN, 0}, // JPEG_QSCALE_1
1153 { 0xC8D2, 0x04, BYTE_LEN, 0}, // CAM_OUTPUT_1_JPEG_QSCALE_0
1154 { 0xC8D3, 0x08, BYTE_LEN, 0}, // CAM_OUTPUT_1_JPEG_QSCALE_1
1155 { 0xC8BC, 0x04, BYTE_LEN, 0}, // CAM_OUTPUT_0_JPEG_QSCALE_0
1156 { 0xC8BD, 0x08, BYTE_LEN, 0}, // CAM_OUTPUT_0_JPEG_QSCALE_1
1158 { 0x301A, 0x10F4, WORD_LEN, 0}, // RESET_REGISTER
1159 { 0x301E, 0x0083, WORD_LEN, 0}, // DATA_PEDESTAL
1160 { 0x301A, 0x10FC, WORD_LEN, 0}, // RESET_REGISTER
1161 { 0xDC33, 0x20, BYTE_LEN, 0}, // SYS_FIRST_BLACK_LEVEL
1162 { 0xDC35, 0x04, BYTE_LEN, 0}, // SYS_UV_COLOR_BOOST
1163 { 0x326E, 0x0006, WORD_LEN, 0}, // LOW_PASS_YUV_FILTER
1164 { 0xDC37, 0x62, BYTE_LEN, 0}, // SYS_BRIGHT_COLORKILL
1165 { 0x35A4, 0x0596, WORD_LEN, 0}, // BRIGHT_COLOR_KILL_CONTROLS
1166 { 0x35A2, 0x009C, WORD_LEN, 0}, // DARK_COLOR_KILL_CONTROLS
1167 { 0x098E, 0x5C02, WORD_LEN, 0}, // MCU_ADDR
1168 { 0xDC02, 0x003E, WORD_LEN, 0}, // SYS_ALGO
1169 { 0xDC36, 0x34, BYTE_LEN, 0}, // SYS_DARK_COLOR_KILL
1170 // Refresh Mode - skip
1171 { 0xBC18, 0x00, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_0
1172 { 0xBC19, 0x11, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_1
1173 { 0xBC1A, 0x23, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_2
1174 { 0xBC1B, 0x3F, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_3
1175 { 0xBC1C, 0x67, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_4
1176 { 0xBC1D, 0x85, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_5
1177 { 0xBC1E, 0x9B, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_6
1178 { 0xBC1F, 0xAD, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_7
1179 { 0xBC20, 0xBB, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_8
1180 { 0xBC21, 0xC7, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_9
1181 { 0xBC22, 0xD1, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_10
1182 { 0xBC23, 0xDA, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_11
1183 { 0xBC24, 0xE1, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_12
1184 { 0xBC25, 0xE8, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_13
1185 { 0xBC26, 0xEE, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_14
1186 { 0xBC27, 0xF3, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_15
1187 { 0xBC28, 0xF7, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_16
1188 { 0xBC29, 0xFB, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_17
1189 { 0xBC2A, 0xFF, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_18
1190 { 0xBC2B, 0x00, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_0
1191 { 0xBC2C, 0x0A, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_1
1192 { 0xBC2D, 0x1C, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_2
1193 { 0xBC2E, 0x36, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_3
1194 { 0xBC2F, 0x53, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_4
1195 { 0xBC30, 0x6F, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_5
1196 { 0xBC31, 0x86, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_6
1197 { 0xBC32, 0x99, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_7
1198 { 0xBC33, 0xAB, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_8
1199 { 0xBC34, 0xBB, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_9
1200 { 0xBC35, 0xC6, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_10
1201 { 0xBC36, 0xD0, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_11
1202 { 0xBC37, 0xD9, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_12
1203 { 0xBC38, 0xE2, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_13
1204 { 0xBC39, 0xE9, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_14
1205 { 0xBC3A, 0xEF, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_15
1206 { 0xBC3B, 0xF5, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_16
1207 { 0xBC3C, 0xFA, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_17
1208 { 0xBC3D, 0xFF, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_18
1209 { 0xBC3E, 0x00, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_0
1210 { 0xBC3F, 0x18, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_1
1211 { 0xBC40, 0x25, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_2
1212 { 0xBC41, 0x3A, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_3
1213 { 0xBC42, 0x59, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_4
1214 { 0xBC43, 0x70, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_5
1215 { 0xBC44, 0x81, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_6
1216 { 0xBC45, 0x90, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_7
1217 { 0xBC46, 0x9E, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_8
1218 { 0xBC47, 0xAB, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_9
1219 { 0xBC48, 0xB6, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_10
1220 { 0xBC49, 0xC1, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_11
1221 { 0xBC4A, 0xCB, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_12
1222 { 0xBC4B, 0xD5, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_13
1223 { 0xBC4C, 0xDE, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_14
1224 { 0xBC4D, 0xE7, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_15
1225 { 0xBC4E, 0xEF, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_16
1226 { 0xBC4F, 0xF7, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_17
1227 { 0xBC50, 0xFF, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_18
1228 { 0xBC51, 0x04, BYTE_LEN, 0}, // LL_GAMMA_CURVE_SELECTOR
1230 { 0xB801, 0xE0, BYTE_LEN, 0}, // STAT_MODE
1231 { 0xB862, 0x04, BYTE_LEN, 0}, // STAT_BMTRACKING_SPEED
1233 { 0xB829, 0x02, BYTE_LEN, 0}, // STAT_LL_BRIGHTNESS_METRIC_DIVISOR
1234 { 0xB863, 0x02, BYTE_LEN, 0}, // STAT_BM_MUL
1235 { 0xB827, 0x0F, BYTE_LEN, 0}, // STAT_AE_EV_SHIFT
1236 { 0xA409, 0x4A, BYTE_LEN, 0}, // AE_RULE_BASE_TARGET
1237 { 0xA805, 0x06, BYTE_LEN, 0}, // AE_TRACK_GATE
1238 { 0xA80D, 0x08, BYTE_LEN, 0},
1239 { 0xA816, 0x0002, WORD_LEN, 0}, // AE_TRACK_MIN_INT_TIME_ROWS
1240 { 0xA401, 0x00, BYTE_LEN, 0}, // AE_RULE_MODE
1241 { 0xA80E, 0x06, BYTE_LEN, 0}, // AE_TRACK_MAX_BLACK_LEVEL
1243 { 0xC8E6, 0x014C, WORD_LEN, 0}, // RESERVED_CAM_E6
1244 { 0xC8E8, 0x0040, WORD_LEN, 0}, // RESERVED_CAM_E8
1245 { 0xBC52, 0x00C8, WORD_LEN, 0}, // LL_START_BRIGHTNESS_METRIC
1246 { 0xBC54, 0x0A28, WORD_LEN, 0}, // LL_END_BRIGHTNESS_METRIC
1247 { 0xBC58, 0x0100, WORD_LEN, 0}, //0x0000 // LL_START_GAIN_METRIC
1248 { 0xBC5A, 0x0480, WORD_LEN, 0}, //0x1000 // LL_END_GAIN_METRIC
1249 { 0xBC5E, 0x0227, WORD_LEN, 0}, // LL_START_APERTURE_GAIN_BM
1250 { 0xBC60, 0x0540, WORD_LEN, 0}, // LL_END_APERTURE_GAIN_BM
1251 { 0xBC66, 0x0154, WORD_LEN, 0}, // LL_START_APERTURE_GM
1252 { 0xBC68, 0x07D0, WORD_LEN, 0}, // LL_END_APERTURE_GM
1253 { 0xBC86, 0x00C8, WORD_LEN, 0}, // LL_START_FFNR_GM
1254 { 0xBC88, 0x0420, WORD_LEN, 0}, // LL_END_FFNR_GM
1255 { 0xBCBC, 0x0040, WORD_LEN, 0}, // LL_SFFB_START_GAIN
1256 { 0xBCBE, 0x01FC, WORD_LEN, 0}, // LL_SFFB_END_GAIN
1257 { 0xBCCC, 0x00C8, WORD_LEN, 0}, // LL_SFFB_START_MAX_GM
1258 { 0xBCCE, 0x0640, WORD_LEN, 0}, // LL_SFFB_END_MAX_GM
1259 { 0xBC90, 0x00C8, WORD_LEN, 0}, // LL_START_GRB_GM
1260 { 0xBC92, 0x0640, WORD_LEN, 0}, // LL_END_GRB_GM
1261 { 0xBC0E, 0x0032, WORD_LEN, 0}, // LL_GAMMA_CURVE_ADJ_START_POS
1262 { 0xBC10, 0x0064, WORD_LEN, 0}, // LL_GAMMA_CURVE_ADJ_MID_POS
1263 { 0xBC12, 0x0FA0, WORD_LEN, 0}, // LL_GAMMA_CURVE_ADJ_END_POS
1264 { 0xBCAA, 0x03E8, WORD_LEN, 0}, // LL_CDC_THR_ADJ_START_POS
1265 { 0xBCAC, 0x012C, WORD_LEN, 0}, // LL_CDC_THR_ADJ_MID_POS
1266 { 0xBCAE, 0x0009, WORD_LEN, 0}, // LL_CDC_THR_ADJ_END_POS
1267 { 0xBCD8, 0x00C8, WORD_LEN, 0}, // LL_PCR_START_BM
1268 { 0xBCDA, 0x0A28, WORD_LEN, 0}, // LL_PCR_END_BM
1271 { 0x3380, 0x0504, WORD_LEN, 0}, // KERNEL_CONFIG
1272 { 0x3380, 0x0505, WORD_LEN, 0}, // KERNEL_CONFIG
1273 { 0x3380, 0x0584, WORD_LEN, 0}, // KERNEL_CONFIG
1274 { 0x3380, 0x0586, WORD_LEN, 0}, // KERNEL_CONFIG
1275 { 0x3380, 0x0587, WORD_LEN, 0}, // KERNEL_CONFIG
1278 { 0xBC94, 0x06, BYTE_LEN, 0}, // LL_GB_START_THRESHOLD_0
1279 { 0xBC95, 0x05, BYTE_LEN, 0}, // LL_GB_START_THRESHOLD_1
1280 { 0xBC9C, 0x09, BYTE_LEN, 0}, // RESERVED_LL_9C
1281 { 0xBC9D, 0x05, BYTE_LEN, 0}, // RESERVED_LL_9D
1284 { 0x33B0, 0x2A16, WORD_LEN, 0}, // FFNR_ALPHA_BETA
1285 { 0xBC8A, 0x0E, BYTE_LEN, 0}, //0x00 // LL_START_FF_MIX_THRESH_Y
1286 { 0xBC8B, 0x4C, BYTE_LEN, 0}, // LL_END_FF_MIX_THRESH_Y
1287 { 0xBC8C, 0x00, BYTE_LEN, 0}, // LL_START_FF_MIX_THRESH_YGAIN
1288 { 0xBC8D, 0x24, BYTE_LEN, 0}, // LL_END_FF_MIX_THRESH_YGAIN
1289 { 0xBC8E, 0xFF, BYTE_LEN, 0}, // LL_START_FF_MIX_THRESH_GAIN
1290 { 0xBC8F, 0x00, BYTE_LEN, 0}, // LL_END_FF_MIX_THRESH_GAIN
1291 { 0xBCB2, 0x20, BYTE_LEN, 0}, // LL_CDC_DARK_CLUS_SLOPE
1292 { 0xBCB3, 0x3A, BYTE_LEN, 0}, // LL_CDC_DARK_CLUS_SATUR
1293 { 0xBCB4, 0x39, BYTE_LEN, 0}, // RESERVED_LL_B4
1294 { 0xBCB7, 0x39, BYTE_LEN, 0}, // RESERVED_LL_B7
1295 { 0xBCB5, 0x20, BYTE_LEN, 0}, // RESERVED_LL_B5
1296 { 0xBCB8, 0x3A, BYTE_LEN, 0}, // RESERVED_LL_B8
1297 { 0xBCB6, 0x80, BYTE_LEN, 0}, // RESERVED_LL_B6
1298 { 0xBCB9, 0x24, BYTE_LEN, 0}, // RESERVED_LL_B9
1300 //SFFB_rev3_noisemodel
1301 { 0xBCC0, 0x1F, BYTE_LEN, 0}, // LL_SFFB_RAMP_START
1302 { 0xBCC1, 0x03, BYTE_LEN, 0}, // LL_SFFB_RAMP_STOP
1303 { 0xBCC2, 0x3C, BYTE_LEN, 0}, // LL_SFFB_SLOPE_START
1304 { 0xBCC3, 0x10, BYTE_LEN, 0}, // LL_SFFB_SLOPE_STOP
1305 { 0xBCC4, 0x07, BYTE_LEN, 0}, // LL_SFFB_THSTART
1306 { 0xBCC5, 0x0B, BYTE_LEN, 0}, // LL_SFFB_THSTOP
1307 { 0xBCBA, 0x0009, WORD_LEN, 0}, // LL_SFFB_CONFIG
1309 //[Step7-CPIPE_Preference]
1311 { 0xBC14, 0xFFFE, WORD_LEN, 0}, // LL_GAMMA_FADE_TO_BLACK_START_POS
1312 { 0xBC16, 0xFFFF, WORD_LEN, 0}, // LL_GAMMA_FADE_TO_BLACK_END_POS
1314 //aperture_preference
1315 { 0xBC6A, 0x06, BYTE_LEN, 0}, // LL_START_APERTURE_INTEGER_GAIN
1316 { 0xBC6B, 0x00, BYTE_LEN, 0}, // LL_END_APERTURE_INTEGER_GAIN
1317 { 0xBC6C, 0x00, BYTE_LEN, 0}, // LL_START_APERTURE_EXP_GAIN
1318 { 0xBC6D, 0x00, BYTE_LEN, 0}, // LL_END_APERTURE_EXP_GAIN
1319 { 0xBCE2, 0x0A, BYTE_LEN, 0}, // LL_START_POS_KNEE
1320 { 0xBCE3, 0x2B, BYTE_LEN, 0}, // LL_END_POS_KNEE
1321 { 0xBCE4, 0x0A, BYTE_LEN, 0}, // LL_START_NEG_KNEE
1322 { 0xBCE5, 0x2B, BYTE_LEN, 0}, // LL_END_NEG_KNEE
1323 { 0x33BA, 0x0084, WORD_LEN, 0}, // APEDGE_CONTROL
1324 { 0x33BE, 0x0000, WORD_LEN, 0}, // UA_KNEE_L
1325 { 0x33C2, 0x5600, WORD_LEN, 0}, // UA_WEIGHTS
1326 { 0xBC62, 0x10, BYTE_LEN, 0}, // LL_START_APERTURE_KPGAIN
1327 { 0xBC63, 0x1F, BYTE_LEN, 0}, // LL_END_APERTURE_KPGAIN
1328 { 0xBC64, 0x10, BYTE_LEN, 0}, // LL_START_APERTURE_KNGAIN
1329 { 0xBC65, 0x1F, BYTE_LEN, 0}, // LL_END_APERTURE_KNGAIN
1330 { 0xA81C, 0x0043, WORD_LEN, 0}, // AE_TRACK_MIN_AGAIN
1331 { 0xA81E, 0x0102, WORD_LEN, 0}, // AE_TRACK_TARGET_AGAIN
1332 { 0xA820, 0x0102, WORD_LEN, 0}, // AE_TRACK_MAX_AGAIN
1333 { 0xA822, 0x0080, WORD_LEN, 0}, // AE_TRACK_MIN_DGAIN
1334 { 0xA824, 0x0080, WORD_LEN, 0}, // AE_TRACK_MAX_DGAIN
1337 { 0xA818, 0x07D0, WORD_LEN, 0}, // AE_TRACK_TARGET_INT_TIME_ROWS
1338 { 0xA81A, 0x0A00, WORD_LEN, 0}, //0x0810(10.9Fps) //0x0FF4(5Fps) // AE_TRACK_MAX_INT_TIME_ROWS
1341 { 0xBC56, 0x80, BYTE_LEN, 0}, //0xA8 // LL_START_CCM_SATURATION
1342 { 0xBC57, 0x10, BYTE_LEN, 0}, // LL_END_CCM_SATURATION
1345 { 0xBCDE, 0x03, BYTE_LEN, 0}, // LL_START_SYS_THRESHOLD
1346 { 0xBCDF, 0x50, BYTE_LEN, 0}, // LL_STOP_SYS_THRESHOLD
1347 { 0xBCE0, 0x08, BYTE_LEN, 0}, // LL_START_SYS_GAIN
1348 { 0xBCE1, 0x03, BYTE_LEN, 0}, // LL_STOP_SYS_GAIN
1351 { 0xBCD0, 0x000A, WORD_LEN, 0}, // LL_SFFB_SOBEL_FLAT_START
1352 { 0xBCD2, 0x00FE, WORD_LEN, 0}, // LL_SFFB_SOBEL_FLAT_STOP
1353 { 0xBCD4, 0x001E, WORD_LEN, 0}, // LL_SFFB_SOBEL_SHARP_START
1354 { 0xBCD6, 0x00FF, WORD_LEN, 0}, // LL_SFFB_SOBEL_SHARP_STOP
1355 { 0xBCC6, 0x00, BYTE_LEN, 0}, // LL_SFFB_SHARPENING_START
1356 { 0xBCC7, 0x00, BYTE_LEN, 0}, // LL_SFFB_SHARPENING_STOP
1357 { 0xBCC8, 0x20, BYTE_LEN, 0}, // LL_SFFB_FLATNESS_START
1358 { 0xBCC9, 0x40, BYTE_LEN, 0}, // LL_SFFB_FLATNESS_STOP
1359 { 0xBCCA, 0x04, BYTE_LEN, 0}, // LL_SFFB_TRANSITION_START
1360 { 0xBCCB, 0x00, BYTE_LEN, 0}, // LL_SFFB_TRANSITION_STOP
1361 //SFFB_slope_zero_enable
1362 { 0xBCE6, 0x03 , BYTE_LEN, 0 }, // LL_SFFB_ZERO_ENABLE
1364 { 0x8417, 0x02, BYTE_LEN, 0 }, // SEQ_STATE_CFG_1_FD
1366 { 0xC8ED, 0x02, BYTE_LEN, 0 }, // CAM_TX_ENABLE_MODE Context A,B time
1368 { 0x8404, 0x06, BYTE_LEN, 0 }, // SEQ_CMD
1369 ///{ SEQUENCE_WAIT_MS,300, WORD_LEN, 0},
1370 { SEQUENCE_WAIT_MS,100, WORD_LEN, 0},
1371 { SEQUENCE_END, 0x00, 0, 0}
1374 /* 720p 15fps @ 1280x720 */
1375 static struct reginfo sensor_720p[]=
1377 //{SEQUENCE_END, 0x00},
1378 {0x098E, 0x843C, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [CAM_CORE_A_Y_ADDR_START]
1379 {0x843C, 0x01, BYTE_LEN, 0 }, // SEQ_STATE_CFG_5_MAX_FRAME_CNT
1380 {0x8404, 0x01, BYTE_LEN, 0 }, // SEQ_CMD
1381 {0x0016, 0x0447, WORD_LEN, 0}, // CLOCKS_CONTROL
1382 {0xC83A, 0x0106, WORD_LEN, 0}, // CAM_CORE_A_Y_ADDR_START
1383 {0xC83C, 0x0018, WORD_LEN, 0}, // CAM_CORE_A_X_ADDR_START
1384 {0xC83E, 0x06B7, WORD_LEN, 0}, // CAM_CORE_A_Y_ADDR_END
1385 {0xC840, 0x0A45, WORD_LEN, 0}, // CAM_CORE_A_X_ADDR_END
1386 {0xC86C, 0x0518, WORD_LEN, 0}, // CAM_CORE_A_OUTPUT_SIZE_WIDTH
1387 {0xC86E, 0x02D8, WORD_LEN, 0}, // CAM_CORE_A_OUTPUT_SIZE_HEIGHT
1388 {0xC870, 0x0014, WORD_LEN, 0}, // CAM_CORE_A_RX_FIFO_TRIGGER_MARK
1389 {0xC858, 0x0003, WORD_LEN, 0}, // CAM_CORE_A_COARSE_ITMIN
1390 {0xC8B8, 0x0004, WORD_LEN, 0}, // CAM_OUTPUT_0_JPEG_CONTROL
1391 /****bug:part pixsels data not to be aquired *****/
1392 #if ADJUST_FOR_720P_FALG
1393 {0xC8AA, 0x0500, WORD_LEN, 0}, // CAM_OUTPUT_0_IMAGE_WIDTH
1394 {0xC8AC, 0x02D1, WORD_LEN, 0}, // CAM_OUTPUT_0_IMAGE_HEIGHT
1396 {0xC8AA, 0x0500, WORD_LEN, 0}, // CAM_OUTPUT_0_IMAGE_WIDTH
1397 {0xC8AC, 0x02D0, WORD_LEN, 0}, // CAM_OUTPUT_0_IMAGE_HEIGHT
1399 {0xC8AE, 0x0001, WORD_LEN, 0}, // CAM_OUTPUT_0_OUTPUT_FORMAT
1400 {0x8404, 0x06, BYTE_LEN, 0 }, // SEQ_CMD
1402 {SEQUENCE_WAIT_MS,100, WORD_LEN, 0},
1403 { SEQUENCE_END, 0x00, 0, 0}
1406 /* 1080p, 0x15fps, 0xyuv @1920x1080 */
1407 static struct reginfo sensor_1080p[]=
1409 { SEQUENCE_END, 0x00, 0, 0}
1412 /* 2592X1944 QSXGA */
1413 #if ADJUST_FOR_CAPTURE_FALG
1414 static struct reginfo sensor_qsxga[] =
1416 {0x098E, 0x48C0,WORD_LEN,0}, // LOGICAL_ADDRESS_ACCESS [CAM_OUTPUT_1_IMAGE_WIDTH]
1417 {0xC8C0, 0x0A20,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_WIDTH
1418 {0xC8C2, 0x0798,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_HEIGHT
1419 {0x8404, 0x06 ,BYTE_LEN,0}, // SEQ_CMD
1420 {SEQUENCE_WAIT_MS,100,WORD_LEN,0},
1421 {SEQUENCE_END, 0x00, 0, 0}
1424 static struct reginfo sensor_qsxga[] =
1426 {SEQUENCE_PROPERTY,SEQUENCE_CAPTURE},
1427 { SEQUENCE_END, 0x00, 0, 0}
1431 /* 2048*1536 QXGA */
1432 #if ADJUST_FOR_CAPTURE_FALG
1433 // send extra two lines to forbid to be captured error
1434 static struct reginfo sensor_qxga[] =
1436 {0x098E, 0x48C0,WORD_LEN,0}, // LOGICAL_ADDRESS_ACCESS [CAM_OUTPUT_1_IMAGE_WIDTH]
1437 {0xC8C0, 0x0800,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_WIDTH
1438 {0xC8C2, 0x0602,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_HEIGHT
1439 {0x8404, 0x06 ,BYTE_LEN,0}, // SEQ_CMD
1440 {SEQUENCE_WAIT_MS,100,WORD_LEN,0},
1441 {SEQUENCE_END, 0x00, 0, 0}
1444 static struct reginfo sensor_qxga[] =
1446 { SEQUENCE_END, 0x00, 0, 0}
1450 /* 1600X1200 UXGA */
1451 #if ADJUST_FOR_CAPTURE_FALG
1452 static struct reginfo sensor_uxga[] =
1454 {0x098E, 0x48C0,WORD_LEN,0}, // LOGICAL_ADDRESS_ACCESS [CAM_OUTPUT_1_IMAGE_WIDTH]
1455 {0xC8C0, 0x0640,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_WIDTH
1456 {0xC8C2, 0x04b2,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_HEIGHT
1457 {0x8404, 0x06 ,BYTE_LEN,0}, // SEQ_CMD
1458 {SEQUENCE_WAIT_MS,100,WORD_LEN,0},
1459 {SEQUENCE_END, 0x00, 0, 0}
1462 static struct reginfo sensor_uxga[] =
1464 { SEQUENCE_END, 0x00, 0, 0}
1468 /* 1280X1024 SXGA */
1469 static struct reginfo sensor_sxga[] =
1471 {SEQUENCE_END, 0x00}
1475 #if ADJUST_FOR_CAPTURE_FALG
1476 static struct reginfo sensor_xga[] =
1478 {0x098E, 0x48C0,WORD_LEN,0}, // LOGICAL_ADDRESS_ACCESS [CAM_OUTPUT_1_IMAGE_WIDTH]
1479 {0xC8C0, 0x0403,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_WIDTH
1480 {0xC8C2, 0x0302,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_HEIGHT
1481 {0x8404, 0x06 ,BYTE_LEN,0}, // SEQ_CMD
1482 {SEQUENCE_WAIT_MS,100,WORD_LEN,0},
1483 {SEQUENCE_END, 0x00, 0, 0}
1486 static struct reginfo sensor_xga[] =
1488 {SEQUENCE_END, 0x00, 0, 0}
1494 static struct reginfo sensor_svga[] =
1496 { SEQUENCE_END, 0x00, 0, 0}
1500 static struct reginfo sensor_vga[] =
1503 {0xC83A, 0x000C, WORD_LEN, 0}, // CAM_CORE_A_Y_ADDR_START
1504 {0xC83C, 0x0018, WORD_LEN, 0}, // CAM_CORE_A_X_ADDR_START
1505 {0xC83E, 0x07B1, WORD_LEN, 0 }, // CAM_CORE_A_Y_ADDR_END
1506 {0xC840, 0x0A45, WORD_LEN, 0}, // CAM_CORE_A_X_ADDR_END
1507 {0xC868, 0x0423, WORD_LEN, 0}, // CAM_CORE_A_FRAME_LENGTH_LINES
1508 {0xC86A, 0x1194, WORD_LEN, 0}, // CAM_CORE_A_LINE_LENGTH_PCK
1509 {0xC86C, 0x0518, WORD_LEN, 0}, // CAM_CORE_A_OUTPUT_SIZE_WIDTH
1510 {0xC86E, 0x03D4, WORD_LEN, 0}, // CAM_CORE_A_OUTPUT_SIZE_HEIGHT
1511 {0xC870, 0x0014, WORD_LEN, 0}, // CAM_CORE_A_RX_FIFO_TRIGGER_MARK
1512 {0xC858, 0x0003, WORD_LEN, 0}, // CAM_CORE_A_COARSE_ITMIN
1513 {0xC8A4, 0x0A28, WORD_LEN, 0}, // CAM_CORE_B_OUTPUT_SIZE_WIDTH
1514 {0xC8A6, 0x07A0, WORD_LEN, 0 }, // CAM_CORE_B_OUTPUT_SIZE_HEIGHT
1515 {0xC8AA, 0x0280, WORD_LEN, 0 }, // CAM_OUTPUT_0_IMAGE_WIDTH
1516 {0xC8AC, 0x01E0, WORD_LEN, 0 }, // CAM_OUTPUT_0_IMAGE_HEIGHT
1517 {0xC8AE, 0x0001, WORD_LEN, 0 }, // CAM_OUTPUT_0_OUTPUT_FORMAT
1518 {0x8404, 0x06, BYTE_LEN, 0 }, // SEQ_CMD
1519 {SEQUENCE_WAIT_MS,100, WORD_LEN, 0},
1520 {SEQUENCE_END, 0x00, 0, 0}
1525 static struct reginfo sensor_cif[] =
1527 {SEQUENCE_END, 0x00}
1531 static struct reginfo sensor_qvga[] =
1533 {SEQUENCE_END, 0x00}
1537 static struct reginfo sensor_qcif[] =
1539 {SEQUENCE_END, 0x00}
1542 static struct reginfo sensor_Preview2Capture[]=
1545 {0x098E, 0x843C, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [SEQ_STATE_CFG_5_MAX_FRAME_CNT]
1546 {0x843C, 0xFF, BYTE_LEN, 0 }, // SEQ_STATE_CFG_5_MAX_FRAME_CNT
1547 {0x8404, 0x02, BYTE_LEN, 0 }, // SEQ_CMD
1548 {SEQUENCE_END, 0x00, 0, 0}
1552 static struct reginfo sensor_Capture2Preview[]=
1555 {0x098E, 0x843C, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [SEQ_STATE_CFG_5_MAX_FRAME_CNT]
1556 {0x843C, 0x01, BYTE_LEN, 0 }, // SEQ_STATE_CFG_5_MAX_FRAME_CNT
1557 {0x8404, 0x01, BYTE_LEN, 0 }, // SEQ_CMD
1558 {0x0016, 0x0447, WORD_LEN, 0}, // CLOCKS_CONTRO
1559 {SEQUENCE_END, 0x00, 0, 0}
1562 static struct reginfo sensor_ClrFmt_YUYV[]=
1564 {SEQUENCE_END, 0x00}
1567 static struct reginfo sensor_ClrFmt_UYVY[]=
1569 {SEQUENCE_END, 0x00}
1573 #if CONFIG_SENSOR_WhiteBalance
1574 static struct reginfo sensor_WhiteB_Auto[]=
1577 {0x098E, 0xACB0, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [AWB_MIN_ACCEPTED_PRE_AWB_R2G_RATIO]
1578 {0xACB0, 0x31, BYTE_LEN, 0 }, // AWB_RG_MIN
1579 {0xACB1, 0x5B, BYTE_LEN, 0 }, // AWB_RG_MAX
1580 {0xACB4, 0x2A, BYTE_LEN, 0 }, // AWB_BG_MIN
1581 {0xACB5, 0x5B, BYTE_LEN, 0 }, // AWB_BG_MAX
1582 {0xACB2, 0x40, BYTE_LEN, 0 }, // AWB_RG_MIN_BRIGHT
1583 {0xACB3, 0x48, BYTE_LEN, 0 }, // AWB_RG_MAX_BRIGHT
1584 {0xACB6, 0x3f, BYTE_LEN, 0 }, // AWB_BG_MIN_BRIGHT
1585 {0xACB7, 0x48, BYTE_LEN, 0 }, // AWB_BG_MAX_BRIGHT
1586 {0xAC44, 0x00, BYTE_LEN, 0 }, // AWB_LEFT_CCM_POS_RANGE_LIMIT
1587 {0xAC45, 0x7F, BYTE_LEN, 0 }, // AWB_RIGHT_CCM_POS_RANGE_LIMIT
1588 {SEQUENCE_END, 0x00, 0, 0}
1591 /* Cloudy Colour Temperature : 6500K - 8000K */
1592 static struct reginfo sensor_WhiteB_Cloudy[]=
1595 { 0x098E, 0xACB0, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [AWB_MIN_ACCEPTED_PRE_AWB_R2G_RATIO]
1596 {0xACB0, 0x38, BYTE_LEN, 0 }, // AWB_RG_MIN
1597 {0xACB1, 0x42, BYTE_LEN, 0 }, // AWB_RG_MAX
1598 {0xACB4, 0x44, BYTE_LEN, 0 }, // AWB_BG_MIN
1599 {0xACB5, 0x4C, BYTE_LEN, 0 }, // AWB_BG_MAX
1600 {0xACB2, 0x38, BYTE_LEN, 0 }, // AWB_RG_MIN_BRIGHT
1601 {0xACB3, 0x42, BYTE_LEN, 0 }, // AWB_RG_MAX_BRIGHT
1602 {0xACB6, 0x44, BYTE_LEN, 0 }, // AWB_BG_MIN_BRIGHT
1603 {0xACB7, 0x4C, BYTE_LEN, 0 }, // AWB_BG_MAX_BRIGHT
1604 {0xAC44, 0x7C, BYTE_LEN, 0 }, // AWB_LEFT_CCM_POS_RANGE_LIMIT
1605 {0xAC45, 0x7F, BYTE_LEN, 0 }, // AWB_RIGHT_CCM_POS_RANGE_LIMIT
1606 {0xAC04, 0x3E, BYTE_LEN, 0 }, // AWB_PRE_AWB_R2G_RATIO
1607 {0xAC05, 0x48, BYTE_LEN, 0 }, // AWB_PRE_AWB_B2G_RATIO
1608 {0xAC08, 0x7F, BYTE_LEN, 0 }, // AWB_CUR_CCM_POS
1609 {SEQUENCE_END, 0x00, 0, 0}
1612 /* ClearDay Colour Temperature : 5000K - 6500K */
1613 static struct reginfo sensor_WhiteB_ClearDay[]=
1616 { 0x098E, 0xACB0, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [AWB_MIN_ACCEPTED_PRE_AWB_R2G_RATIO]
1617 {0xACB0, 0x3A, BYTE_LEN, 0 }, // AWB_RG_MIN
1618 {0xACB1, 0x44, BYTE_LEN, 0 }, // AWB_RG_MAX
1619 {0xACB4, 0x40, BYTE_LEN, 0 }, // AWB_BG_MIN
1620 {0xACB5, 0x4A, BYTE_LEN, 0 }, // AWB_BG_MAX
1621 {0xACB2, 0x3A, BYTE_LEN, 0 }, // AWB_RG_MIN_BRIGHT
1622 {0xACB3, 0x44, BYTE_LEN, 0 }, // AWB_RG_MAX_BRIGHT
1623 {0xACB6, 0x40, BYTE_LEN, 0 }, // AWB_BG_MIN_BRIGHT
1624 {0xACB7, 0x4A, BYTE_LEN, 0 }, // AWB_BG_MAX_BRIGHT
1625 {0xAC44, 0x7C, BYTE_LEN, 0 }, // AWB_LEFT_CCM_POS_RANGE_LIMIT
1626 {0xAC45, 0x7F, BYTE_LEN, 0 }, // AWB_RIGHT_CCM_POS_RANGE_LIMIT
1627 {0xAC04, 0x40, BYTE_LEN, 0 }, // AWB_PRE_AWB_R2G_RATIO
1628 {0xAC05, 0x48, BYTE_LEN, 0 }, // AWB_PRE_AWB_B2G_RATIO
1629 {0xAC08, 0x7F, BYTE_LEN, 0 }, // AWB_CUR_CCM_POS
1630 {SEQUENCE_END, 0x00, 0, 0}
1633 /* Office Colour Temperature : 3500K - 5000K */
1634 static struct reginfo sensor_WhiteB_TungstenLamp1[]=
1637 { 0x098E, 0xACB0, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [AWB_MIN_ACCEPTED_PRE_AWB_R2G_RATIO]
1638 {0xACB0, 0x44, BYTE_LEN, 0 }, // AWB_RG_MIN
1639 {0xACB1, 0x4B, BYTE_LEN, 0 }, // AWB_RG_MAX
1640 {0xACB4, 0x2C, BYTE_LEN, 0 }, // AWB_BG_MIN
1641 {0xACB5, 0x34, BYTE_LEN, 0 }, // AWB_BG_MAX
1642 {0xACB2, 0x44, BYTE_LEN, 0 }, // AWB_RG_MIN_BRIGHT
1643 {0xACB3, 0x4B, BYTE_LEN, 0 }, // AWB_RG_MAX_BRIGHT
1644 {0xACB6, 0x2C, BYTE_LEN, 0 }, // AWB_BG_MIN_BRIGHT
1645 {0xACB7, 0x34, BYTE_LEN, 0 }, // AWB_BG_MAX_BRIGHT
1646 {0xAC44, 0x40, BYTE_LEN, 0 }, // AWB_LEFT_CCM_POS_RANGE_LIMIT
1647 {0xAC45, 0x4A, BYTE_LEN, 0 }, // AWB_RIGHT_CCM_POS_RANGE_LIMIT
1648 {0xAC04, 0x47, BYTE_LEN, 0 }, // AWB_PRE_AWB_R2G_RATIO
1649 {0xAC05, 0x30, BYTE_LEN, 0 }, // AWB_PRE_AWB_B2G_RATIO
1650 {0xAC08, 0x45, BYTE_LEN, 0 }, // AWB_CUR_CCM_POS
1651 {SEQUENCE_END, 0x00, 0, 0}
1653 /* Home Colour Temperature : 2500K - 3500K */
1654 static struct reginfo sensor_WhiteB_TungstenLamp2[]=
1656 //[II. Incandescent]
1657 { 0x098E, 0xACB0, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [AWB_MIN_ACCEPTED_PRE_AWB_R2G_RATIO]
1658 {0xACB0, 0x57, BYTE_LEN, 0 }, // AWB_RG_MIN
1659 {0xACB1, 0x5F, BYTE_LEN, 0 }, // AWB_RG_MAX
1660 {0xACB4, 0x26, BYTE_LEN, 0 }, // AWB_BG_MIN
1661 {0xACB5, 0x2E, BYTE_LEN, 0 }, // AWB_BG_MAX
1662 {0xACB2, 0x57, BYTE_LEN, 0 }, // AWB_RG_MIN_BRIGHT
1663 {0xACB3, 0x5F, BYTE_LEN, 0 }, // AWB_RG_MAX_BRIGHT
1664 {0xACB6, 0x26, BYTE_LEN, 0 }, // AWB_BG_MIN_BRIGHT
1665 {0xACB7, 0x2E, BYTE_LEN, 0 }, // AWB_BG_MAX_BRIGHT
1666 {0xAC44, 0x00, BYTE_LEN, 0 }, // AWB_LEFT_CCM_POS_RANGE_LIMIT
1667 {0xAC45, 0x08, BYTE_LEN, 0 }, // AWB_RIGHT_CCM_POS_RANGE_LIMIT
1668 {0xAC04, 0x5B, BYTE_LEN, 0 }, // AWB_PRE_AWB_R2G_RATIO
1669 {0xAC05, 0x2A, BYTE_LEN, 0 }, // AWB_PRE_AWB_B2G_RATIO
1670 {0xAC08, 0x00, BYTE_LEN, 0 }, // AWB_CUR_CCM_POS
1671 {SEQUENCE_END, 0x00, 0, 0}
1673 static struct reginfo *sensor_WhiteBalanceSeqe[] = {sensor_WhiteB_Auto, sensor_WhiteB_TungstenLamp1,sensor_WhiteB_TungstenLamp2,
1674 sensor_WhiteB_ClearDay, sensor_WhiteB_Cloudy,NULL,
1678 #if CONFIG_SENSOR_Brightness
1679 static struct reginfo sensor_Brightness0[]=
1681 {SEQUENCE_END, 0x00}
1684 static struct reginfo sensor_Brightness1[]=
1686 {SEQUENCE_END, 0x00}
1689 static struct reginfo sensor_Brightness2[]=
1691 {SEQUENCE_END, 0x00}
1694 static struct reginfo sensor_Brightness3[]=
1696 {SEQUENCE_END, 0x00}
1699 static struct reginfo sensor_Brightness4[]=
1701 {SEQUENCE_END, 0x00}
1704 static struct reginfo sensor_Brightness5[]=
1706 {SEQUENCE_END, 0x00}
1708 static struct reginfo *sensor_BrightnessSeqe[] = {sensor_Brightness0, sensor_Brightness1, sensor_Brightness2, sensor_Brightness3,
1709 sensor_Brightness4, sensor_Brightness5,NULL,
1714 #if CONFIG_SENSOR_Effect
1715 static struct reginfo sensor_Effect_Normal[] =
1717 {0x098e,0xdc38, WORD_LEN, 0},
1718 {0xdc38,0x00, BYTE_LEN, 0 },
1719 {0x8404,0x06, BYTE_LEN, 0 },
1720 {SEQUENCE_END, 0x00, 0, 0}
1723 static struct reginfo sensor_Effect_WandB[] =
1725 {SEQUENCE_END, 0x00, 0, 0}
1728 static struct reginfo sensor_Effect_Sepia[] =
1730 {0x098e,0xdc38, WORD_LEN, 0},
1731 {0xdc38,0x02, BYTE_LEN, 0 },
1732 {0xdc3a,0x10, BYTE_LEN, 0 },
1733 {0xdc3b,0xe0, BYTE_LEN, 0 },
1734 {0x8404,0x06, BYTE_LEN, 0 },
1735 {SEQUENCE_END, 0x00, 0, 0}
1738 static struct reginfo sensor_Effect_Negative[] =
1740 {0x098e,0xdc38, WORD_LEN, 0},
1741 {0xdc38,0x03, BYTE_LEN, 0 },
1742 {0x8404,0x06, BYTE_LEN, 0 },
1743 {SEQUENCE_END, 0x00, 0, 0}
1746 static struct reginfo sensor_Effect_Bluish[] =
1748 {SEQUENCE_END, 0x00, 0, 0}
1751 static struct reginfo sensor_Effect_Green[] =
1753 {SEQUENCE_END, 0x00, 0, 0}
1756 static struct reginfo sensor_Effect_Solarize[] =
1758 {0x098e,0xdc38, WORD_LEN, 0},
1759 {0xdc38,0x05, BYTE_LEN, 0 },
1760 {0xdc39,0x20, BYTE_LEN, 0 },
1761 {0x8404,0x06, BYTE_LEN, 0 },
1762 {SEQUENCE_END, 0x00, 0, 0}
1764 static struct reginfo *sensor_EffectSeqe[] = {sensor_Effect_Normal, sensor_Effect_Negative,sensor_Effect_Sepia,
1765 sensor_Effect_Solarize,NULL,
1768 #if CONFIG_SENSOR_Exposure
1769 static struct reginfo sensor_Exposure0[]=
1771 {SEQUENCE_END, 0x00}
1774 static struct reginfo sensor_Exposure1[]=
1776 {SEQUENCE_END, 0x00}
1779 static struct reginfo sensor_Exposure2[]=
1781 {SEQUENCE_END, 0x00}
1784 static struct reginfo sensor_Exposure3[]=
1786 {SEQUENCE_END, 0x00}
1789 static struct reginfo sensor_Exposure4[]=
1791 {SEQUENCE_END, 0x00}
1794 static struct reginfo sensor_Exposure5[]=
1796 {SEQUENCE_END, 0x00}
1799 static struct reginfo sensor_Exposure6[]=
1801 {SEQUENCE_END, 0x00}
1804 static struct reginfo *sensor_ExposureSeqe[] = {sensor_Exposure0, sensor_Exposure1, sensor_Exposure2, sensor_Exposure3,
1805 sensor_Exposure4, sensor_Exposure5,sensor_Exposure6,NULL,
1808 #if CONFIG_SENSOR_Saturation
1809 static struct reginfo sensor_Saturation0[]=
1811 {SEQUENCE_END, 0x00}
1814 static struct reginfo sensor_Saturation1[]=
1816 {SEQUENCE_END, 0x00}
1819 static struct reginfo sensor_Saturation2[]=
1821 {SEQUENCE_END, 0x00}
1823 static struct reginfo *sensor_SaturationSeqe[] = {sensor_Saturation0, sensor_Saturation1, sensor_Saturation2, NULL,};
1826 #if CONFIG_SENSOR_Contrast
1827 static struct reginfo sensor_Contrast0[]=
1829 {SEQUENCE_END, 0x00}
1832 static struct reginfo sensor_Contrast1[]=
1834 {SEQUENCE_END, 0x00}
1837 static struct reginfo sensor_Contrast2[]=
1839 {SEQUENCE_END, 0x00}
1842 static struct reginfo sensor_Contrast3[]=
1844 {SEQUENCE_END, 0x00}
1847 static struct reginfo sensor_Contrast4[]=
1849 {SEQUENCE_END, 0x00}
1853 static struct reginfo sensor_Contrast5[]=
1855 {SEQUENCE_END, 0x00}
1858 static struct reginfo sensor_Contrast6[]=
1860 {SEQUENCE_END, 0x00}
1862 static struct reginfo *sensor_ContrastSeqe[] = {sensor_Contrast0, sensor_Contrast1, sensor_Contrast2, sensor_Contrast3,
1863 sensor_Contrast4, sensor_Contrast5, sensor_Contrast6, NULL,
1867 #if CONFIG_SENSOR_Mirror
1868 static struct reginfo sensor_MirrorOn[]=
1870 {SEQUENCE_END, 0x00, 0, 0}
1873 static struct reginfo sensor_MirrorOff[]=
1875 {SEQUENCE_END, 0x00, 0, 0}
1877 static struct reginfo *sensor_MirrorSeqe[] = {sensor_MirrorOff, sensor_MirrorOn,NULL,};
1879 #if CONFIG_SENSOR_Flip
1880 static struct reginfo sensor_FlipOn[]=
1882 {SEQUENCE_END, 0x00, 0, 0}
1885 static struct reginfo sensor_FlipOff[]=
1887 {SEQUENCE_END, 0x00, 0, 0}
1889 static struct reginfo *sensor_FlipSeqe[] = {sensor_FlipOff, sensor_FlipOn,NULL,};
1893 #if CONFIG_SENSOR_Scene
1894 static struct reginfo sensor_SceneAuto[] =
1896 {SEQUENCE_END, 0x00, 0, 0}
1899 static struct reginfo sensor_SceneNight[] =
1901 {SEQUENCE_END, 0x00, 0, 0}
1903 static struct reginfo *sensor_SceneSeqe[] = {sensor_SceneAuto, sensor_SceneNight,NULL,};
1907 #if CONFIG_SENSOR_DigitalZoom
1908 static struct reginfo sensor_Zoom0[] =
1910 {SEQUENCE_END, 0x00, 0, 0}
1913 static struct reginfo sensor_Zoom1[] =
1915 {SEQUENCE_END, 0x00, 0, 0}
1918 static struct reginfo sensor_Zoom2[] =
1920 {SEQUENCE_END, 0x00, 0, 0}
1924 static struct reginfo sensor_Zoom3[] =
1926 {SEQUENCE_END, 0x00, 0, 0}
1928 static struct reginfo *sensor_ZoomSeqe[] = {sensor_Zoom0, sensor_Zoom1, sensor_Zoom2, sensor_Zoom3, NULL};
1930 static const struct v4l2_querymenu sensor_menus[] =
1932 #if CONFIG_SENSOR_WhiteBalance
1933 { .id = V4L2_CID_DO_WHITE_BALANCE, .index = 0, .name = "auto", .reserved = 0, }, { .id = V4L2_CID_DO_WHITE_BALANCE, .index = 1, .name = "incandescent", .reserved = 0,},
1934 { .id = V4L2_CID_DO_WHITE_BALANCE, .index = 2, .name = "fluorescent", .reserved = 0,}, { .id = V4L2_CID_DO_WHITE_BALANCE, .index = 3, .name = "daylight", .reserved = 0,},
1935 { .id = V4L2_CID_DO_WHITE_BALANCE, .index = 4, .name = "cloudy-daylight", .reserved = 0,},
1938 #if CONFIG_SENSOR_Effect
1939 { .id = V4L2_CID_EFFECT, .index = 0, .name = "none", .reserved = 0, }, { .id = V4L2_CID_EFFECT, .index = 1, .name = "negative", .reserved = 0,},
1940 { .id = V4L2_CID_EFFECT, .index = 2, .name = "sepia", .reserved = 0,}, { .id = V4L2_CID_EFFECT, .index = 3, .name = "solarize", .reserved = 0,},
1943 #if CONFIG_SENSOR_Scene
1944 { .id = V4L2_CID_SCENE, .index = 0, .name = "auto", .reserved = 0,} ,{ .id = V4L2_CID_SCENE, .index = 1, .name = "night", .reserved = 0,},
1947 #if CONFIG_SENSOR_Flash
1948 { .id = V4L2_CID_FLASH, .index = 0, .name = "off", .reserved = 0, }, { .id = V4L2_CID_FLASH, .index = 1, .name = "auto", .reserved = 0,},
1949 { .id = V4L2_CID_FLASH, .index = 2, .name = "on", .reserved = 0,}, { .id = V4L2_CID_FLASH, .index = 3, .name = "torch", .reserved = 0,},
1953 static const struct v4l2_queryctrl sensor_controls[] =
1955 #if CONFIG_SENSOR_WhiteBalance
1957 .id = V4L2_CID_DO_WHITE_BALANCE,
1958 .type = V4L2_CTRL_TYPE_MENU,
1959 .name = "White Balance Control",
1967 #if CONFIG_SENSOR_Brightness
1969 .id = V4L2_CID_BRIGHTNESS,
1970 .type = V4L2_CTRL_TYPE_INTEGER,
1971 .name = "Brightness Control",
1979 #if CONFIG_SENSOR_Effect
1981 .id = V4L2_CID_EFFECT,
1982 .type = V4L2_CTRL_TYPE_MENU,
1983 .name = "Effect Control",
1991 #if CONFIG_SENSOR_Exposure
1993 .id = V4L2_CID_EXPOSURE,
1994 .type = V4L2_CTRL_TYPE_INTEGER,
1995 .name = "Exposure Control",
2003 #if CONFIG_SENSOR_Saturation
2005 .id = V4L2_CID_SATURATION,
2006 .type = V4L2_CTRL_TYPE_INTEGER,
2007 .name = "Saturation Control",
2015 #if CONFIG_SENSOR_Contrast
2017 .id = V4L2_CID_CONTRAST,
2018 .type = V4L2_CTRL_TYPE_INTEGER,
2019 .name = "Contrast Control",
2027 #if CONFIG_SENSOR_Mirror
2029 .id = V4L2_CID_HFLIP,
2030 .type = V4L2_CTRL_TYPE_BOOLEAN,
2031 .name = "Mirror Control",
2039 #if CONFIG_SENSOR_Flip
2041 .id = V4L2_CID_VFLIP,
2042 .type = V4L2_CTRL_TYPE_BOOLEAN,
2043 .name = "Flip Control",
2051 #if CONFIG_SENSOR_Scene
2053 .id = V4L2_CID_SCENE,
2054 .type = V4L2_CTRL_TYPE_MENU,
2055 .name = "Scene Control",
2063 #if CONFIG_SENSOR_DigitalZoom
2065 .id = V4L2_CID_ZOOM_RELATIVE,
2066 .type = V4L2_CTRL_TYPE_INTEGER,
2067 .name = "DigitalZoom Control",
2073 .id = V4L2_CID_ZOOM_ABSOLUTE,
2074 .type = V4L2_CTRL_TYPE_INTEGER,
2075 .name = "DigitalZoom Control",
2083 #if CONFIG_SENSOR_Focus
2085 .id = V4L2_CID_FOCUS_RELATIVE,
2086 .type = V4L2_CTRL_TYPE_INTEGER,
2087 .name = "Focus Control",
2093 .id = V4L2_CID_FOCUS_ABSOLUTE,
2094 .type = V4L2_CTRL_TYPE_INTEGER,
2095 .name = "Focus Control",
2099 .default_value = 125,
2102 .id = V4L2_CID_FOCUS_AUTO,
2103 .type = V4L2_CTRL_TYPE_BOOLEAN,
2104 .name = "Focus Control",
2110 .id = V4L2_CID_FOCUS_CONTINUOUS,
2111 .type = V4L2_CTRL_TYPE_BOOLEAN,
2112 .name = "Focus Control",
2120 #if CONFIG_SENSOR_Flash
2122 .id = V4L2_CID_FLASH,
2123 .type = V4L2_CTRL_TYPE_MENU,
2124 .name = "Flash Control",
2134 static int sensor_probe(struct i2c_client *client, const struct i2c_device_id *did);
2135 static int sensor_video_probe(struct soc_camera_device *icd, struct i2c_client *client);
2136 static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
2137 static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
2138 static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl);
2139 static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl);
2140 static int sensor_suspend(struct soc_camera_device *icd, pm_message_t pm_msg);
2141 static int sensor_resume(struct soc_camera_device *icd);
2142 static int sensor_set_bus_param(struct soc_camera_device *icd,unsigned long flags);
2143 static unsigned long sensor_query_bus_param(struct soc_camera_device *icd);
2144 static int sensor_set_effect(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value);
2145 static int sensor_set_whiteBalance(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value);
2146 static int sensor_deactivate(struct i2c_client *client);
2148 static struct soc_camera_ops sensor_ops =
2150 .suspend = sensor_suspend,
2151 .resume = sensor_resume,
2152 .set_bus_param = sensor_set_bus_param,
2153 .query_bus_param = sensor_query_bus_param,
2154 .controls = sensor_controls,
2155 .menus = sensor_menus,
2156 .num_controls = ARRAY_SIZE(sensor_controls),
2157 .num_menus = ARRAY_SIZE(sensor_menus),
2160 /* only one fixed colorspace per pixelcode */
2161 struct sensor_datafmt {
2162 enum v4l2_mbus_pixelcode code;
2163 enum v4l2_colorspace colorspace;
2166 /* Find a data format by a pixel code in an array */
2167 static const struct sensor_datafmt *sensor_find_datafmt(
2168 enum v4l2_mbus_pixelcode code, const struct sensor_datafmt *fmt,
2172 for (i = 0; i < n; i++)
2173 if (fmt[i].code == code)
2179 static const struct sensor_datafmt sensor_colour_fmts[] = {
2180 {V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},
2181 {V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
2183 enum sensor_work_state
2185 sensor_work_ready = 0,
2190 struct i2c_client *client;
2191 struct delayed_work dwork;
2192 enum sensor_work_state state;
2195 typedef struct sensor_info_priv_s
2209 unsigned char mirror; /* HFLIP */
2210 unsigned char flip; /* VFLIP */
2217 struct reginfo *winseqe_cur_addr;
2218 struct sensor_datafmt fmt;
2219 unsigned int enable;
2220 unsigned int funmodule_state;
2221 } sensor_info_priv_t;
2225 struct sensor_parameter
2227 unsigned short int preview_maxlines;
2228 unsigned short int preview_exposure;
2229 unsigned short int preview_line_width;
2230 unsigned short int preview_gain;
2232 unsigned short int capture_framerate;
2233 unsigned short int preview_framerate;
2238 struct v4l2_subdev subdev;
2239 struct i2c_client *client;
2240 sensor_info_priv_t info_priv;
2241 struct sensor_parameter parameter;
2242 struct workqueue_struct *sensor_wq;
2243 struct sensor_work sensor_wk;
2244 struct mutex wq_lock;
2245 int model; /* V4L2_IDENT_OV* codes from v4l2-chip-ident.h */
2246 #if CONFIG_SENSOR_I2C_NOSCHED
2247 atomic_t tasklock_cnt;
2249 struct rk29camera_platform_data *sensor_io_request;
2250 struct rk29camera_gpio_res *sensor_gpio_res;
2253 static struct sensor* to_sensor(const struct i2c_client *client)
2255 return container_of(i2c_get_clientdata(client), struct sensor, subdev);
2258 static int sensor_task_lock(struct i2c_client *client, int lock)
2260 #if CONFIG_SENSOR_I2C_NOSCHED
2262 struct sensor *sensor = to_sensor(client);
2265 if (atomic_read(&sensor->tasklock_cnt) == 0) {
2266 while ((atomic_read(&client->adapter->bus_lock.count) < 1) && (cnt>0)) {
2267 SENSOR_TR("\n %s will obtain i2c in atomic, but i2c bus is locked! Wait...\n",SENSOR_NAME_STRING());
2271 if ((atomic_read(&client->adapter->bus_lock.count) < 1) && (cnt<=0)) {
2272 SENSOR_TR("\n %s obtain i2c fail in atomic!!\n",SENSOR_NAME_STRING());
2273 goto sensor_task_lock_err;
2278 atomic_add(1, &sensor->tasklock_cnt);
2280 if (atomic_read(&sensor->tasklock_cnt) > 0) {
2281 atomic_sub(1, &sensor->tasklock_cnt);
2283 if (atomic_read(&sensor->tasklock_cnt) == 0)
2288 sensor_task_lock_err:
2294 /*sensor register write */
2295 static int sensor_write(struct i2c_client *client, struct reginfo *reg_info)
2299 struct i2c_msg msg[1];
2301 switch (reg_info->reg)
2303 case SEQUENCE_WAIT_MS:
2306 mdelay(reg_info->val);
2308 msleep(reg_info->val);
2312 case SEQUENCE_WAIT_US:
2314 udelay(reg_info->val);
2317 case SEQUENCE_PROPERTY:
2323 buf[0] = reg_info->reg >> 8;
2324 buf[1] = reg_info->reg & 0xFF;
2325 if (reg_info->reg_len == WORD_LEN) {
2326 buf[2] = reg_info->val >> 8;
2327 buf[3] = reg_info->val & 0xFF;
2329 } else if (reg_info->reg_len == BYTE_LEN) {
2330 buf[2] = reg_info->val;
2333 msg->addr = client->addr;
2334 msg->flags = client->flags;
2336 msg->scl_rate = CONFIG_SENSOR_I2C_SPEED; /* ddl@rock-chips.com : 100kHz */
2337 msg->read_type = 0; /* fpga i2c:0==I2C_NORMAL : direct use number not enum for don't want include spi_fpga.h */
2340 while ((cnt-- > 0) && (err < 0)) { /* ddl@rock-chips.com : Transfer again if transent is failed */
2341 err = i2c_transfer(client->adapter, msg, 1);
2346 SENSOR_TR("\n %s write reg(0x%x, val:0x%x) failed, try to write again!\n",SENSOR_NAME_STRING(),reg_info->reg, reg_info->val);
2356 *sensor_write_Multiple_data - sensor register write with Multiple data
2358 * @reg_info: the first register address
2359 * @count: data number
2361 * Returns negative errno, else the number of messages executed.
2365 static int sensor_write_Multiple_data(struct i2c_client *client, struct reginfo *reg_info, int count)
2370 struct reginfo *tmpval = NULL;
2372 struct i2c_msg msg[1];
2375 if(count < 1 || tmpval==NULL||tmpval->reg==0x0000)
2378 memset((char*)&msg[0],0,sizeof(struct i2c_msg));
2379 buf = kmalloc((count*2+10)*sizeof(u8),GFP_KERNEL);
2381 SENSOR_TR("%s %s fail,because kmalloc failed",SENSOR_NAME_STRING(),__FUNCTION__);
2383 goto sensor_write_Multiple_data_end;
2385 memset(buf,0,sizeof(buf));
2387 switch (reg_info->reg)
2389 case SEQUENCE_WAIT_MS:
2392 mdelay(reg_info->val);
2394 msleep(reg_info->val);
2398 case SEQUENCE_WAIT_US:
2400 udelay(reg_info->val);
2404 case SEQUENCE_PROPERTY:
2411 buf[0] = tmpval->reg >> 8;
2412 buf[1] = tmpval->reg & 0xFF;
2414 if (tmpval->reg_len == WORD_LEN)
2419 buf[i] = tmpval->val >> 8;
2420 buf[i+1] = tmpval->val & 0xFF;
2425 } else if (tmpval->reg_len == BYTE_LEN) {
2429 buf[i] = tmpval->val;
2435 msg->addr = client->addr;
2436 msg->flags = client->flags;
2438 msg->scl_rate = CONFIG_SENSOR_I2C_SPEED; /* ddl@rock-chips.com : 100kHz */
2439 msg->read_type = 0; /* fpga i2c:0==I2C_NORMAL : direct use number not enum for don't want include spi_fpga.h */
2442 while ((cnt-- > 0) && (err < 0)) { /* ddl@rock-chips.com : Transfer again if transent is failed */
2443 err = i2c_transfer(client->adapter, msg, 1);
2447 SENSOR_TR("\n %s write reg(0x%x, val:0x%x) failed, try to write again!\n",SENSOR_NAME_STRING(),reg_info->reg, reg_info->val);
2453 sensor_write_Multiple_data_end:
2461 /* sensor register read */
2462 static int sensor_read(struct i2c_client *client, u16 reg, u16 *val)
2466 struct i2c_msg msg[2];
2469 buf[1] = reg & 0xFF;
2471 msg[0].addr = client->addr;
2472 msg[0].flags = client->flags;
2474 msg[0].len = sizeof(buf);
2475 msg[0].scl_rate = CONFIG_SENSOR_I2C_SPEED; /* ddl@rock-chips.com : 100kHz */
2476 msg[0].read_type = 2; /* fpga i2c:0==I2C_NO_STOP : direct use number not enum for don't want include spi_fpga.h */
2478 msg[1].addr = client->addr;
2479 msg[1].flags = client->flags|I2C_M_RD;
2482 msg[1].scl_rate = CONFIG_SENSOR_I2C_SPEED; /* ddl@rock-chips.com : 100kHz */
2483 msg[1].read_type = 2; /* fpga i2c:0==I2C_NO_STOP : direct use number not enum for don't want include spi_fpga.h */
2487 while ((cnt-- > 0) && (err < 0)) { /* ddl@rock-chips.com : Transfer again if transent is failed */
2488 err = i2c_transfer(client->adapter, msg, 2);
2494 SENSOR_TR("\n %s read reg(0x%x val:0x%x) failed, try to read again! \n",SENSOR_NAME_STRING(),reg, *val);
2502 /* write a array of registers */
2503 static int sensor_write_array(struct i2c_client *client, struct reginfo *regarray)
2510 #if CONFIG_SENSOR_I2C_RDWRCHK
2515 if (sensor_task_lock(client, 1) < 0)
2516 goto sensor_write_array_end;
2518 // SENSOR_TR("%s ..%s..\n",SENSOR_NAME_STRING(),__FUNCTION__);
2520 while (regarray[i].reg != SEQUENCE_END) {
2523 while((regarray[j].reg_len ==regarray[i].reg_len)&®array[j].reg != SEQUENCE_END)
2525 temp = regarray[j].reg - regarray[j-1].reg;
2526 if((regarray[j].reg_len==WORD_LEN && temp!=0x0002)||(regarray[j].reg_len==BYTE_LEN && temp!=0x0001))
2531 err = sensor_write_Multiple_data(client, ®array[i], num) ;
2535 SENSOR_TR("%s..write failed current reg:0x%x, Write array again !\n", SENSOR_NAME_STRING(),regarray[i].reg);
2539 SENSOR_TR("%s..write array failed!!!\n", SENSOR_NAME_STRING());
2541 goto sensor_write_array_end;
2544 #if CONFIG_SENSOR_I2C_RDWRCHK
2545 sensor_read(client, regarray[i].reg, &valchk);
2546 if (valchk != regarray[i].val)
2547 SENSOR_TR("%s Reg:0x%x write(0x%x, 0x%x) fail\n",SENSOR_NAME_STRING(), regarray[i].reg, regarray[i].val, valchk);
2553 sensor_write_array_end:
2554 sensor_task_lock(client,0);
2558 /* write sensor initial data */
2559 static int sensor_write_init_data(struct i2c_client *client, struct reginfo *regarray)
2564 #if CONFIG_SENSOR_I2C_RDWRCHK
2568 int table[167] = { /*written data numbers every time*/
2569 3,1,1,3,1,1,1,1,11,2,2,13,1,1,1,2,11,2,2,13,
2570 1,2,1,1,2,1,1,1,1,1,8,1,1,1,1,1,1,714,1,1,
2571 1,1,1,1,1,42,1,3,9,1,1,2,2,1,1,1,1,3,1,1,
2572 1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,8,2,2,2,
2573 2,2,1,1,1,1,10,10,9,6,4,2,9,2,2,2,1,1,1,1,
2574 1,1,1,1,1,1,1,1,58,1,1,1,1,1,1,1,1,1,1,1,
2575 2,2,2,2,2,2,2,2,2,3,3,2,1,1,1,1,1, 2,2,1,
2576 6,3,1,1,1,1,1,6,1,2,4,4,1,1,1,4,5,2,2,4,
2581 if (sensor_task_lock(client, 1) < 0)
2582 goto sensor_write_array_end;
2584 while (regarray[i].reg != SEQUENCE_END) {
2590 err = sensor_write_Multiple_data(client, ®array[i], num) ;
2594 SENSOR_TR("%s..write failed current reg:0x%x, Write array again !\n", SENSOR_NAME_STRING(),regarray[i].reg);
2598 SENSOR_TR("%s..write array failed!!!\n", SENSOR_NAME_STRING());
2600 goto sensor_write_array_end;
2603 #if CONFIG_SENSOR_I2C_RDWRCHK
2604 sensor_read(client, regarray[i].reg, &valchk);
2605 if (valchk != regarray[i].val)
2606 SENSOR_TR("%s Reg:0x%x write(0x%x, 0x%x) fail\n",SENSOR_NAME_STRING(), regarray[i].reg, regarray[i].val, valchk);
2611 sensor_write_array_end:
2612 sensor_task_lock(client,0);
2617 /* write a array of registers */
2618 static int sensor_write_array(struct i2c_client *client, struct reginfo *regarray)
2622 #if CONFIG_SENSOR_I2C_RDWRCHK
2626 if (sensor_task_lock(client, 1) < 0)
2627 goto sensor_write_array_end;
2629 while (regarray[i].reg != SEQUENCE_END) {
2631 err = sensor_write(client, ®array[i]);
2636 SENSOR_TR("%s..write failed current reg:0x%x, Write array again !\n", SENSOR_NAME_STRING(),regarray[i].reg);
2640 SENSOR_TR("%s..write array failed!!!\n", SENSOR_NAME_STRING());
2642 goto sensor_write_array_end;
2645 #if CONFIG_SENSOR_I2C_RDWRCHK
2646 sensor_read(client, regarray[i].reg, &valchk);
2647 if (valchk != regarray[i].val)
2648 SENSOR_TR("%s Reg:0x%x write(0x%x, 0x%x) fail\n",SENSOR_NAME_STRING(), regarray[i].reg, regarray[i].val, valchk);
2653 sensor_write_array_end:
2654 sensor_task_lock(client,0);
2658 #if CONFIG_SENSOR_I2C_RDWRCHK
2659 static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regarray)
2667 while (regarray[i].reg != SEQUENCE_END)
2669 sensor_read(client, regarray[i].reg, &valchk);
2670 if (valchk != regarray[i].val)
2671 SENSOR_TR("%s Reg:0x%x read(0x%x, 0x%x) error\n",SENSOR_NAME_STRING(), regarray[i].reg, regarray[i].val, valchk);
2679 #if CONFIG_SENSOR_Focus
2680 static struct reginfo sensor_af_init0[] =
2682 { 0xC400, 0x88, BYTE_LEN, 0 }, // AFM_ALGO
2683 { 0x8419, 0x05, BYTE_LEN, 0 }, // SEQ_STATE_CFG_1_AF
2684 { 0xC400, 0x08, BYTE_LEN, 0 }, // AFM_ALGO
2686 { 0xB002, 0x0305, WORD_LEN, 0}, // AF_MODE
2687 { 0xB004, 0x0002, WORD_LEN, 0}, // AF_ALGO
2689 { 0xB008, 0x0003, WORD_LEN, 0}, // AF_ZONE_WEIGHTS_HI
2690 { 0xB00A, 0xFFFF, WORD_LEN, 0}, // AF_ZONE_WEIGHTS_HI
2691 { 0xB00C, 0xFFFF, WORD_LEN, 0}, // AF_ZONE_WEIGHTS_LO
2692 { 0xB00E, 0xFFFF, WORD_LEN, 0}, // AF_ZONE_WEIGHTS_LO
2693 {SEQUENCE_END, 0x00, 0, 0}
2695 static struct reginfo sensor_af_init1[] =
2698 { 0xC40A, 0x0028, WORD_LEN, 0 }, // AFM_POS_MIN
2699 { 0xC40C, 0x00BE, WORD_LEN, 0 }, // AFM_POS_MAX
2700 //AF_postition_settings
2701 { 0xB018, 0x00, BYTE_LEN, 0}, // AF_FS_POS_0
2702 { 0xB019, 0x20, BYTE_LEN, 0}, // AF_FS_POS_1
2703 { 0xB01A, 0x40, BYTE_LEN, 0}, // AF_FS_POS_2
2704 { 0xB01B, 0x60, BYTE_LEN, 0}, // AF_FS_POS_3
2705 { 0xB01C, 0x80, BYTE_LEN, 0}, // AF_FS_POS_4
2706 { 0xB01D, 0xA0, BYTE_LEN, 0}, // AF_FS_POS_5
2707 { 0xB01E, 0xC0, BYTE_LEN, 0}, // AF_FS_POS_6
2708 { 0xB01A, 0x38, BYTE_LEN, 0}, // AF_FS_POS_2
2709 { 0xB01B, 0x50, BYTE_LEN, 0}, // AF_FS_POS_3
2710 { 0xB01C, 0x68, BYTE_LEN, 0}, // AF_FS_POS_4
2711 { 0xB01D, 0x80, BYTE_LEN, 0}, // AF_FS_POS_5
2712 { 0xB01E, 0x98, BYTE_LEN, 0}, // AF_FS_POS_6
2713 { 0xB01F, 0xB0, BYTE_LEN, 0}, // AF_FS_POS_7
2714 { 0xB020, 0xC0, BYTE_LEN, 0}, // AF_FS_POS_8
2715 { 0xB012, 0x09, BYTE_LEN, 0}, // AF_FS_NUM_STEPS
2717 { 0xB013, 0x55, BYTE_LEN, 0}, // AF_FS_NUM_STEPS2
2718 { 0xB014, 0x06, BYTE_LEN, 0}, // AF_FS_STEP_SIZE
2719 { 0x8404, 0x05, BYTE_LEN, 0}, // SEQ_CMD
2720 //{ SEQUENCE_WAIT_MS,300, WORD_LEN, 0},
2721 { SEQUENCE_WAIT_MS,100, WORD_LEN, 0},
2722 //{ 0x3EDA, 0x6060 // DAC_LD_14_15
2723 { 0x0018, 0x2008, WORD_LEN, 0}, // STANDBY_CONTROL_AND_STATUS
2724 //{ SEQUENCE_WAIT_MS,100, WORD_LEN, 0},
2725 { SEQUENCE_WAIT_MS,30, WORD_LEN, 0},
2726 { 0x3EDA, 0x6060, WORD_LEN, 0 }, // DAC_LD_14_15
2727 {SEQUENCE_END, 0x00, 0, 0}
2731 static struct reginfo sensor_af_trigger[] =
2733 {0x098e,0xb006, WORD_LEN, 0 },
2734 {0xb006,0x01, BYTE_LEN, 0 },
2735 {SEQUENCE_END, 0x00, 0, 0}
2737 static int sensor_af_single(struct i2c_client *client)
2741 ret = sensor_write_array(client, sensor_af_trigger);
2743 SENSOR_TR("%s sensor auto focus trigger fail!!\n",SENSOR_NAME_STRING());
2745 SENSOR_DG("%s sensor auto focus trigger success!\n",SENSOR_NAME_STRING());
2746 sensor_af_single_end:
2750 static int sensor_af_const(struct i2c_client *client)
2754 sensor_af_const_end:
2758 static int sensor_af_zoneupdate(struct i2c_client *client)
2761 struct i2c_msg msg[2];
2764 {0xb0,0x08,0x00,0x03,0xff,0xff},
2765 {0xb0,0x0c,0xff,0xff,0xff,0xff},
2768 msg[0].addr = client->addr;
2769 msg[0].flags = client->flags;
2770 msg[0].buf = buf[0];
2771 msg[0].len = sizeof(buf);
2772 msg[0].scl_rate = CONFIG_SENSOR_I2C_SPEED; /* ddl@rock-chips.com : 100kHz */
2773 msg[0].read_type = 0; /* fpga i2c:0==I2C_NORMAL : direct use number not enum for don't want include spi_fpga.h */
2775 msg[1].addr = client->addr;
2776 msg[1].flags = client->flags;
2777 msg[1].buf = buf[1];
2778 msg[1].len = sizeof(buf);
2779 msg[1].scl_rate = CONFIG_SENSOR_I2C_SPEED; /* ddl@rock-chips.com : 100kHz */
2780 msg[1].read_type = 0; /* fpga i2c:0==I2C_NORMAL : direct use number not enum for don't want include spi_fpga.h */
2782 ret = i2c_transfer(client->adapter, &msg[0], 1);
2783 ret |= i2c_transfer(client->adapter, &msg[1], 1);
2787 SENSOR_TR("\n %s sensor auto focus zone set fail!!\n",SENSOR_NAME_STRING());
2790 sensor_af_zoneupdate_end:
2794 static int sensor_af_init(struct i2c_client *client)
2798 ret = sensor_write_array(client, sensor_af_init0);
2800 SENSOR_DG("%s sensor auto focus init_0 fail!!",SENSOR_NAME_STRING());
2802 SENSOR_DG("%s sensor auto focus init_0 sucess!!",SENSOR_NAME_STRING());
2803 if (sensor_af_zoneupdate(client) == 0) {
2804 ret = sensor_write_array(client, sensor_af_init1);
2806 SENSOR_DG("%s sensor auto focus init_1 fail!!",SENSOR_NAME_STRING());
2808 SENSOR_DG("%s sensor auto focus init_1 success!!",SENSOR_NAME_STRING());
2817 static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
2819 struct soc_camera_link *icl = to_soc_camera_link(icd);
2822 SENSOR_DG("%s %s cmd(%d) on(%d)\n",SENSOR_NAME_STRING(),__FUNCTION__,cmd,on);
2825 case Sensor_PowerDown:
2827 if (icl->powerdown) {
2828 ret = icl->powerdown(icd->pdev, on);
2829 if (ret == RK29_CAM_IO_SUCCESS) {
2833 icl->reset(icd->pdev);
2835 } else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
2837 goto sensor_power_end;
2844 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
2845 struct sensor *sensor = to_sensor(client);
2847 if (sensor->sensor_io_request && sensor->sensor_io_request->sensor_ioctrl) {
2848 sensor->sensor_io_request->sensor_ioctrl(icd->pdev,Cam_Flash, on);
2854 SENSOR_TR("%s %s cmd(0x%x) is unknown!",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
2862 static int sensor_init(struct v4l2_subdev *sd, u32 val)
2864 struct i2c_client *client = v4l2_get_subdevdata(sd);
2865 struct soc_camera_device *icd = client->dev.platform_data;
2866 struct sensor *sensor = to_sensor(client);
2867 #if (ADJUST_OPTIMIZE_TIME_FALG == 0)
2868 const struct v4l2_queryctrl *qctrl;
2870 const struct sensor_datafmt *fmt;
2873 #if (SENSOR_RESET_REG != SEQUENCE_END)
2874 struct reginfo reg_info;
2877 SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
2879 if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
2881 goto sensor_INIT_ERR;
2884 SENSOR_DG("\n soft reset..%s.\n",SENSOR_NAME_STRING());
2887 if (sensor_task_lock(client,1)<0)
2888 goto sensor_INIT_ERR;
2890 #if (SENSOR_RESET_REG != SEQUENCE_END)
2891 reg_info.reg = SENSOR_RESET_REG;
2892 reg_info.val = SENSOR_RESET_VAL;
2893 reg_info.reg_len = SENSOR_RESET_REG_LEN;
2894 ret = sensor_write(client, ®_info);
2896 SENSOR_TR("%s soft reset sensor failed\n",SENSOR_NAME_STRING());
2898 goto sensor_INIT_ERR;
2900 mdelay(5); //delay 5 microseconds
2903 /* check if it is an sensor sensor */
2904 #if (SENSOR_ID_REG != SEQUENCE_END)
2905 ret = sensor_read(client, SENSOR_ID_REG, &pid);
2907 SENSOR_TR("read chip id failed\n");
2909 goto sensor_INIT_ERR;
2911 SENSOR_DG("\n %s pid = 0x%x \n", SENSOR_NAME_STRING(), pid);
2916 if (pid == SENSOR_ID) {
2917 sensor->model = SENSOR_V4L2_IDENT;
2919 SENSOR_TR("error: %s mismatched pid = 0x%x\n", SENSOR_NAME_STRING(), pid);
2921 goto sensor_INIT_ERR;
2924 SENSOR_DG("\n sensor_init_data..%s.\n",SENSOR_NAME_STRING());
2926 ret =sensor_write_init_data(client, sensor_init_data);
2928 SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
2929 goto sensor_INIT_ERR;
2931 sensor_task_lock(client,0);
2932 sensor->info_priv.preview_w = SENSOR_INIT_WIDTH;
2933 sensor->info_priv.preview_h = SENSOR_INIT_HEIGHT;
2934 sensor->info_priv.capture_w = SENSOR_MAX_WIDTH;
2935 sensor->info_priv.capture_h = SENSOR_MAX_HEIGHT;
2936 sensor->info_priv.winseqe_cur_addr = SENSOR_INIT_WINSEQADR;
2937 fmt = sensor_find_datafmt(SENSOR_INIT_PIXFMT,sensor_colour_fmts, ARRAY_SIZE(sensor_colour_fmts));
2939 SENSOR_TR("error: %s initial array colour fmts is not support!!",SENSOR_NAME_STRING());
2941 goto sensor_INIT_ERR;
2943 sensor->info_priv.fmt = *fmt;
2945 /* sensor sensor information for initialization */
2946 #if ADJUST_OPTIMIZE_TIME_FALG
2947 SENSOR_DG("\n optimize code..%s.\n",SENSOR_NAME_STRING());
2948 #if CONFIG_SENSOR_WhiteBalance
2949 sensor->info_priv.whiteBalance = 0;
2951 #if CONFIG_SENSOR_Brightness
2952 sensor->info_priv.brightness = 0;
2954 #if CONFIG_SENSOR_Effect
2955 sensor->info_priv.effect = 0;
2957 #if CONFIG_SENSOR_Exposure
2958 sensor->info_priv.exposure = 0;
2960 #if CONFIG_SENSOR_Saturation
2961 sensor->info_priv.saturation = 0;
2963 #if CONFIG_SENSOR_Contrast
2964 sensor->info_priv.contrast = 0;
2966 #if CONFIG_SENSOR_Mirror
2967 sensor->info_priv.mirror = 1;
2969 #if CONFIG_SENSOR_Flip
2970 sensor->info_priv.flip = 1;
2973 #if CONFIG_SENSOR_Scene
2974 sensor->info_priv.scene = 0;
2977 #if CONFIG_SENSOR_DigitalZoom
2978 sensor->info_priv.digitalzoom = 0;
2980 #if CONFIG_SENSOR_Focus
2981 sensor->info_priv.focus = 125 ;
2982 if (sensor_af_init(client) < 0) {
2983 sensor->info_priv.funmodule_state &= ~SENSOR_AF_IS_OK;
2984 SENSOR_TR("%s auto focus module init is fail!\n",SENSOR_NAME_STRING());
2986 sensor->info_priv.funmodule_state |= SENSOR_AF_IS_OK;
2987 SENSOR_DG("%s auto focus module init is success!\n",SENSOR_NAME_STRING());
2990 #if CONFIG_SENSOR_Flash
2991 sensor->info_priv.flash = 0 ;
2995 SENSOR_DG("\n origin code..%s.\n",SENSOR_NAME_STRING());
2997 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_DO_WHITE_BALANCE);
2999 sensor->info_priv.whiteBalance = qctrl->default_value;
3001 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_BRIGHTNESS);
3003 sensor->info_priv.brightness = qctrl->default_value;
3005 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_EFFECT);
3007 sensor->info_priv.effect = qctrl->default_value;
3009 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_EXPOSURE);
3011 sensor->info_priv.exposure = qctrl->default_value;
3013 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_SATURATION);
3015 sensor->info_priv.saturation = qctrl->default_value;
3017 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_CONTRAST);
3019 sensor->info_priv.contrast = qctrl->default_value;
3021 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_HFLIP);
3023 sensor->info_priv.mirror = qctrl->default_value;
3025 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_VFLIP);
3027 sensor->info_priv.flip = qctrl->default_value;
3029 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_SCENE);
3031 sensor->info_priv.scene = qctrl->default_value;
3033 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_ZOOM_ABSOLUTE);
3035 sensor->info_priv.digitalzoom = qctrl->default_value;
3037 /* ddl@rock-chips.com : if sensor support auto focus and flash, programer must run focus and flash code */
3038 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FOCUS_ABSOLUTE);
3040 sensor->info_priv.focus = qctrl->default_value;
3042 #if CONFIG_SENSOR_Focus
3043 if (sensor_af_init(client) < 0) {
3044 sensor->info_priv.funmodule_state &= ~SENSOR_AF_IS_OK;
3045 SENSOR_TR("%s auto focus module init is fail!\n",SENSOR_NAME_STRING());
3047 sensor->info_priv.funmodule_state |= SENSOR_AF_IS_OK;
3048 SENSOR_DG("%s auto focus module init is success!\n",SENSOR_NAME_STRING());
3051 #if CONFIG_SENSOR_Flash
3052 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
3054 sensor->info_priv.flash = qctrl->default_value;
3057 SENSOR_DG("\n%s..%s.. icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),((val == 0)?__FUNCTION__:"sensor_reinit"),icd->user_width,icd->user_height);
3058 sensor->info_priv.funmodule_state |= SENSOR_INIT_IS_OK;
3061 sensor->info_priv.funmodule_state &= ~SENSOR_INIT_IS_OK;
3062 sensor_task_lock(client,0);
3063 sensor_deactivate(client);
3066 static int sensor_deactivate(struct i2c_client *client)
3068 struct soc_camera_device *icd = client->dev.platform_data;
3069 struct sensor *sensor = to_sensor(client);
3071 SENSOR_DG("\n%s..%s.. Enter\n",SENSOR_NAME_STRING(),__FUNCTION__);
3073 /* ddl@rock-chips.com : all sensor output pin must change to input for other sensor */
3076 sensor_ioctrl(icd, Sensor_PowerDown, 1);
3079 /* ddl@rock-chips.com : sensor config init width , because next open sensor quickly(soc_camera_open -> Try to configure with default parameters) */
3080 icd->user_width = SENSOR_INIT_WIDTH;
3081 icd->user_height = SENSOR_INIT_HEIGHT;
3082 sensor->info_priv.funmodule_state &= ~SENSOR_INIT_IS_OK;
3086 static struct reginfo sensor_power_down_sequence[]=
3090 static int sensor_suspend(struct soc_camera_device *icd, pm_message_t pm_msg)
3093 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3095 if (pm_msg.event == PM_EVENT_SUSPEND) {
3096 SENSOR_DG("\n %s Enter Suspend..pm_msg.event=%d \n", SENSOR_NAME_STRING(),pm_msg.event);
3097 ret = sensor_write_array(client, sensor_power_down_sequence) ;
3099 SENSOR_TR("\n %s..%s WriteReg Fail.. \n", SENSOR_NAME_STRING(),__FUNCTION__);
3102 ret = sensor_ioctrl(icd, Sensor_PowerDown, 1);
3104 SENSOR_TR("\n %s suspend fail for turn on power!\n", SENSOR_NAME_STRING());
3109 SENSOR_TR("\n %s cann't suppout Suspend..\n",SENSOR_NAME_STRING());
3116 static int sensor_resume(struct soc_camera_device *icd)
3120 ret = sensor_ioctrl(icd, Sensor_PowerDown, 0);
3122 SENSOR_TR("\n %s resume fail for turn on power!\n", SENSOR_NAME_STRING());
3126 SENSOR_DG("\n %s Enter Resume.. \n", SENSOR_NAME_STRING());
3130 static int sensor_set_bus_param(struct soc_camera_device *icd,
3131 unsigned long flags)
3137 static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
3139 struct soc_camera_link *icl = to_soc_camera_link(icd);
3140 unsigned long flags = SENSOR_BUS_PARAM;
3142 return soc_camera_apply_sensor_flags(icl, flags);
3145 static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
3147 struct i2c_client *client = v4l2_get_subdevdata(sd);
3148 struct soc_camera_device *icd = client->dev.platform_data;
3149 struct sensor *sensor = to_sensor(client);
3151 mf->width = icd->user_width;
3152 mf->height = icd->user_height;
3153 mf->code = sensor->info_priv.fmt.code;
3154 mf->colorspace = sensor->info_priv.fmt.colorspace;
3155 mf->field = V4L2_FIELD_NONE;
3159 static bool sensor_fmt_capturechk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
3163 if ((mf->width == 1024) && (mf->height == 768)) {
3165 } else if ((mf->width == 1280) && (mf->height == 1024)) {
3167 } else if ((mf->width == 1600) && (mf->height == 1200)) {
3169 } else if ((mf->width == 2048) && (mf->height == 1536)) {
3171 } else if ((mf->width == 2592) && (mf->height == 1944)) {
3176 SENSOR_DG("%s %dx%d is capture format\n", __FUNCTION__, mf->width, mf->height);
3180 static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
3184 if ((mf->width == 1280) && (mf->height == 720)) {
3186 } else if ((mf->width == 1920) && (mf->height == 1080)) {
3191 SENSOR_DG("%s %dx%d is video format\n", __FUNCTION__, mf->width, mf->height);
3194 static struct reginfo* sensor_fmt_catch(int set_w, int set_h, int *ret_w, int *ret_h)
3196 struct reginfo *winseqe_set_addr = NULL;
3198 if (set_w*240 == set_h*320) {
3199 if (((set_w >= 320) && (set_h >= 240)) && (sensor_qvga[0].reg!=SEQUENCE_END)) {
3200 winseqe_set_addr = sensor_qvga;
3205 #if ADJUST_FOR_VGA_FALG
3206 // to forbid preview err
3207 if (((set_w >= 576) && (set_h >= 432)) && (sensor_vga[0].reg!=SEQUENCE_END)) {
3208 winseqe_set_addr = sensor_vga;
3213 if (((set_w >= 640) && (set_h >= 480)) && (sensor_vga[0].reg!=SEQUENCE_END)) {
3214 winseqe_set_addr = sensor_vga;
3221 if (((set_w >= 800) && (set_h >= 600)) && (sensor_svga[0].reg!=SEQUENCE_END)) {
3222 winseqe_set_addr = sensor_svga;
3227 if (((set_w >= 1024) && (set_h >= 768)) && (sensor_xga[0].reg!=SEQUENCE_END)) {
3228 winseqe_set_addr = sensor_xga;
3233 if (((set_w >= 1280) && (set_h >= 1024)) && (sensor_sxga[0].reg!=SEQUENCE_END)) {
3234 winseqe_set_addr = sensor_sxga;
3239 if (((set_w >= 1600) && (set_h >= 1200)) && (sensor_uxga[0].reg!=SEQUENCE_END)) {
3240 winseqe_set_addr = sensor_uxga;
3245 if (((set_w >= 2048) && (set_h >= 1536)) && (sensor_qxga[0].reg!=SEQUENCE_END)) {
3246 winseqe_set_addr = sensor_qxga;
3251 if (((set_w >= 2592) && (set_h >= 1944)) && (sensor_qsxga[0].reg!=SEQUENCE_END)) {
3252 winseqe_set_addr = sensor_qsxga;
3257 if (winseqe_set_addr == NULL) {
3258 if (((set_w <= 176) && (set_h <= 144)) && (sensor_qcif[0].reg!=SEQUENCE_END)) {
3259 winseqe_set_addr = sensor_qcif;
3262 } else if (((set_w <= 352) && (set_h<= 288)) && (sensor_cif[0].reg!=SEQUENCE_END)) {
3263 winseqe_set_addr = sensor_cif;
3268 if (((set_w <= 1280) && (set_h <= 720)) && (sensor_720p[0].reg!=SEQUENCE_END)) {
3269 winseqe_set_addr = sensor_720p;
3272 } else if (((set_w <= 1920) && (set_h <= 1080)) && (sensor_1080p[0].reg!=SEQUENCE_END)) {
3273 winseqe_set_addr = sensor_1080p;
3279 } else if (set_w*288 == set_h*352) {
3280 if (((set_w >= 176) && (set_h >= 144)) && (sensor_qcif[0].reg!=SEQUENCE_END)) {
3281 winseqe_set_addr = sensor_qcif;
3284 } else if (((set_w >= 352) && (set_h >= 288)) && (sensor_cif[0].reg!=SEQUENCE_END)) {
3285 winseqe_set_addr = sensor_cif;
3290 if (winseqe_set_addr == NULL) {
3291 if (((set_w <= 320) && (set_h <= 240)) && (sensor_qvga[0].reg!=SEQUENCE_END)) {
3292 winseqe_set_addr = sensor_qvga;
3295 } else if (((set_w <= 640) && (set_h <= 480)) && (sensor_vga[0].reg!=SEQUENCE_END)) {
3296 winseqe_set_addr = sensor_vga;
3299 } else if (((set_w <= 800) && (set_h <= 600)) && (sensor_svga[0].reg!=SEQUENCE_END)) {
3300 winseqe_set_addr = sensor_svga;
3303 } else if (((set_w <= 1024) && (set_h <= 768)) && (sensor_xga[0].reg!=SEQUENCE_END)) {
3304 winseqe_set_addr = sensor_xga;
3307 } else if (((set_w <= 1280) && (set_h <= 1024)) && (sensor_sxga[0].reg!=SEQUENCE_END)) {
3308 winseqe_set_addr = sensor_sxga;
3311 } else if (((set_w <= 1600) && (set_h <= 1200)) && (sensor_uxga[0].reg!=SEQUENCE_END)) {
3312 winseqe_set_addr = sensor_uxga;
3315 } else if (((set_w <= 2048) && (set_h <= 1536)) && (sensor_qxga[0].reg!=SEQUENCE_END)) {
3316 winseqe_set_addr = sensor_qxga;
3319 } else if (((set_w <= 2592) && (set_h <= 1944)) && (sensor_qsxga[0].reg!=SEQUENCE_END)) {
3320 winseqe_set_addr = sensor_qsxga;
3326 if (((set_w <= 1280) && (set_h <= 720)) && (sensor_720p[0].reg!=SEQUENCE_END)) {
3327 winseqe_set_addr = sensor_720p;
3330 } else if (((set_w <= 1920) && (set_h <= 1080)) && (sensor_1080p[0].reg!=SEQUENCE_END)) {
3331 winseqe_set_addr = sensor_1080p;
3336 } else if (set_w*720 == set_h*1280) {
3337 if (((set_w >= 1280) && (set_h >= 720)) && (sensor_720p[0].reg!=SEQUENCE_END)) {
3338 winseqe_set_addr = sensor_720p;
3341 } else if (((set_w >= 1920) && (set_h >= 1080)) && (sensor_1080p[0].reg!=SEQUENCE_END)) {
3342 winseqe_set_addr = sensor_1080p;
3347 if (winseqe_set_addr == NULL) {
3349 if (((set_w <= 176) && (set_h <= 144)) && (sensor_qcif[0].reg!=SEQUENCE_END)) {
3350 winseqe_set_addr = sensor_qcif;
3353 } else if (((set_w <= 352) && (set_h<= 288)) && (sensor_cif[0].reg!=SEQUENCE_END)) {
3354 winseqe_set_addr = sensor_cif;
3359 if (((set_w <= 320) && (set_h <= 240)) && (sensor_qvga[0].reg!=SEQUENCE_END)) {
3360 winseqe_set_addr = sensor_qvga;
3363 } else if (((set_w <= 640) && (set_h <= 480)) && (sensor_vga[0].reg!=SEQUENCE_END)) {
3364 winseqe_set_addr = sensor_vga;
3367 } else if (((set_w <= 800) && (set_h <= 600)) && (sensor_svga[0].reg!=SEQUENCE_END)) {
3368 winseqe_set_addr = sensor_svga;
3371 } else if (((set_w <= 1024) && (set_h <= 768)) && (sensor_xga[0].reg!=SEQUENCE_END)) {
3372 winseqe_set_addr = sensor_xga;
3375 } else if (((set_w <= 1280) && (set_h <= 1024)) && (sensor_sxga[0].reg!=SEQUENCE_END)) {
3376 winseqe_set_addr = sensor_sxga;
3379 } else if (((set_w <= 1600) && (set_h <= 1200)) && (sensor_uxga[0].reg!=SEQUENCE_END)) {
3380 winseqe_set_addr = sensor_uxga;
3383 } else if (((set_w <= 2048) && (set_h <= 1536)) && (sensor_qxga[0].reg!=SEQUENCE_END)) {
3384 winseqe_set_addr = sensor_qxga;
3387 } else if (((set_w <= 2592) && (set_h <= 1944)) && (sensor_qsxga[0].reg!=SEQUENCE_END)) {
3388 winseqe_set_addr = sensor_qsxga;
3394 if (((set_w <= 176) && (set_h <= 144)) && (sensor_qcif[0].reg!=SEQUENCE_END)) {
3395 winseqe_set_addr = sensor_qcif;
3398 } else if (((set_w <= 320) && (set_h <= 240)) && (sensor_qvga[0].reg!=SEQUENCE_END)) {
3399 winseqe_set_addr = sensor_qvga;
3402 } else if (((set_w <= 352) && (set_h<= 288)) && (sensor_cif[0].reg!=SEQUENCE_END)) {
3403 winseqe_set_addr = sensor_cif;
3406 } else if (((set_w <= 640) && (set_h <= 480)) && (sensor_vga[0].reg!=SEQUENCE_END)) {
3407 winseqe_set_addr = sensor_vga;
3410 } else if (((set_w <= 800) && (set_h <= 600)) && (sensor_svga[0].reg!=SEQUENCE_END)) {
3411 winseqe_set_addr = sensor_svga;
3414 } else if (((set_w <= 1024) && (set_h <= 768)) && (sensor_xga[0].reg!=SEQUENCE_END)) {
3415 winseqe_set_addr = sensor_xga;
3418 } else if (((set_w <= 1280) && (set_h <= 720)) && (sensor_720p[0].reg!=SEQUENCE_END)) {
3419 winseqe_set_addr = sensor_720p;
3422 } else if (((set_w <= 1280) && (set_h <= 1024)) && (sensor_sxga[0].reg!=SEQUENCE_END)) {
3423 winseqe_set_addr = sensor_sxga;
3426 } else if (((set_w <= 1600) && (set_h <= 1200)) && (sensor_uxga[0].reg!=SEQUENCE_END)) {
3427 winseqe_set_addr = sensor_uxga;
3430 } else if (((set_w <= 1920) && (set_h <= 1080)) && (sensor_1080p[0].reg!=SEQUENCE_END)) {
3431 winseqe_set_addr = sensor_1080p;
3434 } else if (((set_w <= 2048) && (set_h <= 1536)) && (sensor_qxga[0].reg!=SEQUENCE_END)) {
3435 winseqe_set_addr = sensor_qxga;
3438 } else if (((set_w <= 2592) && (set_h <= 1944)) && (sensor_qsxga[0].reg!=SEQUENCE_END)) {
3439 winseqe_set_addr = sensor_qsxga;
3445 return winseqe_set_addr;
3448 /*modify image with resolution 2592*1944;solve bug that the first 32 pixel data*/
3449 /*in the first line have misplace with the last 32 pixel data in the last line*/
3450 static int sensor_cb(void *arg)
3452 void __iomem *vbpmem;
3453 struct videobuf_buffer *buffer;
3454 char *imagey_addr =NULL;
3455 char *imageuv_addr = NULL;
3456 char *tempaddr = NULL;
3459 buffer = (struct videobuf_buffer*)arg;
3460 if(buffer->width!=SENSOR_MAX_WIDTH||buffer->height!=SENSOR_MAX_HEIGHT||buffer==NULL)
3463 if (buffer->bsize< YUV420_BUFFER_MAX_SIZE) //yuv420 format size
3467 vbpmem = ioremap(buffer->boff,buffer->bsize);
3468 if(vbpmem == NULL) {
3469 SENSOR_DG("\n%s..%s..ioremap fail\n",__FUNCTION__,SENSOR_NAME_STRING());
3473 imagey_addr = (char*)vbpmem; // y data to be dealed with
3474 imageuv_addr = imagey_addr+buffer->width*buffer->height;
3476 tempaddr = imageuv_addr - 32;
3477 memcpy(tempaddr,imagey_addr,32);
3479 tempaddr = imagey_addr+32;
3480 memcpy(imagey_addr,tempaddr,32);
3482 //uv data to be dealed with
3483 tempsize = YUV420_BUFFER_MAX_SIZE-32;
3484 tempaddr = imagey_addr+tempsize;
3485 memcpy(tempaddr,imageuv_addr,32);
3487 tempaddr = imageuv_addr+32;
3488 memcpy(imageuv_addr,tempaddr,32);
3493 static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
3495 struct i2c_client *client = v4l2_get_subdevdata(sd);
3496 struct soc_camera_device *icd = client->dev.platform_data;
3497 struct sensor *sensor = to_sensor(client);
3498 const struct sensor_datafmt *fmt;
3499 struct reginfo *winseqe_set_addr=NULL;
3500 int ret = 0, set_w,set_h,cnt;
3503 u16 targetbrightness,realbrightness;
3505 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
3507 fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
3508 ARRAY_SIZE(sensor_colour_fmts));
3511 goto sensor_s_fmt_end;
3514 if (sensor->info_priv.fmt.code != mf->code) {
3517 case V4L2_MBUS_FMT_YUYV8_2X8:
3519 winseqe_set_addr = sensor_ClrFmt_YUYV;
3522 case V4L2_MBUS_FMT_UYVY8_2X8:
3524 winseqe_set_addr = sensor_ClrFmt_UYVY;
3530 if (winseqe_set_addr != NULL) {
3531 sensor_write_array(client, winseqe_set_addr);
3532 sensor->info_priv.fmt.code = mf->code;
3533 sensor->info_priv.fmt.colorspace= mf->colorspace;
3534 SENSOR_DG("%s v4l2_mbus_code:%d set success!\n", SENSOR_NAME_STRING(),mf->code);
3536 SENSOR_TR("%s v4l2_mbus_code:%d is invalidate!\n", SENSOR_NAME_STRING(),mf->code);
3543 winseqe_set_addr = sensor_fmt_catch(set_w, set_h, &set_w, &set_h);
3545 if ((winseqe_set_addr != sensor->info_priv.winseqe_cur_addr) && winseqe_set_addr)
3547 /*solve bug that video set is ineffective */
3548 /*set five times to make sure sensor_720p set go into effect*/
3549 if(winseqe_set_addr==sensor_720p)
3559 ret |= sensor_write_array(client, winseqe_set_addr);
3561 SENSOR_TR("%s set format capability failed\n", SENSOR_NAME_STRING());
3562 goto sensor_s_fmt_end;
3566 sensor->info_priv.winseqe_cur_addr = winseqe_set_addr;
3567 if (winseqe_set_addr==sensor_qxga ||winseqe_set_addr==sensor_qsxga||winseqe_set_addr==sensor_uxga ||winseqe_set_addr==sensor_xga)
3569 SENSOR_DG("\n%s..%s..Capture icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),__FUNCTION__,set_w,set_h);
3571 SENSOR_DG("\n%s..%s..Video icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),__FUNCTION__,set_w,set_h);
3572 sensor->info_priv.preview_w = mf->width;
3573 sensor->info_priv.preview_h = mf->height;
3577 if (winseqe_set_addr && (winseqe_set_addr==sensor_qxga ||winseqe_set_addr==sensor_qsxga||winseqe_set_addr==sensor_uxga ||winseqe_set_addr==sensor_xga))
3579 ret |= sensor_write_array(client, sensor_Preview2Capture);
3581 SENSOR_TR("%s Preview 2 Capture failed\n", SENSOR_NAME_STRING());
3582 goto sensor_s_fmt_end;
3585 /*check state of register 0x8405 to make sure set is successful*/
3586 /*set sensor_Preview2Capture more times to make sure set go into effect */
3592 ret =sensor_read(client,0x8405, &seq_state);
3594 goto sensor_s_fmt_end;
3600 ret |= sensor_write_array(client, sensor_Preview2Capture);
3601 if (ret != 0||time >2) {
3602 SENSOR_TR("%s Preview 2 Capture failed\n", SENSOR_NAME_STRING());
3603 goto sensor_s_fmt_end;
3605 SENSOR_DG("mt9p111 Preview 2 Capture again\n");
3607 SENSOR_DG("mt9p111 Preview 2 Capture count = %d;seq_state = 0x%x\n",cnt,seq_state);
3608 } while((seq_state != 0x07) && (time < 4));
3610 SENSOR_TR("%s Preview 2 Capture successs\n", SENSOR_NAME_STRING());
3612 #if CONFIG_SENSOR_Flash
3613 /*The 0xA409 is AE target register address.*/
3614 /*The 0xB804 is currently total brightness Y value of sensor.*/
3615 targetbrightness = 0;
3617 if((sensor->info_priv.flash == 1) || (sensor->info_priv.flash == 2))
3619 if(sensor->info_priv.flash == 1)
3621 ret =sensor_read(client,0xA409, &targetbrightness);
3623 SENSOR_DG("%s ..%s..get targetbrightness fail\n", SENSOR_NAME_STRING(),__FUNCTION__);
3625 ret =sensor_read(client, 0xB804, &realbrightness);
3627 SENSOR_DG("%s ..%s..get realbrightness fail\n", SENSOR_NAME_STRING(),__FUNCTION__);
3630 if((realbrightness < targetbrightness)|| (sensor->info_priv.flash == 2))
3632 sensor_ioctrl(icd, Sensor_Flash, Flash_On);
3633 SENSOR_DG("%s flash on,realbrightness=%d,targetbrightness=%d\n", SENSOR_NAME_STRING(),realbrightness,targetbrightness);
3635 SENSOR_DG("%s not need to flash in capture!\n", SENSOR_NAME_STRING());
3639 sensor->info_priv.capture_w = set_w;
3640 sensor->info_priv.capture_h = set_h;
3641 sensor->info_priv.snap2preview = true;
3642 } else if (sensor->info_priv.snap2preview == true) {
3643 if (winseqe_set_addr || ((sensor->info_priv.preview_w == mf->width) && (sensor->info_priv.preview_h == mf->height))) {
3644 ret |= sensor_write_array(client, sensor_Capture2Preview);
3646 SENSOR_TR("%s Capture 2 Preview success\n", SENSOR_NAME_STRING());
3647 goto sensor_s_fmt_end;
3651 do{ //check state of register 0x8405 to make sure set is successful
3654 ret =sensor_read(client,0x8405, &seq_state);
3656 goto sensor_s_fmt_end;
3657 SENSOR_DG("mt9p111 Capture 2 Preview seq_state = 0x%x\n",seq_state);
3658 } while((seq_state != 0x03) && (cnt < 20));
3660 SENSOR_TR("%s Capture 2 Preview success\n", SENSOR_NAME_STRING());
3662 #if CONFIG_SENSOR_Flash
3663 if ((sensor->info_priv.flash == 1) || (sensor->info_priv.flash == 2)) {
3664 sensor_ioctrl(icd, Sensor_Flash, Flash_Off);
3665 SENSOR_DG("%s flash off in preivew!\n", SENSOR_NAME_STRING());
3668 sensor->info_priv.preview_w = mf->width;
3669 sensor->info_priv.preview_h = mf->height;
3670 sensor->info_priv.snap2preview = false;
3672 SENSOR_TR("\n %s..%s Format is Invalidate. pix->width = %d.. pix->height = %d\n",SENSOR_NAME_STRING(),__FUNCTION__,mf->width,mf->height);
3682 static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
3684 struct i2c_client *client = v4l2_get_subdevdata(sd);
3685 struct sensor *sensor = to_sensor(client);
3686 const struct sensor_datafmt *fmt;
3689 fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
3690 ARRAY_SIZE(sensor_colour_fmts));
3692 fmt = &sensor->info_priv.fmt;
3693 mf->code = fmt->code;
3696 if (mf->height > SENSOR_MAX_HEIGHT)
3697 mf->height = SENSOR_MAX_HEIGHT;
3698 else if (mf->height < SENSOR_MIN_HEIGHT)
3699 mf->height = SENSOR_MIN_HEIGHT;
3701 if (mf->width > SENSOR_MAX_WIDTH)
3702 mf->width = SENSOR_MAX_WIDTH;
3703 else if (mf->width < SENSOR_MIN_WIDTH)
3704 mf->width = SENSOR_MIN_WIDTH;
3706 mf->colorspace = fmt->colorspace;
3710 static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
3712 struct i2c_client *client = v4l2_get_subdevdata(sd);
3714 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
3717 if (id->match.addr != client->addr)
3720 id->ident = SENSOR_V4L2_IDENT; /* ddl@rock-chips.com : Return OV2655 identifier */
3725 #if CONFIG_SENSOR_Brightness
3726 static int sensor_set_brightness(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
3728 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3730 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
3732 if (sensor_BrightnessSeqe[value - qctrl->minimum] != NULL)
3734 if (sensor_write_array(client, sensor_BrightnessSeqe[value - qctrl->minimum]) != 0)
3736 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
3739 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
3743 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
3747 #if CONFIG_SENSOR_Effect
3748 static int sensor_set_effect(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
3752 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3754 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
3756 if (sensor_EffectSeqe[value - qctrl->minimum] != NULL)
3758 /*set five times to make sure the set go into effect*/
3759 /*solve bug for setting invalidate during changing from preview to video*/
3763 ret |=sensor_write_array(client, sensor_EffectSeqe[value - qctrl->minimum]);
3766 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
3771 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
3775 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
3779 #if CONFIG_SENSOR_Exposure
3780 static int sensor_set_exposure(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
3782 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3784 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
3786 if (sensor_ExposureSeqe[value - qctrl->minimum] != NULL)
3788 if (sensor_write_array(client, sensor_ExposureSeqe[value - qctrl->minimum]) != 0)
3790 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
3793 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
3797 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
3801 #if CONFIG_SENSOR_Saturation
3802 static int sensor_set_saturation(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
3804 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3806 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
3808 if (sensor_SaturationSeqe[value - qctrl->minimum] != NULL)
3810 if (sensor_write_array(client, sensor_SaturationSeqe[value - qctrl->minimum]) != 0)
3812 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
3815 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
3819 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
3823 #if CONFIG_SENSOR_Contrast
3824 static int sensor_set_contrast(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
3826 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3828 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
3830 if (sensor_ContrastSeqe[value - qctrl->minimum] != NULL)
3832 if (sensor_write_array(client, sensor_ContrastSeqe[value - qctrl->minimum]) != 0)
3834 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
3837 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
3841 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
3845 #if CONFIG_SENSOR_Mirror
3846 static int sensor_set_mirror(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
3848 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3850 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
3852 if (sensor_MirrorSeqe[value - qctrl->minimum] != NULL)
3854 if (sensor_write_array(client, sensor_MirrorSeqe[value - qctrl->minimum]) != 0)
3856 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
3859 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
3863 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
3867 #if CONFIG_SENSOR_Flip
3868 static int sensor_set_flip(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
3870 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3872 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
3874 if (sensor_FlipSeqe[value - qctrl->minimum] != NULL)
3876 if (sensor_write_array(client, sensor_FlipSeqe[value - qctrl->minimum]) != 0)
3878 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
3881 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
3885 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
3889 #if CONFIG_SENSOR_Scene
3890 static int sensor_set_scene(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
3892 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3894 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
3896 if (sensor_SceneSeqe[value - qctrl->minimum] != NULL)
3898 if (sensor_write_array(client, sensor_SceneSeqe[value - qctrl->minimum]) != 0)
3900 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
3903 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
3907 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
3911 #if CONFIG_SENSOR_WhiteBalance
3912 static int sensor_set_whiteBalance(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
3914 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3916 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
3918 if (sensor_WhiteBalanceSeqe[value - qctrl->minimum] != NULL)
3920 if (sensor_write_array(client, sensor_WhiteBalanceSeqe[value - qctrl->minimum]) != 0)
3922 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
3925 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
3929 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
3933 #if CONFIG_SENSOR_DigitalZoom
3934 static int sensor_set_digitalzoom(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
3936 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3937 struct sensor *sensor = to_sensor(client);
3938 const struct v4l2_queryctrl *qctrl_info;
3939 int digitalzoom_cur, digitalzoom_total;
3941 qctrl_info = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_ZOOM_ABSOLUTE);
3945 digitalzoom_cur = sensor->info_priv.digitalzoom;
3946 digitalzoom_total = qctrl_info->maximum;
3948 if ((value > 0) && (digitalzoom_cur >= digitalzoom_total))
3950 SENSOR_TR("%s digitalzoom is maximum - %x\n", SENSOR_NAME_STRING(), digitalzoom_cur);
3954 if ((value < 0) && (digitalzoom_cur <= qctrl_info->minimum))
3956 SENSOR_TR("%s digitalzoom is minimum - %x\n", SENSOR_NAME_STRING(), digitalzoom_cur);
3960 if ((value > 0) && ((digitalzoom_cur + value) > digitalzoom_total))
3962 value = digitalzoom_total - digitalzoom_cur;
3965 if ((value < 0) && ((digitalzoom_cur + value) < 0))
3967 value = 0 - digitalzoom_cur;
3970 digitalzoom_cur += value;
3972 if (sensor_ZoomSeqe[digitalzoom_cur] != NULL)
3974 if (sensor_write_array(client, sensor_ZoomSeqe[digitalzoom_cur]) != 0)
3976 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
3979 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
3986 #if CONFIG_SENSOR_Flash
3987 static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
3989 if ((value >= qctrl->minimum) && (value <= qctrl->maximum)) {
3990 if (value == 3) { /* ddl@rock-chips.com: torch */
3991 sensor_ioctrl(icd, Sensor_Flash, Flash_Torch); /* Flash On */
3993 sensor_ioctrl(icd, Sensor_Flash, Flash_Off);
3995 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
3999 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4003 #if CONFIG_SENSOR_Focus
4004 static int sensor_set_focus_absolute(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4006 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4007 struct sensor *sensor = to_sensor(client);
4008 const struct v4l2_queryctrl *qctrl_info;
4011 qctrl_info = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FOCUS_ABSOLUTE);
4015 if ((sensor->info_priv.funmodule_state & SENSOR_AF_IS_OK) && (sensor->info_priv.affm_reinit == 0)) {
4016 if ((value >= qctrl_info->minimum) && (value <= qctrl_info->maximum)) {
4018 SENSOR_DG("%s..%s : %d ret:0x%x\n",SENSOR_NAME_STRING(),__FUNCTION__, value,ret);
4021 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4025 SENSOR_TR("\n %s..%s AF module state(0x%x, 0x%x) is error!\n",SENSOR_NAME_STRING(),__FUNCTION__,
4026 sensor->info_priv.funmodule_state,sensor->info_priv.affm_reinit);
4029 sensor_set_focus_absolute_end:
4032 static int sensor_set_focus_relative(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4034 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4035 struct sensor *sensor = to_sensor(client);
4036 const struct v4l2_queryctrl *qctrl_info;
4039 qctrl_info = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FOCUS_RELATIVE);
4043 if ((sensor->info_priv.funmodule_state & SENSOR_AF_IS_OK) && (sensor->info_priv.affm_reinit == 0)) {
4044 if ((value >= qctrl_info->minimum) && (value <= qctrl_info->maximum)) {
4046 SENSOR_DG("%s..%s : %d ret:0x%x\n",SENSOR_NAME_STRING(),__FUNCTION__, value,ret);
4049 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4053 SENSOR_TR("\n %s..%s AF module state(0x%x, 0x%x) is error!\n",SENSOR_NAME_STRING(),__FUNCTION__,
4054 sensor->info_priv.funmodule_state,sensor->info_priv.affm_reinit);
4056 sensor_set_focus_relative_end:
4060 static int sensor_set_focus_mode(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4062 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4063 struct sensor *sensor = to_sensor(client);
4066 if ((sensor->info_priv.funmodule_state & SENSOR_AF_IS_OK) && (sensor->info_priv.affm_reinit == 0)) {
4069 case SENSOR_AF_MODE_AUTO:
4071 ret = sensor_af_single(client);
4075 case SENSOR_AF_MODE_MACRO:
4077 ret = sensor_set_focus_absolute(icd, qctrl, 0xff);
4081 case SENSOR_AF_MODE_INFINITY:
4083 ret = sensor_set_focus_absolute(icd, qctrl, 0x00);
4087 case SENSOR_AF_MODE_CONTINUOUS:
4089 ret = sensor_af_const(client);
4093 SENSOR_TR("\n %s..%s AF value(0x%x) is error!\n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4098 SENSOR_DG("%s..%s : %d ret:0x%x\n",SENSOR_NAME_STRING(),__FUNCTION__, value,ret);
4101 SENSOR_TR("\n %s..%s AF module state(0x%x, 0x%x) is error!\n",SENSOR_NAME_STRING(),__FUNCTION__,
4102 sensor->info_priv.funmodule_state,sensor->info_priv.affm_reinit);
4108 static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
4110 struct i2c_client *client = v4l2_get_subdevdata(sd);
4111 struct sensor *sensor = to_sensor(client);
4112 const struct v4l2_queryctrl *qctrl;
4113 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
4115 qctrl = soc_camera_find_qctrl(&sensor_ops, ctrl->id);
4119 SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ctrl->id);
4125 case V4L2_CID_BRIGHTNESS:
4127 ctrl->value = sensor->info_priv.brightness;
4130 case V4L2_CID_SATURATION:
4132 ctrl->value = sensor->info_priv.saturation;
4135 case V4L2_CID_CONTRAST:
4137 ctrl->value = sensor->info_priv.contrast;
4140 case V4L2_CID_DO_WHITE_BALANCE:
4142 ctrl->value = sensor->info_priv.whiteBalance;
4145 case V4L2_CID_EXPOSURE:
4147 ctrl->value = sensor->info_priv.exposure;
4150 case V4L2_CID_HFLIP:
4152 ctrl->value = sensor->info_priv.mirror;
4155 case V4L2_CID_VFLIP:
4157 ctrl->value = sensor->info_priv.flip;
4168 static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
4170 struct i2c_client *client = v4l2_get_subdevdata(sd);
4171 struct sensor *sensor = to_sensor(client);
4172 struct soc_camera_device *icd = client->dev.platform_data;
4173 const struct v4l2_queryctrl *qctrl;
4175 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
4178 qctrl = soc_camera_find_qctrl(&sensor_ops, ctrl->id);
4182 SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ctrl->id);
4188 #if CONFIG_SENSOR_Brightness
4189 case V4L2_CID_BRIGHTNESS:
4191 if (ctrl->value != sensor->info_priv.brightness)
4193 if (sensor_set_brightness(icd, qctrl,ctrl->value) != 0)
4197 sensor->info_priv.brightness = ctrl->value;
4202 #if CONFIG_SENSOR_Exposure
4203 case V4L2_CID_EXPOSURE:
4205 if (ctrl->value != sensor->info_priv.exposure)
4207 if (sensor_set_exposure(icd, qctrl,ctrl->value) != 0)
4211 sensor->info_priv.exposure = ctrl->value;
4216 #if CONFIG_SENSOR_Saturation
4217 case V4L2_CID_SATURATION:
4219 if (ctrl->value != sensor->info_priv.saturation)
4221 if (sensor_set_saturation(icd, qctrl,ctrl->value) != 0)
4225 sensor->info_priv.saturation = ctrl->value;
4230 #if CONFIG_SENSOR_Contrast
4231 case V4L2_CID_CONTRAST:
4233 if (ctrl->value != sensor->info_priv.contrast)
4235 if (sensor_set_contrast(icd, qctrl,ctrl->value) != 0)
4239 sensor->info_priv.contrast = ctrl->value;
4244 #if CONFIG_SENSOR_WhiteBalance
4245 case V4L2_CID_DO_WHITE_BALANCE:
4247 if (ctrl->value != sensor->info_priv.whiteBalance)
4249 if (sensor_set_whiteBalance(icd, qctrl,ctrl->value) != 0)
4253 sensor->info_priv.whiteBalance = ctrl->value;
4258 #if CONFIG_SENSOR_Mirror
4259 case V4L2_CID_HFLIP:
4261 if (ctrl->value != sensor->info_priv.mirror)
4263 if (sensor_set_mirror(icd, qctrl,ctrl->value) != 0)
4265 sensor->info_priv.mirror = ctrl->value;
4270 #if CONFIG_SENSOR_Flip
4271 case V4L2_CID_VFLIP:
4273 if (ctrl->value != sensor->info_priv.flip)
4275 if (sensor_set_flip(icd, qctrl,ctrl->value) != 0)
4277 sensor->info_priv.flip = ctrl->value;
4288 static int sensor_g_ext_control(struct soc_camera_device *icd , struct v4l2_ext_control *ext_ctrl)
4290 const struct v4l2_queryctrl *qctrl;
4291 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4292 struct sensor *sensor = to_sensor(client);
4294 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
4296 qctrl = soc_camera_find_qctrl(&sensor_ops, ext_ctrl->id);
4300 SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ext_ctrl->id);
4304 switch (ext_ctrl->id)
4306 case V4L2_CID_SCENE:
4308 ext_ctrl->value = sensor->info_priv.scene;
4311 case V4L2_CID_EFFECT:
4313 ext_ctrl->value = sensor->info_priv.effect;
4316 case V4L2_CID_ZOOM_ABSOLUTE:
4318 ext_ctrl->value = sensor->info_priv.digitalzoom;
4321 case V4L2_CID_ZOOM_RELATIVE:
4325 case V4L2_CID_FOCUS_ABSOLUTE:
4329 case V4L2_CID_FOCUS_RELATIVE:
4333 case V4L2_CID_FLASH:
4335 ext_ctrl->value = sensor->info_priv.flash;
4343 static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_control *ext_ctrl)
4345 const struct v4l2_queryctrl *qctrl;
4346 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4347 struct sensor *sensor = to_sensor(client);
4350 qctrl = soc_camera_find_qctrl(&sensor_ops, ext_ctrl->id);
4354 SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ext_ctrl->id);
4359 switch (ext_ctrl->id)
4361 #if CONFIG_SENSOR_Scene
4362 case V4L2_CID_SCENE:
4364 if (ext_ctrl->value != sensor->info_priv.scene)
4366 if (sensor_set_scene(icd, qctrl,ext_ctrl->value) != 0)
4368 sensor->info_priv.scene = ext_ctrl->value;
4373 #if CONFIG_SENSOR_Effect
4374 case V4L2_CID_EFFECT:
4376 if (ext_ctrl->value != sensor->info_priv.effect)
4378 if (sensor_set_effect(icd, qctrl,ext_ctrl->value) != 0)
4380 sensor->info_priv.effect= ext_ctrl->value;
4385 #if CONFIG_SENSOR_DigitalZoom
4386 case V4L2_CID_ZOOM_ABSOLUTE:
4388 if ((ext_ctrl->value < qctrl->minimum) || (ext_ctrl->value > qctrl->maximum))
4391 if (ext_ctrl->value != sensor->info_priv.digitalzoom)
4393 val_offset = ext_ctrl->value -sensor->info_priv.digitalzoom;
4395 if (sensor_set_digitalzoom(icd, qctrl,&val_offset) != 0)
4397 sensor->info_priv.digitalzoom += val_offset;
4399 SENSOR_DG("%s digitalzoom is %x\n",SENSOR_NAME_STRING(), sensor->info_priv.digitalzoom);
4404 case V4L2_CID_ZOOM_RELATIVE:
4406 if (ext_ctrl->value)
4408 if (sensor_set_digitalzoom(icd, qctrl,&ext_ctrl->value) != 0)
4410 sensor->info_priv.digitalzoom += ext_ctrl->value;
4412 SENSOR_DG("%s digitalzoom is %x\n", SENSOR_NAME_STRING(), sensor->info_priv.digitalzoom);
4417 #if CONFIG_SENSOR_Focus
4418 case V4L2_CID_FOCUS_ABSOLUTE:
4420 if ((ext_ctrl->value < qctrl->minimum) || (ext_ctrl->value > qctrl->maximum))
4423 if (sensor_set_focus_absolute(icd, qctrl,ext_ctrl->value) == 0) {
4424 if (ext_ctrl->value == qctrl->minimum) {
4425 sensor->info_priv.auto_focus = SENSOR_AF_MODE_INFINITY;
4426 } else if (ext_ctrl->value == qctrl->maximum) {
4427 sensor->info_priv.auto_focus = SENSOR_AF_MODE_MACRO;
4429 sensor->info_priv.auto_focus = SENSOR_AF_MODE_FIXED;
4435 case V4L2_CID_FOCUS_RELATIVE:
4437 if ((ext_ctrl->value < qctrl->minimum) || (ext_ctrl->value > qctrl->maximum))
4440 sensor_set_focus_relative(icd, qctrl,ext_ctrl->value);
4443 case V4L2_CID_FOCUS_AUTO:
4445 if (ext_ctrl->value == 1) {
4446 if (sensor_set_focus_mode(icd, qctrl,SENSOR_AF_MODE_AUTO) != 0)
4448 sensor->info_priv.auto_focus = SENSOR_AF_MODE_AUTO;
4449 } else if (SENSOR_AF_MODE_AUTO == sensor->info_priv.auto_focus){
4450 if (ext_ctrl->value == 0)
4451 sensor->info_priv.auto_focus = SENSOR_AF_MODE_CLOSE;
4455 case V4L2_CID_FOCUS_CONTINUOUS:
4457 if (SENSOR_AF_MODE_CONTINUOUS != sensor->info_priv.auto_focus) {
4458 if (ext_ctrl->value == 1) {
4459 if (sensor_set_focus_mode(icd, qctrl,SENSOR_AF_MODE_CONTINUOUS) != 0)
4461 sensor->info_priv.auto_focus = SENSOR_AF_MODE_CONTINUOUS;
4464 if (ext_ctrl->value == 0)
4465 sensor->info_priv.auto_focus = SENSOR_AF_MODE_CLOSE;
4470 #if CONFIG_SENSOR_Flash
4471 case V4L2_CID_FLASH:
4473 if (sensor_set_flash(icd, qctrl,ext_ctrl->value) != 0)
4475 sensor->info_priv.flash = ext_ctrl->value;
4477 SENSOR_DG("%s flash is %x\n",SENSOR_NAME_STRING(), sensor->info_priv.flash);
4488 static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
4490 struct i2c_client *client = v4l2_get_subdevdata(sd);
4491 struct soc_camera_device *icd = client->dev.platform_data;
4492 int i, error_cnt=0, error_idx=-1;
4494 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
4497 for (i=0; i<ext_ctrl->count; i++) {
4498 if (sensor_g_ext_control(icd, &ext_ctrl->controls[i]) != 0) {
4505 error_idx = ext_ctrl->count;
4507 if (error_idx != -1) {
4508 ext_ctrl->error_idx = error_idx;
4515 static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
4517 struct i2c_client *client = v4l2_get_subdevdata(sd);
4518 struct soc_camera_device *icd = client->dev.platform_data;
4519 int i, error_cnt=0, error_idx=-1;
4521 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
4523 for (i=0; i<ext_ctrl->count; i++) {
4524 if (sensor_s_ext_control(icd, &ext_ctrl->controls[i]) != 0) {
4531 error_idx = ext_ctrl->count;
4533 if (error_idx != -1) {
4534 ext_ctrl->error_idx = error_idx;
4541 static int sensor_s_stream(struct v4l2_subdev *sd, int enable)
4543 struct i2c_client *client = v4l2_get_subdevdata(sd);
4544 struct sensor *sensor = to_sensor(client);
4547 sensor->info_priv.enable = 1;
4548 } else if (enable == 0) {
4549 sensor->info_priv.enable = 0;
4555 /* Interface active, can use i2c. If it fails, it can indeed mean, that
4556 * this wasn't our capture interface, so, we wait for the right one */
4557 static int sensor_video_probe(struct soc_camera_device *icd,
4558 struct i2c_client *client)
4561 struct sensor *sensor = to_sensor(client);
4562 #if (SENSOR_RESET_REG != SEQUENCE_END)
4563 struct reginfo reg_info;
4565 /* We must have a parent by now. And it cannot be a wrong one.
4566 * So this entire test is completely redundant. */
4567 if (!icd->dev.parent ||
4568 to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
4571 if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
4573 goto sensor_video_probe_err;
4577 #if (SENSOR_RESET_REG != SEQUENCE_END)
4578 reg_info.reg = SENSOR_RESET_REG;
4579 reg_info.val = SENSOR_RESET_VAL;
4580 reg_info.reg_len = SENSOR_RESET_REG_LEN;
4581 ret = sensor_write(client, ®_info);
4583 SENSOR_TR("%s soft reset sensor failed\n",SENSOR_NAME_STRING());
4585 goto sensor_video_probe_err;
4588 mdelay(5); //delay 5 microseconds
4591 /* check if it is an sensor sensor */
4592 #if (SENSOR_ID_REG != SEQUENCE_END)
4593 ret = sensor_read(client, SENSOR_ID_REG, &pid);
4595 SENSOR_TR("read chip id failed\n");
4597 goto sensor_video_probe_err;
4600 SENSOR_DG("\n %s pid = 0x%x \n", SENSOR_NAME_STRING(), pid);
4605 if (pid == SENSOR_ID) {
4606 sensor->model = SENSOR_V4L2_IDENT;
4608 SENSOR_TR("error: %s mismatched pid = 0x%x\n", SENSOR_NAME_STRING(), pid);
4610 goto sensor_video_probe_err;
4615 sensor_video_probe_err:
4619 static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
4621 struct i2c_client *client = v4l2_get_subdevdata(sd);
4622 struct soc_camera_device *icd = client->dev.platform_data;
4623 struct sensor *sensor = to_sensor(client);
4624 #if CONFIG_SENSOR_Flash
4629 rk29_camera_sensor_cb_s *icd_cb =NULL;
4631 SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
4634 case RK29_CAM_SUBDEV_DEACTIVATE:
4636 sensor_deactivate(client);
4639 case RK29_CAM_SUBDEV_IOREQUEST:
4641 sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
4642 if (sensor->sensor_io_request != NULL) {
4643 if (sensor->sensor_io_request->gpio_res[0].dev_name &&
4644 (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
4645 sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
4646 } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
4647 (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
4648 sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
4651 SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
4653 goto sensor_ioctl_end;
4655 /* ddl@rock-chips.com : if gpio_flash havn't been set in board-xxx.c, sensor driver must notify is not support flash control
4657 #if CONFIG_SENSOR_Flash
4658 if (sensor->sensor_gpio_res) {
4659 if (sensor->sensor_gpio_res->gpio_flash == INVALID_GPIO) {
4660 for (i = 0; i < icd->ops->num_controls; i++) {
4661 if (V4L2_CID_FLASH == icd->ops->controls[i].id) {
4662 memset((char*)(icd->ops->controls+i),0x00,sizeof(struct v4l2_queryctrl));
4665 sensor->info_priv.flash = 0xff;
4666 SENSOR_DG("%s flash gpio is invalidate!\n",SENSOR_NAME_STRING());
4672 case RK29_CAM_SUBDEV_CB_REGISTER:
4674 icd_cb = (rk29_camera_sensor_cb_s*)(arg);
4675 icd_cb->sensor_cb = sensor_cb;
4680 SENSOR_TR("%s %s cmd(0x%x) is unknown !\n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
4688 static int sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
4689 enum v4l2_mbus_pixelcode *code)
4691 if (index >= ARRAY_SIZE(sensor_colour_fmts))
4694 *code = sensor_colour_fmts[index].code;
4697 static struct v4l2_subdev_core_ops sensor_subdev_core_ops = {
4698 .init = sensor_init,
4699 .g_ctrl = sensor_g_control,
4700 .s_ctrl = sensor_s_control,
4701 .g_ext_ctrls = sensor_g_ext_controls,
4702 .s_ext_ctrls = sensor_s_ext_controls,
4703 .g_chip_ident = sensor_g_chip_ident,
4704 .ioctl = sensor_ioctl,
4706 static struct v4l2_subdev_video_ops sensor_subdev_video_ops = {
4707 .s_mbus_fmt = sensor_s_fmt,
4708 .g_mbus_fmt = sensor_g_fmt,
4709 .try_mbus_fmt = sensor_try_fmt,
4710 .enum_mbus_fmt = sensor_enum_fmt,
4711 .s_stream = sensor_s_stream,
4713 static struct v4l2_subdev_ops sensor_subdev_ops = {
4714 .core = &sensor_subdev_core_ops,
4715 .video = &sensor_subdev_video_ops,
4718 static int sensor_probe(struct i2c_client *client,
4719 const struct i2c_device_id *did)
4721 struct sensor *sensor;
4722 struct soc_camera_device *icd = client->dev.platform_data;
4723 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
4724 struct soc_camera_link *icl;
4727 SENSOR_DG("\n%s..%s..%d..\n",__FUNCTION__,__FILE__,__LINE__);
4729 dev_err(&client->dev, "%s: missing soc-camera data!\n",SENSOR_NAME_STRING());
4733 icl = to_soc_camera_link(icd);
4735 dev_err(&client->dev, "%s driver needs platform data\n", SENSOR_NAME_STRING());
4739 if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
4740 dev_warn(&adapter->dev,
4741 "I2C-Adapter doesn't support I2C_FUNC_I2C\n");
4745 sensor = kzalloc(sizeof(struct sensor), GFP_KERNEL);
4749 v4l2_i2c_subdev_init(&sensor->subdev, client, &sensor_subdev_ops);
4751 /* Second stage probe - when a capture adapter is there */
4752 icd->ops = &sensor_ops;
4753 sensor->info_priv.fmt = sensor_colour_fmts[0];
4754 #if CONFIG_SENSOR_I2C_NOSCHED
4755 atomic_set(&sensor->tasklock_cnt,0);
4758 ret = sensor_video_probe(icd, client);
4761 i2c_set_clientdata(client, NULL);
4765 SENSOR_DG("\n%s..%s..%d ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
4769 static int sensor_remove(struct i2c_client *client)
4771 struct sensor *sensor = to_sensor(client);
4772 struct soc_camera_device *icd = client->dev.platform_data;
4774 #if CONFIG_SENSOR_Focus
4775 if (sensor->sensor_wq) {
4776 destroy_workqueue(sensor->sensor_wq);
4777 sensor->sensor_wq = NULL;
4782 i2c_set_clientdata(client, NULL);
4783 client->driver = NULL;
4789 static const struct i2c_device_id sensor_id[] = {
4790 {SENSOR_NAME_STRING(), 0 },
4793 MODULE_DEVICE_TABLE(i2c, sensor_id);
4795 static struct i2c_driver sensor_i2c_driver = {
4797 .name = SENSOR_NAME_STRING(),
4799 .probe = sensor_probe,
4800 .remove = sensor_remove,
4801 .id_table = sensor_id,
4804 static int __init sensor_mod_init(void)
4806 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
4807 return i2c_add_driver(&sensor_i2c_driver);
4810 static void __exit sensor_mod_exit(void)
4812 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
4813 i2c_del_driver(&sensor_i2c_driver);
4816 device_initcall_sync(sensor_mod_init);
4817 module_exit(sensor_mod_exit);
4819 MODULE_DESCRIPTION(SENSOR_NAME_STRING(Camera sensor driver));
4820 MODULE_AUTHOR("ddl <kernel@rock-chips>");
4821 MODULE_LICENSE("GPL");