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 <plat/rk_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 0
67 #define CONFIG_SENSOR_Brightness 0
68 #define CONFIG_SENSOR_Contrast 0
69 #define CONFIG_SENSOR_Saturation 0
70 #define CONFIG_SENSOR_Effect 0
71 #define CONFIG_SENSOR_Scene 0
72 #define CONFIG_SENSOR_DigitalZoom 0
73 #define CONFIG_SENSOR_Exposure 0
74 #define CONFIG_SENSOR_Flash 0
75 #define CONFIG_SENSOR_Mirror 0
76 #define CONFIG_SENSOR_Flip 0
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*/
118 #define SENSOR_AF_MODE_AUTO 0
119 #define SENSOR_AF_MODE_CLOSE 1
120 #define SENSOR_AF_MODE_CONTINUOUS 2
123 //flash off in fixed time to prevent from too hot , zyc
126 struct soc_camera_device *icd;
127 struct hrtimer timer;
129 static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
131 static struct flash_timer flash_off_timer;
132 //for user defined if user want to customize the series , zyc
133 #ifdef CONFIG_MT9P111_USER_DEFINED_SERIES
134 #include "mt9p111_user_series.c"
137 /* init 640X480 VGA */
138 static struct reginfo sensor_init_data[] =
140 { 0x0010, 0x0340, WORD_LEN, 0 },
143 { 0x0010, 0x0340, WORD_LEN, 0 }, // PLL_DIVIDERS
144 { 0x0012, 0x0080, WORD_LEN, 0 }, // PLL_P_DIVIDERS
145 { 0x0014, 0x2025, WORD_LEN, 0 }, // PLL_CONTROL
146 { 0x001E, 0x0565, WORD_LEN, 0 }, // PAD_SLEW_PAD_CONFIG
147 { 0x0022, 0x0030, WORD_LEN, 0 }, // VDD_DIS_COUNTER
148 { 0x002A, 0x7FFF, WORD_LEN, 0 }, // PLL_P4_P5_P6_DIVIDERS
149 { 0x002C, 0x0000, WORD_LEN, 0 }, // PLL_P7_DIVIDER
150 { 0x002E, 0x0000, WORD_LEN, 0 }, // SENSOR_CLOCK_DIVIDER
151 { 0x0018, 0x400c, WORD_LEN, 0 }, // STANDBY_CONTROL_AND_STATUS
153 {SEQUENCE_WAIT_MS,300,WORD_LEN,0},
154 { 0x098E, 0x483A, WORD_LEN, 0 }, // LOGICAL_ADDRESS_ACCESS
155 { 0xC83A, 0x000C, WORD_LEN, 0 }, // CAM_CORE_A_Y_ADDR_START
156 { 0xC83C, 0x0018, WORD_LEN, 0 }, // CAM_CORE_A_X_ADDR_START
157 { 0xC83E, 0x07B1, WORD_LEN, 0 }, // CAM_CORE_A_Y_ADDR_END
158 { 0xC840, 0x0A45, WORD_LEN, 0 }, // CAM_CORE_A_X_ADDR_END
159 { 0xC842, 0x0001, WORD_LEN, 0 }, // CAM_CORE_A_ROW_SPEED
160 { 0xC844, 0x0103, WORD_LEN, 0 }, // CAM_CORE_A_SKIP_X_CORE
161 { 0xC846, 0x0103, WORD_LEN, 0 }, // CAM_CORE_A_SKIP_Y_CORE
162 { 0xC848, 0x0103, WORD_LEN, 0 }, // CAM_CORE_A_SKIP_X_PIPE
163 { 0xC84A, 0x0103, WORD_LEN, 0 }, // CAM_CORE_A_SKIP_Y_PIPE
164 { 0xC84C, 0x00F6, WORD_LEN, 0 }, // CAM_CORE_A_POWER_MODE
165 { 0xC84E, 0x0001, WORD_LEN, 0 }, // CAM_CORE_A_BIN_MODE
166 { 0xC850, 0x00, BYTE_LEN, 0}, // CAM_CORE_A_ORIENTATION
167 { 0xC851, 0x00, BYTE_LEN, 0}, // CAM_CORE_A_PIXEL_ORDER
168 { 0xC852, 0x019C, WORD_LEN, 0 }, // CAM_CORE_A_FINE_CORRECTION
169 { 0xC854, 0x0732, WORD_LEN, 0 }, // CAM_CORE_A_FINE_ITMIN
170 { 0xC858, 0x0000, WORD_LEN, 0 }, // CAM_CORE_A_COARSE_ITMIN
171 { 0xC85A, 0x0001, WORD_LEN, 0 }, // CAM_CORE_A_COARSE_ITMAX_MARGIN
172 { 0xC85C, 0x0423, WORD_LEN, 0 }, // CAM_CORE_A_MIN_FRAME_LENGTH_LINES
173 { 0xC85E, 0xFFFF, WORD_LEN, 0 }, // CAM_CORE_A_MAX_FRAME_LENGTH_LINES
174 { 0xC860, 0x0423, WORD_LEN, 0 }, // CAM_CORE_A_BASE_FRAME_LENGTH_LINES
175 { 0xC862, 0x1194, WORD_LEN, 0 }, // CAM_CORE_A_MIN_LINE_LENGTH_PCLK
176 { 0xC864, 0xFFFE, WORD_LEN, 0 }, // CAM_CORE_A_MAX_LINE_LENGTH_PCLK
177 { 0xC866, 0x7F7F, WORD_LEN, 0 }, // CAM_CORE_A_P4_5_6_DIVIDER
178 { 0xC868, 0x0423, WORD_LEN, 0 }, // CAM_CORE_A_FRAME_LENGTH_LINES
179 { 0xC86A, 0x1194, WORD_LEN, 0 }, // CAM_CORE_A_LINE_LENGTH_PCK
180 { 0xC86C, 0x0518, WORD_LEN, 0 }, // CAM_CORE_A_OUTPUT_SIZE_WIDTH
181 { 0xC86E, 0x03D4, WORD_LEN, 0 }, // CAM_CORE_A_OUTPUT_SIZE_HEIGHT
182 { 0xC870, 0x0014, WORD_LEN, 0 }, // CAM_CORE_A_RX_FIFO_TRIGGER_MARK
183 { 0xC858, 0x0003, WORD_LEN, 0 }, // CAM_CORE_A_COARSE_ITMIN
184 { 0xC8B8, 0x0004, WORD_LEN, 0 }, // CAM_OUTPUT_0_JPEG_CONTROL
185 { 0xC8AE, 0x0001, WORD_LEN, 0 }, // CAM_OUTPUT_0_OUTPUT_FORMAT
186 { 0xC8AA, 0x0280, WORD_LEN, 0 }, // CAM_OUTPUT_0_IMAGE_WIDTH
187 { 0xC8AC, 0x01E0, WORD_LEN, 0 }, // CAM_OUTPUT_0_IMAGE_HEIGHT
188 { 0xC872, 0x0010, WORD_LEN, 0 }, // CAM_CORE_B_Y_ADDR_START
189 { 0xC874, 0x001C, WORD_LEN, 0 }, // CAM_CORE_B_X_ADDR_START
190 { 0xC876, 0x07AF, WORD_LEN, 0 }, // CAM_CORE_B_Y_ADDR_END
191 { 0xC878, 0x0A43, WORD_LEN, 0 }, // CAM_CORE_B_X_ADDR_END
192 { 0xC87A, 0x0001, WORD_LEN, 0 }, // CAM_CORE_B_ROW_SPEED
193 { 0xC87C, 0x0101, WORD_LEN, 0 }, // CAM_CORE_B_SKIP_X_CORE
194 { 0xC87E, 0x0101, WORD_LEN, 0 }, // CAM_CORE_B_SKIP_Y_CORE
195 { 0xC880, 0x0101, WORD_LEN, 0 }, // CAM_CORE_B_SKIP_X_PIPE
196 { 0xC882, 0x0101, WORD_LEN, 0 }, // CAM_CORE_B_SKIP_Y_PIPE
197 { 0xC884, 0x00F2, WORD_LEN, 0 }, // CAM_CORE_B_POWER_MODE
198 { 0xC886, 0x0000, WORD_LEN, 0 }, // CAM_CORE_B_BIN_MODE
199 { 0xC888, 0x00, BYTE_LEN, 0}, // CAM_CORE_B_ORIENTATION
200 { 0xC889, 0x00, BYTE_LEN, 0}, // CAM_CORE_B_PIXEL_ORDER
201 { 0xC88A, 0x009C, WORD_LEN, 0 }, // CAM_CORE_B_FINE_CORRECTION
202 { 0xC88C, 0x034A, WORD_LEN, 0 }, // CAM_CORE_B_FINE_ITMIN
203 { 0xC890, 0x0000, WORD_LEN, 0 }, // CAM_CORE_B_COARSE_ITMIN
204 { 0xC892, 0x0001, WORD_LEN, 0 }, // CAM_CORE_B_COARSE_ITMAX_MARGIN
205 { 0xC894, 0x07EF, WORD_LEN, 0 }, // CAM_CORE_B_MIN_FRAME_LENGTH_LINES
206 { 0xC896, 0xFFFF, WORD_LEN, 0 }, // CAM_CORE_B_MAX_FRAME_LENGTH_LINES
207 { 0xC898, 0x082F, WORD_LEN, 0 }, // CAM_CORE_B_BASE_FRAME_LENGTH_LINES
208 { 0xC89A, 0x1964, WORD_LEN, 0 }, // CAM_CORE_B_MIN_LINE_LENGTH_PCLK
209 { 0xC89C, 0xFFFE, WORD_LEN, 0 }, // CAM_CORE_B_MAX_LINE_LENGTH_PCLK
210 { 0xC89E, 0x7F7F, WORD_LEN, 0 }, // CAM_CORE_B_P4_5_6_DIVIDER
211 { 0xC8A0, 0x07EF, WORD_LEN, 0 }, // CAM_CORE_B_FRAME_LENGTH_LINES
212 { 0xC8A2, 0x1964, WORD_LEN, 0 }, // CAM_CORE_B_LINE_LENGTH_PCK
213 { 0xC8A4, 0x0A28, WORD_LEN, 0 }, // CAM_CORE_B_OUTPUT_SIZE_WIDTH
214 { 0xC8A6, 0x07A0, WORD_LEN, 0 }, // CAM_CORE_B_OUTPUT_SIZE_HEIGHT
215 { 0xC8A8, 0x0124, WORD_LEN, 0 }, // CAM_CORE_B_RX_FIFO_TRIGGER_MARK
216 { 0xC890, 0x0003, WORD_LEN, 0 }, // CAM_CORE_B_COARSE_ITMIN
217 { 0xC8C0, 0x0A20, WORD_LEN, 0 }, // CAM_OUTPUT_1_IMAGE_WIDTH
218 { 0xC8C2, 0x0798, WORD_LEN, 0 }, // CAM_OUTPUT_1_IMAGE_HEIGHT
219 { 0xC89A, 0x1964, WORD_LEN, 0 }, // CAM_CORE_B_MIN_LINE_LENGTH_PCLK
220 { 0xC8A2, 0x1964, WORD_LEN, 0 }, // CAM_CORE_B_LINE_LENGTH_PCK
221 { 0xC8C4, 0x0001, WORD_LEN, 0 }, // CAM_OUTPUT_1_OUTPUT_FORMAT
222 { 0xC8C6, 0x0000, WORD_LEN, 0 }, // CAM_OUTPUT_1_OUTPUT_FORMAT_ORDER
223 { 0xC8CE, 0x0014, WORD_LEN, 0 }, // CAM_OUTPUT_1_JPEG_CONTROL
224 { 0xD822, 0x4610, WORD_LEN, 0 }, // JPEG_JPSS_CTRL_VAR
225 { 0x3330, 0x0000, WORD_LEN, 0 }, // OUTPUT_FORMAT_TEST
226 { 0x098E, 0xA00E, WORD_LEN, 0 }, // LOGICAL_ADDRESS_ACCESS
227 { 0xA00E, 0x32, BYTE_LEN, 0}, // FD_MAX_NUM_AUTOCOR_FUNC_VALUES_TO_CHECK
228 { 0xA010, 0x00CC, WORD_LEN, 0 }, // FD_MIN_EXPECTED50HZ_FLICKER_PERIOD
229 { 0xA012, 0x00E0, WORD_LEN, 0 }, // FD_MAX_EXPECTED50HZ_FLICKER_PERIOD
230 { 0xA014, 0x00A8, WORD_LEN, 0 }, // FD_MIN_EXPECTED60HZ_FLICKER_PERIOD
231 { 0xA016, 0x00BC, WORD_LEN, 0 }, // FD_MAX_EXPECTED60HZ_FLICKER_PERIOD
232 { 0xA018, 0x00D6, WORD_LEN, 0 }, // FD_EXPECTED50HZ_FLICKER_PERIOD_IN_CONTEXT_A
233 { 0xA01A, 0x0075, WORD_LEN, 0 }, // FD_EXPECTED50HZ_FLICKER_PERIOD_IN_CONTEXT_B
234 { 0xA01C, 0x00B2, WORD_LEN, 0 }, // FD_EXPECTED60HZ_FLICKER_PERIOD_IN_CONTEXT_A
235 { 0xA01E, 0x0062, WORD_LEN, 0 }, // FD_EXPECTED60HZ_FLICKER_PERIOD_IN_CONTEXT_B
236 { 0xA000, 0x10, BYTE_LEN, 0}, // FD_STATUS
237 { 0x8417, 0x02, BYTE_LEN, 0}, // SEQ_STATE_CFG_1_FD
239 { SEQUENCE_WAIT_MS,100, BYTE_LEN, 0},
243 // Default variable access mode is always logical.
246 { 0x098E, 0x0000, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS
247 { 0x301A, 0x0030, WORD_LEN, 0}, // RESET_REGISTER
248 { 0x316C, 0xB430, WORD_LEN, 0}, // DAC_TXLO
249 { 0x31E0, 0x0003, WORD_LEN, 0}, // PIX_DEF_ID
250 { 0x3E2E, 0xF319, WORD_LEN, 0}, // SAMP_SPARE
251 { 0x3EE6, 0xA7C1, WORD_LEN, 0}, // DAC_LD_26_27
252 { 0x301E, 0x00A8, WORD_LEN, 0}, // DATA_PEDESTAL
253 { 0xDC33, 0x2A, BYTE_LEN, 0}, // SYS_FIRST_BLACK_LEVEL
254 { 0x3812, 0x212C, WORD_LEN, 0}, // OTPM_CFG
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, 0x08D4, 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, 0x08D4, WORD_LEN, 0},
299 { 0x88C0, 0xFF80, WORD_LEN, 0},
300 { 0x88C2, 0x08DC, WORD_LEN, 0},
301 { 0x88C4, 0xFF80, WORD_LEN, 0},
302 { 0x88C6, 0x0F58, WORD_LEN, 0},
303 { 0x88C8, 0xFF80, WORD_LEN, 0},
304 { 0x88CA, 0x0920, WORD_LEN, 0},
305 { 0x88CC, 0xFF80, WORD_LEN, 0},
306 { 0x88CE, 0x1010, WORD_LEN, 0},
307 { 0x88D0, 0xFF80, WORD_LEN, 0},
308 { 0x88D2, 0x1030, WORD_LEN, 0},
309 { 0x88D4, 0x0010, WORD_LEN, 0},
310 { 0x88D6, 0x0008, WORD_LEN, 0},
311 { 0x88D8, 0x0000, WORD_LEN, 0},
312 { 0x88DA, 0x0000, WORD_LEN, 0},
313 { 0x88DC, 0xD102, WORD_LEN, 0},
314 { 0x88DE, 0xD003, WORD_LEN, 0},
315 { 0x88E0, 0x7FE0, WORD_LEN, 0},
316 { 0x88E2, 0xB035, WORD_LEN, 0},
317 { 0x88E4, 0xFF80, WORD_LEN, 0},
318 { 0x88E6, 0x10C8, WORD_LEN, 0},
319 { 0x88E8, 0xFF80, WORD_LEN, 0},
320 { 0x88EA, 0x0118, WORD_LEN, 0},
321 { 0x88EC, 0xC0F1, WORD_LEN, 0},
322 { 0x88EE, 0xC5E1, WORD_LEN, 0},
323 { 0x88F0, 0xD5EC, WORD_LEN, 0},
324 { 0x88F2, 0x8D04, WORD_LEN, 0},
325 { 0x88F4, 0x8D25, WORD_LEN, 0},
326 { 0x88F6, 0xB808, WORD_LEN, 0},
327 { 0x88F8, 0x7825, WORD_LEN, 0},
328 { 0x88FA, 0x0821, WORD_LEN, 0},
329 { 0x88FC, 0x01DE, WORD_LEN, 0},
330 { 0x88FE, 0xD0EA, WORD_LEN, 0},
331 { 0x8900, 0x8000, WORD_LEN, 0},
332 { 0x8902, 0x8008, WORD_LEN, 0},
333 { 0x8904, 0x7840, WORD_LEN, 0},
334 { 0x8906, 0x8D04, WORD_LEN, 0},
335 { 0x8908, 0x8D25, WORD_LEN, 0},
336 { 0x890A, 0xB808, WORD_LEN, 0},
337 { 0x890C, 0x7825, WORD_LEN, 0},
338 { 0x890E, 0xB8A7, WORD_LEN, 0},
339 { 0x8910, 0x2841, WORD_LEN, 0},
340 { 0x8912, 0x0201, WORD_LEN, 0},
341 { 0x8914, 0xAD24, WORD_LEN, 0},
342 { 0x8916, 0xAD05, WORD_LEN, 0},
343 { 0x8918, 0x09A6, WORD_LEN, 0},
344 { 0x891A, 0x0104, WORD_LEN, 0},
345 { 0x891C, 0x01A9, WORD_LEN, 0},
346 { 0x891E, 0x06C4, WORD_LEN, 0},
347 { 0x8920, 0xC0F1, WORD_LEN, 0},
348 { 0x8922, 0x0932, WORD_LEN, 0},
349 { 0x8924, 0x06E4, WORD_LEN, 0},
350 { 0x8926, 0xDA38, WORD_LEN, 0},
351 { 0x8928, 0xD1E0, WORD_LEN, 0},
352 { 0x892A, 0xD5E1, WORD_LEN, 0},
353 { 0x892C, 0x76A9, WORD_LEN, 0},
354 { 0x892E, 0x0EC6, WORD_LEN, 0},
355 { 0x8930, 0x06A4, WORD_LEN, 0},
356 { 0x8932, 0x70C9, WORD_LEN, 0},
357 { 0x8934, 0xD0DF, WORD_LEN, 0},
358 { 0x8936, 0xA501, WORD_LEN, 0},
359 { 0x8938, 0xD0DF, WORD_LEN, 0},
360 { 0x893A, 0xA503, WORD_LEN, 0},
361 { 0x893C, 0xD0DF, WORD_LEN, 0},
362 { 0x893E, 0xA506, WORD_LEN, 0},
363 { 0x8940, 0xD0DF, WORD_LEN, 0},
364 { 0x8942, 0xA509, WORD_LEN, 0},
365 { 0x8944, 0xD0D8, WORD_LEN, 0},
366 { 0x8946, 0xA0C0, WORD_LEN, 0},
367 { 0x8948, 0xD0DE, WORD_LEN, 0},
368 { 0x894A, 0x802E, WORD_LEN, 0},
369 { 0x894C, 0x9117, WORD_LEN, 0},
370 { 0x894E, 0x0171, WORD_LEN, 0},
371 { 0x8950, 0x06E4, WORD_LEN, 0},
372 { 0x8952, 0xB10E, WORD_LEN, 0},
373 { 0x8954, 0xC0F1, WORD_LEN, 0},
374 { 0x8956, 0xD0D3, WORD_LEN, 0},
375 { 0x8958, 0x8806, WORD_LEN, 0},
376 { 0x895A, 0x080F, WORD_LEN, 0},
377 { 0x895C, 0x0051, WORD_LEN, 0},
378 { 0x895E, 0xD0D2, WORD_LEN, 0},
379 { 0x8960, 0x8000, WORD_LEN, 0},
380 { 0x8962, 0x8008, WORD_LEN, 0},
381 { 0x8964, 0x7840, WORD_LEN, 0},
382 { 0x8966, 0x0A1E, WORD_LEN, 0},
383 { 0x8968, 0x0104, WORD_LEN, 0},
384 { 0x896A, 0xC0D1, WORD_LEN, 0},
385 { 0x896C, 0x7EE0, WORD_LEN, 0},
386 { 0x896E, 0x78E0, WORD_LEN, 0},
387 { 0x8970, 0xC0F1, WORD_LEN, 0},
388 { 0x8972, 0x08D6, WORD_LEN, 0},
389 { 0x8974, 0x06C4, WORD_LEN, 0},
390 { 0x8976, 0xD7CC, WORD_LEN, 0},
391 { 0x8978, 0x8700, WORD_LEN, 0},
392 { 0x897A, 0x8009, WORD_LEN, 0},
393 { 0x897C, 0x7840, WORD_LEN, 0},
394 { 0x897E, 0xE080, WORD_LEN, 0},
395 { 0x8980, 0x0276, WORD_LEN, 0},
396 { 0x8982, 0x0002, WORD_LEN, 0},
397 { 0x8984, 0xD5C7, WORD_LEN, 0},
398 { 0x8986, 0xD6D0, WORD_LEN, 0},
399 { 0x8988, 0x1530, WORD_LEN, 0},
400 { 0x898A, 0x1081, WORD_LEN, 0},
401 { 0x898C, 0x1531, WORD_LEN, 0},
402 { 0x898E, 0x1080, WORD_LEN, 0},
403 { 0x8990, 0xB908, WORD_LEN, 0},
404 { 0x8992, 0x7905, WORD_LEN, 0},
405 { 0x8994, 0x2941, WORD_LEN, 0},
406 { 0x8996, 0x0200, WORD_LEN, 0},
407 { 0x8998, 0x1D32, WORD_LEN, 0},
408 { 0x899A, 0x1002, WORD_LEN, 0},
409 { 0x899C, 0x1D33, WORD_LEN, 0},
410 { 0x899E, 0x1042, WORD_LEN, 0},
411 { 0x89A0, 0x962D, WORD_LEN, 0},
412 { 0x89A2, 0x2540, WORD_LEN, 0},
413 { 0x89A4, 0x15D1, WORD_LEN, 0},
414 { 0x89A6, 0x2941, WORD_LEN, 0},
415 { 0x89A8, 0x0200, WORD_LEN, 0},
416 { 0x89AA, 0x1D30, WORD_LEN, 0},
417 { 0x89AC, 0x1002, WORD_LEN, 0},
418 { 0x89AE, 0x8D06, WORD_LEN, 0},
419 { 0x89B0, 0x2540, WORD_LEN, 0},
420 { 0x89B2, 0x1610, WORD_LEN, 0},
421 { 0x89B4, 0x1D31, WORD_LEN, 0},
422 { 0x89B6, 0x1042, WORD_LEN, 0},
423 { 0x89B8, 0x081B, WORD_LEN, 0},
424 { 0x89BA, 0x0051, WORD_LEN, 0},
425 { 0x89BC, 0x8700, WORD_LEN, 0},
426 { 0x89BE, 0x8008, WORD_LEN, 0},
427 { 0x89C0, 0x7840, WORD_LEN, 0},
428 { 0x89C2, 0xD900, WORD_LEN, 0},
429 { 0x89C4, 0x2941, WORD_LEN, 0},
430 { 0x89C6, 0x0200, WORD_LEN, 0},
431 { 0x89C8, 0xAD00, WORD_LEN, 0},
432 { 0x89CA, 0xAD21, WORD_LEN, 0},
433 { 0x89CC, 0xD801, WORD_LEN, 0},
434 { 0x89CE, 0x1D4D, WORD_LEN, 0},
435 { 0x89D0, 0x1002, WORD_LEN, 0},
436 { 0x89D2, 0x154D, WORD_LEN, 0},
437 { 0x89D4, 0x1080, WORD_LEN, 0},
438 { 0x89D6, 0xB861, WORD_LEN, 0},
439 { 0x89D8, 0xE085, WORD_LEN, 0},
440 { 0x89DA, 0x0218, WORD_LEN, 0},
441 { 0x89DC, 0x000D, WORD_LEN, 0},
442 { 0x89DE, 0x2740, WORD_LEN, 0},
443 { 0x89E0, 0x7381, WORD_LEN, 0},
444 { 0x89E2, 0x2132, WORD_LEN, 0},
445 { 0x89E4, 0x0000, WORD_LEN, 0},
446 { 0x89E6, 0x7914, WORD_LEN, 0},
447 { 0x89E8, 0x7900, WORD_LEN, 0},
448 { 0x89EA, 0x0323, WORD_LEN, 0},
449 { 0x89EC, 0x67BB, WORD_LEN, 0},
450 { 0x89EE, 0xD62E, WORD_LEN, 0},
451 { 0x89F0, 0x8D11, WORD_LEN, 0},
452 { 0x89F2, 0xD1B6, WORD_LEN, 0},
453 { 0x89F4, 0x8924, WORD_LEN, 0},
454 { 0x89F6, 0x2032, WORD_LEN, 0},
455 { 0x89F8, 0x2000, WORD_LEN, 0},
456 { 0x89FA, 0xDE02, WORD_LEN, 0},
457 { 0x89FC, 0x082B, WORD_LEN, 0},
458 { 0x89FE, 0x0040, WORD_LEN, 0},
459 { 0x8A00, 0x8D20, WORD_LEN, 0},
460 { 0x8A02, 0x8D41, WORD_LEN, 0},
461 { 0x8A04, 0xB908, WORD_LEN, 0},
462 { 0x8A06, 0x7945, WORD_LEN, 0},
463 { 0x8A08, 0xB983, WORD_LEN, 0},
464 { 0x8A0A, 0x2941, WORD_LEN, 0},
465 { 0x8A0C, 0x0202, WORD_LEN, 0},
466 { 0x8A0E, 0xAD40, WORD_LEN, 0},
467 { 0x8A10, 0xAD21, WORD_LEN, 0},
468 { 0x8A12, 0xD1AF, WORD_LEN, 0},
469 { 0x8A14, 0x8120, WORD_LEN, 0},
470 { 0x8A16, 0x8121, WORD_LEN, 0},
471 { 0x8A18, 0x7940, WORD_LEN, 0},
472 { 0x8A1A, 0x8D06, WORD_LEN, 0},
473 { 0x8A1C, 0xE001, WORD_LEN, 0},
474 { 0x8A1E, 0xAD06, WORD_LEN, 0},
475 { 0x8A20, 0x1D4D, WORD_LEN, 0},
476 { 0x8A22, 0x1382, WORD_LEN, 0},
477 { 0x8A24, 0xF0E9, WORD_LEN, 0},
478 { 0x8A26, 0x8D06, WORD_LEN, 0},
479 { 0x8A28, 0x1D4D, WORD_LEN, 0},
480 { 0x8A2A, 0x1382, WORD_LEN, 0},
481 { 0x8A2C, 0xE001, WORD_LEN, 0},
482 { 0x8A2E, 0xAD06, WORD_LEN, 0},
483 { 0x8A30, 0x8D00, WORD_LEN, 0},
484 { 0x8A32, 0x8D21, WORD_LEN, 0},
485 { 0x8A34, 0xB808, WORD_LEN, 0},
486 { 0x8A36, 0x7825, WORD_LEN, 0},
487 { 0x8A38, 0xB885, WORD_LEN, 0},
488 { 0x8A3A, 0x2841, WORD_LEN, 0},
489 { 0x8A3C, 0x0201, WORD_LEN, 0},
490 { 0x8A3E, 0xAD20, WORD_LEN, 0},
491 { 0x8A40, 0xAD01, WORD_LEN, 0},
492 { 0x8A42, 0x8D31, WORD_LEN, 0},
493 { 0x8A44, 0xF01A, WORD_LEN, 0},
494 { 0x8A46, 0x8D31, WORD_LEN, 0},
495 { 0x8A48, 0x8D12, WORD_LEN, 0},
496 { 0x8A4A, 0x8D46, WORD_LEN, 0},
497 { 0x8A4C, 0x7822, WORD_LEN, 0},
498 { 0x8A4E, 0x0863, WORD_LEN, 0},
499 { 0x8A50, 0x0082, WORD_LEN, 0},
500 { 0x8A52, 0x1532, WORD_LEN, 0},
501 { 0x8A54, 0x1080, WORD_LEN, 0},
502 { 0x8A56, 0x1533, WORD_LEN, 0},
503 { 0x8A58, 0x1081, WORD_LEN, 0},
504 { 0x8A5A, 0x1531, WORD_LEN, 0},
505 { 0x8A5C, 0x1082, WORD_LEN, 0},
506 { 0x8A5E, 0xB808, WORD_LEN, 0},
507 { 0x8A60, 0x7825, WORD_LEN, 0},
508 { 0x8A62, 0x1530, WORD_LEN, 0},
509 { 0x8A64, 0x1081, WORD_LEN, 0},
510 { 0x8A66, 0xB908, WORD_LEN, 0},
511 { 0x8A68, 0x7945, WORD_LEN, 0},
512 { 0x8A6A, 0xD29A, WORD_LEN, 0},
513 { 0x8A6C, 0x0992, WORD_LEN, 0},
514 { 0x8A6E, 0x0020, WORD_LEN, 0},
515 { 0x8A70, 0x8A40, WORD_LEN, 0},
516 { 0x8A72, 0x8D31, WORD_LEN, 0},
517 { 0x8A74, 0x081F, WORD_LEN, 0},
518 { 0x8A76, 0x0051, WORD_LEN, 0},
519 { 0x8A78, 0x8D06, WORD_LEN, 0},
520 { 0x8A7A, 0x6038, WORD_LEN, 0},
521 { 0x8A7C, 0xD194, WORD_LEN, 0},
522 { 0x8A7E, 0x8120, WORD_LEN, 0},
523 { 0x8A80, 0x8121, WORD_LEN, 0},
524 { 0x8A82, 0x7960, WORD_LEN, 0},
525 { 0x8A84, 0x2132, WORD_LEN, 0},
526 { 0x8A86, 0x2000, WORD_LEN, 0},
527 { 0x8A88, 0x8D06, WORD_LEN, 0},
528 { 0x8A8A, 0xE001, WORD_LEN, 0},
529 { 0x8A8C, 0xAD06, WORD_LEN, 0},
530 { 0x8A8E, 0xD806, WORD_LEN, 0},
531 { 0x8A90, 0xF0B1, WORD_LEN, 0},
532 { 0x8A92, 0xE88F, WORD_LEN, 0},
533 { 0x8A94, 0x8D66, WORD_LEN, 0},
534 { 0x8A96, 0x633B, WORD_LEN, 0},
535 { 0x8A98, 0x63BB, WORD_LEN, 0},
536 { 0x8A9A, 0xD08D, WORD_LEN, 0},
537 { 0x8A9C, 0x8000, WORD_LEN, 0},
538 { 0x8A9E, 0x8021, WORD_LEN, 0},
539 { 0x8AA0, 0x7960, WORD_LEN, 0},
540 { 0x8AA2, 0x8B17, WORD_LEN, 0},
541 { 0x8AA4, 0x8D06, WORD_LEN, 0},
542 { 0x8AA6, 0xE001, WORD_LEN, 0},
543 { 0x8AA8, 0xAD06, WORD_LEN, 0},
544 { 0x8AAA, 0xD803, WORD_LEN, 0},
545 { 0x8AAC, 0xF0A3, WORD_LEN, 0},
546 { 0x8AAE, 0x2032, WORD_LEN, 0},
547 { 0x8AB0, 0x2040, WORD_LEN, 0},
548 { 0x8AB2, 0xAD07, WORD_LEN, 0},
549 { 0x8AB4, 0xD804, WORD_LEN, 0},
550 { 0x8AB6, 0xF09F, WORD_LEN, 0},
551 { 0x8AB8, 0x1532, WORD_LEN, 0},
552 { 0x8ABA, 0x1080, WORD_LEN, 0},
553 { 0x8ABC, 0x1533, WORD_LEN, 0},
554 { 0x8ABE, 0x1081, WORD_LEN, 0},
555 { 0x8AC0, 0x1531, WORD_LEN, 0},
556 { 0x8AC2, 0x1082, WORD_LEN, 0},
557 { 0x8AC4, 0xB808, WORD_LEN, 0},
558 { 0x8AC6, 0x7825, WORD_LEN, 0},
559 { 0x8AC8, 0x1530, WORD_LEN, 0},
560 { 0x8ACA, 0x1081, WORD_LEN, 0},
561 { 0x8ACC, 0xB908, WORD_LEN, 0},
562 { 0x8ACE, 0x7945, WORD_LEN, 0},
563 { 0x8AD0, 0xD280, WORD_LEN, 0},
564 { 0x8AD2, 0x092E, WORD_LEN, 0},
565 { 0x8AD4, 0x0020, WORD_LEN, 0},
566 { 0x8AD6, 0x8A41, WORD_LEN, 0},
567 { 0x8AD8, 0x8D51, WORD_LEN, 0},
568 { 0x8ADA, 0x8D32, WORD_LEN, 0},
569 { 0x8ADC, 0x8DC6, WORD_LEN, 0},
570 { 0x8ADE, 0x7942, WORD_LEN, 0},
571 { 0x8AE0, 0x62DB, WORD_LEN, 0},
572 { 0x8AE2, 0x091F, WORD_LEN, 0},
573 { 0x8AE4, 0x03A2, WORD_LEN, 0},
574 { 0x8AE6, 0x63BB, WORD_LEN, 0},
575 { 0x8AE8, 0xE88B, WORD_LEN, 0},
576 { 0x8AEA, 0x8D00, WORD_LEN, 0},
577 { 0x8AEC, 0x8D21, WORD_LEN, 0},
578 { 0x8AEE, 0xB808, WORD_LEN, 0},
579 { 0x8AF0, 0x7825, WORD_LEN, 0},
580 { 0x8AF2, 0xB885, WORD_LEN, 0},
581 { 0x8AF4, 0x2841, WORD_LEN, 0},
582 { 0x8AF6, 0x0201, WORD_LEN, 0},
583 { 0x8AF8, 0xAD20, WORD_LEN, 0},
584 { 0x8AFA, 0xAD01, WORD_LEN, 0},
585 { 0x8AFC, 0xF1CF, WORD_LEN, 0},
586 { 0x8AFE, 0xDF04, WORD_LEN, 0},
587 { 0x8B00, 0x092B, WORD_LEN, 0},
588 { 0x8B02, 0x03A3, WORD_LEN, 0},
589 { 0x8B04, 0x1D4D, WORD_LEN, 0},
590 { 0x8B06, 0x13C2, WORD_LEN, 0},
591 { 0x8B08, 0x1530, WORD_LEN, 0},
592 { 0x8B0A, 0x108E, WORD_LEN, 0},
593 { 0x8B0C, 0x1531, WORD_LEN, 0},
594 { 0x8B0E, 0x1081, WORD_LEN, 0},
595 { 0x8B10, 0x1533, WORD_LEN, 0},
596 { 0x8B12, 0x108F, WORD_LEN, 0},
597 { 0x8B14, 0xBE08, WORD_LEN, 0},
598 { 0x8B16, 0x7E25, WORD_LEN, 0},
599 { 0x8B18, 0x1532, WORD_LEN, 0},
600 { 0x8B1A, 0x1081, WORD_LEN, 0},
601 { 0x8B1C, 0xB908, WORD_LEN, 0},
602 { 0x8B1E, 0x79E5, WORD_LEN, 0},
603 { 0x8B20, 0x0907, WORD_LEN, 0},
604 { 0x8B22, 0x0382, WORD_LEN, 0},
605 { 0x8B24, 0xE883, WORD_LEN, 0},
606 { 0x8B26, 0x8B16, WORD_LEN, 0},
607 { 0x8B28, 0xF002, WORD_LEN, 0},
608 { 0x8B2A, 0x8B15, WORD_LEN, 0},
609 { 0x8B2C, 0x8D22, WORD_LEN, 0},
610 { 0x8B2E, 0xAD07, WORD_LEN, 0},
611 { 0x8B30, 0x8D03, WORD_LEN, 0},
612 { 0x8B32, 0xD367, WORD_LEN, 0},
613 { 0x8B34, 0xB908, WORD_LEN, 0},
614 { 0x8B36, 0x8DC1, WORD_LEN, 0},
615 { 0x8B38, 0x7905, WORD_LEN, 0},
616 { 0x8B3A, 0x8D00, WORD_LEN, 0},
617 { 0x8B3C, 0xB808, WORD_LEN, 0},
618 { 0x8B3E, 0x78C5, WORD_LEN, 0},
619 { 0x8B40, 0x0921, WORD_LEN, 0},
620 { 0x8B42, 0x011E, WORD_LEN, 0},
621 { 0x8B44, 0xB883, WORD_LEN, 0},
622 { 0x8B46, 0x2841, WORD_LEN, 0},
623 { 0x8B48, 0x0201, WORD_LEN, 0},
624 { 0x8B4A, 0xAD20, WORD_LEN, 0},
625 { 0x8B4C, 0x8320, WORD_LEN, 0},
626 { 0x8B4E, 0xAD01, WORD_LEN, 0},
627 { 0x8B50, 0x8121, WORD_LEN, 0},
628 { 0x8B52, 0x7960, WORD_LEN, 0},
629 { 0x8B54, 0x2032, WORD_LEN, 0},
630 { 0x8B56, 0x2080, WORD_LEN, 0},
631 { 0x8B58, 0x8D06, WORD_LEN, 0},
632 { 0x8B5A, 0xE001, WORD_LEN, 0},
633 { 0x8B5C, 0xAD06, WORD_LEN, 0},
634 { 0x8B5E, 0xF04D, WORD_LEN, 0},
635 { 0x8B60, 0x8D00, WORD_LEN, 0},
636 { 0x8B62, 0x8D21, WORD_LEN, 0},
637 { 0x8B64, 0xB808, WORD_LEN, 0},
638 { 0x8B66, 0x7825, WORD_LEN, 0},
639 { 0x8B68, 0xB886, WORD_LEN, 0},
640 { 0x8B6A, 0x2841, WORD_LEN, 0},
641 { 0x8B6C, 0x0201, WORD_LEN, 0},
642 { 0x8B6E, 0xAD20, WORD_LEN, 0},
643 { 0x8B70, 0xAD01, WORD_LEN, 0},
644 { 0x8B72, 0xD057, WORD_LEN, 0},
645 { 0x8B74, 0x8000, WORD_LEN, 0},
646 { 0x8B76, 0x8021, WORD_LEN, 0},
647 { 0x8B78, 0x7960, WORD_LEN, 0},
648 { 0x8B7A, 0x8D07, WORD_LEN, 0},
649 { 0x8B7C, 0x1545, WORD_LEN, 0},
650 { 0x8B7E, 0x1080, WORD_LEN, 0},
651 { 0x8B80, 0x1546, WORD_LEN, 0},
652 { 0x8B82, 0x1081, WORD_LEN, 0},
653 { 0x8B84, 0xB808, WORD_LEN, 0},
654 { 0x8B86, 0x7825, WORD_LEN, 0},
655 { 0x8B88, 0x085D, WORD_LEN, 0},
656 { 0x8B8A, 0x005E, WORD_LEN, 0},
657 { 0x8B8C, 0x8D06, WORD_LEN, 0},
658 { 0x8B8E, 0xE001, WORD_LEN, 0},
659 { 0x8B90, 0xAD06, WORD_LEN, 0},
660 { 0x8B92, 0xD805, WORD_LEN, 0},
661 { 0x8B94, 0xF02F, WORD_LEN, 0},
662 { 0x8B96, 0x1530, WORD_LEN, 0},
663 { 0x8B98, 0x1082, WORD_LEN, 0},
664 { 0x8B9A, 0x1531, WORD_LEN, 0},
665 { 0x8B9C, 0x1080, WORD_LEN, 0},
666 { 0x8B9E, 0xD14D, WORD_LEN, 0},
667 { 0x8BA0, 0xBA08, WORD_LEN, 0},
668 { 0x8BA2, 0x7A05, WORD_LEN, 0},
669 { 0x8BA4, 0x8903, WORD_LEN, 0},
670 { 0x8BA6, 0x080F, WORD_LEN, 0},
671 { 0x8BA8, 0x0083, WORD_LEN, 0},
672 { 0x8BAA, 0x8902, WORD_LEN, 0},
673 { 0x8BAC, 0x8E44, WORD_LEN, 0},
674 { 0x8BAE, 0x0839, WORD_LEN, 0},
675 { 0x8BB0, 0x0082, WORD_LEN, 0},
676 { 0x8BB2, 0x1545, WORD_LEN, 0},
677 { 0x8BB4, 0x1082, WORD_LEN, 0},
678 { 0x8BB6, 0x1546, WORD_LEN, 0},
679 { 0x8BB8, 0x1080, WORD_LEN, 0},
680 { 0x8BBA, 0xBA08, WORD_LEN, 0},
681 { 0x8BBC, 0x7A05, WORD_LEN, 0},
682 { 0x8BBE, 0x0A29, WORD_LEN, 0},
683 { 0x8BC0, 0x005E, WORD_LEN, 0},
684 { 0x8BC2, 0x8D00, WORD_LEN, 0},
685 { 0x8BC4, 0x8D21, WORD_LEN, 0},
686 { 0x8BC6, 0xB808, WORD_LEN, 0},
687 { 0x8BC8, 0x7825, WORD_LEN, 0},
688 { 0x8BCA, 0xB88D, WORD_LEN, 0},
689 { 0x8BCC, 0x2841, WORD_LEN, 0},
690 { 0x8BCE, 0x0201, WORD_LEN, 0},
691 { 0x8BD0, 0xAD20, WORD_LEN, 0},
692 { 0x8BD2, 0xAD01, WORD_LEN, 0},
693 { 0x8BD4, 0x0A11, WORD_LEN, 0},
694 { 0x8BD6, 0x009E, WORD_LEN, 0},
695 { 0x8BD8, 0xD03D, WORD_LEN, 0},
696 { 0x8BDA, 0x8000, WORD_LEN, 0},
697 { 0x8BDC, 0x8021, WORD_LEN, 0},
698 { 0x8BDE, 0x7960, WORD_LEN, 0},
699 { 0x8BE0, 0x1550, WORD_LEN, 0},
700 { 0x8BE2, 0x1080, WORD_LEN, 0},
701 { 0x8BE4, 0xD800, WORD_LEN, 0},
702 { 0x8BE6, 0x09AA, WORD_LEN, 0},
703 { 0x8BE8, 0x0164, WORD_LEN, 0},
704 { 0x8BEA, 0x1D4D, WORD_LEN, 0},
705 { 0x8BEC, 0x1002, WORD_LEN, 0},
706 { 0x8BEE, 0xF005, WORD_LEN, 0},
707 { 0x8BF0, 0xD800, WORD_LEN, 0},
708 { 0x8BF2, 0x1D4D, WORD_LEN, 0},
709 { 0x8BF4, 0x1002, WORD_LEN, 0},
710 { 0x8BF6, 0x06B1, WORD_LEN, 0},
711 { 0x8BF8, 0x0684, WORD_LEN, 0},
712 { 0x8BFA, 0x78E0, WORD_LEN, 0},
713 { 0x8BFC, 0xC0F1, WORD_LEN, 0},
714 { 0x8BFE, 0x0E4E, WORD_LEN, 0},
715 { 0x8C00, 0x06A4, WORD_LEN, 0},
716 { 0x8C02, 0x7308, WORD_LEN, 0},
717 { 0x8C04, 0x0919, WORD_LEN, 0},
718 { 0x8C06, 0x0023, WORD_LEN, 0},
719 { 0x8C08, 0x721A, WORD_LEN, 0},
720 { 0x8C0A, 0xD026, WORD_LEN, 0},
721 { 0x8C0C, 0x1030, WORD_LEN, 0},
722 { 0x8C0E, 0x0082, WORD_LEN, 0},
723 { 0x8C10, 0x1031, WORD_LEN, 0},
724 { 0x8C12, 0x0081, WORD_LEN, 0},
725 { 0x8C14, 0xBA08, WORD_LEN, 0},
726 { 0x8C16, 0x7A25, WORD_LEN, 0},
727 { 0x8C18, 0xDD00, WORD_LEN, 0},
728 { 0x8C1A, 0xF005, WORD_LEN, 0},
729 { 0x8C1C, 0xDD01, WORD_LEN, 0},
730 { 0x8C1E, 0x7268, WORD_LEN, 0},
731 { 0x8C20, 0x7328, WORD_LEN, 0},
732 { 0x8C22, 0x2302, WORD_LEN, 0},
733 { 0x8C24, 0x0080, WORD_LEN, 0},
734 { 0x8C26, 0x2885, WORD_LEN, 0},
735 { 0x8C28, 0x0901, WORD_LEN, 0},
736 { 0x8C2A, 0x702F, WORD_LEN, 0},
737 { 0x8C2C, 0x0EFA, WORD_LEN, 0},
738 { 0x8C2E, 0x06A4, WORD_LEN, 0},
739 { 0x8C30, 0x7168, WORD_LEN, 0},
740 { 0x8C32, 0xD31C, WORD_LEN, 0},
741 { 0x8C34, 0x8BC6, WORD_LEN, 0},
742 { 0x8C36, 0x8B31, WORD_LEN, 0},
743 { 0x8C38, 0x780F, WORD_LEN, 0},
744 { 0x8C3A, 0xD226, WORD_LEN, 0},
745 { 0x8C3C, 0x663E, WORD_LEN, 0},
746 { 0x8C3E, 0xD123, WORD_LEN, 0},
747 { 0x8C40, 0xBE62, WORD_LEN, 0},
748 { 0x8C42, 0x7ECF, WORD_LEN, 0},
749 { 0x8C44, 0x89E4, WORD_LEN, 0},
750 { 0x8C46, 0x2214, WORD_LEN, 0},
751 { 0x8C48, 0x0381, WORD_LEN, 0},
752 { 0x8C4A, 0xED07, WORD_LEN, 0},
753 { 0x8C4C, 0x2840, WORD_LEN, 0},
754 { 0x8C4E, 0x020E, WORD_LEN, 0},
755 { 0x8C50, 0x7EE5, WORD_LEN, 0},
756 { 0x8C52, 0xB1CC, WORD_LEN, 0},
757 { 0x8C54, 0xF007, WORD_LEN, 0},
758 { 0x8C56, 0x7E12, WORD_LEN, 0},
759 { 0x8C58, 0xE601, WORD_LEN, 0},
760 { 0x8C5A, 0x7ECF, WORD_LEN, 0},
761 { 0x8C5C, 0xBE08, WORD_LEN, 0},
762 { 0x8C5E, 0x7FC5, WORD_LEN, 0},
763 { 0x8C60, 0xB1EC, WORD_LEN, 0},
764 { 0x8C62, 0x080D, WORD_LEN, 0},
765 { 0x8C64, 0x2003, WORD_LEN, 0},
766 { 0x8C66, 0xED0D, WORD_LEN, 0},
767 { 0x8C68, 0xD800, WORD_LEN, 0},
768 { 0x8C6A, 0xF01A, WORD_LEN, 0},
769 { 0x8C6C, 0x134D, WORD_LEN, 0},
770 { 0x8C6E, 0x0080, WORD_LEN, 0},
771 { 0x8C70, 0x080B, WORD_LEN, 0},
772 { 0x8C72, 0x0190, WORD_LEN, 0},
773 { 0x8C74, 0x8A0E, WORD_LEN, 0},
774 { 0x8C76, 0x080B, WORD_LEN, 0},
775 { 0x8C78, 0x0291, WORD_LEN, 0},
776 { 0x8C7A, 0xD801, WORD_LEN, 0},
777 { 0x8C7C, 0xF010, WORD_LEN, 0},
778 { 0x8C7E, 0x1330, WORD_LEN, 0},
779 { 0x8C80, 0x0081, WORD_LEN, 0},
780 { 0x8C82, 0x1331, WORD_LEN, 0},
781 { 0x8C84, 0x008D, WORD_LEN, 0},
782 { 0x8C86, 0xD802, WORD_LEN, 0},
783 { 0x8C88, 0xB908, WORD_LEN, 0},
784 { 0x8C8A, 0x79A5, WORD_LEN, 0},
785 { 0x8C8C, 0xB22A, WORD_LEN, 0},
786 { 0x8C8E, 0x1332, WORD_LEN, 0},
787 { 0x8C90, 0x0081, WORD_LEN, 0},
788 { 0x8C92, 0x1333, WORD_LEN, 0},
789 { 0x8C94, 0x008D, WORD_LEN, 0},
790 { 0x8C96, 0xB908, WORD_LEN, 0},
791 { 0x8C98, 0x79A5, WORD_LEN, 0},
792 { 0x8C9A, 0xB22B, WORD_LEN, 0},
793 { 0x8C9C, 0x0611, WORD_LEN, 0},
794 { 0x8C9E, 0x0684, WORD_LEN, 0},
795 { 0x8CA0, 0xFF80, WORD_LEN, 0},
796 { 0x8CA2, 0x0290, WORD_LEN, 0},
797 { 0x8CA4, 0x8000, WORD_LEN, 0},
798 { 0x8CA6, 0x008C, WORD_LEN, 0},
799 { 0x8CA8, 0x0000, WORD_LEN, 0},
800 { 0x8CAA, 0xF3BC, WORD_LEN, 0},
801 { 0x8CAC, 0xFF80, WORD_LEN, 0},
802 { 0x8CAE, 0x1120, WORD_LEN, 0},
803 { 0x8CB0, 0xFF80, WORD_LEN, 0},
804 { 0x8CB2, 0x08EC, WORD_LEN, 0},
805 { 0x8CB4, 0xFF80, WORD_LEN, 0},
806 { 0x8CB6, 0x0954, WORD_LEN, 0},
807 { 0x8CB8, 0xFF80, WORD_LEN, 0},
808 { 0x8CBA, 0x0970, WORD_LEN, 0},
809 { 0x8CBC, 0xFF80, WORD_LEN, 0},
810 { 0x8CBE, 0x0CD4, WORD_LEN, 0},
811 { 0x8CC0, 0xFF80, WORD_LEN, 0},
812 { 0x8CC2, 0x06C8, WORD_LEN, 0},
813 { 0x8CC4, 0xFF80, WORD_LEN, 0},
814 { 0x8CC6, 0x050C, WORD_LEN, 0},
815 { 0x8CC8, 0xFF80, WORD_LEN, 0},
816 { 0x8CCA, 0x0158, WORD_LEN, 0},
817 { 0x8CCC, 0x8000, WORD_LEN, 0},
818 { 0x8CCE, 0x0008, WORD_LEN, 0},
819 { 0x8CD0, 0xFF80, WORD_LEN, 0},
820 { 0x8CD2, 0x10C8, WORD_LEN, 0},
821 { 0x8CD4, 0xC0F1, WORD_LEN, 0},
822 { 0x8CD6, 0x0D7E, WORD_LEN, 0},
823 { 0x8CD8, 0x0684, WORD_LEN, 0},
824 { 0x8CDA, 0x17C8, WORD_LEN, 0},
825 { 0x8CDC, 0xF00D, WORD_LEN, 0},
826 { 0x8CDE, 0x1545, WORD_LEN, 0},
827 { 0x8CE0, 0x1080, WORD_LEN, 0},
828 { 0x8CE2, 0x1546, WORD_LEN, 0},
829 { 0x8CE4, 0x1081, WORD_LEN, 0},
830 { 0x8CE6, 0xB808, WORD_LEN, 0},
831 { 0x8CE8, 0x7825, WORD_LEN, 0},
832 { 0x8CEA, 0xB8E0, WORD_LEN, 0},
833 { 0x8CEC, 0xDE00, WORD_LEN, 0},
834 { 0x8CEE, 0xF208, WORD_LEN, 0},
835 { 0x8CF0, 0x8D00, WORD_LEN, 0},
836 { 0x8CF2, 0x8D21, WORD_LEN, 0},
837 { 0x8CF4, 0xB808, WORD_LEN, 0},
838 { 0x8CF6, 0x7825, WORD_LEN, 0},
839 { 0x8CF8, 0x2044, WORD_LEN, 0},
840 { 0x8CFA, 0x020E, WORD_LEN, 0},
841 { 0x8CFC, 0x8D00, WORD_LEN, 0},
842 { 0x8CFE, 0x8D21, WORD_LEN, 0},
843 { 0x8D00, 0xB808, WORD_LEN, 0},
844 { 0x8D02, 0x7825, WORD_LEN, 0},
845 { 0x8D04, 0x082F, WORD_LEN, 0},
846 { 0x8D06, 0x00DE, WORD_LEN, 0},
847 { 0x8D08, 0x7108, WORD_LEN, 0},
848 { 0x8D0A, 0x2186, WORD_LEN, 0},
849 { 0x8D0C, 0x0FFE, WORD_LEN, 0},
850 { 0x8D0E, 0x262F, WORD_LEN, 0},
851 { 0x8D10, 0xF04A, WORD_LEN, 0},
852 { 0x8D12, 0xF211, WORD_LEN, 0},
853 { 0x8D14, 0x17BC, WORD_LEN, 0},
854 { 0x8D16, 0xF002, WORD_LEN, 0},
855 { 0x8D18, 0x8A25, WORD_LEN, 0},
856 { 0x8D1A, 0xE906, WORD_LEN, 0},
857 { 0x8D1C, 0xB961, WORD_LEN, 0},
858 { 0x8D1E, 0xAA25, WORD_LEN, 0},
859 { 0x8D20, 0xD806, WORD_LEN, 0},
860 { 0x8D22, 0xF01E, WORD_LEN, 0},
861 { 0x8D24, 0x8A24, WORD_LEN, 0},
862 { 0x8D26, 0xB8A3, WORD_LEN, 0},
863 { 0x8D28, 0xAA25, WORD_LEN, 0},
864 { 0x8D2A, 0x2841, WORD_LEN, 0},
865 { 0x8D2C, 0x0201, WORD_LEN, 0},
866 { 0x8D2E, 0xAD20, WORD_LEN, 0},
867 { 0x8D30, 0xAD01, WORD_LEN, 0},
868 { 0x8D32, 0x0D56, WORD_LEN, 0},
869 { 0x8D34, 0x0144, WORD_LEN, 0},
870 { 0x8D36, 0x1545, WORD_LEN, 0},
871 { 0x8D38, 0x1081, WORD_LEN, 0},
872 { 0x8D3A, 0x1546, WORD_LEN, 0},
873 { 0x8D3C, 0x1082, WORD_LEN, 0},
874 { 0x8D3E, 0xB908, WORD_LEN, 0},
875 { 0x8D40, 0x7945, WORD_LEN, 0},
876 { 0x8D42, 0xB9E0, WORD_LEN, 0},
877 { 0x8D44, 0x26CC, WORD_LEN, 0},
878 { 0x8D46, 0x9022, WORD_LEN, 0},
879 { 0x8D48, 0xF20A, WORD_LEN, 0},
880 { 0x8D4A, 0x8D20, WORD_LEN, 0},
881 { 0x8D4C, 0x8D41, WORD_LEN, 0},
882 { 0x8D4E, 0xB908, WORD_LEN, 0},
883 { 0x8D50, 0x7945, WORD_LEN, 0},
884 { 0x8D52, 0xB983, WORD_LEN, 0},
885 { 0x8D54, 0x2941, WORD_LEN, 0},
886 { 0x8D56, 0x0202, WORD_LEN, 0},
887 { 0x8D58, 0xAD40, WORD_LEN, 0},
888 { 0x8D5A, 0xAD21, WORD_LEN, 0},
889 { 0x8D5C, 0x0561, WORD_LEN, 0},
890 { 0x8D5E, 0x0684, WORD_LEN, 0},
891 { 0x8D60, 0xC0F1, WORD_LEN, 0},
892 { 0x8D62, 0x0CEE, WORD_LEN, 0},
893 { 0x8D64, 0x06A4, WORD_LEN, 0},
894 { 0x8D66, 0x7098, WORD_LEN, 0},
895 { 0x8D68, 0xD284, WORD_LEN, 0},
896 { 0x8D6A, 0x1206, WORD_LEN, 0},
897 { 0x8D6C, 0x0086, WORD_LEN, 0},
898 { 0x8D6E, 0x2240, WORD_LEN, 0},
899 { 0x8D70, 0x0205, WORD_LEN, 0},
900 { 0x8D72, 0x264C, WORD_LEN, 0},
901 { 0x8D74, 0x8000, WORD_LEN, 0},
902 { 0x8D76, 0x20CA, WORD_LEN, 0},
903 { 0x8D78, 0x0101, WORD_LEN, 0},
904 { 0x8D7A, 0xF237, WORD_LEN, 0},
905 { 0x8D7C, 0x8AA7, WORD_LEN, 0},
906 { 0x8D7E, 0x6D69, WORD_LEN, 0},
907 { 0x8D80, 0x7B6D, WORD_LEN, 0},
908 { 0x8D82, 0x0B3F, WORD_LEN, 0},
909 { 0x8D84, 0x0012, WORD_LEN, 0},
910 { 0x8D86, 0x7068, WORD_LEN, 0},
911 { 0x8D88, 0x780D, WORD_LEN, 0},
912 { 0x8D8A, 0x2040, WORD_LEN, 0},
913 { 0x8D8C, 0x007C, WORD_LEN, 0},
914 { 0x8D8E, 0x20A8, WORD_LEN, 0},
915 { 0x8D90, 0x0640, WORD_LEN, 0},
916 { 0x8D92, 0x71CF, WORD_LEN, 0},
917 { 0x8D94, 0xFF80, WORD_LEN, 0},
918 { 0x8D96, 0x0158, WORD_LEN, 0},
919 { 0x8D98, 0x8924, WORD_LEN, 0},
920 { 0x8D9A, 0x2532, WORD_LEN, 0},
921 { 0x8D9C, 0x00C0, WORD_LEN, 0},
922 { 0x8D9E, 0xBD61, WORD_LEN, 0},
923 { 0x8DA0, 0x0819, WORD_LEN, 0},
924 { 0x8DA2, 0x0063, WORD_LEN, 0},
925 { 0x8DA4, 0x7DAF, WORD_LEN, 0},
926 { 0x8DA6, 0x76CF, WORD_LEN, 0},
927 { 0x8DA8, 0xFF80, WORD_LEN, 0},
928 { 0x8DAA, 0x0290, WORD_LEN, 0},
929 { 0x8DAC, 0x8EF1, WORD_LEN, 0},
930 { 0x8DAE, 0x2640, WORD_LEN, 0},
931 { 0x8DB0, 0x1601, WORD_LEN, 0},
932 { 0x8DB2, 0x61E9, WORD_LEN, 0},
933 { 0x8DB4, 0x090F, WORD_LEN, 0},
934 { 0x8DB6, 0x0002, WORD_LEN, 0},
935 { 0x8DB8, 0xAAA7, WORD_LEN, 0},
936 { 0x8DBA, 0xBB61, WORD_LEN, 0},
937 { 0x8DBC, 0x7B6D, WORD_LEN, 0},
938 { 0x8DBE, 0x7088, WORD_LEN, 0},
939 { 0x8DC0, 0xF005, WORD_LEN, 0},
940 { 0x8DC2, 0x8E26, WORD_LEN, 0},
941 { 0x8DC4, 0xAAA7, WORD_LEN, 0},
942 { 0x8DC6, 0xB961, WORD_LEN, 0},
943 { 0x8DC8, 0xAE26, WORD_LEN, 0},
944 { 0x8DCA, 0x0B1F, WORD_LEN, 0},
945 { 0x8DCC, 0x0013, WORD_LEN, 0},
946 { 0x8DCE, 0x1A07, WORD_LEN, 0},
947 { 0x8DD0, 0x0182, WORD_LEN, 0},
948 { 0x8DD2, 0xD26B, WORD_LEN, 0},
949 { 0x8DD4, 0x8A20, WORD_LEN, 0},
950 { 0x8DD6, 0x8A61, WORD_LEN, 0},
951 { 0x8DD8, 0xB908, WORD_LEN, 0},
952 { 0x8DDA, 0x7965, WORD_LEN, 0},
953 { 0x8DDC, 0xB9A3, WORD_LEN, 0},
954 { 0x8DDE, 0x2941, WORD_LEN, 0},
955 { 0x8DE0, 0x020C, WORD_LEN, 0},
956 { 0x8DE2, 0xAA80, WORD_LEN, 0},
957 { 0x8DE4, 0xAA21, WORD_LEN, 0},
958 { 0x8DE6, 0x04D1, WORD_LEN, 0},
959 { 0x8DE8, 0x0684, WORD_LEN, 0},
960 { 0x8DEA, 0x78E0, WORD_LEN, 0},
961 { 0x8DEC, 0xC0F1, WORD_LEN, 0},
962 { 0x8DEE, 0xC5E1, WORD_LEN, 0},
963 { 0x8DF0, 0xD363, WORD_LEN, 0},
964 { 0x8DF2, 0x8B24, WORD_LEN, 0},
965 { 0x8DF4, 0x8B45, WORD_LEN, 0},
966 { 0x8DF6, 0xB908, WORD_LEN, 0},
967 { 0x8DF8, 0x7945, WORD_LEN, 0},
968 { 0x8DFA, 0xE188, WORD_LEN, 0},
969 { 0x8DFC, 0x21CC, WORD_LEN, 0},
970 { 0x8DFE, 0x8422, WORD_LEN, 0},
971 { 0x8E00, 0xF41F, WORD_LEN, 0},
972 { 0x8E02, 0x8B26, WORD_LEN, 0},
973 { 0x8E04, 0x093B, WORD_LEN, 0},
974 { 0x8E06, 0x0051, WORD_LEN, 0},
975 { 0x8E08, 0xD15C, WORD_LEN, 0},
976 { 0x8E0A, 0xD80A, WORD_LEN, 0},
977 { 0x8E0C, 0xA90E, WORD_LEN, 0},
978 { 0x8E0E, 0xD05D, WORD_LEN, 0},
979 { 0x8E10, 0x8804, WORD_LEN, 0},
980 { 0x8E12, 0x1330, WORD_LEN, 0},
981 { 0x8E14, 0x0082, WORD_LEN, 0},
982 { 0x8E16, 0x1331, WORD_LEN, 0},
983 { 0x8E18, 0x008D, WORD_LEN, 0},
984 { 0x8E1A, 0xBA08, WORD_LEN, 0},
985 { 0x8E1C, 0x7AA5, WORD_LEN, 0},
986 { 0x8E1E, 0xB148, WORD_LEN, 0},
987 { 0x8E20, 0x8952, WORD_LEN, 0},
988 { 0x8E22, 0xA90F, WORD_LEN, 0},
989 { 0x8E24, 0x0813, WORD_LEN, 0},
990 { 0x8E26, 0x00A2, WORD_LEN, 0},
991 { 0x8E28, 0x132C, WORD_LEN, 0},
992 { 0x8E2A, 0x0083, WORD_LEN, 0},
993 { 0x8E2C, 0xDA00, WORD_LEN, 0},
994 { 0x8E2E, 0xA953, WORD_LEN, 0},
995 { 0x8E30, 0x7862, WORD_LEN, 0},
996 { 0x8E32, 0x780F, WORD_LEN, 0},
997 { 0x8E34, 0xF005, WORD_LEN, 0},
998 { 0x8E36, 0xDA01, WORD_LEN, 0},
999 { 0x8E38, 0xA953, WORD_LEN, 0},
1000 { 0x8E3A, 0x6078, WORD_LEN, 0},
1001 { 0x8E3C, 0x780F, WORD_LEN, 0},
1002 { 0x8E3E, 0x080E, WORD_LEN, 0},
1003 { 0x8E40, 0x0000, WORD_LEN, 0},
1004 { 0x8E42, 0x0485, WORD_LEN, 0},
1005 { 0x8E44, 0x0684, WORD_LEN, 0},
1006 { 0x8E46, 0x78E0, WORD_LEN, 0},
1007 { 0x8E48, 0xC0F1, WORD_LEN, 0},
1008 { 0x8E4A, 0x0BFE, WORD_LEN, 0},
1009 { 0x8E4C, 0x0684, WORD_LEN, 0},
1010 { 0x8E4E, 0xD64D, WORD_LEN, 0},
1011 { 0x8E50, 0x7508, WORD_LEN, 0},
1012 { 0x8E52, 0x8E01, WORD_LEN, 0},
1013 { 0x8E54, 0xD14A, WORD_LEN, 0},
1014 { 0x8E56, 0x2046, WORD_LEN, 0},
1015 { 0x8E58, 0x00C0, WORD_LEN, 0},
1016 { 0x8E5A, 0xAE01, WORD_LEN, 0},
1017 { 0x8E5C, 0x1145, WORD_LEN, 0},
1018 { 0x8E5E, 0x0080, WORD_LEN, 0},
1019 { 0x8E60, 0x1146, WORD_LEN, 0},
1020 { 0x8E62, 0x0082, WORD_LEN, 0},
1021 { 0x8E64, 0xB808, WORD_LEN, 0},
1022 { 0x8E66, 0x7845, WORD_LEN, 0},
1023 { 0x8E68, 0x0817, WORD_LEN, 0},
1024 { 0x8E6A, 0x001E, WORD_LEN, 0},
1025 { 0x8E6C, 0x8900, WORD_LEN, 0},
1026 { 0x8E6E, 0x8941, WORD_LEN, 0},
1027 { 0x8E70, 0xB808, WORD_LEN, 0},
1028 { 0x8E72, 0x7845, WORD_LEN, 0},
1029 { 0x8E74, 0x080B, WORD_LEN, 0},
1030 { 0x8E76, 0x00DE, WORD_LEN, 0},
1031 { 0x8E78, 0x70A9, WORD_LEN, 0},
1032 { 0x8E7A, 0xFFBA, WORD_LEN, 0},
1033 { 0x8E7C, 0x7508, WORD_LEN, 0},
1034 { 0x8E7E, 0x1604, WORD_LEN, 0},
1035 { 0x8E80, 0x1090, WORD_LEN, 0},
1036 { 0x8E82, 0x0D93, WORD_LEN, 0},
1037 { 0x8E84, 0x1400, WORD_LEN, 0},
1038 { 0x8E86, 0x8EEA, WORD_LEN, 0},
1039 { 0x8E88, 0x8E0B, WORD_LEN, 0},
1040 { 0x8E8A, 0x214A, WORD_LEN, 0},
1041 { 0x8E8C, 0x2040, WORD_LEN, 0},
1042 { 0x8E8E, 0x8E2D, WORD_LEN, 0},
1043 { 0x8E90, 0xBF08, WORD_LEN, 0},
1044 { 0x8E92, 0x7F05, WORD_LEN, 0},
1045 { 0x8E94, 0x8E0C, WORD_LEN, 0},
1046 { 0x8E96, 0xB808, WORD_LEN, 0},
1047 { 0x8E98, 0x7825, WORD_LEN, 0},
1048 { 0x8E9A, 0x7710, WORD_LEN, 0},
1049 { 0x8E9C, 0x21C2, WORD_LEN, 0},
1050 { 0x8E9E, 0x244C, WORD_LEN, 0},
1051 { 0x8EA0, 0x081D, WORD_LEN, 0},
1052 { 0x8EA2, 0x03E3, WORD_LEN, 0},
1053 { 0x8EA4, 0xD9FF, WORD_LEN, 0},
1054 { 0x8EA6, 0x2702, WORD_LEN, 0},
1055 { 0x8EA8, 0x1002, WORD_LEN, 0},
1056 { 0x8EAA, 0x2A05, WORD_LEN, 0},
1057 { 0x8EAC, 0x037E, WORD_LEN, 0},
1058 { 0x8EAE, 0x0C7A, WORD_LEN, 0},
1059 { 0x8EB0, 0x06A4, WORD_LEN, 0},
1060 { 0x8EB2, 0x702F, WORD_LEN, 0},
1061 { 0x8EB4, 0x7810, WORD_LEN, 0},
1062 { 0x8EB6, 0x7F02, WORD_LEN, 0},
1063 { 0x8EB8, 0x7FF0, WORD_LEN, 0},
1064 { 0x8EBA, 0xF00B, WORD_LEN, 0},
1065 { 0x8EBC, 0x78E2, WORD_LEN, 0},
1066 { 0x8EBE, 0x2805, WORD_LEN, 0},
1067 { 0x8EC0, 0x037E, WORD_LEN, 0},
1068 { 0x8EC2, 0x0C66, WORD_LEN, 0},
1069 { 0x8EC4, 0x06A4, WORD_LEN, 0},
1070 { 0x8EC6, 0x702F, WORD_LEN, 0},
1071 { 0x8EC8, 0x7810, WORD_LEN, 0},
1072 { 0x8ECA, 0x671F, WORD_LEN, 0},
1073 { 0x8ECC, 0x7FF0, WORD_LEN, 0},
1074 { 0x8ECE, 0x7FEF, WORD_LEN, 0},
1075 { 0x8ED0, 0x8E08, WORD_LEN, 0},
1076 { 0x8ED2, 0xBF06, WORD_LEN, 0},
1077 { 0x8ED4, 0xD12C, WORD_LEN, 0},
1078 { 0x8ED6, 0xB8C3, WORD_LEN, 0},
1079 { 0x8ED8, 0x78E5, WORD_LEN, 0},
1080 { 0x8EDA, 0xB88F, WORD_LEN, 0},
1081 { 0x8EDC, 0x1908, WORD_LEN, 0},
1082 { 0x8EDE, 0x0024, WORD_LEN, 0},
1083 { 0x8EE0, 0x2841, WORD_LEN, 0},
1084 { 0x8EE2, 0x0201, WORD_LEN, 0},
1085 { 0x8EE4, 0x1E26, WORD_LEN, 0},
1086 { 0x8EE6, 0x1042, WORD_LEN, 0},
1087 { 0x8EE8, 0x0D15, WORD_LEN, 0},
1088 { 0x8EEA, 0x1423, WORD_LEN, 0},
1089 { 0x8EEC, 0x1E27, WORD_LEN, 0},
1090 { 0x8EEE, 0x1002, WORD_LEN, 0},
1091 { 0x8EF0, 0x214C, WORD_LEN, 0},
1092 { 0x8EF2, 0xA000, WORD_LEN, 0},
1093 { 0x8EF4, 0x214A, WORD_LEN, 0},
1094 { 0x8EF6, 0x2040, WORD_LEN, 0},
1095 { 0x8EF8, 0x21C2, WORD_LEN, 0},
1096 { 0x8EFA, 0x2442, WORD_LEN, 0},
1097 { 0x8EFC, 0x8E21, WORD_LEN, 0},
1098 { 0x8EFE, 0x214F, WORD_LEN, 0},
1099 { 0x8F00, 0x0040, WORD_LEN, 0},
1100 { 0x8F02, 0x090F, WORD_LEN, 0},
1101 { 0x8F04, 0x2010, WORD_LEN, 0},
1102 { 0x8F06, 0x2145, WORD_LEN, 0},
1103 { 0x8F08, 0x0181, WORD_LEN, 0},
1104 { 0x8F0A, 0xAE21, WORD_LEN, 0},
1105 { 0x8F0C, 0xF003, WORD_LEN, 0},
1106 { 0x8F0E, 0xB8A2, WORD_LEN, 0},
1107 { 0x8F10, 0xAE01, WORD_LEN, 0},
1108 { 0x8F12, 0x0FFE, WORD_LEN, 0},
1109 { 0x8F14, 0xFFA3, WORD_LEN, 0},
1110 { 0x8F16, 0x70A9, WORD_LEN, 0},
1111 { 0x8F18, 0x038D, WORD_LEN, 0},
1112 { 0x8F1A, 0x0684, WORD_LEN, 0},
1113 { 0x8F1C, 0xC0F1, WORD_LEN, 0},
1114 { 0x8F1E, 0xC5E1, WORD_LEN, 0},
1115 { 0x8F20, 0xD518, WORD_LEN, 0},
1116 { 0x8F22, 0x8D00, WORD_LEN, 0},
1117 { 0x8F24, 0xB8E7, WORD_LEN, 0},
1118 { 0x8F26, 0x20D1, WORD_LEN, 0},
1119 { 0x8F28, 0x80E2, WORD_LEN, 0},
1120 { 0x8F2A, 0xF20D, WORD_LEN, 0},
1121 { 0x8F2C, 0xD117, WORD_LEN, 0},
1122 { 0x8F2E, 0xB8A7, WORD_LEN, 0},
1123 { 0x8F30, 0xAD00, WORD_LEN, 0},
1124 { 0x8F32, 0xD017, WORD_LEN, 0},
1125 { 0x8F34, 0x7228, WORD_LEN, 0},
1126 { 0x8F36, 0x8123, WORD_LEN, 0},
1127 { 0x8F38, 0xA040, WORD_LEN, 0},
1128 { 0x8F3A, 0x7960, WORD_LEN, 0},
1129 { 0x8F3C, 0xD801, WORD_LEN, 0},
1130 { 0x8F3E, 0xD800, WORD_LEN, 0},
1131 { 0x8F40, 0xAD05, WORD_LEN, 0},
1132 { 0x8F42, 0x0F56, WORD_LEN, 0},
1133 { 0x8F44, 0xFF83, WORD_LEN, 0},
1134 { 0x8F46, 0x0381, WORD_LEN, 0},
1135 { 0x8F48, 0x0684, WORD_LEN, 0},
1136 { 0x8F4A, 0x78E0, WORD_LEN, 0},
1137 { 0x8F4C, 0xD20D, WORD_LEN, 0},
1138 { 0x8F4E, 0x8A21, WORD_LEN, 0},
1139 { 0x8F50, 0xB9A1, WORD_LEN, 0},
1140 { 0x8F52, 0x782F, WORD_LEN, 0},
1141 { 0x8F54, 0x7FE0, WORD_LEN, 0},
1142 { 0x8F56, 0xAA21, WORD_LEN, 0},
1143 { 0x8F58, 0xD00E, WORD_LEN, 0},
1144 { 0x8F5A, 0xD10C, WORD_LEN, 0},
1145 { 0x8F5C, 0xA100, WORD_LEN, 0},
1146 { 0x8F5E, 0xD00E, WORD_LEN, 0},
1147 { 0x8F60, 0xA101, WORD_LEN, 0},
1148 { 0x8F62, 0xD00E, WORD_LEN, 0},
1149 { 0x8F64, 0xA102, WORD_LEN, 0},
1150 { 0x8F66, 0xD00E, WORD_LEN, 0},
1151 { 0x8F68, 0xA103, WORD_LEN, 0},
1152 { 0x8F6A, 0xD009, WORD_LEN, 0},
1153 { 0x8F6C, 0xA020, WORD_LEN, 0},
1154 { 0x8F6E, 0xD005, WORD_LEN, 0},
1155 { 0x8F70, 0xD988, WORD_LEN, 0},
1156 { 0x8F72, 0xA820, WORD_LEN, 0},
1157 { 0x8F74, 0xF1D4, WORD_LEN, 0},
1158 { 0x8F76, 0x78E0, WORD_LEN, 0},
1159 { 0x8F78, 0xFF80, WORD_LEN, 0},
1160 { 0x8F7A, 0x10C8, WORD_LEN, 0},
1161 { 0x8F7C, 0xFF80, WORD_LEN, 0},
1162 { 0x8F7E, 0x0290, WORD_LEN, 0},
1163 { 0x8F80, 0xFF80, WORD_LEN, 0},
1164 { 0x8F82, 0x0158, WORD_LEN, 0},
1165 { 0x8F84, 0xFF00, WORD_LEN, 0},
1166 { 0x8F86, 0x0618, WORD_LEN, 0},
1167 { 0x8F88, 0xFF80, WORD_LEN, 0},
1168 { 0x8F8A, 0x1158, WORD_LEN, 0},
1169 { 0x8F8C, 0x8000, WORD_LEN, 0},
1170 { 0x8F8E, 0x0008, WORD_LEN, 0},
1171 { 0x8F90, 0xFF80, WORD_LEN, 0},
1172 { 0x8F92, 0x0F1C, WORD_LEN, 0},
1173 { 0x8F94, 0xFF80, WORD_LEN, 0},
1174 { 0x8F96, 0x0DEC, WORD_LEN, 0},
1175 { 0x8F98, 0xFF80, WORD_LEN, 0},
1176 { 0x8F9A, 0x0F4C, WORD_LEN, 0},
1177 { 0x8F9C, 0x0000, WORD_LEN, 0},
1178 { 0x8F9E, 0x0998, WORD_LEN, 0},
1179 { 0x8FA0, 0xC0F1, WORD_LEN, 0},
1180 { 0x8FA2, 0xC5E1, WORD_LEN, 0},
1181 { 0x8FA4, 0xD02C, WORD_LEN, 0},
1182 { 0x8FA6, 0x0982, WORD_LEN, 0},
1183 { 0x8FA8, 0x0664, WORD_LEN, 0},
1184 { 0x8FAA, 0x88AE, WORD_LEN, 0},
1185 { 0x8FAC, 0x0D23, WORD_LEN, 0},
1186 { 0x8FAE, 0x1051, WORD_LEN, 0},
1187 { 0x8FB0, 0xD12A, WORD_LEN, 0},
1188 { 0x8FB2, 0x1145, WORD_LEN, 0},
1189 { 0x8FB4, 0x0080, WORD_LEN, 0},
1190 { 0x8FB6, 0x1146, WORD_LEN, 0},
1191 { 0x8FB8, 0x0082, WORD_LEN, 0},
1192 { 0x8FBA, 0xB808, WORD_LEN, 0},
1193 { 0x8FBC, 0x7845, WORD_LEN, 0},
1194 { 0x8FBE, 0x0813, WORD_LEN, 0},
1195 { 0x8FC0, 0x00DE, WORD_LEN, 0},
1196 { 0x8FC2, 0xD027, WORD_LEN, 0},
1197 { 0x8FC4, 0x8000, WORD_LEN, 0},
1198 { 0x8FC6, 0x8041, WORD_LEN, 0},
1199 { 0x8FC8, 0x7A60, WORD_LEN, 0},
1200 { 0x8FCA, 0x1150, WORD_LEN, 0},
1201 { 0x8FCC, 0x0080, WORD_LEN, 0},
1202 { 0x8FCE, 0x02F9, WORD_LEN, 0},
1203 { 0x8FD0, 0x0684, WORD_LEN, 0},
1204 { 0x8FD2, 0x78E0, WORD_LEN, 0},
1205 { 0x8FD4, 0xC0F1, WORD_LEN, 0},
1206 { 0x8FD6, 0x0A7E, WORD_LEN, 0},
1207 { 0x8FD8, 0x0684, WORD_LEN, 0},
1208 { 0x8FDA, 0xD622, WORD_LEN, 0},
1209 { 0x8FDC, 0x8EA9, WORD_LEN, 0},
1210 { 0x8FDE, 0x8E2A, WORD_LEN, 0},
1211 { 0x8FE0, 0xBD08, WORD_LEN, 0},
1212 { 0x8FE2, 0x7D25, WORD_LEN, 0},
1213 { 0x8FE4, 0x2550, WORD_LEN, 0},
1214 { 0x8FE6, 0x10C2, WORD_LEN, 0},
1215 { 0x8FE8, 0x2A41, WORD_LEN, 0},
1216 { 0x8FEA, 0x0201, WORD_LEN, 0},
1217 { 0x8FEC, 0xAE29, WORD_LEN, 0},
1218 { 0x8FEE, 0x0F9A, WORD_LEN, 0},
1219 { 0x8FF0, 0x05A4, WORD_LEN, 0},
1220 { 0x8FF2, 0xAE4A, WORD_LEN, 0},
1221 { 0x8FF4, 0x0D17, WORD_LEN, 0},
1222 { 0x8FF6, 0x10DE, WORD_LEN, 0},
1223 { 0x8FF8, 0x8E09, WORD_LEN, 0},
1224 { 0x8FFA, 0x8E2A, WORD_LEN, 0},
1225 { 0x8FFC, 0xB808, WORD_LEN, 0},
1226 { 0x8FFE, 0x7825, WORD_LEN, 0},
1227 { 0x9000, 0xB883, WORD_LEN, 0},
1228 { 0x9002, 0x2841, WORD_LEN, 0},
1229 { 0x9004, 0x0201, WORD_LEN, 0},
1230 { 0x9006, 0xAE29, WORD_LEN, 0},
1231 { 0x9008, 0xAE0A, WORD_LEN, 0},
1232 { 0x900A, 0x02B5, WORD_LEN, 0},
1233 { 0x900C, 0x0684, WORD_LEN, 0},
1234 { 0x900E, 0x78E0, WORD_LEN, 0},
1235 { 0x9010, 0xC0F1, WORD_LEN, 0},
1236 { 0x9012, 0x0A42, WORD_LEN, 0},
1237 { 0x9014, 0x06A4, WORD_LEN, 0},
1238 { 0x9016, 0xDA34, WORD_LEN, 0},
1239 { 0x9018, 0xD113, WORD_LEN, 0},
1240 { 0x901A, 0xD514, WORD_LEN, 0},
1241 { 0x901C, 0x76A9, WORD_LEN, 0},
1242 { 0x901E, 0x0FD6, WORD_LEN, 0},
1243 { 0x9020, 0x0664, WORD_LEN, 0},
1244 { 0x9022, 0x70C9, WORD_LEN, 0},
1245 { 0x9024, 0xD012, WORD_LEN, 0},
1246 { 0x9026, 0xA504, WORD_LEN, 0},
1247 { 0x9028, 0xD012, WORD_LEN, 0},
1248 { 0x902A, 0x0295, WORD_LEN, 0},
1249 { 0x902C, 0x06A4, WORD_LEN, 0},
1250 { 0x902E, 0xA0C0, WORD_LEN, 0},
1251 { 0x9030, 0xC0F1, WORD_LEN, 0},
1252 { 0x9032, 0xC5E1, WORD_LEN, 0},
1253 { 0x9034, 0xD50D, WORD_LEN, 0},
1254 { 0x9036, 0xD110, WORD_LEN, 0},
1255 { 0x9038, 0x2540, WORD_LEN, 0},
1256 { 0x903A, 0x1D00, WORD_LEN, 0},
1257 { 0x903C, 0x0FB6, WORD_LEN, 0},
1258 { 0x903E, 0x0664, WORD_LEN, 0},
1259 { 0x9040, 0xDA50, WORD_LEN, 0},
1260 { 0x9042, 0xD00E, WORD_LEN, 0},
1261 { 0x9044, 0x2540, WORD_LEN, 0},
1262 { 0x9046, 0x1D01, WORD_LEN, 0},
1263 { 0x9048, 0xA517, WORD_LEN, 0},
1264 { 0x904A, 0xD00D, WORD_LEN, 0},
1265 { 0x904C, 0x0279, WORD_LEN, 0},
1266 { 0x904E, 0x06A4, WORD_LEN, 0},
1267 { 0x9050, 0xA020, WORD_LEN, 0},
1268 { 0x9052, 0x78E0, WORD_LEN, 0},
1269 { 0x9054, 0xFF80, WORD_LEN, 0},
1270 { 0x9056, 0x07A8, WORD_LEN, 0},
1271 { 0x9058, 0xFF80, WORD_LEN, 0},
1272 { 0x905A, 0x0290, WORD_LEN, 0},
1273 { 0x905C, 0x8000, WORD_LEN, 0},
1274 { 0x905E, 0x0008, WORD_LEN, 0},
1275 { 0x9060, 0xFF80, WORD_LEN, 0},
1276 { 0x9062, 0x02CC, WORD_LEN, 0},
1277 { 0x9064, 0x0000, WORD_LEN, 0},
1278 { 0x9066, 0xFA88, WORD_LEN, 0},
1279 { 0x9068, 0xFF80, WORD_LEN, 0},
1280 { 0x906A, 0x1168, WORD_LEN, 0},
1281 { 0x906C, 0xFF80, WORD_LEN, 0},
1282 { 0x906E, 0x0FD4, WORD_LEN, 0},
1283 { 0x9070, 0x8000, WORD_LEN, 0},
1284 { 0x9072, 0x0194, WORD_LEN, 0},
1285 { 0x9074, 0x0000, WORD_LEN, 0},
1286 { 0x9076, 0xFB08, WORD_LEN, 0},
1287 { 0x9078, 0xFF80, WORD_LEN, 0},
1288 { 0x907A, 0x0FA0, WORD_LEN, 0},
1289 { 0x907C, 0x8000, WORD_LEN, 0},
1290 { 0x907E, 0x01A0, WORD_LEN, 0},
1291 { 0x9080, 0xE280, WORD_LEN, 0},
1292 { 0x9082, 0x24CA, WORD_LEN, 0},
1293 { 0x9084, 0x7082, WORD_LEN, 0},
1294 { 0x9086, 0x78E0, WORD_LEN, 0},
1295 { 0x9088, 0x20E8, WORD_LEN, 0},
1296 { 0x908A, 0x01A2, WORD_LEN, 0},
1297 { 0x908C, 0x1002, WORD_LEN, 0},
1298 { 0x908E, 0x0D02, WORD_LEN, 0},
1299 { 0x9090, 0x1902, WORD_LEN, 0},
1300 { 0x9092, 0x0094, WORD_LEN, 0},
1301 { 0x9094, 0x7FE0, WORD_LEN, 0},
1302 { 0x9096, 0x7028, WORD_LEN, 0},
1303 { 0x9098, 0x7308, WORD_LEN, 0},
1304 { 0x909A, 0x1000, WORD_LEN, 0},
1305 { 0x909C, 0x0900, WORD_LEN, 0},
1306 { 0x909E, 0x7904, WORD_LEN, 0},
1307 { 0x90A0, 0x7947, WORD_LEN, 0},
1308 { 0x90A2, 0x1B00, WORD_LEN, 0},
1309 { 0x90A4, 0x0064, WORD_LEN, 0},
1310 { 0x90A6, 0x7EE0, WORD_LEN, 0},
1311 { 0x90A8, 0xE280, WORD_LEN, 0},
1312 { 0x90AA, 0x24CA, WORD_LEN, 0},
1313 { 0x90AC, 0x7082, WORD_LEN, 0},
1314 { 0x90AE, 0x78E0, WORD_LEN, 0},
1315 { 0x90B0, 0x20E8, WORD_LEN, 0},
1316 { 0x90B2, 0x01A2, WORD_LEN, 0},
1317 { 0x90B4, 0x1102, WORD_LEN, 0},
1318 { 0x90B6, 0x0502, WORD_LEN, 0},
1319 { 0x90B8, 0x1802, WORD_LEN, 0},
1320 { 0x90BA, 0x00B4, WORD_LEN, 0},
1321 { 0x90BC, 0x7FE0, WORD_LEN, 0},
1322 { 0x90BE, 0x7028, WORD_LEN, 0},
1323 { 0x90C0, 0x0000, WORD_LEN, 0},
1324 { 0x90C2, 0x0000, WORD_LEN, 0},
1325 { 0x90C4, 0x0000, WORD_LEN, 0},
1326 { 0x90C6, 0x0000, WORD_LEN, 0},
1327 { 0x098E, 0x0000, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS
1328 { 0x8016, 0x086C, WORD_LEN, 0}, // MON_ADDRESS_LO
1329 { 0x8018, 0xFF80, WORD_LEN, 0}, // MON_ADDRESS_HI
1330 { 0x8002, 0x0001, WORD_LEN, 0}, // MON_CMD
1332 { SEQUENCE_WAIT_MS,100, BYTE_LEN, 0},
1334 //[Lens Correction 90% 02/04/13 18:03:18]
1335 //BITFIELD= 0x3210, 0x0008, 0 //PGA_ENABLE
1336 { 0x3210, 0x0008, WORD_LEN, 0},
1337 { 0x3210, 0x49B0, WORD_LEN, 0}, // COLOR_PIPELINE_CONTROL
1338 { 0x3640, 0x0170, WORD_LEN, 0}, // P_G1_P0Q0
1339 { 0x3642, 0x0BCC, WORD_LEN, 0}, // P_G1_P0Q1
1340 { 0x3644, 0x7210, WORD_LEN, 0}, // P_G1_P0Q2
1341 { 0x3646, 0x4C8D, WORD_LEN, 0}, // P_G1_P0Q3
1342 { 0x3648, 0xF58D, WORD_LEN, 0}, // P_G1_P0Q4
1343 { 0x364A, 0x0610, WORD_LEN, 0}, // P_R_P0Q0
1344 { 0x364C, 0x8D6E, WORD_LEN, 0}, // P_R_P0Q1
1345 { 0x364E, 0x6E90, WORD_LEN, 0}, // P_R_P0Q2
1346 { 0x3650, 0x088F, WORD_LEN, 0}, // P_R_P0Q3
1347 { 0x3652, 0xA890, WORD_LEN, 0}, // P_R_P0Q4
1348 { 0x3654, 0x0550, WORD_LEN, 0}, // P_B_P0Q0
1349 { 0x3656, 0x764C, WORD_LEN, 0}, // P_B_P0Q1
1350 { 0x3658, 0x0FB0, WORD_LEN, 0}, // P_B_P0Q2
1351 { 0x365A, 0x9A0D, WORD_LEN, 0}, // P_B_P0Q3
1352 { 0x365C, 0xF4AD, WORD_LEN, 0}, // P_B_P0Q4
1353 { 0x365E, 0x02F0, WORD_LEN, 0}, // P_G2_P0Q0
1354 { 0x3660, 0x9A0E, WORD_LEN, 0}, // P_G2_P0Q1
1355 { 0x3662, 0x77B0, WORD_LEN, 0}, // P_G2_P0Q2
1356 { 0x3664, 0x416D, WORD_LEN, 0}, // P_G2_P0Q3
1357 { 0x3666, 0xF24D, WORD_LEN, 0}, // P_G2_P0Q4
1358 { 0x3680, 0x018A, WORD_LEN, 0}, // P_G1_P1Q0
1359 { 0x3682, 0xD0AD, WORD_LEN, 0}, // P_G1_P1Q1
1360 { 0x3684, 0xC62E, WORD_LEN, 0}, // P_G1_P1Q2
1361 { 0x3686, 0x736D, WORD_LEN, 0}, // P_G1_P1Q3
1362 { 0x3688, 0x0130, WORD_LEN, 0}, // P_G1_P1Q4
1363 { 0x368A, 0x52ED, WORD_LEN, 0}, // P_R_P1Q0
1364 { 0x368C, 0x682D, WORD_LEN, 0}, // P_R_P1Q1
1365 { 0x368E, 0xF02B, WORD_LEN, 0}, // P_R_P1Q2
1366 { 0x3690, 0xB68E, WORD_LEN, 0}, // P_R_P1Q3
1367 { 0x3692, 0xF4AD, WORD_LEN, 0}, // P_R_P1Q4
1368 { 0x3694, 0xC68D, WORD_LEN, 0}, // P_B_P1Q0
1369 { 0x3696, 0x440D, WORD_LEN, 0}, // P_B_P1Q1
1370 { 0x3698, 0x416E, WORD_LEN, 0}, // P_B_P1Q2
1371 { 0x369A, 0xC0CE, WORD_LEN, 0}, // P_B_P1Q3
1372 { 0x369C, 0xB46D, WORD_LEN, 0}, // P_B_P1Q4
1373 { 0x369E, 0xD90A, WORD_LEN, 0}, // P_G2_P1Q0
1374 { 0x36A0, 0xD76D, WORD_LEN, 0}, // P_G2_P1Q1
1375 { 0x36A2, 0xFE0D, WORD_LEN, 0}, // P_G2_P1Q2
1376 { 0x36A4, 0x0E0D, WORD_LEN, 0}, // P_G2_P1Q3
1377 { 0x36A6, 0x0890, WORD_LEN, 0}, // P_G2_P1Q4
1378 { 0x36C0, 0x70D0, WORD_LEN, 0}, // P_G1_P2Q0
1379 { 0x36C2, 0x10CF, WORD_LEN, 0}, // P_G1_P2Q1
1380 { 0x36C4, 0x4592, WORD_LEN, 0}, // P_G1_P2Q2
1381 { 0x36C6, 0xB74D, WORD_LEN, 0}, // P_G1_P2Q3
1382 { 0x36C8, 0xEEB3, WORD_LEN, 0}, // P_G1_P2Q4
1383 { 0x36CA, 0x1991, WORD_LEN, 0}, // P_R_P2Q0
1384 { 0x36CC, 0x9B8E, WORD_LEN, 0}, // P_R_P2Q1
1385 { 0x36CE, 0x5DCD, WORD_LEN, 0}, // P_R_P2Q2
1386 { 0x36D0, 0x1C8D, WORD_LEN, 0}, // P_R_P2Q3
1387 { 0x36D2, 0x8C71, WORD_LEN, 0}, // P_R_P2Q4
1388 { 0x36D4, 0x00F1, WORD_LEN, 0}, // P_B_P2Q0
1389 { 0x36D6, 0x480F, WORD_LEN, 0}, // P_B_P2Q1
1390 { 0x36D8, 0x26AF, WORD_LEN, 0}, // P_B_P2Q2
1391 { 0x36DA, 0xC2EF, WORD_LEN, 0}, // P_B_P2Q3
1392 { 0x36DC, 0xFC8F, WORD_LEN, 0}, // P_B_P2Q4
1393 { 0x36DE, 0x0071, WORD_LEN, 0}, // P_G2_P2Q0
1394 { 0x36E0, 0x8230, WORD_LEN, 0}, // P_G2_P2Q1
1395 { 0x36E2, 0x60B2, WORD_LEN, 0}, // P_G2_P2Q2
1396 { 0x36E4, 0x3E51, WORD_LEN, 0}, // P_G2_P2Q3
1397 { 0x36E6, 0x8C74, WORD_LEN, 0}, // P_G2_P2Q4
1398 { 0x3700, 0x492E, WORD_LEN, 0}, // P_G1_P3Q0
1399 { 0x3702, 0x7FAD, WORD_LEN, 0}, // P_G1_P3Q1
1400 { 0x3704, 0x93CE, WORD_LEN, 0}, // P_G1_P3Q2
1401 { 0x3706, 0xC86F, WORD_LEN, 0}, // P_G1_P3Q3
1402 { 0x3708, 0xC830, WORD_LEN, 0}, // P_G1_P3Q4
1403 { 0x370A, 0x610E, WORD_LEN, 0}, // P_R_P3Q0
1404 { 0x370C, 0x8EC8, WORD_LEN, 0}, // P_R_P3Q1
1405 { 0x370E, 0xA930, WORD_LEN, 0}, // P_R_P3Q2
1406 { 0x3710, 0xE88D, WORD_LEN, 0}, // P_R_P3Q3
1407 { 0x3712, 0x2B51, WORD_LEN, 0}, // P_R_P3Q4
1408 { 0x3714, 0xDECD, WORD_LEN, 0}, // P_B_P3Q0
1409 { 0x3716, 0xBD8E, WORD_LEN, 0}, // P_B_P3Q1
1410 { 0x3718, 0x2E50, WORD_LEN, 0}, // P_B_P3Q2
1411 { 0x371A, 0x60AF, WORD_LEN, 0}, // P_B_P3Q3
1412 { 0x371C, 0xBB11, WORD_LEN, 0}, // P_B_P3Q4
1413 { 0x371E, 0x22CB, WORD_LEN, 0}, // P_G2_P3Q0
1414 { 0x3720, 0xEEEC, WORD_LEN, 0}, // P_G2_P3Q1
1415 { 0x3722, 0x0251, WORD_LEN, 0}, // P_G2_P3Q2
1416 { 0x3724, 0x142D, WORD_LEN, 0}, // P_G2_P3Q3
1417 { 0x3726, 0xE271, WORD_LEN, 0}, // P_G2_P3Q4
1418 { 0x3740, 0x1D10, WORD_LEN, 0}, // P_G1_P4Q0
1419 { 0x3742, 0xE94F, WORD_LEN, 0}, // P_G1_P4Q1
1420 { 0x3744, 0x8735, WORD_LEN, 0}, // P_G1_P4Q2
1421 { 0x3746, 0xC2CC, WORD_LEN, 0}, // P_G1_P4Q3
1422 { 0x3748, 0x23F6, WORD_LEN, 0}, // P_G1_P4Q4
1423 { 0x374A, 0xE90F, WORD_LEN, 0}, // P_R_P4Q0
1424 { 0x374C, 0x1A30, WORD_LEN, 0}, // P_R_P4Q1
1425 { 0x374E, 0xAEF3, WORD_LEN, 0}, // P_R_P4Q2
1426 { 0x3750, 0xB2F2, WORD_LEN, 0}, // P_R_P4Q3
1427 { 0x3752, 0x2195, WORD_LEN, 0}, // P_R_P4Q4
1428 { 0x3754, 0xFFEE, WORD_LEN, 0}, // P_B_P4Q0
1429 { 0x3756, 0xD8D0, WORD_LEN, 0}, // P_B_P4Q1
1430 { 0x3758, 0xCC92, WORD_LEN, 0}, // P_B_P4Q2
1431 { 0x375A, 0x0451, WORD_LEN, 0}, // P_B_P4Q3
1432 { 0x375C, 0x5814, WORD_LEN, 0}, // P_B_P4Q4
1433 { 0x375E, 0x2470, WORD_LEN, 0}, // P_G2_P4Q0
1434 { 0x3760, 0x6151, WORD_LEN, 0}, // P_G2_P4Q1
1435 { 0x3762, 0x9555, WORD_LEN, 0}, // P_G2_P4Q2
1436 { 0x3764, 0xD5D3, WORD_LEN, 0}, // P_G2_P4Q3
1437 { 0x3766, 0x3B56, WORD_LEN, 0}, // P_G2_P4Q4
1438 { 0x3782, 0x03DC, WORD_LEN, 0}, // CENTER_ROW
1439 { 0x3784, 0x04E0, WORD_LEN, 0}, // CENTER_COLUMN
1440 { 0x3210, 0x49B8, WORD_LEN, 0}, // COLOR_PIPELINE_CONTROL
1441 //BITFIELD= 0x3210, 0x0008, 1 //PGA_ENABLE
1442 //{ 0x3210, 0x0008, WORD_LEN, 0},
1446 //[*********Step6************]
1450 { 0xAC01, 0xBB, BYTE_LEN, 0}, // AWB_MODE
1452 { 0xAC46, 0x0221, WORD_LEN, 0}, // AWB_LEFT_CCM_0
1453 { 0xAC48, 0xFEAE, WORD_LEN, 0}, // AWB_LEFT_CCM_1
1454 { 0xAC4A, 0x0032, WORD_LEN, 0}, // AWB_LEFT_CCM_2
1455 { 0xAC4C, 0xFFC5, WORD_LEN, 0}, // AWB_LEFT_CCM_3
1456 { 0xAC4E, 0x0154, WORD_LEN, 0}, // AWB_LEFT_CCM_4
1457 { 0xAC50, 0xFFE7, WORD_LEN, 0}, // AWB_LEFT_CCM_5
1458 { 0xAC52, 0xFFB1, WORD_LEN, 0}, // AWB_LEFT_CCM_6
1459 { 0xAC54, 0xFEC5, WORD_LEN, 0}, // AWB_LEFT_CCM_7
1460 { 0xAC56, 0x028A, WORD_LEN, 0}, // AWB_LEFT_CCM_8
1461 { 0xAC58, 0x00C6, WORD_LEN, 0}, // AWB_LEFT_CCM_R2BRATIO
1462 { 0xAC5C, 0x01CD, WORD_LEN, 0}, // AWB_RIGHT_CCM_0
1463 { 0xAC5E, 0xFF63, WORD_LEN, 0}, // AWB_RIGHT_CCM_1
1464 { 0xAC60, 0xFFD0, WORD_LEN, 0}, // AWB_RIGHT_CCM_2
1465 { 0xAC62, 0xFFCD, WORD_LEN, 0}, // AWB_RIGHT_CCM_3
1466 { 0xAC64, 0x013B, WORD_LEN, 0}, // AWB_RIGHT_CCM_4
1467 { 0xAC66, 0xFFF8, WORD_LEN, 0}, // AWB_RIGHT_CCM_5
1468 { 0xAC68, 0xFFFB, WORD_LEN, 0}, // AWB_RIGHT_CCM_6
1469 { 0xAC6A, 0xFF78, WORD_LEN, 0}, // AWB_RIGHT_CCM_7
1470 { 0xAC6C, 0x018D, WORD_LEN, 0}, // AWB_RIGHT_CCM_8
1471 { 0xAC6E, 0x0055, WORD_LEN, 0}, // AWB_RIGHT_CCM_R2BRATIO
1474 { 0xB842, 0x0037, WORD_LEN, 0}, // STAT_AWB_GRAY_CHECKER_OFFSET_X
1475 { 0xB844, 0x0044, WORD_LEN, 0}, // STAT_AWB_GRAY_CHECKER_OFFSET_Y
1476 { 0x3240, 0x0024, WORD_LEN, 0}, // AWB_XY_SCALE
1477 { 0x3240, 0x0024, WORD_LEN, 0}, // AWB_XY_SCALE
1478 { 0x3242, 0x0000, WORD_LEN, 0}, // AWB_WEIGHT_R0
1479 { 0x3244, 0x0000, WORD_LEN, 0}, // AWB_WEIGHT_R1
1480 { 0x3246, 0x0000, WORD_LEN, 0}, // AWB_WEIGHT_R2
1481 { 0x3248, 0x7F00, WORD_LEN, 0}, // AWB_WEIGHT_R3
1482 { 0x324A, 0xA500, WORD_LEN, 0}, // AWB_WEIGHT_R4
1483 { 0x324C, 0x1540, WORD_LEN, 0}, // AWB_WEIGHT_R5
1484 { 0x324E, 0x01AC, WORD_LEN, 0}, // AWB_WEIGHT_R6
1485 { 0x3250, 0x003E, WORD_LEN, 0}, // AWB_WEIGHT_R7
1488 { 0xACB0, 0x32, BYTE_LEN, 0}, // AWB_RG_MIN
1489 { 0xACB1, 0x5A, BYTE_LEN, 0}, // AWB_RG_MAX
1490 { 0xACB2, 0x32, BYTE_LEN, 0}, // AWB_RG_MIN_BRIGHT
1491 { 0xACB3, 0x5A, BYTE_LEN, 0}, // AWB_RG_MAX_BRIGHT
1492 { 0xACB4, 0x23, BYTE_LEN, 0}, // AWB_BG_MIN
1493 { 0xACB5, 0x55, BYTE_LEN, 0}, // AWB_BG_MAX
1494 { 0xACB6, 0x49, BYTE_LEN, 0}, // AWB_BG_MIN_BRIGHT
1495 { 0xACB7, 0x55, BYTE_LEN, 0}, // AWB_BG_MAX_BRIGHT
1497 //[**********Step7*************]
1498 //[Step7-CPIPE_Calibration]
1502 { 0xD80F, 0x04, BYTE_LEN, 0}, // JPEG_QSCALE_0
1503 { 0xD810, 0x08, BYTE_LEN, 0}, // JPEG_QSCALE_1
1504 { 0xC8D2, 0x04, BYTE_LEN, 0}, // CAM_OUTPUT_1_JPEG_QSCALE_0
1505 { 0xC8D3, 0x08, BYTE_LEN, 0}, // CAM_OUTPUT_1_JPEG_QSCALE_1
1506 { 0xC8BC, 0x04, BYTE_LEN, 0}, // CAM_OUTPUT_0_JPEG_QSCALE_0
1507 { 0xC8BD, 0x08, BYTE_LEN, 0}, // CAM_OUTPUT_0_JPEG_QSCALE_1
1510 { 0xDC35, 0x04, BYTE_LEN, 0}, // SYS_UV_COLOR_BOOST
1511 { 0x326E, 0x0006, WORD_LEN, 0}, // RESERVED_SOC1_326E
1512 { 0xDC37, 0x62, BYTE_LEN, 0}, // SYS_BRIGHT_COLORKILL
1513 { 0x35A4, 0x0596, WORD_LEN, 0}, // BRIGHT_COLOR_KILL_CONTROLS
1514 { 0x35A2, 0x0094, WORD_LEN, 0}, // DARK_COLOR_KILL_CONTROLS
1515 { 0xDC36, 0x23, BYTE_LEN, 0}, // SYS_DARK_COLOR_KILL
1517 //[Gamma_Curves_REV3]
1518 { 0xBC18, 0x00, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_0
1519 { 0xBC19, 0x11, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_1
1520 { 0xBC1A, 0x23, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_2
1521 { 0xBC1B, 0x3F, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_3
1522 { 0xBC1C, 0x67, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_4
1523 { 0xBC1D, 0x85, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_5
1524 { 0xBC1E, 0x9B, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_6
1525 { 0xBC1F, 0xAD, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_7
1526 { 0xBC20, 0xBB, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_8
1527 { 0xBC21, 0xC7, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_9
1528 { 0xBC22, 0xD1, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_10
1529 { 0xBC23, 0xDA, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_11
1530 { 0xBC24, 0xE1, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_12
1531 { 0xBC25, 0xE8, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_13
1532 { 0xBC26, 0xEE, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_14
1533 { 0xBC27, 0xF3, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_15
1534 { 0xBC28, 0xF7, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_16
1535 { 0xBC29, 0xFB, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_17
1536 { 0xBC2A, 0xFF, BYTE_LEN, 0}, // LL_GAMMA_CONTRAST_CURVE_18
1537 { 0xBC2B, 0x00, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_0
1538 { 0xBC2C, 0x11, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_1
1539 { 0xBC2D, 0x23, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_2
1540 { 0xBC2E, 0x3F, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_3
1541 { 0xBC2F, 0x67, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_4
1542 { 0xBC30, 0x85, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_5
1543 { 0xBC31, 0x9B, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_6
1544 { 0xBC32, 0xAD, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_7
1545 { 0xBC33, 0xBB, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_8
1546 { 0xBC34, 0xC7, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_9
1547 { 0xBC35, 0xD1, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_10
1548 { 0xBC36, 0xDA, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_11
1549 { 0xBC37, 0xE1, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_12
1550 { 0xBC38, 0xE8, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_13
1551 { 0xBC39, 0xEE, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_14
1552 { 0xBC3A, 0xF3, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_15
1553 { 0xBC3B, 0xF7, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_16
1554 { 0xBC3C, 0xFB, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_17
1555 { 0xBC3D, 0xFF, BYTE_LEN, 0}, // LL_GAMMA_NEUTRAL_CURVE_18
1556 { 0xBC3E, 0x00, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_0
1557 { 0xBC3F, 0x05, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_1
1558 { 0xBC40, 0x0F, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_2
1559 { 0xBC41, 0x21, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_3
1560 { 0xBC42, 0x3C, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_4
1561 { 0xBC43, 0x52, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_5
1562 { 0xBC44, 0x67, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_6
1563 { 0xBC45, 0x7B, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_7
1564 { 0xBC46, 0x8D, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_8
1565 { 0xBC47, 0x9E, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_9
1566 { 0xBC48, 0xAD, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_10
1567 { 0xBC49, 0xBA, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_11
1568 { 0xBC4A, 0xC6, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_12
1569 { 0xBC4B, 0xD1, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_13
1570 { 0xBC4C, 0xDC, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_14
1571 { 0xBC4D, 0xE5, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_15
1572 { 0xBC4E, 0xEE, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_16
1573 { 0xBC4F, 0xF7, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_17
1574 { 0xBC50, 0xFF, BYTE_LEN, 0}, // LL_GAMMA_NR_CURVE_18
1577 { 0xB801, 0xE0, BYTE_LEN, 0}, // STAT_MODE
1578 { 0xB862, 0x04, BYTE_LEN, 0}, // STAT_BMTRACKING_SPEED
1581 { 0xB829, 0x02, BYTE_LEN, 0}, // STAT_LL_BRIGHTNESS_METRIC_DIVISOR
1582 { 0xB863, 0x02, BYTE_LEN, 0}, // STAT_BM_MUL
1583 { 0xB827, 0x0F, BYTE_LEN, 0}, // STAT_AE_EV_SHIFT
1584 { 0xA409, 0x42, BYTE_LEN, 0}, // AE_RULE_BASE_TARGET
1586 //[BM_GM_Start_Stop]
1587 { 0xBC52, 0x00C8, WORD_LEN, 0}, // LL_START_BRIGHTNESS_METRIC
1588 { 0xBC54, 0x0A28, WORD_LEN, 0}, // LL_END_BRIGHTNESS_METRIC
1589 { 0xBC58, 0x00C8, WORD_LEN, 0}, // LL_START_GAIN_METRIC
1590 { 0xBC5A, 0x12C0, WORD_LEN, 0}, // LL_END_GAIN_METRIC
1591 { 0xBC5E, 0x00FA, WORD_LEN, 0}, // LL_START_APERTURE_GAIN_BM
1592 { 0xBC60, 0x0258, WORD_LEN, 0}, // LL_END_APERTURE_GAIN_BM
1593 { 0xBC66, 0x00FA, WORD_LEN, 0}, // LL_START_APERTURE_GM
1594 { 0xBC68, 0x0258, WORD_LEN, 0}, // LL_END_APERTURE_GM
1595 { 0xBC86, 0x00C8, WORD_LEN, 0}, // LL_START_FFNR_GM
1596 { 0xBC88, 0x0640, WORD_LEN, 0}, // LL_END_FFNR_GM
1597 { 0xBCBC, 0x0040, WORD_LEN, 0}, // LL_SFFB_START_GAIN
1598 { 0xBCBE, 0x01FC, WORD_LEN, 0}, // LL_SFFB_END_GAIN
1599 { 0xBCCC, 0x00C8, WORD_LEN, 0}, // LL_SFFB_START_MAX_GM
1600 { 0xBCCE, 0x0640, WORD_LEN, 0}, // LL_SFFB_END_MAX_GM
1601 { 0xBC90, 0x00C8, WORD_LEN, 0}, // LL_START_GRB_GM
1602 { 0xBC92, 0x0640, WORD_LEN, 0}, // LL_END_GRB_GM
1603 { 0xBC0E, 0x0001, WORD_LEN, 0}, // LL_GAMMA_CURVE_ADJ_START_POS
1604 { 0xBC10, 0x0002, WORD_LEN, 0}, // LL_GAMMA_CURVE_ADJ_MID_POS
1605 { 0xBC12, 0x02BC, WORD_LEN, 0}, // LL_GAMMA_CURVE_ADJ_END_POS
1606 { 0xBCAA, 0x044C, WORD_LEN, 0}, // LL_CDC_THR_ADJ_START_POS
1607 { 0xBCAC, 0x00AF, WORD_LEN, 0}, // LL_CDC_THR_ADJ_MID_POS
1608 { 0xBCAE, 0x0009, WORD_LEN, 0}, // LL_CDC_THR_ADJ_END_POS
1609 { 0xBCD8, 0x00C8, WORD_LEN, 0}, // LL_PCR_START_BM
1610 { 0xBCDA, 0x0A28, WORD_LEN, 0}, // LL_PCR_END_BM
1613 { 0x3380, 0x0504, WORD_LEN, 0}, // KERNEL_CONFIG
1616 { 0xBC94, 0x0C, BYTE_LEN, 0}, // LL_GB_START_THRESHOLD_0
1617 { 0xBC95, 0x08, BYTE_LEN, 0}, // LL_GB_START_THRESHOLD_1
1618 { 0xBC9C, 0x3C, BYTE_LEN, 0}, // RESERVED_LL_9C
1619 { 0xBC9D, 0x28, BYTE_LEN, 0}, // RESERVED_LL_9D
1622 { 0x33B0, 0x2A16, WORD_LEN, 0}, // FFNR_ALPHA_BETA
1623 { 0xBC8A, 0x02, BYTE_LEN, 0}, // LL_START_FF_MIX_THRESH_Y
1624 { 0xBC8B, 0x0F, BYTE_LEN, 0}, // LL_END_FF_MIX_THRESH_Y
1625 { 0xBC8C, 0xFF, BYTE_LEN, 0}, // LL_START_FF_MIX_THRESH_YGAIN
1626 { 0xBC8D, 0xFF, BYTE_LEN, 0}, // LL_END_FF_MIX_THRESH_YGAIN
1627 { 0xBC8E, 0xFF, BYTE_LEN, 0}, // LL_START_FF_MIX_THRESH_GAIN
1628 { 0xBC8F, 0x00, BYTE_LEN, 0}, // LL_END_FF_MIX_THRESH_GAIN
1631 { 0xBCB2, 0x20, BYTE_LEN, 0}, // LL_CDC_DARK_CLUS_SLOPE
1632 { 0xBCB3, 0x3A, BYTE_LEN, 0}, // LL_CDC_DARK_CLUS_SATUR
1633 { 0xBCB4, 0x39, BYTE_LEN, 0}, // RESERVED_LL_B4
1634 { 0xBCB7, 0x39, BYTE_LEN, 0}, // RESERVED_LL_B7
1635 { 0xBCB5, 0x20, BYTE_LEN, 0}, // RESERVED_LL_B5
1636 { 0xBCB8, 0x3A, BYTE_LEN, 0}, // RESERVED_LL_B8
1637 { 0xBCB6, 0x80, BYTE_LEN, 0}, // RESERVED_LL_B6
1638 { 0xBCB9, 0x24, BYTE_LEN, 0}, // RESERVED_LL_B9
1639 { 0xBCAA, 0x03E8, WORD_LEN, 0}, // LL_CDC_THR_ADJ_START_POS
1640 { 0xBCAC, 0x012C, WORD_LEN, 0}, // LL_CDC_THR_ADJ_MID_POS
1641 { 0xBCAE, 0x0009, WORD_LEN, 0}, // LL_CDC_THR_ADJ_END_POS
1644 { 0x33BA, 0x0084, WORD_LEN, 0}, // APEDGE_CONTROL
1645 { 0x33BE, 0x0000, WORD_LEN, 0}, // UA_KNEE_L
1646 { 0x33C2, 0x8800, WORD_LEN, 0}, // UA_WEIGHTS
1647 { 0xBC5E, 0x0154, WORD_LEN, 0}, // LL_START_APERTURE_GAIN_BM
1648 { 0xBC60, 0x0640, WORD_LEN, 0}, // LL_END_APERTURE_GAIN_BM
1649 { 0xBC62, 0x0E, BYTE_LEN, 0}, // LL_START_APERTURE_KPGAIN
1650 { 0xBC63, 0x14, BYTE_LEN, 0}, // LL_END_APERTURE_KPGAIN
1651 { 0xBC64, 0x0E, BYTE_LEN, 0}, // LL_START_APERTURE_KNGAIN
1652 { 0xBC65, 0x14, BYTE_LEN, 0}, // LL_END_APERTURE_KNGAIN
1653 { 0xBCE2, 0x0A, BYTE_LEN, 0}, // LL_START_POS_KNEE
1654 { 0xBCE3, 0x2B, BYTE_LEN, 0}, // LL_END_POS_KNEE
1655 { 0xBCE4, 0x0A, BYTE_LEN, 0}, // LL_START_NEG_KNEE
1656 { 0xBCE5, 0x2B, BYTE_LEN, 0}, // LL_END_NEG_KNEE
1657 { 0x3210, 0x49B8, WORD_LEN, 0}, // COLOR_PIPELINE_CONTROL
1659 //[SFFB_REV3_noisemodel]
1660 { 0xBCC0, 0x1F, BYTE_LEN, 0}, // LL_SFFB_RAMP_START
1661 { 0xBCC1, 0x03, BYTE_LEN, 0}, // LL_SFFB_RAMP_STOP
1662 { 0xBCC2, 0x2C, BYTE_LEN, 0}, // LL_SFFB_SLOPE_START
1663 { 0xBCC3, 0x10, BYTE_LEN, 0}, // LL_SFFB_SLOPE_STOP
1664 { 0xBCC4, 0x07, BYTE_LEN, 0}, // LL_SFFB_THSTART
1665 { 0xBCC5, 0x0B, BYTE_LEN, 0}, // LL_SFFB_THSTOP
1666 { 0xBCBA, 0x0009, WORD_LEN, 0}, // LL_SFFB_CONFIG
1668 //[**********Step8*************]
1670 { 0xBC14, 0xFFFE, WORD_LEN, 0}, // LL_GAMMA_FADE_TO_BLACK_START_POS
1671 { 0xBC16, 0xFFFE, WORD_LEN, 0}, // LL_GAMMA_FADE_TO_BLACK_END_POS
1673 //[Aperture_preference]
1674 { 0xBC66, 0x0154, WORD_LEN, 0}, // LL_START_APERTURE_GM
1675 { 0xBC68, 0x07D0, WORD_LEN, 0}, // LL_END_APERTURE_GM
1676 { 0xBC6A, 0x04, BYTE_LEN, 0}, // LL_START_APERTURE_INTEGER_GAIN
1677 { 0xBC6B, 0x00, BYTE_LEN, 0}, // LL_END_APERTURE_INTEGER_GAIN
1678 { 0xBC6C, 0x00, BYTE_LEN, 0}, // LL_START_APERTURE_EXP_GAIN
1679 { 0xBC6D, 0x00, BYTE_LEN, 0}, // LL_END_APERTURE_EXP_GAIN
1682 { 0xA81C, 0x0040, WORD_LEN, 0}, // AE_TRACK_MIN_AGAIN
1683 { 0xA820, 0x012C, WORD_LEN, 0}, // AE_TRACK_MAX_AGAIN
1684 { 0xA822, 0x0060, WORD_LEN, 0}, // AE_TRACK_MIN_DGAIN
1685 { 0xA824, 0x00E5, WORD_LEN, 0}, // AE_TRACK_MAX_DGAIN
1688 { 0xBC56, 0x64, BYTE_LEN, 0}, // LL_START_CCM_SATURATION
1689 { 0xBC57, 0x1E, BYTE_LEN, 0}, // LL_END_CCM_SATURATION
1692 { 0xBCDE, 0x03, BYTE_LEN, 0}, // LL_START_SYS_THRESHOLD
1693 { 0xBCDF, 0x50, BYTE_LEN, 0}, // LL_STOP_SYS_THRESHOLD
1694 { 0xBCE0, 0x08, BYTE_LEN, 0}, // LL_START_SYS_GAIN
1695 { 0xBCE1, 0x03, BYTE_LEN, 0}, // LL_STOP_SYS_GAIN
1698 { 0xBCD0, 0x000A, WORD_LEN, 0}, // LL_SFFB_SOBEL_FLAT_START
1699 { 0xBCD2, 0x00FE, WORD_LEN, 0}, // LL_SFFB_SOBEL_FLAT_STOP
1700 { 0xBCD4, 0x001E, WORD_LEN, 0}, // LL_SFFB_SOBEL_SHARP_START
1701 { 0xBCD6, 0x00FF, WORD_LEN, 0}, // LL_SFFB_SOBEL_SHARP_STOP
1702 { 0xBCC6, 0x00, BYTE_LEN, 0}, // LL_SFFB_SHARPENING_START
1703 { 0xBCC7, 0x00, BYTE_LEN, 0}, // LL_SFFB_SHARPENING_STOP
1704 { 0xBCC8, 0x20, BYTE_LEN, 0}, // LL_SFFB_FLATNESS_START
1705 { 0xBCC9, 0x40, BYTE_LEN, 0}, // LL_SFFB_FLATNESS_STOP
1706 { 0xBCCA, 0x04, BYTE_LEN, 0}, // LL_SFFB_TRANSITION_START
1707 { 0xBCCB, 0x00, BYTE_LEN, 0}, // LL_SFFB_TRANSITION_STOP
1709 //[SFFB_slope_zero_enable]
1710 { 0xBCE6, 0x03, BYTE_LEN, 0}, // LL_SFFB_ZERO_ENABLE
1711 { 0xBCE6, 0x03, BYTE_LEN, 0}, // LL_SFFB_ZERO_ENABLE
1715 { 0xA410, 0x04, BYTE_LEN, 0}, // AE_RULE_TARGET_AE_6
1716 { 0xA411, 0x06, BYTE_LEN, 0}, // AE_RULE_TARGET_AE_7
1719 //[**********Step9*************]
1720 //[JPEG Quantization]
1722 { 0xDC3A, 0x23, BYTE_LEN, 0}, // SYS_SEPIA_CR
1723 { 0xDC3B, 0xB2, BYTE_LEN, 0}, // SYS_SEPIA_CB
1726 //[Touch Focus + Fast Focus AF_AFM_INIT]
1727 { 0x8411, 0x00, BYTE_LEN, 0}, // SEQ_STATE_CFG_0_AF
1728 { 0x8419, 0x04, BYTE_LEN, 0}, // SEQ_STATE_CFG_1_AF
1730 { 0xB002, 0x0002, WORD_LEN, 0}, // AF_MODE
1731 { 0xC40A, 0x0030, WORD_LEN, 0}, // AFM_POS_MIN
1732 { 0xC40C, 0x00A0, WORD_LEN, 0}, // AFM_POS_MAX
1733 { 0xB045, 0x000C, WORD_LEN, 0}, // AF_MODE_EX
1737 { 0xB854, 0x60, BYTE_LEN, 0}, // STAT_SM_WINDOW_POS_X
1738 { 0xB855, 0x60, BYTE_LEN, 0}, // STAT_SM_WINDOW_POS_Y
1739 { 0xB856, 0x40, BYTE_LEN, 0}, // STAT_SM_WINDOW_SIZE_X
1740 { 0xB857, 0x40, BYTE_LEN, 0}, // STAT_SM_WINDOW_SIZE_Y
1741 { 0xB012, 0x0A, BYTE_LEN, 0}, // AF_FS_NUM_STEPS
1742 { 0xB018, 0x00, BYTE_LEN, 0}, // AF_FS_POS_0
1743 { 0xB019, 0x30, BYTE_LEN, 0}, // AF_FS_POS_1
1744 { 0xB01A, 0x48, BYTE_LEN, 0}, // AF_FS_POS_2
1745 { 0xB01B, 0x60, BYTE_LEN, 0}, // AF_FS_POS_3
1746 { 0xB01C, 0x78, BYTE_LEN, 0}, // AF_FS_POS_4
1747 { 0xB01D, 0x90, BYTE_LEN, 0}, // AF_FS_POS_5
1748 { 0xB01E, 0xA8, BYTE_LEN, 0}, // AF_FS_POS_6
1749 { 0xB01F, 0xC0, BYTE_LEN, 0}, // AF_FS_POS_7
1750 { 0xB020, 0xE0, BYTE_LEN, 0}, // AF_FS_POS_8
1751 { 0xB021, 0xFF, BYTE_LEN, 0}, // AF_FS_POS_9
1752 { 0xB022, 0x00, BYTE_LEN, 0}, // AF_FS_POS_10
1753 { 0xB011, 0x00, BYTE_LEN, 0}, // AF_FS_INIT_POS
1755 //INIT PATCH PAGE used in FF
1756 { 0x098E, 0xD40E, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS
1757 { 0xD40E, 0x0000, WORD_LEN, 0},
1758 { 0xD40F, 0x0000, WORD_LEN, 0},
1759 { 0xD410, 0x0000, WORD_LEN, 0},
1760 { 0xD411, 0x0000, WORD_LEN, 0},
1761 { 0xD412, 0x0000, WORD_LEN, 0},
1762 { 0xD413, 0x0000, WORD_LEN, 0},
1763 { 0xD414, 0x0000, WORD_LEN, 0},
1764 { 0xD415, 0x0000, WORD_LEN, 0},
1765 { 0xD416, 0x0000, WORD_LEN, 0},
1766 { 0xD417, 0x0000, WORD_LEN, 0},
1767 { 0xD418, 0x0000, WORD_LEN, 0},
1768 { 0xD418, 0x0000, WORD_LEN, 0},
1769 { 0xD419, 0x0000, WORD_LEN, 0},
1770 { 0xD41A, 0x0000, WORD_LEN, 0},
1771 { 0xD41B, 0x0000, WORD_LEN, 0},
1772 { 0xD41C, 0x0000, WORD_LEN, 0},
1773 { 0xD41D, 0x0000, WORD_LEN, 0},
1774 { 0xD41E, 0x0000, WORD_LEN, 0},
1775 { 0xD420, 0x0000, WORD_LEN, 0},
1776 { 0xD406, 0x0000, WORD_LEN, 0},
1777 { 0xD407, 0x0000, WORD_LEN, 0},
1778 { 0xD422, 0x0000, WORD_LEN, 0},
1779 { 0xD423, 0x0000, WORD_LEN, 0},
1780 { 0xD424, 0x0000, WORD_LEN, 0},
1781 { 0xD425, 0x0000, WORD_LEN, 0},
1782 { 0xD426, 0x0000, WORD_LEN, 0},
1783 { 0xD427, 0x0000, WORD_LEN, 0},
1784 { 0xD428, 0x0000, WORD_LEN, 0},
1785 { 0xD429, 0x0000, WORD_LEN, 0},
1786 { 0xD42A, 0x0000, WORD_LEN, 0},
1787 { 0xD42B, 0x0000, WORD_LEN, 0},
1788 { 0xD400, 0x0001, WORD_LEN, 0},
1789 { 0xD401, 0x0000, WORD_LEN, 0},
1790 { 0xD402, 0x0028, WORD_LEN, 0},
1791 { 0xD403, 0x0080, WORD_LEN, 0},
1792 { 0xD404, 0x0000, WORD_LEN, 0},
1793 { 0xD405, 0x0000, WORD_LEN, 0},
1794 { 0xD406, 0x0000, WORD_LEN, 0},
1795 { 0xD407, 0x0000, WORD_LEN, 0},
1796 { 0xD408, 0x0030, WORD_LEN, 0},
1797 { 0xD409, 0x0040, WORD_LEN, 0},
1798 { 0xD40A, 0x0050, WORD_LEN, 0},
1799 { 0xD40B, 0x0070, WORD_LEN, 0},
1800 { 0xD40C, 0x0080, WORD_LEN, 0},
1801 { 0xD40D, 0x0090, WORD_LEN, 0},
1803 { 0x0018, 0x2008, WORD_LEN, 0}, // STANDBY_CONTROL_AND_STATUS
1805 {SEQUENCE_WAIT_MS,100, WORD_LEN, 0},
1807 { SEQUENCE_END, 0x00, 0, 0}
1813 /* 720p 15fps @ 1280x720 */
1814 static struct reginfo sensor_720p[]=
1816 //{SEQUENCE_END, 0x00},
1817 {0x098E, 0x843C, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [CAM_CORE_A_Y_ADDR_START]
1818 {0x843C, 0x01, BYTE_LEN, 0 }, // SEQ_STATE_CFG_5_MAX_FRAME_CNT
1819 {0x8404, 0x01, BYTE_LEN, 0 }, // SEQ_CMD
1820 {0x0016, 0x0447, WORD_LEN, 0}, // CLOCKS_CONTROL
1821 {0xC83A, 0x0106, WORD_LEN, 0}, // CAM_CORE_A_Y_ADDR_START
1822 {0xC83C, 0x0018, WORD_LEN, 0}, // CAM_CORE_A_X_ADDR_START
1823 {0xC83E, 0x06B7, WORD_LEN, 0}, // CAM_CORE_A_Y_ADDR_END
1824 {0xC840, 0x0A45, WORD_LEN, 0}, // CAM_CORE_A_X_ADDR_END
1825 {0xC86C, 0x0518, WORD_LEN, 0}, // CAM_CORE_A_OUTPUT_SIZE_WIDTH
1826 {0xC86E, 0x02D8, WORD_LEN, 0}, // CAM_CORE_A_OUTPUT_SIZE_HEIGHT
1827 {0xC870, 0x0014, WORD_LEN, 0}, // CAM_CORE_A_RX_FIFO_TRIGGER_MARK
1828 {0xC858, 0x0003, WORD_LEN, 0}, // CAM_CORE_A_COARSE_ITMIN
1829 {0xC8B8, 0x0004, WORD_LEN, 0}, // CAM_OUTPUT_0_JPEG_CONTROL
1830 /****bug:part pixsels data not to be aquired *****/
1831 #if ADJUST_FOR_720P_FALG
1832 {0xC8AA, 0x0500, WORD_LEN, 0}, // CAM_OUTPUT_0_IMAGE_WIDTH
1833 {0xC8AC, 0x02D1, WORD_LEN, 0}, // CAM_OUTPUT_0_IMAGE_HEIGHT
1835 {0xC8AA, 0x0500, WORD_LEN, 0}, // CAM_OUTPUT_0_IMAGE_WIDTH
1836 {0xC8AC, 0x02D0, WORD_LEN, 0}, // CAM_OUTPUT_0_IMAGE_HEIGHT
1838 {0xC8AE, 0x0001, WORD_LEN, 0}, // CAM_OUTPUT_0_OUTPUT_FORMAT
1839 {0x8404, 0x06, BYTE_LEN, 0 }, // SEQ_CMD
1841 {SEQUENCE_WAIT_MS,100, WORD_LEN, 0},
1843 { SEQUENCE_END, 0x00, 0, 0}
1846 /* 1080p, 0x15fps, 0xyuv @1920x1080 */
1847 static struct reginfo sensor_1080p[]=
1849 { SEQUENCE_END, 0x00, 0, 0}
1852 /* 2592X1944 QSXGA */
1853 #if ADJUST_FOR_CAPTURE_FALG
1854 static struct reginfo sensor_qsxga[] =
1857 {0x098E, 0x48C0,WORD_LEN,0}, // LOGICAL_ADDRESS_ACCESS [CAM_OUTPUT_1_IMAGE_WIDTH]
1858 {0xC8C0, 0x0A20,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_WIDTH
1859 {0xC8C2, 0x0798,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_HEIGHT
1860 {0x8404, 0x06 ,BYTE_LEN,0}, // SEQ_CMD
1861 {SEQUENCE_WAIT_MS,100,WORD_LEN,0},
1863 {SEQUENCE_END, 0x00, 0, 0}
1866 static struct reginfo sensor_qsxga[] =
1868 {SEQUENCE_PROPERTY,SEQUENCE_CAPTURE},
1869 { SEQUENCE_END, 0x00, 0, 0}
1873 /* 2048*1536 QXGA */
1874 #if ADJUST_FOR_CAPTURE_FALG
1875 // send extra two lines to forbid to be captured error
1876 static struct reginfo sensor_qxga[] =
1878 {0x098E, 0x48C0,WORD_LEN,0}, // LOGICAL_ADDRESS_ACCESS [CAM_OUTPUT_1_IMAGE_WIDTH]
1879 {0xC8C0, 0x0800,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_WIDTH
1880 {0xC8C2, 0x0602,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_HEIGHT
1881 {0x8404, 0x06 ,BYTE_LEN,0}, // SEQ_CMD
1882 {SEQUENCE_WAIT_MS,100,WORD_LEN,0},
1884 {SEQUENCE_END, 0x00, 0, 0}
1887 static struct reginfo sensor_qxga[] =
1889 { SEQUENCE_END, 0x00, 0, 0}
1893 /* 1600X1200 UXGA */
1894 #if ADJUST_FOR_CAPTURE_FALG
1895 static struct reginfo sensor_uxga[] =
1897 {0x098E, 0x48C0,WORD_LEN,0}, // LOGICAL_ADDRESS_ACCESS [CAM_OUTPUT_1_IMAGE_WIDTH]
1898 {0xC8C0, 0x0640,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_WIDTH
1899 {0xC8C2, 0x04b2,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_HEIGHT
1900 {0x8404, 0x06 ,BYTE_LEN,0}, // SEQ_CMD
1901 {SEQUENCE_WAIT_MS,100,WORD_LEN,0},
1903 {SEQUENCE_END, 0x00, 0, 0}
1906 static struct reginfo sensor_uxga[] =
1908 { SEQUENCE_END, 0x00, 0, 0}
1912 /* 1280X1024 SXGA */
1913 static struct reginfo sensor_sxga[] =
1915 {SEQUENCE_END, 0x00}
1919 #if ADJUST_FOR_CAPTURE_FALG
1920 static struct reginfo sensor_xga[] =
1922 {0x098E, 0x48C0,WORD_LEN,0}, // LOGICAL_ADDRESS_ACCESS [CAM_OUTPUT_1_IMAGE_WIDTH]
1923 {0xC8C0, 0x0403,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_WIDTH
1924 {0xC8C2, 0x0302,WORD_LEN,0}, // CAM_OUTPUT_1_IMAGE_HEIGHT
1925 {0x8404, 0x06 ,BYTE_LEN,0}, // SEQ_CMD
1926 {SEQUENCE_WAIT_MS,100,WORD_LEN,0},
1928 {SEQUENCE_END, 0x00, 0, 0}
1931 static struct reginfo sensor_xga[] =
1933 {SEQUENCE_END, 0x00, 0, 0}
1939 static struct reginfo sensor_svga[] =
1941 { SEQUENCE_END, 0x00, 0, 0}
1945 static struct reginfo sensor_vga[] =
1948 {0xC83A, 0x000C, WORD_LEN, 0}, // CAM_CORE_A_Y_ADDR_START
1949 {0xC83C, 0x0018, WORD_LEN, 0}, // CAM_CORE_A_X_ADDR_START
1950 {0xC83E, 0x07B1, WORD_LEN, 0 }, // CAM_CORE_A_Y_ADDR_END
1951 {0xC840, 0x0A45, WORD_LEN, 0}, // CAM_CORE_A_X_ADDR_END
1952 {0xC868, 0x0423, WORD_LEN, 0}, // CAM_CORE_A_FRAME_LENGTH_LINES
1953 {0xC86A, 0x1194, WORD_LEN, 0}, // CAM_CORE_A_LINE_LENGTH_PCK
1954 {0xC86C, 0x0518, WORD_LEN, 0}, // CAM_CORE_A_OUTPUT_SIZE_WIDTH
1955 {0xC86E, 0x03D4, WORD_LEN, 0}, // CAM_CORE_A_OUTPUT_SIZE_HEIGHT
1956 {0xC870, 0x0014, WORD_LEN, 0}, // CAM_CORE_A_RX_FIFO_TRIGGER_MARK
1957 {0xC858, 0x0003, WORD_LEN, 0}, // CAM_CORE_A_COARSE_ITMIN
1958 {0xC8A4, 0x0A28, WORD_LEN, 0}, // CAM_CORE_B_OUTPUT_SIZE_WIDTH
1959 {0xC8A6, 0x07A0, WORD_LEN, 0 }, // CAM_CORE_B_OUTPUT_SIZE_HEIGHT
1960 {0xC8AA, 0x0280, WORD_LEN, 0 }, // CAM_OUTPUT_0_IMAGE_WIDTH
1961 {0xC8AC, 0x01E0, WORD_LEN, 0 }, // CAM_OUTPUT_0_IMAGE_HEIGHT
1962 {0xC8AE, 0x0001, WORD_LEN, 0 }, // CAM_OUTPUT_0_OUTPUT_FORMAT
1963 {0x8404, 0x06, BYTE_LEN, 0 }, // SEQ_CMD
1964 {SEQUENCE_WAIT_MS,100, WORD_LEN, 0},
1965 {SEQUENCE_END, 0x00, 0, 0}
1970 static struct reginfo sensor_cif[] =
1972 {SEQUENCE_END, 0x00}
1976 static struct reginfo sensor_qvga[] =
1978 {SEQUENCE_END, 0x00}
1982 static struct reginfo sensor_qcif[] =
1984 {SEQUENCE_END, 0x00}
1987 static struct reginfo sensor_Preview2Capture[]=
1990 {0x098E, 0x843C, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [SEQ_STATE_CFG_5_MAX_FRAME_CNT]
1991 {0x843C, 0xFF, BYTE_LEN, 0 }, // SEQ_STATE_CFG_5_MAX_FRAME_CNT
1992 {0x8404, 0x02, BYTE_LEN, 0 }, // SEQ_CMD
1993 {SEQUENCE_END, 0x00, 0, 0}
1997 static struct reginfo sensor_Capture2Preview[]=
2000 {0x098E, 0x843C, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [SEQ_STATE_CFG_5_MAX_FRAME_CNT]
2001 {0x843C, 0x01, BYTE_LEN, 0 }, // SEQ_STATE_CFG_5_MAX_FRAME_CNT
2002 {0x8404, 0x01, BYTE_LEN, 0 }, // SEQ_CMD
2003 {0x0016, 0x0447, WORD_LEN, 0}, // CLOCKS_CONTRO
2004 {SEQUENCE_END, 0x00, 0, 0}
2007 static struct reginfo sensor_ClrFmt_YUYV[]=
2009 {SEQUENCE_END, 0x00}
2012 static struct reginfo sensor_ClrFmt_UYVY[]=
2014 {SEQUENCE_END, 0x00}
2018 #if CONFIG_SENSOR_WhiteBalance
2019 static struct reginfo sensor_WhiteB_Auto[]=
2022 {0x098E, 0xACB0, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [AWB_MIN_ACCEPTED_PRE_AWB_R2G_RATIO]
2023 {0xACB0, 0x31, BYTE_LEN, 0 }, // AWB_RG_MIN
2024 {0xACB1, 0x5B, BYTE_LEN, 0 }, // AWB_RG_MAX
2025 {0xACB4, 0x2A, BYTE_LEN, 0 }, // AWB_BG_MIN
2026 {0xACB5, 0x5B, BYTE_LEN, 0 }, // AWB_BG_MAX
2027 {0xACB2, 0x40, BYTE_LEN, 0 }, // AWB_RG_MIN_BRIGHT
2028 {0xACB3, 0x48, BYTE_LEN, 0 }, // AWB_RG_MAX_BRIGHT
2029 {0xACB6, 0x3f, BYTE_LEN, 0 }, // AWB_BG_MIN_BRIGHT
2030 {0xACB7, 0x48, BYTE_LEN, 0 }, // AWB_BG_MAX_BRIGHT
2031 {0xAC44, 0x00, BYTE_LEN, 0 }, // AWB_LEFT_CCM_POS_RANGE_LIMIT
2032 {0xAC45, 0x7F, BYTE_LEN, 0 }, // AWB_RIGHT_CCM_POS_RANGE_LIMIT
2033 {SEQUENCE_END, 0x00, 0, 0}
2036 /* Cloudy Colour Temperature : 6500K - 8000K */
2037 static struct reginfo sensor_WhiteB_Cloudy[]=
2040 { 0x098E, 0xACB0, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [AWB_MIN_ACCEPTED_PRE_AWB_R2G_RATIO]
2041 {0xACB0, 0x38, BYTE_LEN, 0 }, // AWB_RG_MIN
2042 {0xACB1, 0x42, BYTE_LEN, 0 }, // AWB_RG_MAX
2043 {0xACB4, 0x44, BYTE_LEN, 0 }, // AWB_BG_MIN
2044 {0xACB5, 0x4C, BYTE_LEN, 0 }, // AWB_BG_MAX
2045 {0xACB2, 0x38, BYTE_LEN, 0 }, // AWB_RG_MIN_BRIGHT
2046 {0xACB3, 0x42, BYTE_LEN, 0 }, // AWB_RG_MAX_BRIGHT
2047 {0xACB6, 0x44, BYTE_LEN, 0 }, // AWB_BG_MIN_BRIGHT
2048 {0xACB7, 0x4C, BYTE_LEN, 0 }, // AWB_BG_MAX_BRIGHT
2049 {0xAC44, 0x7C, BYTE_LEN, 0 }, // AWB_LEFT_CCM_POS_RANGE_LIMIT
2050 {0xAC45, 0x7F, BYTE_LEN, 0 }, // AWB_RIGHT_CCM_POS_RANGE_LIMIT
2051 {0xAC04, 0x3E, BYTE_LEN, 0 }, // AWB_PRE_AWB_R2G_RATIO
2052 {0xAC05, 0x48, BYTE_LEN, 0 }, // AWB_PRE_AWB_B2G_RATIO
2053 {0xAC08, 0x7F, BYTE_LEN, 0 }, // AWB_CUR_CCM_POS
2054 {SEQUENCE_END, 0x00, 0, 0}
2057 /* ClearDay Colour Temperature : 5000K - 6500K */
2058 static struct reginfo sensor_WhiteB_ClearDay[]=
2061 { 0x098E, 0xACB0, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [AWB_MIN_ACCEPTED_PRE_AWB_R2G_RATIO]
2062 {0xACB0, 0x3A, BYTE_LEN, 0 }, // AWB_RG_MIN
2063 {0xACB1, 0x44, BYTE_LEN, 0 }, // AWB_RG_MAX
2064 {0xACB4, 0x40, BYTE_LEN, 0 }, // AWB_BG_MIN
2065 {0xACB5, 0x4A, BYTE_LEN, 0 }, // AWB_BG_MAX
2066 {0xACB2, 0x3A, BYTE_LEN, 0 }, // AWB_RG_MIN_BRIGHT
2067 {0xACB3, 0x44, BYTE_LEN, 0 }, // AWB_RG_MAX_BRIGHT
2068 {0xACB6, 0x40, BYTE_LEN, 0 }, // AWB_BG_MIN_BRIGHT
2069 {0xACB7, 0x4A, BYTE_LEN, 0 }, // AWB_BG_MAX_BRIGHT
2070 {0xAC44, 0x7C, BYTE_LEN, 0 }, // AWB_LEFT_CCM_POS_RANGE_LIMIT
2071 {0xAC45, 0x7F, BYTE_LEN, 0 }, // AWB_RIGHT_CCM_POS_RANGE_LIMIT
2072 {0xAC04, 0x40, BYTE_LEN, 0 }, // AWB_PRE_AWB_R2G_RATIO
2073 {0xAC05, 0x48, BYTE_LEN, 0 }, // AWB_PRE_AWB_B2G_RATIO
2074 {0xAC08, 0x7F, BYTE_LEN, 0 }, // AWB_CUR_CCM_POS
2075 {SEQUENCE_END, 0x00, 0, 0}
2078 /* Office Colour Temperature : 3500K - 5000K */
2079 static struct reginfo sensor_WhiteB_TungstenLamp1[]=
2082 { 0x098E, 0xACB0, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [AWB_MIN_ACCEPTED_PRE_AWB_R2G_RATIO]
2083 {0xACB0, 0x44, BYTE_LEN, 0 }, // AWB_RG_MIN
2084 {0xACB1, 0x4B, BYTE_LEN, 0 }, // AWB_RG_MAX
2085 {0xACB4, 0x2C, BYTE_LEN, 0 }, // AWB_BG_MIN
2086 {0xACB5, 0x34, BYTE_LEN, 0 }, // AWB_BG_MAX
2087 {0xACB2, 0x44, BYTE_LEN, 0 }, // AWB_RG_MIN_BRIGHT
2088 {0xACB3, 0x4B, BYTE_LEN, 0 }, // AWB_RG_MAX_BRIGHT
2089 {0xACB6, 0x2C, BYTE_LEN, 0 }, // AWB_BG_MIN_BRIGHT
2090 {0xACB7, 0x34, BYTE_LEN, 0 }, // AWB_BG_MAX_BRIGHT
2091 {0xAC44, 0x40, BYTE_LEN, 0 }, // AWB_LEFT_CCM_POS_RANGE_LIMIT
2092 {0xAC45, 0x4A, BYTE_LEN, 0 }, // AWB_RIGHT_CCM_POS_RANGE_LIMIT
2093 {0xAC04, 0x47, BYTE_LEN, 0 }, // AWB_PRE_AWB_R2G_RATIO
2094 {0xAC05, 0x30, BYTE_LEN, 0 }, // AWB_PRE_AWB_B2G_RATIO
2095 {0xAC08, 0x45, BYTE_LEN, 0 }, // AWB_CUR_CCM_POS
2096 {SEQUENCE_END, 0x00, 0, 0}
2098 /* Home Colour Temperature : 2500K - 3500K */
2099 static struct reginfo sensor_WhiteB_TungstenLamp2[]=
2101 //[II. Incandescent]
2102 { 0x098E, 0xACB0, WORD_LEN, 0}, // LOGICAL_ADDRESS_ACCESS [AWB_MIN_ACCEPTED_PRE_AWB_R2G_RATIO]
2103 {0xACB0, 0x57, BYTE_LEN, 0 }, // AWB_RG_MIN
2104 {0xACB1, 0x5F, BYTE_LEN, 0 }, // AWB_RG_MAX
2105 {0xACB4, 0x26, BYTE_LEN, 0 }, // AWB_BG_MIN
2106 {0xACB5, 0x2E, BYTE_LEN, 0 }, // AWB_BG_MAX
2107 {0xACB2, 0x57, BYTE_LEN, 0 }, // AWB_RG_MIN_BRIGHT
2108 {0xACB3, 0x5F, BYTE_LEN, 0 }, // AWB_RG_MAX_BRIGHT
2109 {0xACB6, 0x26, BYTE_LEN, 0 }, // AWB_BG_MIN_BRIGHT
2110 {0xACB7, 0x2E, BYTE_LEN, 0 }, // AWB_BG_MAX_BRIGHT
2111 {0xAC44, 0x00, BYTE_LEN, 0 }, // AWB_LEFT_CCM_POS_RANGE_LIMIT
2112 {0xAC45, 0x08, BYTE_LEN, 0 }, // AWB_RIGHT_CCM_POS_RANGE_LIMIT
2113 {0xAC04, 0x5B, BYTE_LEN, 0 }, // AWB_PRE_AWB_R2G_RATIO
2114 {0xAC05, 0x2A, BYTE_LEN, 0 }, // AWB_PRE_AWB_B2G_RATIO
2115 {0xAC08, 0x00, BYTE_LEN, 0 }, // AWB_CUR_CCM_POS
2116 {SEQUENCE_END, 0x00, 0, 0}
2118 static struct reginfo *sensor_WhiteBalanceSeqe[] = {sensor_WhiteB_Auto, sensor_WhiteB_TungstenLamp1,sensor_WhiteB_TungstenLamp2,
2119 sensor_WhiteB_ClearDay, sensor_WhiteB_Cloudy,NULL,
2123 #if CONFIG_SENSOR_Brightness
2124 static struct reginfo sensor_Brightness0[]=
2126 {SEQUENCE_END, 0x00}
2129 static struct reginfo sensor_Brightness1[]=
2131 {SEQUENCE_END, 0x00}
2134 static struct reginfo sensor_Brightness2[]=
2136 {SEQUENCE_END, 0x00}
2139 static struct reginfo sensor_Brightness3[]=
2141 {SEQUENCE_END, 0x00}
2144 static struct reginfo sensor_Brightness4[]=
2146 {SEQUENCE_END, 0x00}
2149 static struct reginfo sensor_Brightness5[]=
2151 {SEQUENCE_END, 0x00}
2153 static struct reginfo *sensor_BrightnessSeqe[] = {sensor_Brightness0, sensor_Brightness1, sensor_Brightness2, sensor_Brightness3,
2154 sensor_Brightness4, sensor_Brightness5,NULL,
2159 #if CONFIG_SENSOR_Effect
2160 static struct reginfo sensor_Effect_Normal[] =
2162 {0x098e,0xdc38, WORD_LEN, 0},
2163 {0xdc38,0x00, BYTE_LEN, 0 },
2164 {0x8404,0x06, BYTE_LEN, 0 },
2165 {SEQUENCE_END, 0x00, 0, 0}
2168 static struct reginfo sensor_Effect_WandB[] =
2170 {SEQUENCE_END, 0x00, 0, 0}
2173 static struct reginfo sensor_Effect_Sepia[] =
2175 {0x098e,0xdc38, WORD_LEN, 0},
2176 {0xdc38,0x02, BYTE_LEN, 0 },
2177 {0xdc3a,0x10, BYTE_LEN, 0 },
2178 {0xdc3b,0xe0, BYTE_LEN, 0 },
2179 {0x8404,0x06, BYTE_LEN, 0 },
2180 {SEQUENCE_END, 0x00, 0, 0}
2183 static struct reginfo sensor_Effect_Negative[] =
2185 {0x098e,0xdc38, WORD_LEN, 0},
2186 {0xdc38,0x03, BYTE_LEN, 0 },
2187 {0x8404,0x06, BYTE_LEN, 0 },
2188 {SEQUENCE_END, 0x00, 0, 0}
2191 static struct reginfo sensor_Effect_Bluish[] =
2193 {SEQUENCE_END, 0x00, 0, 0}
2196 static struct reginfo sensor_Effect_Green[] =
2198 {SEQUENCE_END, 0x00, 0, 0}
2201 static struct reginfo sensor_Effect_Solarize[] =
2203 {0x098e,0xdc38, WORD_LEN, 0},
2204 {0xdc38,0x05, BYTE_LEN, 0 },
2205 {0xdc39,0x20, BYTE_LEN, 0 },
2206 {0x8404,0x06, BYTE_LEN, 0 },
2207 {SEQUENCE_END, 0x00, 0, 0}
2209 static struct reginfo *sensor_EffectSeqe[] = {sensor_Effect_Normal, sensor_Effect_Negative,sensor_Effect_Sepia,
2210 sensor_Effect_Solarize,NULL,
2213 #if CONFIG_SENSOR_Exposure
2214 static struct reginfo sensor_Exposure0[]=
2216 {SEQUENCE_END, 0x00}
2219 static struct reginfo sensor_Exposure1[]=
2221 {SEQUENCE_END, 0x00}
2224 static struct reginfo sensor_Exposure2[]=
2226 {SEQUENCE_END, 0x00}
2229 static struct reginfo sensor_Exposure3[]=
2231 {SEQUENCE_END, 0x00}
2234 static struct reginfo sensor_Exposure4[]=
2236 {SEQUENCE_END, 0x00}
2239 static struct reginfo sensor_Exposure5[]=
2241 {SEQUENCE_END, 0x00}
2244 static struct reginfo sensor_Exposure6[]=
2246 {SEQUENCE_END, 0x00}
2249 static struct reginfo *sensor_ExposureSeqe[] = {sensor_Exposure0, sensor_Exposure1, sensor_Exposure2, sensor_Exposure3,
2250 sensor_Exposure4, sensor_Exposure5,sensor_Exposure6,NULL,
2253 #if CONFIG_SENSOR_Saturation
2254 static struct reginfo sensor_Saturation0[]=
2256 {SEQUENCE_END, 0x00}
2259 static struct reginfo sensor_Saturation1[]=
2261 {SEQUENCE_END, 0x00}
2264 static struct reginfo sensor_Saturation2[]=
2266 {SEQUENCE_END, 0x00}
2268 static struct reginfo *sensor_SaturationSeqe[] = {sensor_Saturation0, sensor_Saturation1, sensor_Saturation2, NULL,};
2271 #if CONFIG_SENSOR_Contrast
2272 static struct reginfo sensor_Contrast0[]=
2274 {SEQUENCE_END, 0x00}
2277 static struct reginfo sensor_Contrast1[]=
2279 {SEQUENCE_END, 0x00}
2282 static struct reginfo sensor_Contrast2[]=
2284 {SEQUENCE_END, 0x00}
2287 static struct reginfo sensor_Contrast3[]=
2289 {SEQUENCE_END, 0x00}
2292 static struct reginfo sensor_Contrast4[]=
2294 {SEQUENCE_END, 0x00}
2298 static struct reginfo sensor_Contrast5[]=
2300 {SEQUENCE_END, 0x00}
2303 static struct reginfo sensor_Contrast6[]=
2305 {SEQUENCE_END, 0x00}
2307 static struct reginfo *sensor_ContrastSeqe[] = {sensor_Contrast0, sensor_Contrast1, sensor_Contrast2, sensor_Contrast3,
2308 sensor_Contrast4, sensor_Contrast5, sensor_Contrast6, NULL,
2312 #if CONFIG_SENSOR_Mirror
2313 static struct reginfo sensor_MirrorOn[]=
2315 {SEQUENCE_END, 0x00, 0, 0}
2318 static struct reginfo sensor_MirrorOff[]=
2320 {SEQUENCE_END, 0x00, 0, 0}
2322 static struct reginfo *sensor_MirrorSeqe[] = {sensor_MirrorOff, sensor_MirrorOn,NULL,};
2324 #if CONFIG_SENSOR_Flip
2325 static struct reginfo sensor_FlipOn[]=
2327 {SEQUENCE_END, 0x00, 0, 0}
2330 static struct reginfo sensor_FlipOff[]=
2332 {SEQUENCE_END, 0x00, 0, 0}
2334 static struct reginfo *sensor_FlipSeqe[] = {sensor_FlipOff, sensor_FlipOn,NULL,};
2338 #if CONFIG_SENSOR_Scene
2339 static struct reginfo sensor_SceneAuto[] =
2341 {SEQUENCE_END, 0x00, 0, 0}
2344 static struct reginfo sensor_SceneNight[] =
2346 {SEQUENCE_END, 0x00, 0, 0}
2348 static struct reginfo *sensor_SceneSeqe[] = {sensor_SceneAuto, sensor_SceneNight,NULL,};
2352 #if CONFIG_SENSOR_DigitalZoom
2353 static struct reginfo sensor_Zoom0[] =
2355 {SEQUENCE_END, 0x00, 0, 0}
2358 static struct reginfo sensor_Zoom1[] =
2360 {SEQUENCE_END, 0x00, 0, 0}
2363 static struct reginfo sensor_Zoom2[] =
2365 {SEQUENCE_END, 0x00, 0, 0}
2369 static struct reginfo sensor_Zoom3[] =
2371 {SEQUENCE_END, 0x00, 0, 0}
2373 static struct reginfo *sensor_ZoomSeqe[] = {sensor_Zoom0, sensor_Zoom1, sensor_Zoom2, sensor_Zoom3, NULL};
2375 static const struct v4l2_querymenu sensor_menus[] =
2377 #if CONFIG_SENSOR_WhiteBalance
2378 { .id = V4L2_CID_DO_WHITE_BALANCE, .index = 0, .name = "auto", .reserved = 0, }, { .id = V4L2_CID_DO_WHITE_BALANCE, .index = 1, .name = "incandescent", .reserved = 0,},
2379 { .id = V4L2_CID_DO_WHITE_BALANCE, .index = 2, .name = "fluorescent", .reserved = 0,}, { .id = V4L2_CID_DO_WHITE_BALANCE, .index = 3, .name = "daylight", .reserved = 0,},
2380 { .id = V4L2_CID_DO_WHITE_BALANCE, .index = 4, .name = "cloudy-daylight", .reserved = 0,},
2383 #if CONFIG_SENSOR_Effect
2384 { .id = V4L2_CID_EFFECT, .index = 0, .name = "none", .reserved = 0, }, { .id = V4L2_CID_EFFECT, .index = 1, .name = "negative", .reserved = 0,},
2385 { .id = V4L2_CID_EFFECT, .index = 2, .name = "sepia", .reserved = 0,}, { .id = V4L2_CID_EFFECT, .index = 3, .name = "solarize", .reserved = 0,},
2388 #if CONFIG_SENSOR_Scene
2389 { .id = V4L2_CID_SCENE, .index = 0, .name = "auto", .reserved = 0,} ,{ .id = V4L2_CID_SCENE, .index = 1, .name = "night", .reserved = 0,},
2392 #if CONFIG_SENSOR_Flash
2393 { .id = V4L2_CID_FLASH, .index = 0, .name = "off", .reserved = 0, }, { .id = V4L2_CID_FLASH, .index = 1, .name = "auto", .reserved = 0,},
2394 { .id = V4L2_CID_FLASH, .index = 2, .name = "on", .reserved = 0,}, { .id = V4L2_CID_FLASH, .index = 3, .name = "torch", .reserved = 0,},
2398 static struct v4l2_queryctrl sensor_controls[] =
2400 #if CONFIG_SENSOR_WhiteBalance
2402 .id = V4L2_CID_DO_WHITE_BALANCE,
2403 .type = V4L2_CTRL_TYPE_MENU,
2404 .name = "White Balance Control",
2412 #if CONFIG_SENSOR_Brightness
2414 .id = V4L2_CID_BRIGHTNESS,
2415 .type = V4L2_CTRL_TYPE_INTEGER,
2416 .name = "Brightness Control",
2424 #if CONFIG_SENSOR_Effect
2426 .id = V4L2_CID_EFFECT,
2427 .type = V4L2_CTRL_TYPE_MENU,
2428 .name = "Effect Control",
2436 #if CONFIG_SENSOR_Exposure
2438 .id = V4L2_CID_EXPOSURE,
2439 .type = V4L2_CTRL_TYPE_INTEGER,
2440 .name = "Exposure Control",
2448 #if CONFIG_SENSOR_Saturation
2450 .id = V4L2_CID_SATURATION,
2451 .type = V4L2_CTRL_TYPE_INTEGER,
2452 .name = "Saturation Control",
2460 #if CONFIG_SENSOR_Contrast
2462 .id = V4L2_CID_CONTRAST,
2463 .type = V4L2_CTRL_TYPE_INTEGER,
2464 .name = "Contrast Control",
2472 #if CONFIG_SENSOR_Mirror
2474 .id = V4L2_CID_HFLIP,
2475 .type = V4L2_CTRL_TYPE_BOOLEAN,
2476 .name = "Mirror Control",
2484 #if CONFIG_SENSOR_Flip
2486 .id = V4L2_CID_VFLIP,
2487 .type = V4L2_CTRL_TYPE_BOOLEAN,
2488 .name = "Flip Control",
2496 #if CONFIG_SENSOR_Scene
2498 .id = V4L2_CID_SCENE,
2499 .type = V4L2_CTRL_TYPE_MENU,
2500 .name = "Scene Control",
2508 #if CONFIG_SENSOR_DigitalZoom
2510 .id = V4L2_CID_ZOOM_RELATIVE,
2511 .type = V4L2_CTRL_TYPE_INTEGER,
2512 .name = "DigitalZoom Control",
2518 .id = V4L2_CID_ZOOM_ABSOLUTE,
2519 .type = V4L2_CTRL_TYPE_INTEGER,
2520 .name = "DigitalZoom Control",
2528 #if CONFIG_SENSOR_Focus
2530 .id = V4L2_CID_FOCUS_RELATIVE,
2531 .type = V4L2_CTRL_TYPE_INTEGER,
2532 .name = "Focus Control",
2538 .id = V4L2_CID_FOCUS_ABSOLUTE,
2539 .type = V4L2_CTRL_TYPE_INTEGER,
2540 .name = "Focus Control",
2544 .default_value = 125,
2547 .id = V4L2_CID_FOCUSZONE,
2548 .type = V4L2_CTRL_TYPE_INTEGER,
2549 .name = "FocusZone Control",
2555 .id = V4L2_CID_FOCUS_AUTO,
2556 .type = V4L2_CTRL_TYPE_BOOLEAN,
2557 .name = "Focus Control",
2563 .id = V4L2_CID_FOCUS_CONTINUOUS,
2564 .type = V4L2_CTRL_TYPE_BOOLEAN,
2565 .name = "Focus Control",
2573 #if CONFIG_SENSOR_Flash
2575 .id = V4L2_CID_FLASH,
2576 .type = V4L2_CTRL_TYPE_MENU,
2577 .name = "Flash Control",
2587 static int sensor_probe(struct i2c_client *client, const struct i2c_device_id *did);
2588 static int sensor_video_probe(struct soc_camera_device *icd, struct i2c_client *client);
2589 static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
2590 static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
2591 static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl);
2592 static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl);
2593 static int sensor_suspend(struct soc_camera_device *icd, pm_message_t pm_msg);
2594 static int sensor_resume(struct soc_camera_device *icd);
2595 static int sensor_set_bus_param(struct soc_camera_device *icd,unsigned long flags);
2596 static unsigned long sensor_query_bus_param(struct soc_camera_device *icd);
2597 static int sensor_set_effect(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value);
2598 static int sensor_set_whiteBalance(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value);
2599 static int sensor_deactivate(struct i2c_client *client);
2601 static struct soc_camera_ops sensor_ops =
2603 .suspend = sensor_suspend,
2604 .resume = sensor_resume,
2605 .set_bus_param = sensor_set_bus_param,
2606 .query_bus_param = sensor_query_bus_param,
2607 .controls = sensor_controls,
2608 .menus = sensor_menus,
2609 .num_controls = ARRAY_SIZE(sensor_controls),
2610 .num_menus = ARRAY_SIZE(sensor_menus),
2613 /* only one fixed colorspace per pixelcode */
2614 struct sensor_datafmt {
2615 enum v4l2_mbus_pixelcode code;
2616 enum v4l2_colorspace colorspace;
2619 /* Find a data format by a pixel code in an array */
2620 static const struct sensor_datafmt *sensor_find_datafmt(
2621 enum v4l2_mbus_pixelcode code, const struct sensor_datafmt *fmt,
2625 for (i = 0; i < n; i++)
2626 if (fmt[i].code == code)
2632 static const struct sensor_datafmt sensor_colour_fmts[] = {
2633 {V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},
2634 {V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
2640 WqCmd_af_special_pos,
2644 WqCmd_af_return_idle,
2646 enum sensor_wq_result
2654 struct i2c_client *client;
2655 struct delayed_work dwork;
2656 enum sensor_wq_cmd cmd;
2657 wait_queue_head_t done;
2658 enum sensor_wq_result result;
2661 int zone_center_pos[2];
2663 typedef struct sensor_info_priv_s
2677 unsigned char mirror; /* HFLIP */
2678 unsigned char flip; /* VFLIP */
2685 struct reginfo *winseqe_cur_addr;
2686 struct sensor_datafmt fmt;
2687 unsigned int enable;
2688 unsigned int funmodule_state;
2689 } sensor_info_priv_t;
2693 struct sensor_parameter
2695 unsigned short int preview_maxlines;
2696 unsigned short int preview_exposure;
2697 unsigned short int preview_line_width;
2698 unsigned short int preview_gain;
2700 unsigned short int capture_framerate;
2701 unsigned short int preview_framerate;
2706 struct v4l2_subdev subdev;
2707 struct i2c_client *client;
2708 sensor_info_priv_t info_priv;
2709 struct sensor_parameter parameter;
2710 struct workqueue_struct *sensor_wq;
2711 struct sensor_work sensor_wk;
2712 struct mutex wq_lock;
2713 int model; /* V4L2_IDENT_OV* codes from v4l2-chip-ident.h */
2714 #if CONFIG_SENSOR_I2C_NOSCHED
2715 atomic_t tasklock_cnt;
2717 struct rk29camera_platform_data *sensor_io_request;
2718 struct rk29camera_gpio_res *sensor_gpio_res;
2722 static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf);
2724 static struct sensor* to_sensor(const struct i2c_client *client)
2726 return container_of(i2c_get_clientdata(client), struct sensor, subdev);
2729 static int sensor_task_lock(struct i2c_client *client, int lock)
2731 #if CONFIG_SENSOR_I2C_NOSCHED
2733 struct sensor *sensor = to_sensor(client);
2736 if (atomic_read(&sensor->tasklock_cnt) == 0) {
2737 while ((atomic_read(&client->adapter->bus_lock.count) < 1) && (cnt>0)) {
2738 SENSOR_TR("\n %s will obtain i2c in atomic, but i2c bus is locked! Wait...\n",SENSOR_NAME_STRING());
2742 if ((atomic_read(&client->adapter->bus_lock.count) < 1) && (cnt<=0)) {
2743 SENSOR_TR("\n %s obtain i2c fail in atomic!!\n",SENSOR_NAME_STRING());
2744 goto sensor_task_lock_err;
2749 atomic_add(1, &sensor->tasklock_cnt);
2751 if (atomic_read(&sensor->tasklock_cnt) > 0) {
2752 atomic_sub(1, &sensor->tasklock_cnt);
2754 if (atomic_read(&sensor->tasklock_cnt) == 0)
2759 sensor_task_lock_err:
2765 /*sensor register write */
2766 static int sensor_write(struct i2c_client *client, struct reginfo *reg_info)
2770 struct i2c_msg msg[1];
2772 switch (reg_info->reg)
2774 case SEQUENCE_WAIT_MS:
2777 mdelay(reg_info->val);
2779 msleep(reg_info->val);
2783 case SEQUENCE_WAIT_US:
2785 udelay(reg_info->val);
2788 case SEQUENCE_PROPERTY:
2794 buf[0] = reg_info->reg >> 8;
2795 buf[1] = reg_info->reg & 0xFF;
2796 if (reg_info->reg_len == WORD_LEN) {
2797 buf[2] = reg_info->val >> 8;
2798 buf[3] = reg_info->val & 0xFF;
2800 } else if (reg_info->reg_len == BYTE_LEN) {
2801 buf[2] = reg_info->val;
2804 msg->addr = client->addr;
2805 msg->flags = client->flags;
2807 msg->scl_rate = CONFIG_SENSOR_I2C_SPEED; /* ddl@rock-chips.com : 100kHz */
2808 msg->read_type = 0; /* fpga i2c:0==I2C_NORMAL : direct use number not enum for don't want include spi_fpga.h */
2811 while ((cnt-- > 0) && (err < 0)) { /* ddl@rock-chips.com : Transfer again if transent is failed */
2812 err = i2c_transfer(client->adapter, msg, 1);
2817 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);
2827 *sensor_write_Multiple_data - sensor register write with Multiple data
2829 * @reg_info: the first register address
2830 * @count: data number
2832 * Returns negative errno, else the number of messages executed.
2836 static int sensor_write_Multiple_data(struct i2c_client *client, struct reginfo *reg_info, int count)
2841 struct reginfo *tmpval = NULL;
2843 struct i2c_msg msg[1];
2846 if(count < 1 || tmpval==NULL||tmpval->reg==0x0000)
2849 memset((char*)&msg[0],0,sizeof(struct i2c_msg));
2850 buf = kmalloc((count*2+10)*sizeof(u8),GFP_KERNEL);
2852 SENSOR_TR("%s %s fail,because kmalloc failed",SENSOR_NAME_STRING(),__FUNCTION__);
2854 goto sensor_write_Multiple_data_end;
2856 memset(buf,0,sizeof(buf));
2858 switch (reg_info->reg)
2860 case SEQUENCE_WAIT_MS:
2863 mdelay(reg_info->val);
2865 msleep(reg_info->val);
2869 case SEQUENCE_WAIT_US:
2871 udelay(reg_info->val);
2875 case SEQUENCE_PROPERTY:
2882 buf[0] = tmpval->reg >> 8;
2883 buf[1] = tmpval->reg & 0xFF;
2885 if (tmpval->reg_len == WORD_LEN)
2890 buf[i] = tmpval->val >> 8;
2891 buf[i+1] = tmpval->val & 0xFF;
2896 } else if (tmpval->reg_len == BYTE_LEN) {
2900 buf[i] = tmpval->val;
2906 msg->addr = client->addr;
2907 msg->flags = client->flags;
2909 msg->scl_rate = CONFIG_SENSOR_I2C_SPEED; /* ddl@rock-chips.com : 100kHz */
2910 msg->read_type = 0; /* fpga i2c:0==I2C_NORMAL : direct use number not enum for don't want include spi_fpga.h */
2913 while ((cnt-- > 0) && (err < 0)) { /* ddl@rock-chips.com : Transfer again if transent is failed */
2914 err = i2c_transfer(client->adapter, msg, 1);
2918 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);
2924 sensor_write_Multiple_data_end:
2932 /* sensor register read */
2933 static int sensor_read(struct i2c_client *client, u16 reg, u16 *val)
2937 struct i2c_msg msg[2];
2940 buf[1] = reg & 0xFF;
2942 msg[0].addr = client->addr;
2943 msg[0].flags = client->flags;
2945 msg[0].len = sizeof(buf);
2946 msg[0].scl_rate = CONFIG_SENSOR_I2C_SPEED; /* ddl@rock-chips.com : 100kHz */
2947 msg[0].read_type = 2; /* fpga i2c:0==I2C_NO_STOP : direct use number not enum for don't want include spi_fpga.h */
2949 msg[1].addr = client->addr;
2950 msg[1].flags = client->flags|I2C_M_RD;
2953 msg[1].scl_rate = CONFIG_SENSOR_I2C_SPEED; /* ddl@rock-chips.com : 100kHz */
2954 msg[1].read_type = 2; /* fpga i2c:0==I2C_NO_STOP : direct use number not enum for don't want include spi_fpga.h */
2958 while ((cnt-- > 0) && (err < 0)) { /* ddl@rock-chips.com : Transfer again if transent is failed */
2959 err = i2c_transfer(client->adapter, msg, 2);
2965 SENSOR_TR("\n %s read reg(0x%x val:0x%x) failed, try to read again! \n",SENSOR_NAME_STRING(),reg, *val);
2973 static int sensor_read1(struct i2c_client *client, struct reginfo *reg_info)
2977 struct i2c_msg msg[2];
2979 buf[0] = reg_info->reg >> 8;
2980 buf[1] = reg_info->reg & 0xFF;
2983 msg[0].addr = client->addr;
2984 msg[0].flags = client->flags;
2986 msg[0].len = sizeof(buf);
2987 msg[0].scl_rate = CONFIG_SENSOR_I2C_SPEED; /* ddl@rock-chips.com : 100kHz */
2988 msg[0].read_type = 2; /* fpga i2c:0==I2C_NO_STOP : direct use number not enum for don't want include spi_fpga.h */
2990 msg[1].addr = client->addr;
2991 msg[1].flags = client->flags|I2C_M_RD;
2993 if (reg_info->reg_len == WORD_LEN) {
2995 } else if (reg_info->reg_len == BYTE_LEN) {
2998 msg[1].scl_rate = CONFIG_SENSOR_I2C_SPEED; /* ddl@rock-chips.com : 100kHz */
2999 msg[1].read_type = 2; /* fpga i2c:0==I2C_NO_STOP : direct use number not enum for don't want include spi_fpga.h */
3003 while ((cnt-- > 0) && (err < 0)) { /* ddl@rock-chips.com : Transfer again if transent is failed */
3004 err = i2c_transfer(client->adapter, msg, 2);
3007 if (reg_info->reg_len == WORD_LEN) {
3008 reg_info->val = buf[0];
3009 reg_info->val <<= 8;
3010 reg_info->val |= buf[1];
3011 } else if (reg_info->reg_len == BYTE_LEN) {
3012 reg_info->val = buf[0];
3016 SENSOR_TR("\n %s read reg(0x%x val:0x%x) failed, try to read again! \n",SENSOR_NAME_STRING(),reg_info->reg, reg_info->val);
3024 /* write a array of registers */
3025 static int sensor_write_array(struct i2c_client *client, struct reginfo *regarray)
3032 #if CONFIG_SENSOR_I2C_RDWRCHK
3037 if (sensor_task_lock(client, 1) < 0)
3038 goto sensor_write_array_end;
3040 // SENSOR_TR("%s ..%s..\n",SENSOR_NAME_STRING(),__FUNCTION__);
3042 while (regarray[i].reg != SEQUENCE_END) {
3046 while((regarray[j].reg_len ==regarray[i].reg_len)&®array[j].reg != SEQUENCE_END)
3048 temp = regarray[j].reg - regarray[j-1].reg;
3049 if((regarray[j].reg_len==WORD_LEN && temp!=0x0002)||(regarray[j].reg_len==BYTE_LEN && temp!=0x0001))
3055 err = sensor_write_Multiple_data(client, ®array[i], num) ;
3059 SENSOR_TR("%s..write failed current reg:0x%x, Write array again !\n", SENSOR_NAME_STRING(),regarray[i].reg);
3063 SENSOR_TR("%s..write array failed!!!\n", SENSOR_NAME_STRING());
3065 goto sensor_write_array_end;
3068 #if CONFIG_SENSOR_I2C_RDWRCHK
3069 sensor_read(client, regarray[i].reg, &valchk);
3070 if (valchk != regarray[i].val)
3071 SENSOR_TR("%s Reg:0x%x write(0x%x, 0x%x) fail\n",SENSOR_NAME_STRING(), regarray[i].reg, regarray[i].val, valchk);
3077 sensor_write_array_end:
3078 sensor_task_lock(client,0);
3082 /* write sensor initial data */
3083 static int sensor_write_init_data(struct i2c_client *client, struct reginfo *regarray)
3088 #if CONFIG_SENSOR_I2C_RDWRCHK
3092 int table[167] = { /*written data numbers every time*/
3093 3,1,1,3,1,1,1,1,11,2,2,13,1,1,1,2,11,2,2,13,
3094 1,2,1,1,2,1,1,1,1,1,8,1,1,1,1,1,1,714,1,1,
3095 1,1,1,1,1,42,1,3,9,1,1,2,2,1,1,1,1,3,1,1,
3096 1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,8,2,2,2,
3097 2,2,1,1,1,1,10,10,9,6,4,2,9,2,2,2,1,1,1,1,
3098 1,1,1,1,1,1,1,1,58,1,1,1,1,1,1,1,1,1,1,1,
3099 2,2,2,2,2,2,2,2,2,3,3,2,1,1,1,1,1, 2,2,1,
3100 6,3,1,1,1,1,1,6,1,2,4,4,1,1,1,4,5,2,2,4,
3105 if (sensor_task_lock(client, 1) < 0)
3106 goto sensor_write_array_end;
3108 while (regarray[i].reg != SEQUENCE_END) {
3117 err = sensor_write_Multiple_data(client, ®array[i], num) ;
3121 SENSOR_TR("%s..write failed current reg:0x%x, Write array again !\n", SENSOR_NAME_STRING(),regarray[i].reg);
3125 SENSOR_TR("%s..write array failed!!!\n", SENSOR_NAME_STRING());
3127 goto sensor_write_array_end;
3130 #if CONFIG_SENSOR_I2C_RDWRCHK
3131 sensor_read(client, regarray[i].reg, &valchk);
3132 if (valchk != regarray[i].val)
3133 SENSOR_TR("%s Reg:0x%x write(0x%x, 0x%x) fail\n",SENSOR_NAME_STRING(), regarray[i].reg, regarray[i].val, valchk);
3138 sensor_write_array_end:
3139 sensor_task_lock(client,0);
3144 /* write a array of registers */
3145 static int sensor_write_array(struct i2c_client *client, struct reginfo *regarray)
3149 #if CONFIG_SENSOR_I2C_RDWRCHK
3153 if (sensor_task_lock(client, 1) < 0)
3154 goto sensor_write_array_end;
3156 while (regarray[i].reg != SEQUENCE_END) {
3158 err = sensor_write(client, ®array[i]);
3163 SENSOR_TR("%s..write failed current reg:0x%x, Write array again !\n", SENSOR_NAME_STRING(),regarray[i].reg);
3167 SENSOR_TR("%s..write array failed!!!\n", SENSOR_NAME_STRING());
3169 goto sensor_write_array_end;
3172 #if CONFIG_SENSOR_I2C_RDWRCHK
3173 sensor_read(client, regarray[i].reg, &valchk);
3174 if (valchk != regarray[i].val)
3175 SENSOR_TR("%s Reg:0x%x write(0x%x, 0x%x) fail\n",SENSOR_NAME_STRING(), regarray[i].reg, regarray[i].val, valchk);
3180 sensor_write_array_end:
3181 sensor_task_lock(client,0);
3185 #if CONFIG_SENSOR_I2C_RDWRCHK
3186 static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regarray)
3194 while (regarray[i].reg != SEQUENCE_END)
3196 sensor_read(client, regarray[i].reg, &valchk);
3197 if (valchk != regarray[i].val)
3198 SENSOR_TR("%s Reg:0x%x read(0x%x, 0x%x) error\n",SENSOR_NAME_STRING(), regarray[i].reg, regarray[i].val, valchk);
3206 #if CONFIG_SENSOR_Focus
3208 static struct reginfo sensor_af_trigger[] =
3210 { 0xB854, 0x4040, WORD_LEN, 0}, // STAT_SM_WINDOW_POS_X; POS_Y
3211 { 0xB856, 0x4040, WORD_LEN, 0}, // STAT_SM_WINDOW_SIZE_X; SIZE_Y
3212 { 0xB006, 0x01, BYTE_LEN, 0}, //run AF - af.progress
3213 {SEQUENCE_END, 0x00, 0, 0}
3215 static int sensor_af_touch_zone(struct i2c_client *client, int *zone_center_pos)
3219 zone_center_pos[0] = zone_center_pos[0]*0x100/2000;
3220 zone_center_pos[1] = zone_center_pos[1]*0x100/2000;
3222 zone_center_pos[0] = zone_center_pos[0]/0x40*0x40;
3223 zone_center_pos[1] = zone_center_pos[1]/0x40*0x40;
3225 sensor_af_trigger[0].val = (zone_center_pos[0]<<8)|zone_center_pos[1];
3230 static int sensor_af_single(struct i2c_client *client)
3236 ret = sensor_write_array(client, sensor_af_trigger);
3238 SENSOR_TR("%s sensor auto focus trigger fail!!\n",SENSOR_NAME_STRING());
3241 reg.reg_len = BYTE_LEN;
3247 sensor_read1(client,®);
3249 } while ((reg.val != 0) && (cnt++ < 50));
3251 SENSOR_DG("%s sensor auto focus trigger(0x%x) success! state: %d, cnt: %d\n",SENSOR_NAME_STRING(),
3252 sensor_af_trigger[0].val,reg.val,cnt);
3256 sensor_af_single_end:
3260 static int sensor_af_const(struct i2c_client *client)
3264 sensor_af_const_end:
3268 static int sensor_af_init(struct i2c_client *client)
3273 static int sensor_af_downfirmware(struct i2c_client *client)
3275 struct sensor *sensor = to_sensor(client);
3277 struct soc_camera_device *icd = client->dev.platform_data;
3278 struct v4l2_mbus_framefmt mf;
3280 SENSOR_DG("%s %s Enter\n",SENSOR_NAME_STRING(), __FUNCTION__);
3282 if (sensor_af_init(client)) {
3283 sensor->info_priv.funmodule_state &= (~SENSOR_AF_IS_OK);
3286 sensor->info_priv.funmodule_state |= SENSOR_AF_IS_OK;
3288 mf.width = icd->user_width;
3289 mf.height = icd->user_height;
3290 mf.code = sensor->info_priv.fmt.code;
3291 mf.colorspace = sensor->info_priv.fmt.colorspace;
3292 mf.field = V4L2_FIELD_NONE;
3293 if (sensor_fmt_videochk(NULL, &mf) == true) { /* ddl@rock-chips.com: focus mode fix const auto focus in video */
3294 ret = sensor_af_const(client);
3296 switch (sensor->info_priv.auto_focus)
3298 case SENSOR_AF_MODE_AUTO:
3300 ret = sensor_af_single(client);
3303 case SENSOR_AF_MODE_CLOSE:
3308 case SENSOR_AF_MODE_CONTINUOUS:
3310 ret = sensor_af_const(client);
3315 SENSOR_DG("%s focus mode(0x%x) is unkonwn\n",SENSOR_NAME_STRING(),sensor->info_priv.auto_focus);
3316 goto sensor_af_downfirmware_end;
3320 SENSOR_DG("%s sensor_af_downfirmware set focus mode(0x%x) ret:0x%x\n",SENSOR_NAME_STRING(), sensor->info_priv.auto_focus,ret);
3323 sensor_af_downfirmware_end:
3327 static void sensor_af_workqueue(struct work_struct *work)
3329 struct sensor_work *sensor_work = container_of(work, struct sensor_work, dwork.work);
3330 struct i2c_client *client = sensor_work->client;
3331 struct sensor *sensor = to_sensor(client);
3332 //struct af_cmdinfo cmdinfo;
3334 SENSOR_DG("%s %s Enter, cmd:0x%x \n",SENSOR_NAME_STRING(), __FUNCTION__,sensor_work->cmd);
3336 mutex_lock(&sensor->wq_lock);
3338 switch (sensor_work->cmd)
3342 if (sensor_af_downfirmware(client) < 0) {
3343 SENSOR_TR("%s Sensor_af_init is failed in sensor_af_workqueue!\n",SENSOR_NAME_STRING());
3347 case WqCmd_af_single:
3349 if ((sensor_work->zone_center_pos[0] >=0) && (sensor_work->zone_center_pos[1]>=0))
3350 sensor_af_touch_zone(client,sensor_work->zone_center_pos);
3352 if (sensor_af_single(client) < 0) {
3353 SENSOR_TR("%s Sensor_af_single is failed in sensor_af_workqueue!\n",SENSOR_NAME_STRING());
3354 sensor_work->result = WqRet_fail;
3356 sensor_work->result = WqRet_success;
3361 case WqCmd_af_special_pos:
3363 sensor_af_idlechk(client);
3365 cmdinfo.cmd_tag = StepFocus_Spec_Tag;
3366 cmdinfo.cmd_para[0] = sensor_work->var;
3367 cmdinfo.validate_bit = 0x81;
3368 if (sensor_af_cmdset(client, StepMode_Cmd, &cmdinfo) < 0)
3369 sensor_work->result = WqRet_fail;
3371 sensor_work->result = WqRet_success;
3374 case WqCmd_af_near_pos:
3376 sensor_af_idlechk(client);
3377 cmdinfo.cmd_tag = StepFocus_Near_Tag;
3378 cmdinfo.validate_bit = 0x80;
3379 if (sensor_af_cmdset(client, StepMode_Cmd, &cmdinfo) < 0)
3380 sensor_work->result = WqRet_fail;
3382 sensor_work->result = WqRet_success;
3385 case WqCmd_af_far_pos:
3387 sensor_af_idlechk(client);
3388 cmdinfo.cmd_tag = StepFocus_Far_Tag;
3389 cmdinfo.validate_bit = 0x80;
3390 if (sensor_af_cmdset(client, StepMode_Cmd, &cmdinfo) < 0)
3391 sensor_work->result = WqRet_fail;
3393 sensor_work->result = WqRet_success;
3397 case WqCmd_af_continues:
3399 if (sensor_af_const(client) < 0)
3400 sensor_work->result = WqRet_fail;
3402 sensor_work->result = WqRet_success;
3406 case WqCmd_af_return_idle:
3408 if (sensor_af_idlechk(client) < 0)
3409 sensor_work->result = WqRet_fail;
3411 sensor_work->result = WqRet_success;
3416 SENSOR_TR("Unknow command(%d) in %s af workqueue!",sensor_work->cmd,SENSOR_NAME_STRING());
3420 if (sensor_work->wait == false) {
3421 kfree((void*)sensor_work);
3423 wake_up(&sensor_work->done);
3425 mutex_unlock(&sensor->wq_lock);
3429 static int sensor_af_workqueue_set(struct soc_camera_device *icd, enum sensor_wq_cmd cmd, int var, bool wait, int *zone_pos)
3431 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3432 struct sensor *sensor = to_sensor(client);
3433 struct sensor_work *wk;
3436 if (sensor->sensor_wq == NULL) {
3438 goto sensor_af_workqueue_set_end;
3441 if ((sensor->info_priv.funmodule_state & SENSOR_AF_IS_OK) != SENSOR_AF_IS_OK) {
3442 if (cmd != WqCmd_af_init) {
3443 SENSOR_TR("%s %s cmd(%d) ingore,because af module isn't ready!",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
3445 goto sensor_af_workqueue_set_end;
3449 wk = kzalloc(sizeof(struct sensor_work), GFP_KERNEL);
3451 wk->client = client;
3452 INIT_DELAYED_WORK(&wk->dwork, sensor_af_workqueue);
3454 wk->result = WqRet_inval;
3460 *(zone_pos+1) += 1000;
3461 *(zone_pos+2) += 1000;
3462 *(zone_pos+3) += 1000;
3463 wk->zone_center_pos[0] = ((*zone_pos + *(zone_pos+2))>>1);
3464 wk->zone_center_pos[1] = ((*(zone_pos+1) + *(zone_pos+3))>>1);
3467 init_waitqueue_head(&wk->done);
3469 /* ddl@rock-chips.com:
3470 * video_lock is been locked in v4l2_ioctl function, but auto focus may slow,
3471 * As a result any other ioctl calls will proceed very, very slowly since each call
3472 * will have to wait for the AF to finish. Camera preview is pause,because VIDIOC_QBUF
3473 * and VIDIOC_DQBUF is sched. so unlock video_lock here.
3476 queue_delayed_work(sensor->sensor_wq,&(wk->dwork),0);
3477 mutex_unlock(&icd->video_lock);
3478 if (wait_event_timeout(wk->done, (wk->result != WqRet_inval), msecs_to_jiffies(5000)) == 0) { //hhb
3479 SENSOR_TR("%s %s cmd(%d) is timeout!\n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
3483 mutex_lock(&icd->video_lock);
3485 queue_delayed_work(sensor->sensor_wq,&(wk->dwork),msecs_to_jiffies(10));
3489 SENSOR_TR("%s %s cmd(%d) ingore,because struct sensor_work malloc failed!",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
3492 sensor_af_workqueue_set_end:
3497 static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
3499 struct soc_camera_link *icl = to_soc_camera_link(icd);
3502 SENSOR_DG("%s %s cmd(%d) on(%d)\n",SENSOR_NAME_STRING(),__FUNCTION__,cmd,on);
3505 case Sensor_PowerDown:
3507 if (icl->powerdown) {
3508 ret = icl->powerdown(icd->pdev, on);
3509 if (ret == RK29_CAM_IO_SUCCESS) {
3513 icl->reset(icd->pdev);
3515 } else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
3517 goto sensor_power_end;
3524 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3525 struct sensor *sensor = to_sensor(client);
3527 if (sensor->sensor_io_request && sensor->sensor_io_request->sensor_ioctrl) {
3528 sensor->sensor_io_request->sensor_ioctrl(icd->pdev,Cam_Flash, on);
3529 printk( "Sensor_Flash on = %d\n", on );
3532 //flash off after 2 secs
3533 if ( flash_off_timer.status ){
3534 hrtimer_cancel(&(flash_off_timer.timer));
3536 hrtimer_start(&(flash_off_timer.timer),ktime_set(0, 800*1000*1000),HRTIMER_MODE_REL);
3537 flash_off_timer.status = 1;
3539 flash_off_timer.status = 0;
3547 SENSOR_TR("%s %s cmd(0x%x) is unknown!",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
3556 static enum hrtimer_restart flash_off_func(struct hrtimer *hrtimer){
3557 struct flash_timer *fps_timer = container_of(hrtimer, struct flash_timer, timer);
3558 sensor_ioctrl(fps_timer->icd,Sensor_Flash,0);
3559 printk("%s %s = 0x%x !!!!!!",SENSOR_NAME_STRING(),__FUNCTION__, fps_timer );
3563 static int sensor_init(struct v4l2_subdev *sd, u32 val)
3565 struct i2c_client *client = v4l2_get_subdevdata(sd);
3566 struct soc_camera_device *icd = client->dev.platform_data;
3567 struct sensor *sensor = to_sensor(client);
3568 #if (ADJUST_OPTIMIZE_TIME_FALG == 0)
3569 const struct v4l2_queryctrl *qctrl;
3571 const struct sensor_datafmt *fmt;
3574 #if (SENSOR_RESET_REG != SEQUENCE_END)
3575 struct reginfo reg_info;
3578 SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
3580 if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
3582 goto sensor_INIT_ERR;
3585 SENSOR_DG("\n soft reset..%s.\n",SENSOR_NAME_STRING());
3588 if (sensor_task_lock(client,1)<0)
3589 goto sensor_INIT_ERR;
3591 #if (SENSOR_RESET_REG != SEQUENCE_END)
3592 reg_info.reg = SENSOR_RESET_REG;
3593 reg_info.val = SENSOR_RESET_VAL;
3594 reg_info.reg_len = SENSOR_RESET_REG_LEN;
3595 ret = sensor_write(client, ®_info);
3597 SENSOR_TR("%s soft reset sensor failed\n",SENSOR_NAME_STRING());
3599 goto sensor_INIT_ERR;
3601 mdelay(5); //delay 5 microseconds
3604 /* check if it is an sensor sensor */
3605 #if (SENSOR_ID_REG != SEQUENCE_END)
3606 ret = sensor_read(client, SENSOR_ID_REG, &pid);
3608 SENSOR_TR("read chip id failed\n");
3610 goto sensor_INIT_ERR;
3612 SENSOR_DG("\n %s pid = 0x%x \n", SENSOR_NAME_STRING(), pid);
3617 if (pid == SENSOR_ID) {
3618 sensor->model = SENSOR_V4L2_IDENT;
3620 SENSOR_TR("error: %s mismatched pid = 0x%x\n", SENSOR_NAME_STRING(), pid);
3622 goto sensor_INIT_ERR;
3625 SENSOR_DG("\n sensor_init_data..%s.\n",SENSOR_NAME_STRING());
3627 ret =sensor_write_init_data(client, sensor_init_data);
3629 SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
3630 goto sensor_INIT_ERR;
3632 sensor_task_lock(client,0);
3633 sensor->info_priv.preview_w = SENSOR_INIT_WIDTH;
3634 sensor->info_priv.preview_h = SENSOR_INIT_HEIGHT;
3635 sensor->info_priv.capture_w = SENSOR_MAX_WIDTH;
3636 sensor->info_priv.capture_h = SENSOR_MAX_HEIGHT;
3637 sensor->info_priv.winseqe_cur_addr = SENSOR_INIT_WINSEQADR;
3638 fmt = sensor_find_datafmt(SENSOR_INIT_PIXFMT,sensor_colour_fmts, ARRAY_SIZE(sensor_colour_fmts));
3640 SENSOR_TR("error: %s initial array colour fmts is not support!!",SENSOR_NAME_STRING());
3642 goto sensor_INIT_ERR;
3644 sensor->info_priv.fmt = *fmt;
3646 /* sensor sensor information for initialization */
3647 #if ADJUST_OPTIMIZE_TIME_FALG
3648 SENSOR_DG("\n optimize code..%s.\n",SENSOR_NAME_STRING());
3649 #if CONFIG_SENSOR_WhiteBalance
3650 sensor->info_priv.whiteBalance = 0;
3652 #if CONFIG_SENSOR_Brightness
3653 sensor->info_priv.brightness = 0;
3655 #if CONFIG_SENSOR_Effect
3656 sensor->info_priv.effect = 0;
3658 #if CONFIG_SENSOR_Exposure
3659 sensor->info_priv.exposure = 0;
3661 #if CONFIG_SENSOR_Saturation
3662 sensor->info_priv.saturation = 0;
3664 #if CONFIG_SENSOR_Contrast
3665 sensor->info_priv.contrast = 0;
3667 #if CONFIG_SENSOR_Mirror
3668 sensor->info_priv.mirror = 1;
3670 #if CONFIG_SENSOR_Flip
3671 sensor->info_priv.flip = 1;
3674 #if CONFIG_SENSOR_Scene
3675 sensor->info_priv.scene = 0;
3678 #if CONFIG_SENSOR_DigitalZoom
3679 sensor->info_priv.digitalzoom = 0;
3681 #if CONFIG_SENSOR_Focus
3682 sensor->info_priv.focus = 125 ;
3683 if (sensor_af_init(client) < 0) {
3684 sensor->info_priv.funmodule_state &= ~SENSOR_AF_IS_OK;
3685 SENSOR_TR("%s auto focus module init is fail!\n",SENSOR_NAME_STRING());
3687 sensor->info_priv.funmodule_state |= SENSOR_AF_IS_OK;
3688 SENSOR_DG("%s auto focus module init is success!\n",SENSOR_NAME_STRING());
3691 #if CONFIG_SENSOR_Flash
3692 sensor->info_priv.flash = 0 ;
3696 SENSOR_DG("\n origin code..%s.\n",SENSOR_NAME_STRING());
3698 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_DO_WHITE_BALANCE);
3700 sensor->info_priv.whiteBalance = qctrl->default_value;
3702 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_BRIGHTNESS);
3704 sensor->info_priv.brightness = qctrl->default_value;
3706 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_EFFECT);
3708 sensor->info_priv.effect = qctrl->default_value;
3710 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_EXPOSURE);
3712 sensor->info_priv.exposure = qctrl->default_value;
3714 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_SATURATION);
3716 sensor->info_priv.saturation = qctrl->default_value;
3718 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_CONTRAST);
3720 sensor->info_priv.contrast = qctrl->default_value;
3722 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_HFLIP);
3724 sensor->info_priv.mirror = qctrl->default_value;
3726 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_VFLIP);
3728 sensor->info_priv.flip = qctrl->default_value;
3730 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_SCENE);
3732 sensor->info_priv.scene = qctrl->default_value;
3734 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_ZOOM_ABSOLUTE);
3736 sensor->info_priv.digitalzoom = qctrl->default_value;
3738 /* ddl@rock-chips.com : if sensor support auto focus and flash, programer must run focus and flash code */
3739 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FOCUS_ABSOLUTE);
3741 sensor->info_priv.focus = qctrl->default_value;
3743 #if CONFIG_SENSOR_Focus
3744 if (sensor_af_init(client) < 0) {
3745 sensor->info_priv.funmodule_state &= ~SENSOR_AF_IS_OK;
3746 SENSOR_TR("%s auto focus module init is fail!\n",SENSOR_NAME_STRING());
3748 sensor->info_priv.funmodule_state |= SENSOR_AF_IS_OK;
3749 SENSOR_DG("%s auto focus module init is success!\n",SENSOR_NAME_STRING());
3752 #ifdef CONFIG_SENSOR_Flash
3753 qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
3755 sensor->info_priv.flash = qctrl->default_value;
3757 flash_off_timer.icd = icd;
3758 flash_off_timer.timer.function = flash_off_func;
3759 printk( "flash_off_timer.timer.function\n" );
3763 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);
3764 sensor->info_priv.funmodule_state |= SENSOR_INIT_IS_OK;
3767 sensor->info_priv.funmodule_state &= ~SENSOR_INIT_IS_OK;
3768 sensor_task_lock(client,0);
3769 sensor_deactivate(client);
3772 static int sensor_deactivate(struct i2c_client *client)
3774 struct soc_camera_device *icd = client->dev.platform_data;
3775 struct sensor *sensor = to_sensor(client);
3777 SENSOR_DG("\n%s..%s.. Enter\n",SENSOR_NAME_STRING(),__FUNCTION__);
3779 /* ddl@rock-chips.com : all sensor output pin must change to input for other sensor */
3782 sensor_ioctrl(icd, Sensor_PowerDown, 1);
3785 /* ddl@rock-chips.com : sensor config init width , because next open sensor quickly(soc_camera_open -> Try to configure with default parameters) */
3786 icd->user_width = SENSOR_INIT_WIDTH;
3787 icd->user_height = SENSOR_INIT_HEIGHT;
3788 sensor->info_priv.funmodule_state &= ~SENSOR_INIT_IS_OK;
3792 static struct reginfo sensor_power_down_sequence[]=
3796 static int sensor_suspend(struct soc_camera_device *icd, pm_message_t pm_msg)
3799 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
3801 if (pm_msg.event == PM_EVENT_SUSPEND) {
3802 SENSOR_DG("\n %s Enter Suspend..pm_msg.event=%d \n", SENSOR_NAME_STRING(),pm_msg.event);
3803 ret = sensor_write_array(client, sensor_power_down_sequence) ;
3805 SENSOR_TR("\n %s..%s WriteReg Fail.. \n", SENSOR_NAME_STRING(),__FUNCTION__);
3808 ret = sensor_ioctrl(icd, Sensor_PowerDown, 1);
3810 SENSOR_TR("\n %s suspend fail for turn on power!\n", SENSOR_NAME_STRING());
3815 SENSOR_TR("\n %s cann't suppout Suspend..\n",SENSOR_NAME_STRING());
3822 static int sensor_resume(struct soc_camera_device *icd)
3826 ret = sensor_ioctrl(icd, Sensor_PowerDown, 0);
3828 SENSOR_TR("\n %s resume fail for turn on power!\n", SENSOR_NAME_STRING());
3832 SENSOR_DG("\n %s Enter Resume.. \n", SENSOR_NAME_STRING());
3836 static int sensor_set_bus_param(struct soc_camera_device *icd,
3837 unsigned long flags)
3843 static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
3845 struct soc_camera_link *icl = to_soc_camera_link(icd);
3846 unsigned long flags = SENSOR_BUS_PARAM;
3848 return soc_camera_apply_sensor_flags(icl, flags);
3851 static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
3853 struct i2c_client *client = v4l2_get_subdevdata(sd);
3854 struct soc_camera_device *icd = client->dev.platform_data;
3855 struct sensor *sensor = to_sensor(client);
3857 mf->width = icd->user_width;
3858 mf->height = icd->user_height;
3859 mf->code = sensor->info_priv.fmt.code;
3860 mf->colorspace = sensor->info_priv.fmt.colorspace;
3861 mf->field = V4L2_FIELD_NONE;
3865 static bool sensor_fmt_capturechk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
3869 if ((mf->width == 1024) && (mf->height == 768)) {
3871 } else if ((mf->width == 1280) && (mf->height == 1024)) {
3873 } else if ((mf->width == 1600) && (mf->height == 1200)) {
3875 } else if ((mf->width == 2048) && (mf->height == 1536)) {
3877 } else if ((mf->width == 2592) && (mf->height == 1944)) {
3882 SENSOR_DG("%s %dx%d is capture format\n", __FUNCTION__, mf->width, mf->height);
3886 static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
3890 if ((mf->width == 1280) && (mf->height == 720)) {
3892 } else if ((mf->width == 1920) && (mf->height == 1080)) {
3897 SENSOR_DG("%s %dx%d is video format\n", __FUNCTION__, mf->width, mf->height);
3900 static struct reginfo* sensor_fmt_catch(int set_w, int set_h, int *ret_w, int *ret_h)
3902 struct reginfo *winseqe_set_addr = NULL;
3904 if (set_w*240 == set_h*320) {
3905 if (((set_w >= 320) && (set_h >= 240)) && (sensor_qvga[0].reg!=SEQUENCE_END)) {
3906 winseqe_set_addr = sensor_qvga;
3911 #if ADJUST_FOR_VGA_FALG
3912 // to forbid preview err
3913 if (((set_w >= 576) && (set_h >= 432)) && (sensor_vga[0].reg!=SEQUENCE_END)) {
3914 winseqe_set_addr = sensor_vga;
3919 if (((set_w >= 640) && (set_h >= 480)) && (sensor_vga[0].reg!=SEQUENCE_END)) {
3920 winseqe_set_addr = sensor_vga;
3927 if (((set_w >= 800) && (set_h >= 600)) && (sensor_svga[0].reg!=SEQUENCE_END)) {
3928 winseqe_set_addr = sensor_svga;
3933 if (((set_w >= 1024) && (set_h >= 768)) && (sensor_xga[0].reg!=SEQUENCE_END)) {
3934 winseqe_set_addr = sensor_xga;
3939 if (((set_w >= 1280) && (set_h >= 1024)) && (sensor_sxga[0].reg!=SEQUENCE_END)) {
3940 winseqe_set_addr = sensor_sxga;
3945 if (((set_w >= 1600) && (set_h >= 1200)) && (sensor_uxga[0].reg!=SEQUENCE_END)) {
3946 winseqe_set_addr = sensor_uxga;
3951 if (((set_w >= 2048) && (set_h >= 1536)) && (sensor_qxga[0].reg!=SEQUENCE_END)) {
3952 winseqe_set_addr = sensor_qxga;
3957 if (((set_w >= 2592) && (set_h >= 1944)) && (sensor_qsxga[0].reg!=SEQUENCE_END)) {
3958 winseqe_set_addr = sensor_qsxga;
3963 if (winseqe_set_addr == NULL) {
3964 if (((set_w <= 176) && (set_h <= 144)) && (sensor_qcif[0].reg!=SEQUENCE_END)) {
3965 winseqe_set_addr = sensor_qcif;
3968 } else if (((set_w <= 352) && (set_h<= 288)) && (sensor_cif[0].reg!=SEQUENCE_END)) {
3969 winseqe_set_addr = sensor_cif;
3974 if (((set_w <= 1280) && (set_h <= 720)) && (sensor_720p[0].reg!=SEQUENCE_END)) {
3975 winseqe_set_addr = sensor_720p;
3978 } else if (((set_w <= 1920) && (set_h <= 1080)) && (sensor_1080p[0].reg!=SEQUENCE_END)) {
3979 winseqe_set_addr = sensor_1080p;
3985 } else if (set_w*288 == set_h*352) {
3986 if (((set_w >= 176) && (set_h >= 144)) && (sensor_qcif[0].reg!=SEQUENCE_END)) {
3987 winseqe_set_addr = sensor_qcif;
3990 } else if (((set_w >= 352) && (set_h >= 288)) && (sensor_cif[0].reg!=SEQUENCE_END)) {
3991 winseqe_set_addr = sensor_cif;
3996 if (winseqe_set_addr == NULL) {
3997 if (((set_w <= 320) && (set_h <= 240)) && (sensor_qvga[0].reg!=SEQUENCE_END)) {
3998 winseqe_set_addr = sensor_qvga;
4001 } else if (((set_w <= 640) && (set_h <= 480)) && (sensor_vga[0].reg!=SEQUENCE_END)) {
4002 winseqe_set_addr = sensor_vga;
4005 } else if (((set_w <= 800) && (set_h <= 600)) && (sensor_svga[0].reg!=SEQUENCE_END)) {
4006 winseqe_set_addr = sensor_svga;
4009 } else if (((set_w <= 1024) && (set_h <= 768)) && (sensor_xga[0].reg!=SEQUENCE_END)) {
4010 winseqe_set_addr = sensor_xga;
4013 } else if (((set_w <= 1280) && (set_h <= 1024)) && (sensor_sxga[0].reg!=SEQUENCE_END)) {
4014 winseqe_set_addr = sensor_sxga;
4017 } else if (((set_w <= 1600) && (set_h <= 1200)) && (sensor_uxga[0].reg!=SEQUENCE_END)) {
4018 winseqe_set_addr = sensor_uxga;
4021 } else if (((set_w <= 2048) && (set_h <= 1536)) && (sensor_qxga[0].reg!=SEQUENCE_END)) {
4022 winseqe_set_addr = sensor_qxga;
4025 } else if (((set_w <= 2592) && (set_h <= 1944)) && (sensor_qsxga[0].reg!=SEQUENCE_END)) {
4026 winseqe_set_addr = sensor_qsxga;
4032 if (((set_w <= 1280) && (set_h <= 720)) && (sensor_720p[0].reg!=SEQUENCE_END)) {
4033 winseqe_set_addr = sensor_720p;
4036 } else if (((set_w <= 1920) && (set_h <= 1080)) && (sensor_1080p[0].reg!=SEQUENCE_END)) {
4037 winseqe_set_addr = sensor_1080p;
4042 } else if (set_w*720 == set_h*1280) {
4043 if (((set_w >= 1280) && (set_h >= 720)) && (sensor_720p[0].reg!=SEQUENCE_END)) {
4044 winseqe_set_addr = sensor_720p;
4047 } else if (((set_w >= 1920) && (set_h >= 1080)) && (sensor_1080p[0].reg!=SEQUENCE_END)) {
4048 winseqe_set_addr = sensor_1080p;
4053 if (winseqe_set_addr == NULL) {
4055 if (((set_w <= 176) && (set_h <= 144)) && (sensor_qcif[0].reg!=SEQUENCE_END)) {
4056 winseqe_set_addr = sensor_qcif;
4059 } else if (((set_w <= 352) && (set_h<= 288)) && (sensor_cif[0].reg!=SEQUENCE_END)) {
4060 winseqe_set_addr = sensor_cif;
4065 if (((set_w <= 320) && (set_h <= 240)) && (sensor_qvga[0].reg!=SEQUENCE_END)) {
4066 winseqe_set_addr = sensor_qvga;
4069 } else if (((set_w <= 640) && (set_h <= 480)) && (sensor_vga[0].reg!=SEQUENCE_END)) {
4070 winseqe_set_addr = sensor_vga;
4073 } else if (((set_w <= 800) && (set_h <= 600)) && (sensor_svga[0].reg!=SEQUENCE_END)) {
4074 winseqe_set_addr = sensor_svga;
4077 } else if (((set_w <= 1024) && (set_h <= 768)) && (sensor_xga[0].reg!=SEQUENCE_END)) {
4078 winseqe_set_addr = sensor_xga;
4081 } else if (((set_w <= 1280) && (set_h <= 1024)) && (sensor_sxga[0].reg!=SEQUENCE_END)) {
4082 winseqe_set_addr = sensor_sxga;
4085 } else if (((set_w <= 1600) && (set_h <= 1200)) && (sensor_uxga[0].reg!=SEQUENCE_END)) {
4086 winseqe_set_addr = sensor_uxga;
4089 } else if (((set_w <= 2048) && (set_h <= 1536)) && (sensor_qxga[0].reg!=SEQUENCE_END)) {
4090 winseqe_set_addr = sensor_qxga;
4093 } else if (((set_w <= 2592) && (set_h <= 1944)) && (sensor_qsxga[0].reg!=SEQUENCE_END)) {
4094 winseqe_set_addr = sensor_qsxga;
4100 if (((set_w <= 176) && (set_h <= 144)) && (sensor_qcif[0].reg!=SEQUENCE_END)) {
4101 winseqe_set_addr = sensor_qcif;
4104 } else if (((set_w <= 320) && (set_h <= 240)) && (sensor_qvga[0].reg!=SEQUENCE_END)) {
4105 winseqe_set_addr = sensor_qvga;
4108 } else if (((set_w <= 352) && (set_h<= 288)) && (sensor_cif[0].reg!=SEQUENCE_END)) {
4109 winseqe_set_addr = sensor_cif;
4112 } else if (((set_w <= 640) && (set_h <= 480)) && (sensor_vga[0].reg!=SEQUENCE_END)) {
4113 winseqe_set_addr = sensor_vga;
4116 } else if (((set_w <= 800) && (set_h <= 600)) && (sensor_svga[0].reg!=SEQUENCE_END)) {
4117 winseqe_set_addr = sensor_svga;
4120 } else if (((set_w <= 1024) && (set_h <= 768)) && (sensor_xga[0].reg!=SEQUENCE_END)) {
4121 winseqe_set_addr = sensor_xga;
4124 } else if (((set_w <= 1280) && (set_h <= 720)) && (sensor_720p[0].reg!=SEQUENCE_END)) {
4125 winseqe_set_addr = sensor_720p;
4128 } else if (((set_w <= 1280) && (set_h <= 1024)) && (sensor_sxga[0].reg!=SEQUENCE_END)) {
4129 winseqe_set_addr = sensor_sxga;
4132 } else if (((set_w <= 1600) && (set_h <= 1200)) && (sensor_uxga[0].reg!=SEQUENCE_END)) {
4133 winseqe_set_addr = sensor_uxga;
4136 } else if (((set_w <= 1920) && (set_h <= 1080)) && (sensor_1080p[0].reg!=SEQUENCE_END)) {
4137 winseqe_set_addr = sensor_1080p;
4140 } else if (((set_w <= 2048) && (set_h <= 1536)) && (sensor_qxga[0].reg!=SEQUENCE_END)) {
4141 winseqe_set_addr = sensor_qxga;
4144 } else if (((set_w <= 2592) && (set_h <= 1944)) && (sensor_qsxga[0].reg!=SEQUENCE_END)) {
4145 winseqe_set_addr = sensor_qsxga;
4151 return winseqe_set_addr;
4154 /*modify image with resolution 2592*1944;solve bug that the first 32 pixel data*/
4155 /*in the first line have misplace with the last 32 pixel data in the last line*/
4156 static int sensor_cb(void *arg)
4158 void __iomem *vbpmem;
4159 struct videobuf_buffer *buffer;
4160 char *imagey_addr =NULL;
4161 char *imageuv_addr = NULL;
4162 char *tempaddr = NULL;
4165 buffer = (struct videobuf_buffer*)arg;
4166 if(buffer->width!=SENSOR_MAX_WIDTH||buffer->height!=SENSOR_MAX_HEIGHT||buffer==NULL)
4169 if (buffer->bsize< YUV420_BUFFER_MAX_SIZE) //yuv420 format size
4173 vbpmem = ioremap(buffer->boff,buffer->bsize);
4174 if(vbpmem == NULL) {
4175 SENSOR_DG("\n%s..%s..ioremap fail\n",__FUNCTION__,SENSOR_NAME_STRING());
4179 imagey_addr = (char*)vbpmem; // y data to be dealed with
4180 imageuv_addr = imagey_addr+buffer->width*buffer->height;
4182 tempaddr = imageuv_addr - 32;
4183 memcpy(tempaddr,imagey_addr,32);
4185 tempaddr = imagey_addr+32;
4186 memcpy(imagey_addr,tempaddr,32);
4188 //uv data to be dealed with
4189 tempsize = YUV420_BUFFER_MAX_SIZE-32;
4190 tempaddr = imagey_addr+tempsize;
4191 memcpy(tempaddr,imageuv_addr,32);
4193 tempaddr = imageuv_addr+32;
4194 memcpy(imageuv_addr,tempaddr,32);
4197 static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
4199 struct i2c_client *client = v4l2_get_subdevdata(sd);
4200 struct soc_camera_device *icd = client->dev.platform_data;
4201 struct sensor *sensor = to_sensor(client);
4202 const struct sensor_datafmt *fmt;
4203 struct reginfo *winseqe_set_addr=NULL;
4204 int ret = 0, set_w,set_h,cnt;
4207 u16 targetbrightness,realbrightness;
4209 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
4211 fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
4212 ARRAY_SIZE(sensor_colour_fmts));
4215 goto sensor_s_fmt_end;
4218 if (sensor->info_priv.fmt.code != mf->code) {
4221 case V4L2_MBUS_FMT_YUYV8_2X8:
4223 winseqe_set_addr = sensor_ClrFmt_YUYV;
4226 case V4L2_MBUS_FMT_UYVY8_2X8:
4228 winseqe_set_addr = sensor_ClrFmt_UYVY;
4234 if (winseqe_set_addr != NULL) {
4235 sensor_write_array(client, winseqe_set_addr);
4236 sensor->info_priv.fmt.code = mf->code;
4237 sensor->info_priv.fmt.colorspace= mf->colorspace;
4238 SENSOR_DG("%s v4l2_mbus_code:%d set success!\n", SENSOR_NAME_STRING(),mf->code);
4240 SENSOR_TR("%s v4l2_mbus_code:%d is invalidate!\n", SENSOR_NAME_STRING(),mf->code);
4247 winseqe_set_addr = sensor_fmt_catch(set_w, set_h, &set_w, &set_h);
4249 if ((winseqe_set_addr != sensor->info_priv.winseqe_cur_addr) && winseqe_set_addr)
4251 /*solve bug that video set is ineffective */
4252 /*set five times to make sure sensor_720p set go into effect*/
4253 if(winseqe_set_addr==sensor_720p)
4263 ret |= sensor_write_array(client, winseqe_set_addr);
4265 SENSOR_TR("%s set format capability failed\n", SENSOR_NAME_STRING());
4266 goto sensor_s_fmt_end;
4270 sensor->info_priv.winseqe_cur_addr = winseqe_set_addr;
4271 if (winseqe_set_addr==sensor_qxga ||winseqe_set_addr==sensor_qsxga||winseqe_set_addr==sensor_uxga ||winseqe_set_addr==sensor_xga)
4273 SENSOR_DG("\n%s..%s..Capture icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),__FUNCTION__,set_w,set_h);
4275 SENSOR_DG("\n%s..%s..Video icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),__FUNCTION__,set_w,set_h);
4276 sensor->info_priv.preview_w = mf->width;
4277 sensor->info_priv.preview_h = mf->height;
4281 if (winseqe_set_addr && (winseqe_set_addr==sensor_qxga ||winseqe_set_addr==sensor_qsxga||winseqe_set_addr==sensor_uxga ||winseqe_set_addr==sensor_xga))
4283 ret |= sensor_write_array(client, sensor_Preview2Capture);
4285 SENSOR_TR("%s Preview 2 Capture failed\n", SENSOR_NAME_STRING());
4286 goto sensor_s_fmt_end;
4289 /*check state of register 0x8405 to make sure set is successful*/
4290 /*set sensor_Preview2Capture more times to make sure set go into effect */
4296 ret =sensor_read(client,0x8405, &seq_state);
4298 goto sensor_s_fmt_end;
4304 ret |= sensor_write_array(client, sensor_Preview2Capture);
4305 if (ret != 0||time >2) {
4306 SENSOR_TR("%s Preview 2 Capture failed\n", SENSOR_NAME_STRING());
4307 goto sensor_s_fmt_end;
4309 SENSOR_DG("mt9p111 Preview 2 Capture again\n");
4311 SENSOR_DG("mt9p111 Preview 2 Capture count = %d;seq_state = 0x%x\n",cnt,seq_state);
4312 } while((seq_state != 0x07) && (time < 4));
4314 SENSOR_TR("%s Preview 2 Capture successs\n", SENSOR_NAME_STRING());
4316 #if CONFIG_SENSOR_Flash
4317 /*The 0xA409 is AE target register address.*/
4318 /*The 0xB804 is currently total brightness Y value of sensor.*/
4319 targetbrightness = 0;
4321 if((sensor->info_priv.flash == 1) || (sensor->info_priv.flash == 2))
4323 if(sensor->info_priv.flash == 1)
4325 ret =sensor_read(client,0xA409, &targetbrightness);
4327 SENSOR_DG("%s ..%s..get targetbrightness fail\n", SENSOR_NAME_STRING(),__FUNCTION__);
4329 ret =sensor_read(client, 0xB804, &realbrightness);
4331 SENSOR_DG("%s ..%s..get realbrightness fail\n", SENSOR_NAME_STRING(),__FUNCTION__);
4334 if((realbrightness < targetbrightness)|| (sensor->info_priv.flash == 2))
4336 sensor_ioctrl(icd, Sensor_Flash, Flash_On);
4337 SENSOR_DG("%s flash on,realbrightness=%d,targetbrightness=%d\n", SENSOR_NAME_STRING(),realbrightness,targetbrightness);
4339 SENSOR_DG("%s not need to flash in capture!\n", SENSOR_NAME_STRING());
4343 sensor->info_priv.capture_w = set_w;
4344 sensor->info_priv.capture_h = set_h;
4345 sensor->info_priv.snap2preview = true;
4346 } else if (sensor->info_priv.snap2preview == true) {
4347 if (winseqe_set_addr || ((sensor->info_priv.preview_w == mf->width) && (sensor->info_priv.preview_h == mf->height))) {
4348 ret |= sensor_write_array(client, sensor_Capture2Preview);
4350 SENSOR_TR("%s Capture 2 Preview success\n", SENSOR_NAME_STRING());
4351 goto sensor_s_fmt_end;
4355 do{ //check state of register 0x8405 to make sure set is successful
4358 ret =sensor_read(client,0x8405, &seq_state);
4360 goto sensor_s_fmt_end;
4361 SENSOR_DG("mt9p111 Capture 2 Preview seq_state = 0x%x\n",seq_state);
4362 } while((seq_state != 0x03) && (cnt < 20));
4364 SENSOR_TR("%s Capture 2 Preview success\n", SENSOR_NAME_STRING());
4366 #if CONFIG_SENSOR_Flash
4367 if ((sensor->info_priv.flash == 1) || (sensor->info_priv.flash == 2)) {
4368 sensor_ioctrl(icd, Sensor_Flash, Flash_Off);
4369 SENSOR_DG("%s flash off in preivew!\n", SENSOR_NAME_STRING());
4372 sensor->info_priv.preview_w = mf->width;
4373 sensor->info_priv.preview_h = mf->height;
4374 sensor->info_priv.snap2preview = false;
4376 SENSOR_TR("\n %s..%s Format is Invalidate. pix->width = %d.. pix->height = %d\n",SENSOR_NAME_STRING(),__FUNCTION__,mf->width,mf->height);
4386 static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
4388 struct i2c_client *client = v4l2_get_subdevdata(sd);
4389 struct sensor *sensor = to_sensor(client);
4390 const struct sensor_datafmt *fmt;
4393 fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
4394 ARRAY_SIZE(sensor_colour_fmts));
4396 fmt = &sensor->info_priv.fmt;
4397 mf->code = fmt->code;
4400 if (mf->height > SENSOR_MAX_HEIGHT)
4401 mf->height = SENSOR_MAX_HEIGHT;
4402 else if (mf->height < SENSOR_MIN_HEIGHT)
4403 mf->height = SENSOR_MIN_HEIGHT;
4405 if (mf->width > SENSOR_MAX_WIDTH)
4406 mf->width = SENSOR_MAX_WIDTH;
4407 else if (mf->width < SENSOR_MIN_WIDTH)
4408 mf->width = SENSOR_MIN_WIDTH;
4409 if (sensor_fmt_catch(mf->width, mf->height, &mf->width, &mf->height) == NULL) {
4413 mf->colorspace = fmt->colorspace;
4417 static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
4419 struct i2c_client *client = v4l2_get_subdevdata(sd);
4421 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
4424 if (id->match.addr != client->addr)
4427 id->ident = SENSOR_V4L2_IDENT; /* ddl@rock-chips.com : Return OV2655 identifier */
4432 #if CONFIG_SENSOR_Brightness
4433 static int sensor_set_brightness(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4435 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4437 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
4439 if (sensor_BrightnessSeqe[value - qctrl->minimum] != NULL)
4441 if (sensor_write_array(client, sensor_BrightnessSeqe[value - qctrl->minimum]) != 0)
4443 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
4446 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
4450 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4454 #if CONFIG_SENSOR_Effect
4455 static int sensor_set_effect(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4459 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4461 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
4463 if (sensor_EffectSeqe[value - qctrl->minimum] != NULL)
4465 /*set five times to make sure the set go into effect*/
4466 /*solve bug for setting invalidate during changing from preview to video*/
4470 ret |=sensor_write_array(client, sensor_EffectSeqe[value - qctrl->minimum]);
4473 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
4478 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
4482 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4486 #if CONFIG_SENSOR_Exposure
4487 static int sensor_set_exposure(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4489 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4491 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
4493 if (sensor_ExposureSeqe[value - qctrl->minimum] != NULL)
4495 if (sensor_write_array(client, sensor_ExposureSeqe[value - qctrl->minimum]) != 0)
4497 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
4500 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
4504 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4508 #if CONFIG_SENSOR_Saturation
4509 static int sensor_set_saturation(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4511 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4513 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
4515 if (sensor_SaturationSeqe[value - qctrl->minimum] != NULL)
4517 if (sensor_write_array(client, sensor_SaturationSeqe[value - qctrl->minimum]) != 0)
4519 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
4522 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
4526 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4530 #if CONFIG_SENSOR_Contrast
4531 static int sensor_set_contrast(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4533 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4535 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
4537 if (sensor_ContrastSeqe[value - qctrl->minimum] != NULL)
4539 if (sensor_write_array(client, sensor_ContrastSeqe[value - qctrl->minimum]) != 0)
4541 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
4544 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
4548 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4552 #if CONFIG_SENSOR_Mirror
4553 static int sensor_set_mirror(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4555 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4557 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
4559 if (sensor_MirrorSeqe[value - qctrl->minimum] != NULL)
4561 if (sensor_write_array(client, sensor_MirrorSeqe[value - qctrl->minimum]) != 0)
4563 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
4566 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
4570 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4574 #if CONFIG_SENSOR_Flip
4575 static int sensor_set_flip(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4577 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4579 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
4581 if (sensor_FlipSeqe[value - qctrl->minimum] != NULL)
4583 if (sensor_write_array(client, sensor_FlipSeqe[value - qctrl->minimum]) != 0)
4585 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
4588 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
4592 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4596 #if CONFIG_SENSOR_Scene
4597 static int sensor_set_scene(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4599 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4601 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
4603 if (sensor_SceneSeqe[value - qctrl->minimum] != NULL)
4605 if (sensor_write_array(client, sensor_SceneSeqe[value - qctrl->minimum]) != 0)
4607 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
4610 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
4614 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4618 #if CONFIG_SENSOR_WhiteBalance
4619 static int sensor_set_whiteBalance(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4621 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4623 if ((value >= qctrl->minimum) && (value <= qctrl->maximum))
4625 if (sensor_WhiteBalanceSeqe[value - qctrl->minimum] != NULL)
4627 if (sensor_write_array(client, sensor_WhiteBalanceSeqe[value - qctrl->minimum]) != 0)
4629 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
4632 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
4636 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4640 #if CONFIG_SENSOR_DigitalZoom
4641 static int sensor_set_digitalzoom(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4643 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4644 struct sensor *sensor = to_sensor(client);
4645 const struct v4l2_queryctrl *qctrl_info;
4646 int digitalzoom_cur, digitalzoom_total;
4648 qctrl_info = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_ZOOM_ABSOLUTE);
4652 digitalzoom_cur = sensor->info_priv.digitalzoom;
4653 digitalzoom_total = qctrl_info->maximum;
4655 if ((value > 0) && (digitalzoom_cur >= digitalzoom_total))
4657 SENSOR_TR("%s digitalzoom is maximum - %x\n", SENSOR_NAME_STRING(), digitalzoom_cur);
4661 if ((value < 0) && (digitalzoom_cur <= qctrl_info->minimum))
4663 SENSOR_TR("%s digitalzoom is minimum - %x\n", SENSOR_NAME_STRING(), digitalzoom_cur);
4667 if ((value > 0) && ((digitalzoom_cur + value) > digitalzoom_total))
4669 value = digitalzoom_total - digitalzoom_cur;
4672 if ((value < 0) && ((digitalzoom_cur + value) < 0))
4674 value = 0 - digitalzoom_cur;
4677 digitalzoom_cur += value;
4679 if (sensor_ZoomSeqe[digitalzoom_cur] != NULL)
4681 if (sensor_write_array(client, sensor_ZoomSeqe[digitalzoom_cur]) != 0)
4683 SENSOR_TR("%s..%s WriteReg Fail.. \n",SENSOR_NAME_STRING(), __FUNCTION__);
4686 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
4693 #if CONFIG_SENSOR_Flash
4694 static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4696 if ((value >= qctrl->minimum) && (value <= qctrl->maximum)) {
4697 if (value == 3) { /* ddl@rock-chips.com: torch */
4698 printk("=====sensor_set_flash====== Flash On\n");
4699 sensor_ioctrl(icd, Sensor_Flash, Flash_Torch); /* Flash On */
4701 printk("=====sensor_set_flash====== Flash off\n");
4702 sensor_ioctrl(icd, Sensor_Flash, Flash_Off);
4704 SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
4708 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4712 #if CONFIG_SENSOR_Focus
4713 static int sensor_set_focus_absolute(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4715 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4716 struct sensor *sensor = to_sensor(client);
4717 const struct v4l2_queryctrl *qctrl_info;
4720 qctrl_info = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FOCUS_ABSOLUTE);
4724 if ((sensor->info_priv.funmodule_state & SENSOR_AF_IS_OK) && (sensor->info_priv.affm_reinit == 0)) {
4725 if ((value >= qctrl_info->minimum) && (value <= qctrl_info->maximum)) {
4727 SENSOR_DG("%s..%s : %d ret:0x%x\n",SENSOR_NAME_STRING(),__FUNCTION__, value,ret);
4730 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4734 SENSOR_TR("\n %s..%s AF module state(0x%x, 0x%x) is error!\n",SENSOR_NAME_STRING(),__FUNCTION__,
4735 sensor->info_priv.funmodule_state,sensor->info_priv.affm_reinit);
4738 sensor_set_focus_absolute_end:
4741 static int sensor_set_focus_relative(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
4743 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4744 struct sensor *sensor = to_sensor(client);
4745 const struct v4l2_queryctrl *qctrl_info;
4748 qctrl_info = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FOCUS_RELATIVE);
4752 if ((sensor->info_priv.funmodule_state & SENSOR_AF_IS_OK) && (sensor->info_priv.affm_reinit == 0)) {
4753 if ((value >= qctrl_info->minimum) && (value <= qctrl_info->maximum)) {
4755 SENSOR_DG("%s..%s : %d ret:0x%x\n",SENSOR_NAME_STRING(),__FUNCTION__, value,ret);
4758 SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4762 SENSOR_TR("\n %s..%s AF module state(0x%x, 0x%x) is error!\n",SENSOR_NAME_STRING(),__FUNCTION__,
4763 sensor->info_priv.funmodule_state,sensor->info_priv.affm_reinit);
4765 sensor_set_focus_relative_end:
4769 static int sensor_set_focus_mode(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value, int *zone_pos)
4771 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
4772 struct sensor *sensor = to_sensor(client);
4775 if ((sensor->info_priv.funmodule_state & SENSOR_AF_IS_OK) && (sensor->info_priv.affm_reinit == 0)) {
4778 case SENSOR_AF_MODE_AUTO:
4780 ret = sensor_af_workqueue_set(icd, WqCmd_af_single, 0, true, zone_pos);
4784 /*case SENSOR_AF_MODE_MACRO:
4786 ret = sensor_set_focus_absolute(icd, qctrl, 0xff);
4790 case SENSOR_AF_MODE_INFINITY:
4792 ret = sensor_set_focus_absolute(icd, qctrl, 0x00);
4796 case SENSOR_AF_MODE_CONTINUOUS:
4798 ret = sensor_af_workqueue_set(icd, WqCmd_af_continues, 0, true,NULL);
4802 SENSOR_TR("\n %s..%s AF value(0x%x) is error!\n",SENSOR_NAME_STRING(),__FUNCTION__,value);
4807 SENSOR_DG("%s..%s : %d ret:0x%x\n",SENSOR_NAME_STRING(),__FUNCTION__, value,ret);
4810 SENSOR_TR("\n %s..%s AF module state(0x%x, 0x%x) is error!\n",SENSOR_NAME_STRING(),__FUNCTION__,
4811 sensor->info_priv.funmodule_state,sensor->info_priv.affm_reinit);
4818 static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
4820 struct i2c_client *client = v4l2_get_subdevdata(sd);
4821 struct sensor *sensor = to_sensor(client);
4822 const struct v4l2_queryctrl *qctrl;
4823 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
4825 qctrl = soc_camera_find_qctrl(&sensor_ops, ctrl->id);
4829 SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ctrl->id);
4835 case V4L2_CID_BRIGHTNESS:
4837 ctrl->value = sensor->info_priv.brightness;
4840 case V4L2_CID_SATURATION:
4842 ctrl->value = sensor->info_priv.saturation;
4845 case V4L2_CID_CONTRAST:
4847 ctrl->value = sensor->info_priv.contrast;
4850 case V4L2_CID_DO_WHITE_BALANCE:
4852 ctrl->value = sensor->info_priv.whiteBalance;
4855 case V4L2_CID_EXPOSURE:
4857 ctrl->value = sensor->info_priv.exposure;
4860 case V4L2_CID_HFLIP:
4862 ctrl->value = sensor->info_priv.mirror;
4865 case V4L2_CID_VFLIP:
4867 ctrl->value = sensor->info_priv.flip;
4878 static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
4880 struct i2c_client *client = v4l2_get_subdevdata(sd);
4881 struct sensor *sensor = to_sensor(client);
4882 struct soc_camera_device *icd = client->dev.platform_data;
4883 const struct v4l2_queryctrl *qctrl;
4885 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
4888 qctrl = soc_camera_find_qctrl(&sensor_ops, ctrl->id);
4892 SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ctrl->id);
4898 #if CONFIG_SENSOR_Brightness
4899 case V4L2_CID_BRIGHTNESS:
4901 if (ctrl->value != sensor->info_priv.brightness)
4903 if (sensor_set_brightness(icd, qctrl,ctrl->value) != 0)
4907 sensor->info_priv.brightness = ctrl->value;
4912 #if CONFIG_SENSOR_Exposure
4913 case V4L2_CID_EXPOSURE:
4915 if (ctrl->value != sensor->info_priv.exposure)
4917 if (sensor_set_exposure(icd, qctrl,ctrl->value) != 0)
4921 sensor->info_priv.exposure = ctrl->value;
4926 #if CONFIG_SENSOR_Saturation
4927 case V4L2_CID_SATURATION:
4929 if (ctrl->value != sensor->info_priv.saturation)
4931 if (sensor_set_saturation(icd, qctrl,ctrl->value) != 0)
4935 sensor->info_priv.saturation = ctrl->value;
4940 #if CONFIG_SENSOR_Contrast
4941 case V4L2_CID_CONTRAST:
4943 if (ctrl->value != sensor->info_priv.contrast)
4945 if (sensor_set_contrast(icd, qctrl,ctrl->value) != 0)
4949 sensor->info_priv.contrast = ctrl->value;
4954 #if CONFIG_SENSOR_WhiteBalance
4955 case V4L2_CID_DO_WHITE_BALANCE:
4957 if (ctrl->value != sensor->info_priv.whiteBalance)
4959 if (sensor_set_whiteBalance(icd, qctrl,ctrl->value) != 0)
4963 sensor->info_priv.whiteBalance = ctrl->value;
4968 #if CONFIG_SENSOR_Mirror
4969 case V4L2_CID_HFLIP:
4971 if (ctrl->value != sensor->info_priv.mirror)
4973 if (sensor_set_mirror(icd, qctrl,ctrl->value) != 0)
4975 sensor->info_priv.mirror = ctrl->value;
4980 #if CONFIG_SENSOR_Flip
4981 case V4L2_CID_VFLIP:
4983 if (ctrl->value != sensor->info_priv.flip)
4985 if (sensor_set_flip(icd, qctrl,ctrl->value) != 0)
4987 sensor->info_priv.flip = ctrl->value;
4998 static int sensor_g_ext_control(struct soc_camera_device *icd , struct v4l2_ext_control *ext_ctrl)
5000 const struct v4l2_queryctrl *qctrl;
5001 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
5002 struct sensor *sensor = to_sensor(client);
5004 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
5006 qctrl = soc_camera_find_qctrl(&sensor_ops, ext_ctrl->id);
5010 SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ext_ctrl->id);
5014 switch (ext_ctrl->id)
5016 case V4L2_CID_SCENE:
5018 ext_ctrl->value = sensor->info_priv.scene;
5021 case V4L2_CID_EFFECT:
5023 ext_ctrl->value = sensor->info_priv.effect;
5026 case V4L2_CID_ZOOM_ABSOLUTE:
5028 ext_ctrl->value = sensor->info_priv.digitalzoom;
5031 case V4L2_CID_ZOOM_RELATIVE:
5035 case V4L2_CID_FOCUS_ABSOLUTE:
5039 case V4L2_CID_FOCUS_RELATIVE:
5043 case V4L2_CID_FLASH:
5045 ext_ctrl->value = sensor->info_priv.flash;
5053 static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_control *ext_ctrl)
5055 const struct v4l2_queryctrl *qctrl;
5056 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
5057 struct sensor *sensor = to_sensor(client);
5060 qctrl = soc_camera_find_qctrl(&sensor_ops, ext_ctrl->id);
5064 SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ext_ctrl->id);
5069 switch (ext_ctrl->id)
5071 #if CONFIG_SENSOR_Scene
5072 case V4L2_CID_SCENE:
5074 if (ext_ctrl->value != sensor->info_priv.scene)
5076 if (sensor_set_scene(icd, qctrl,ext_ctrl->value) != 0)
5078 sensor->info_priv.scene = ext_ctrl->value;
5083 #if CONFIG_SENSOR_Effect
5084 case V4L2_CID_EFFECT:
5086 if (ext_ctrl->value != sensor->info_priv.effect)
5088 if (sensor_set_effect(icd, qctrl,ext_ctrl->value) != 0)
5090 sensor->info_priv.effect= ext_ctrl->value;
5095 #if CONFIG_SENSOR_DigitalZoom
5096 case V4L2_CID_ZOOM_ABSOLUTE:
5098 if ((ext_ctrl->value < qctrl->minimum) || (ext_ctrl->value > qctrl->maximum))
5101 if (ext_ctrl->value != sensor->info_priv.digitalzoom)
5103 val_offset = ext_ctrl->value -sensor->info_priv.digitalzoom;
5105 if (sensor_set_digitalzoom(icd, qctrl,&val_offset) != 0)
5107 sensor->info_priv.digitalzoom += val_offset;
5109 SENSOR_DG("%s digitalzoom is %x\n",SENSOR_NAME_STRING(), sensor->info_priv.digitalzoom);
5114 case V4L2_CID_ZOOM_RELATIVE:
5116 if (ext_ctrl->value)
5118 if (sensor_set_digitalzoom(icd, qctrl,&ext_ctrl->value) != 0)
5120 sensor->info_priv.digitalzoom += ext_ctrl->value;
5122 SENSOR_DG("%s digitalzoom is %x\n", SENSOR_NAME_STRING(), sensor->info_priv.digitalzoom);
5127 #if CONFIG_SENSOR_Focus
5129 case V4L2_CID_FOCUS_ABSOLUTE:
5131 if ((ext_ctrl->value < qctrl->minimum) || (ext_ctrl->value > qctrl->maximum))
5134 if (sensor_set_focus_absolute(icd, qctrl,ext_ctrl->value) == 0) {
5135 if (ext_ctrl->value == qctrl->minimum) {
5136 sensor->info_priv.auto_focus = SENSOR_AF_MODE_INFINITY;
5137 } else if (ext_ctrl->value == qctrl->maximum) {
5138 sensor->info_priv.auto_focus = SENSOR_AF_MODE_MACRO;
5140 sensor->info_priv.auto_focus = SENSOR_AF_MODE_FIXED;
5146 case V4L2_CID_FOCUS_RELATIVE:
5148 if ((ext_ctrl->value < qctrl->minimum) || (ext_ctrl->value > qctrl->maximum))
5151 sensor_set_focus_relative(icd, qctrl,ext_ctrl->value);
5155 case V4L2_CID_FOCUS_AUTO:
5157 if (ext_ctrl->value) {
5158 if ((ext_ctrl->value==1) || (SENSOR_AF_MODE_AUTO == sensor->info_priv.auto_focus)) {
5159 if (sensor_set_focus_mode(icd, qctrl,SENSOR_AF_MODE_AUTO,ext_ctrl->rect) != 0) {
5160 if(0 == (sensor->info_priv.funmodule_state & SENSOR_AF_IS_OK)) {
5161 sensor->info_priv.auto_focus = SENSOR_AF_MODE_AUTO;
5166 if (ext_ctrl->value == 1)
5167 sensor->info_priv.auto_focus = SENSOR_AF_MODE_AUTO;
5168 } else if (SENSOR_AF_MODE_AUTO == sensor->info_priv.auto_focus){
5169 if (ext_ctrl->value == 0)
5170 sensor->info_priv.auto_focus = SENSOR_AF_MODE_CLOSE;
5174 case V4L2_CID_FOCUS_CONTINUOUS:
5176 if (SENSOR_AF_MODE_CONTINUOUS != sensor->info_priv.auto_focus) {
5177 if (ext_ctrl->value == 1) {
5178 if (sensor_set_focus_mode(icd, qctrl,SENSOR_AF_MODE_CONTINUOUS,NULL) != 0) {
5179 if(0 == (sensor->info_priv.funmodule_state & SENSOR_AF_IS_OK)) {
5180 sensor->info_priv.auto_focus = SENSOR_AF_MODE_CONTINUOUS;
5184 sensor->info_priv.auto_focus = SENSOR_AF_MODE_CONTINUOUS;
5187 if (ext_ctrl->value == 0)
5188 sensor->info_priv.auto_focus = SENSOR_AF_MODE_CLOSE;
5193 #if CONFIG_SENSOR_Flash
5194 case V4L2_CID_FLASH:
5196 if (sensor_set_flash(icd, qctrl,ext_ctrl->value) != 0)
5198 sensor->info_priv.flash = ext_ctrl->value;
5200 SENSOR_DG("%s flash is %x\n",SENSOR_NAME_STRING(), sensor->info_priv.flash);
5211 static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
5213 struct i2c_client *client = v4l2_get_subdevdata(sd);
5214 struct soc_camera_device *icd = client->dev.platform_data;
5215 int i, error_cnt=0, error_idx=-1;
5217 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
5220 for (i=0; i<ext_ctrl->count; i++) {
5221 if (sensor_g_ext_control(icd, &ext_ctrl->controls[i]) != 0) {
5228 error_idx = ext_ctrl->count;
5230 if (error_idx != -1) {
5231 ext_ctrl->error_idx = error_idx;
5238 static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
5240 struct i2c_client *client = v4l2_get_subdevdata(sd);
5241 struct soc_camera_device *icd = client->dev.platform_data;
5242 int i, error_cnt=0, error_idx=-1;
5244 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
5246 for (i=0; i<ext_ctrl->count; i++) {
5247 if (sensor_s_ext_control(icd, &ext_ctrl->controls[i]) != 0) {
5254 error_idx = ext_ctrl->count;
5256 if (error_idx != -1) {
5257 ext_ctrl->error_idx = error_idx;
5264 static int sensor_s_stream(struct v4l2_subdev *sd, int enable)
5266 struct i2c_client *client = v4l2_get_subdevdata(sd);
5267 struct sensor *sensor = to_sensor(client);
5268 #if CONFIG_SENSOR_Focus
5269 struct soc_camera_device *icd = client->dev.platform_data;
5270 struct v4l2_mbus_framefmt mf;
5274 sensor->info_priv.enable = 1;
5275 #if CONFIG_SENSOR_Focus
5276 mf.width = icd->user_width;
5277 mf.height = icd->user_height;
5278 mf.code = sensor->info_priv.fmt.code;
5279 mf.colorspace = sensor->info_priv.fmt.colorspace;
5280 mf.field = V4L2_FIELD_NONE;
5281 /* If auto focus firmware haven't download success, must download firmware again when in video or preview stream on */
5282 if (sensor_fmt_capturechk(sd, &mf) == false) {
5283 if ((sensor->info_priv.affm_reinit == 1) || ((sensor->info_priv.funmodule_state & SENSOR_AF_IS_OK)==0)) {
5284 sensor_af_workqueue_set(icd, WqCmd_af_init, 0, false,NULL);
5285 sensor->info_priv.affm_reinit = 0;
5289 } else if (enable == 0) {
5290 sensor->info_priv.enable = 0;
5291 #if CONFIG_SENSOR_Focus
5292 flush_workqueue(sensor->sensor_wq);
5298 /* Interface active, can use i2c. If it fails, it can indeed mean, that
5299 * this wasn't our capture interface, so, we wait for the right one */
5300 static int sensor_video_probe(struct soc_camera_device *icd,
5301 struct i2c_client *client)
5304 struct sensor *sensor = to_sensor(client);
5305 #if (SENSOR_RESET_REG != SEQUENCE_END)
5306 struct reginfo reg_info;
5308 /* We must have a parent by now. And it cannot be a wrong one.
5309 * So this entire test is completely redundant. */
5310 if (!icd->dev.parent ||
5311 to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
5314 if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
5316 goto sensor_video_probe_err;
5320 #if (SENSOR_RESET_REG != SEQUENCE_END)
5321 reg_info.reg = SENSOR_RESET_REG;
5322 reg_info.val = SENSOR_RESET_VAL;
5323 reg_info.reg_len = SENSOR_RESET_REG_LEN;
5324 ret = sensor_write(client, ®_info);
5326 SENSOR_TR("%s soft reset sensor failed\n",SENSOR_NAME_STRING());
5328 goto sensor_video_probe_err;
5331 mdelay(5); //delay 5 microseconds
5334 /* check if it is an sensor sensor */
5335 #if (SENSOR_ID_REG != SEQUENCE_END)
5336 ret = sensor_read(client, SENSOR_ID_REG, &pid);
5338 SENSOR_TR("read chip id failed\n");
5340 goto sensor_video_probe_err;
5343 SENSOR_DG("\n %s pid = 0x%x \n", SENSOR_NAME_STRING(), pid);
5348 if (pid == SENSOR_ID) {
5349 sensor->model = SENSOR_V4L2_IDENT;
5351 SENSOR_TR("error: %s mismatched pid = 0x%x\n", SENSOR_NAME_STRING(), pid);
5353 goto sensor_video_probe_err;
5358 sensor_video_probe_err:
5362 static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
5364 struct i2c_client *client = v4l2_get_subdevdata(sd);
5365 struct soc_camera_device *icd = client->dev.platform_data;
5366 struct sensor *sensor = to_sensor(client);
5367 //#if CONFIG_SENSOR_Flash
5372 rk29_camera_sensor_cb_s *icd_cb =NULL;
5374 SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
5377 case RK29_CAM_SUBDEV_DEACTIVATE:
5379 sensor_deactivate(client);
5382 case RK29_CAM_SUBDEV_IOREQUEST:
5384 sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
5385 if (sensor->sensor_io_request != NULL) {
5386 sensor->sensor_gpio_res = NULL;
5387 for (i=0; i<RK29_CAM_SUPPORT_NUMS;i++) {
5388 if (sensor->sensor_io_request->gpio_res[i].dev_name &&
5389 (strcmp(sensor->sensor_io_request->gpio_res[i].dev_name, dev_name(icd->pdev)) == 0)) {
5390 sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[i];
5393 if (sensor->sensor_gpio_res == NULL) {
5394 SENSOR_TR("%s %s obtain gpio resource failed when RK29_CAM_SUBDEV_IOREQUEST \n",SENSOR_NAME_STRING(),__FUNCTION__);
5396 goto sensor_ioctl_end;
5399 SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
5401 goto sensor_ioctl_end;
5403 /* ddl@rock-chips.com : if gpio_flash havn't been set in board-xxx.c, sensor driver must notify is not support flash control
5405 #if CONFIG_SENSOR_Flash
5406 if (sensor->sensor_gpio_res) {
5407 if (sensor->sensor_gpio_res->gpio_flash == INVALID_GPIO) {
5408 for (i = 0; i < icd->ops->num_controls; i++) {
5409 if (V4L2_CID_FLASH == icd->ops->controls[i].id) {
5410 //memset((char*)&icd->ops->controls[i],0x00,sizeof(struct v4l2_queryctrl));
5411 sensor_controls[i].id=0xffff;
5414 sensor->info_priv.flash = 0xff;
5415 SENSOR_DG("%s flash gpio is invalidate!\n",SENSOR_NAME_STRING());
5416 }else{ //two cameras are the same,need to deal diffrently ,zyc
5417 for (i = 0; i < icd->ops->num_controls; i++) {
5418 if(0xffff == icd->ops->controls[i].id){
5419 sensor_controls[i].id=V4L2_CID_FLASH;
5427 case RK29_CAM_SUBDEV_CB_REGISTER:
5429 icd_cb = (rk29_camera_sensor_cb_s*)(arg);
5430 icd_cb->sensor_cb = sensor_cb;
5435 SENSOR_TR("%s %s cmd(0x%x) is unknown !\n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
5443 static int sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
5444 enum v4l2_mbus_pixelcode *code)
5446 if (index >= ARRAY_SIZE(sensor_colour_fmts))
5449 *code = sensor_colour_fmts[index].code;
5452 static struct v4l2_subdev_core_ops sensor_subdev_core_ops = {
5453 .init = sensor_init,
5454 .g_ctrl = sensor_g_control,
5455 .s_ctrl = sensor_s_control,
5456 .g_ext_ctrls = sensor_g_ext_controls,
5457 .s_ext_ctrls = sensor_s_ext_controls,
5458 .g_chip_ident = sensor_g_chip_ident,
5459 .ioctl = sensor_ioctl,
5461 static struct v4l2_subdev_video_ops sensor_subdev_video_ops = {
5462 .s_mbus_fmt = sensor_s_fmt,
5463 .g_mbus_fmt = sensor_g_fmt,
5464 .try_mbus_fmt = sensor_try_fmt,
5465 .enum_mbus_fmt = sensor_enum_fmt,
5466 .s_stream = sensor_s_stream,
5468 static struct v4l2_subdev_ops sensor_subdev_ops = {
5469 .core = &sensor_subdev_core_ops,
5470 .video = &sensor_subdev_video_ops,
5473 static int sensor_probe(struct i2c_client *client,
5474 const struct i2c_device_id *did)
5476 struct sensor *sensor;
5477 struct soc_camera_device *icd = client->dev.platform_data;
5478 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
5479 struct soc_camera_link *icl;
5482 SENSOR_DG("\n%s..%s..%d..\n",__FUNCTION__,__FILE__,__LINE__);
5484 dev_err(&client->dev, "%s: missing soc-camera data!\n",SENSOR_NAME_STRING());
5488 icl = to_soc_camera_link(icd);
5490 dev_err(&client->dev, "%s driver needs platform data\n", SENSOR_NAME_STRING());
5494 if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
5495 dev_warn(&adapter->dev,
5496 "I2C-Adapter doesn't support I2C_FUNC_I2C\n");
5500 sensor = kzalloc(sizeof(struct sensor), GFP_KERNEL);
5504 v4l2_i2c_subdev_init(&sensor->subdev, client, &sensor_subdev_ops);
5506 /* Second stage probe - when a capture adapter is there */
5507 icd->ops = &sensor_ops;
5508 sensor->info_priv.fmt = sensor_colour_fmts[0];
5509 #if CONFIG_SENSOR_I2C_NOSCHED
5510 atomic_set(&sensor->tasklock_cnt,0);
5513 ret = sensor_video_probe(icd, client);
5516 i2c_set_clientdata(client, NULL);
5520 #if CONFIG_SENSOR_Focus
5521 sensor->sensor_wq = create_singlethread_workqueue(SENSOR_NAME_STRING(_af_workqueue));
5522 if (sensor->sensor_wq == NULL)
5523 SENSOR_TR("%s create fail!", SENSOR_NAME_STRING(_af_workqueue));
5524 mutex_init(&sensor->wq_lock);
5527 flash_off_timer.status = 0;
5528 hrtimer_init(&(flash_off_timer.timer), CLOCK_MONOTONIC, HRTIMER_MODE_REL);
5529 SENSOR_DG("\n%s..%s..%d ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
5533 static int sensor_remove(struct i2c_client *client)
5535 struct sensor *sensor = to_sensor(client);
5536 struct soc_camera_device *icd = client->dev.platform_data;
5538 #if CONFIG_SENSOR_Focus
5539 if (sensor->sensor_wq) {
5540 destroy_workqueue(sensor->sensor_wq);
5541 sensor->sensor_wq = NULL;
5546 i2c_set_clientdata(client, NULL);
5547 client->driver = NULL;
5553 static const struct i2c_device_id sensor_id[] = {
5554 {SENSOR_NAME_STRING(), 0 },
5557 MODULE_DEVICE_TABLE(i2c, sensor_id);
5559 static struct i2c_driver sensor_i2c_driver = {
5561 .name = SENSOR_NAME_STRING(),
5563 .probe = sensor_probe,
5564 .remove = sensor_remove,
5565 .id_table = sensor_id,
5568 static int __init sensor_mod_init(void)
5570 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
5571 return i2c_add_driver(&sensor_i2c_driver);
5574 static void __exit sensor_mod_exit(void)
5576 SENSOR_DG("\n%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
5577 i2c_del_driver(&sensor_i2c_driver);
5580 device_initcall_sync(sensor_mod_init);
5581 module_exit(sensor_mod_exit);
5583 MODULE_DESCRIPTION(SENSOR_NAME_STRING(Camera sensor driver));
5584 MODULE_AUTHOR("ddl <kernel@rock-chips>");
5585 MODULE_LICENSE("GPL");