2 camera.h - PXA camera driver header file
4 Copyright (C) 2003, Intel Corporation
5 Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef __ASM_ARCH_CAMERA_RK_H_
23 #define __ASM_ARCH_CAMERA_RK_H_
25 #include <linux/videodev2.h>
26 #include <media/soc_camera.h>
27 #include <linux/i2c.h>
29 #define RK29_CAM_PLATFORM_DEV_ID 33
30 #define RK_CAM_PLATFORM_DEV_ID_0 RK29_CAM_PLATFORM_DEV_ID
31 #define RK_CAM_PLATFORM_DEV_ID_1 (RK_CAM_PLATFORM_DEV_ID_0+1)
32 #define INVALID_VALUE -1
34 #define INVALID_GPIO INVALID_VALUE
36 #define RK29_CAM_IO_SUCCESS 0
37 #define RK29_CAM_EIO_INVALID -1
38 #define RK29_CAM_EIO_REQUESTFAIL -2
40 #define RK29_CAM_POWERACTIVE_BITPOS 0x00
41 #define RK29_CAM_RESETACTIVE_BITPOS 0x01
42 #define RK29_CAM_POWERDNACTIVE_BITPOS 0x02
43 #define RK29_CAM_FLASHACTIVE_BITPOS 0x03
46 #define RK29_CAM_SUPPORT_NUMS RK_CAM_NUM
47 #define RK_CAM_SUPPORT_RESOLUTION 0x800000
49 #define _CONS(a,b) a##b
50 #define CONS(a,b) _CONS(a,b)
52 #define _CONS4(a,b,c,d) a##b##c##d
53 #define CONS4(a,b,c,d) _CONS4(a,b,c,d)
56 #define _STR(x) __STR(x)
57 #define STR(x) _STR(x)
59 #define new_camera_device_ex(sensor_name,\
79 I2C_BOARD_INFO(STR(sensor_name), i2c_addr>>1),\
82 .bus_id= RK29_CAM_PLATFORM_DEV_ID+cif_chl,\
83 .i2c_adapter_id = i2c_chl,\
84 .module_name = STR(sensor_name),\
87 .name = "soc-camera-pdrv",\
89 .init_name = STR(CONS(_CONS(sensor_name,_),face)),\
94 .gpio_power = pwr_io,\
95 .gpio_reset = rst_io,\
96 .gpio_powerdown = pwdn_io,\
97 .gpio_flash = INVALID_GPIO,\
98 .gpio_flag = ((pwr_active&0x01)<<RK29_CAM_POWERACTIVE_BITPOS)|((rst_active&0x01)<<RK29_CAM_RESETACTIVE_BITPOS)|((pwdn_active&0x01)<<RK29_CAM_POWERDNACTIVE_BITPOS),\
103 .i2c_rate = i2c_spd,\
104 .flash = flash_attach,\
105 .pwdn_info = ((pwdn_active&0x10)|0x01),\
106 .powerup_sequence = CONS(sensor_name,_PWRSEQ),\
110 #define new_camera_device(sensor_name,\
117 new_camera_device_ex(sensor_name,\
125 CONS(sensor_name,_PWRDN_ACTIVE),\
127 CONS(sensor_name,_FULL_RESOLUTION),\
130 CONS(sensor_name,_I2C_ADDR),\
134 #define new_camera_device_end new_camera_device_ex(end,end,\
135 INVALID_VALUE,INVALID_VALUE,INVALID_VALUE,INVALID_VALUE,\
136 INVALID_VALUE,INVALID_VALUE,INVALID_VALUE,INVALID_VALUE,\
137 INVALID_VALUE,INVALID_VALUE,INVALID_VALUE,INVALID_VALUE,INVALID_VALUE,INVALID_VALUE,INVALID_VALUE)
140 /*---------------- Camera Sensor Must Define Macro Begin ------------------------*/
141 #define RK29_CAM_SENSOR_OV7675 ov7675
142 #define RK29_CAM_SENSOR_OV9650 ov9650
143 #define RK29_CAM_SENSOR_OV2640 ov2640
144 #define RK29_CAM_SENSOR_OV2655 ov2655
145 #define RK29_CAM_SENSOR_OV2659 ov2659
146 #define RK29_CAM_SENSOR_OV7690 ov7690
147 #define RK29_CAM_SENSOR_OV3640 ov3640
148 #define RK29_CAM_SENSOR_OV3660 ov3660
149 #define RK29_CAM_SENSOR_OV5640 ov5640
150 #define RK29_CAM_SENSOR_OV5642 ov5642
151 #define RK29_CAM_SENSOR_S5K6AA s5k6aa
152 #define RK29_CAM_SENSOR_MT9D112 mt9d112
153 #define RK29_CAM_SENSOR_MT9D113 mt9d113
154 #define RK29_CAM_SENSOR_MT9P111 mt9p111
155 #define RK29_CAM_SENSOR_MT9T111 mt9t111
156 #define RK29_CAM_SENSOR_GT2005 gt2005
157 #define RK29_CAM_SENSOR_GC0307 gc0307
158 #define RK29_CAM_SENSOR_GC0308 gc0308
159 #define RK29_CAM_SENSOR_GC0309 gc0309
160 #define RK29_CAM_SENSOR_GC2015 gc2015
161 #define RK29_CAM_SENSOR_GC0328 gc0328
162 #define RK29_CAM_SENSOR_GC0329 gc0329
163 #define RK29_CAM_SENSOR_GC2035 gc2035
164 #define RK29_CAM_SENSOR_SIV120B siv120b
165 #define RK29_CAM_SENSOR_SIV121D siv121d
166 #define RK29_CAM_SENSOR_SID130B sid130B
167 #define RK29_CAM_SENSOR_HI253 hi253
168 #define RK29_CAM_SENSOR_HI704 hi704
169 #define RK29_CAM_SENSOR_NT99250 nt99250
170 #define RK29_CAM_SENSOR_SP0718 sp0718
171 #define RK29_CAM_SENSOR_SP0838 sp0838
172 #define RK29_CAM_SENSOR_SP2518 sp2518
173 #define RK29_CAM_SENSOR_S5K5CA s5k5ca
174 #define RK29_CAM_ISP_MTK9335 mtk9335isp
175 #define RK29_CAM_SENSOR_HM2057 hm2057
176 #define RK29_CAM_SENSOR_HM5065 hm5065
177 #define RK29_CAM_SENSOR_NT99160 nt99160 //oyyf@rock-chips.com
178 #define RK29_CAM_SENSOR_NT99240 nt99240 //oyyf@rock-chips.com
179 #define RK29_CAM_SENSOR_NT99252 nt99252 //oyyf@rock-chips.com
180 #define RK29_CAM_SENSOR_NT99340 nt99340 //oyyf@rock-chips.com
183 #define RK29_CAM_SENSOR_NAME_OV7675 "ov7675"
184 #define RK29_CAM_SENSOR_NAME_OV9650 "ov9650"
185 #define RK29_CAM_SENSOR_NAME_OV2640 "ov2640"
186 #define RK29_CAM_SENSOR_NAME_OV2655 "ov2655"
187 #define RK29_CAM_SENSOR_NAME_OV2659 "ov2659"
188 #define RK29_CAM_SENSOR_NAME_OV7690 "ov7690"
189 #define RK29_CAM_SENSOR_NAME_OV3640 "ov3640"
190 #define RK29_CAM_SENSOR_NAME_OV3660 "ov3660"
191 #define RK29_CAM_SENSOR_NAME_OV5640 "ov5640"
192 #define RK29_CAM_SENSOR_NAME_OV5642 "ov5642"
193 #define RK29_CAM_SENSOR_NAME_S5K6AA "s5k6aa"
194 #define RK29_CAM_SENSOR_NAME_MT9D112 "mt9d112"
195 #define RK29_CAM_SENSOR_NAME_MT9D113 "mt9d113"
196 #define RK29_CAM_SENSOR_NAME_MT9P111 "mt9p111"
197 #define RK29_CAM_SENSOR_NAME_MT9T111 "mt9t111"
198 #define RK29_CAM_SENSOR_NAME_GT2005 "gt2005"
199 #define RK29_CAM_SENSOR_NAME_GC0307 "gc0307"
200 #define RK29_CAM_SENSOR_NAME_GC0308 "gc0308"
201 #define RK29_CAM_SENSOR_NAME_GC0309 "gc0309"
202 #define RK29_CAM_SENSOR_NAME_GC2015 "gc2015"
203 #define RK29_CAM_SENSOR_NAME_GC0328 "gc0328"
204 #define RK29_CAM_SENSOR_NAME_GC2035 "gc2035"
205 #define RK29_CAM_SENSOR_NAME_GC0329 "gc0329"
206 #define RK29_CAM_SENSOR_NAME_SIV120B "siv120b"
207 #define RK29_CAM_SENSOR_NAME_SIV121D "siv121d"
208 #define RK29_CAM_SENSOR_NAME_SID130B "sid130B"
209 #define RK29_CAM_SENSOR_NAME_HI253 "hi253"
210 #define RK29_CAM_SENSOR_NAME_HI704 "hi704"
211 #define RK29_CAM_SENSOR_NAME_NT99250 "nt99250"
212 #define RK29_CAM_SENSOR_NAME_SP0718 "sp0718"
213 #define RK29_CAM_SENSOR_NAME_SP0838 "sp0838"
214 #define RK29_CAM_SENSOR_NAME_SP2518 "sp2518"
215 #define RK29_CAM_SENSOR_NAME_S5K5CA "s5k5ca"
216 #define RK29_CAM_ISP_NAME_MTK9335ISP "mtk9335isp"
217 #define RK29_CAM_SENSOR_NAME_HM2057 "hm2057"
218 #define RK29_CAM_SENSOR_NAME_HM5065 "hm5065"
220 //Sensor full resolution define
221 #define ov7675_FULL_RESOLUTION 0x30000 // 0.3 megapixel
222 #define ov9650_FULL_RESOLUTION 0x130000 // 1.3 megapixel
223 #define ov2640_FULL_RESOLUTION 0x200000 // 2 megapixel
224 #define ov2655_FULL_RESOLUTION 0x200000 // 2 megapixel
225 #define ov2659_FULL_RESOLUTION 0x200000 // 2 megapixel
226 #define ov7690_FULL_RESOLUTION 0x300000 // 2 megapixel
227 #define ov3640_FULL_RESOLUTION 0x300000 // 3 megapixel
228 #define ov3660_FULL_RESOLUTION 0x300000 // 3 megapixel
229 #define ov5640_FULL_RESOLUTION 0x500000 // 5 megapixel
230 #if defined(CONFIG_SOC_CAMERA_OV5642_INTERPOLATION_8M)
231 #define ov5642_FULL_RESOLUTION 0x800000 // 8 megapixel
233 #define ov5642_FULL_RESOLUTION 0x500000 // 5 megapixel
235 #define s5k6aa_FULL_RESOLUTION 0x130000 // 1.3 megapixel
236 #define mt9d112_FULL_RESOLUTION 0x200000 // 2 megapixel
237 #define mt9d113_FULL_RESOLUTION 0x200000 // 2 megapixel
238 #define mt9t111_FULL_RESOLUTION 0x300000 // 3 megapixel
239 #define mt9p111_FULL_RESOLUTION 0x500000 // 5 megapixel
240 #define gt2005_FULL_RESOLUTION 0x200000 // 2 megapixel
241 #if defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_5M)
242 #define gc0308_FULL_RESOLUTION 0x500000 // 5 megapixel
243 #elif defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_3M)
244 #define gc0308_FULL_RESOLUTION 0x300000 // 3 megapixel
245 #elif defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_2M)
246 #define gc0308_FULL_RESOLUTION 0x200000 // 2 megapixel
248 #define gc0308_FULL_RESOLUTION 0x30000 // 0.3 megapixel#endif
250 #define gc0328_FULL_RESOLUTION 0x30000 // 0.3 megapixel
251 #define gc0307_FULL_RESOLUTION 0x30000 // 0.3 megapixel
252 #define gc0309_FULL_RESOLUTION 0x30000 // 0.3 megapixel
253 #define gc2015_FULL_RESOLUTION 0x200000 // 2 megapixel
254 #define siv120b_FULL_RESOLUTION 0x30000 // 0.3 megapixel
255 #define siv121d_FULL_RESOLUTION 0x30000 // 0.3 megapixel
256 #define sid130B_FULL_RESOLUTION 0x200000 // 2 megapixel
258 #if defined(CONFIG_SOC_CAMERA_HI253_INTERPOLATION_5M)
259 #define hi253_FULL_RESOLUTION 0x500000 // 5 megapixel
260 #elif defined(CONFIG_SOC_CAMERA_HI253_INTERPOLATION_3M)
261 #define hi253_FULL_RESOLUTION 0x300000 // 3 megapixel
263 #define hi253_FULL_RESOLUTION 0x200000 // 2 megapixel
266 #define hi704_FULL_RESOLUTION 0x30000 // 0.3 megapixel
267 #define nt99250_FULL_RESOLUTION 0x200000 // 2 megapixel
268 #define sp0718_FULL_RESOLUTION 0x30000 // 0.3 megapixel
269 #define sp0838_FULL_RESOLUTION 0x30000 // 0.3 megapixel
270 #define sp2518_FULL_RESOLUTION 0x200000 // 2 megapixel
271 #define gc0329_FULL_RESOLUTION 0x30000 // 0.3 megapixel
272 #define s5k5ca_FULL_RESOLUTION 0x300000 // 3 megapixel
273 #define mtk9335isp_FULL_RESOLUTION 0x500000 //5 megapixel
274 #define gc2035_FULL_RESOLUTION 0x200000 // 2 megapixel
275 #define hm2057_FULL_RESOLUTION 0x200000 // 2 megapixel
276 #define hm5065_FULL_RESOLUTION 0x500000 // 5 megapixel
277 #define nt99160_FULL_RESOLUTION 0x100000 // oyyf@rock-chips.com: 1 megapixel 1280*720
278 #define nt99240_FULL_RESOLUTION 0x200000 // oyyf@rock-chips.com: 2 megapixel 1600*1200
279 #define nt99252_FULL_RESOLUTION 0x200000 // oyyf@rock-chips.com: 2 megapixel 1600*1200
280 #define nt99340_FULL_RESOLUTION 0x300000 // oyyf@rock-chips.com: 3 megapixel 2048*1536
282 #define end_FULL_RESOLUTION 0x00
284 //Sensor i2c addr define
285 #define ov7675_I2C_ADDR 0x78
286 #define ov9650_I2C_ADDR 0x60
287 #define ov2640_I2C_ADDR 0x60
288 #define ov2655_I2C_ADDR 0x60
289 #define ov2659_I2C_ADDR 0x60
290 #define ov7690_I2C_ADDR 0x42
291 #define ov3640_I2C_ADDR 0x78
292 #define ov3660_I2C_ADDR 0x78
293 #define ov5640_I2C_ADDR 0x78
294 #define ov5642_I2C_ADDR 0x78
296 #define s5k6aa_I2C_ADDR 0x78 //0x5a
297 #define s5k5ca_I2C_ADDR 0x78 //0x5a
299 #define mt9d112_I2C_ADDR 0x78
300 #define mt9d113_I2C_ADDR 0x78
301 #define mt9t111_I2C_ADDR 0x78 // 0x7a
303 #define mt9p111_I2C_ADDR 0x78 //0x7a
304 #define gt2005_I2C_ADDR 0x78
305 #define gc0307_I2C_ADDR 0x42
306 #define gc0328_I2C_ADDR 0x42
307 #define gc0308_I2C_ADDR 0x42
308 #define gc0309_I2C_ADDR 0x42
309 #define gc0329_I2C_ADDR 0x62
310 #define gc2015_I2C_ADDR 0x60
311 #define gc2035_I2C_ADDR 0x78
313 #define siv120b_I2C_ADDR INVALID_VALUE
314 #define siv121d_I2C_ADDR INVALID_VALUE
315 #define sid130B_I2C_ADDR 0x37
317 #define hi253_I2C_ADDR 0x40
318 #define hi704_I2C_ADDR 0x60
320 #define nt99160_I2C_ADDR 0x54
321 #define nt99240_I2C_ADDR 0x6c
322 #define nt99250_I2C_ADDR 0x6c
323 #define nt99252_I2C_ADDR 0x6c
324 #define nt99340_I2C_ADDR 0x76
326 #define sp0718_I2C_ADDR 0x42
327 #define sp0838_I2C_ADDR INVALID_VALUE
328 #define sp0a19_I2C_ADDR 0x7a
329 #define sp1628_I2C_ADDR 0x78
330 #define sp2518_I2C_ADDR 0x60
331 #define mtk9335isp_I2C_ADDR 0x50
332 #define hm2057_I2C_ADDR 0x48
333 #define hm5065_I2C_ADDR 0x3e
334 #define end_I2C_ADDR INVALID_VALUE
337 //Sensor power down active level define
338 #define ov7675_PWRDN_ACTIVE 0x01
339 #define ov9650_PWRDN_ACTIVE 0x01
340 #define ov2640_PWRDN_ACTIVE 0x01
341 #define ov2655_PWRDN_ACTIVE 0x01
342 #define ov2659_PWRDN_ACTIVE 0x01
343 #define ov7690_PWRDN_ACTIVE 0x01
344 #define ov3640_PWRDN_ACTIVE 0x01
345 #define ov3660_PWRDN_ACTIVE 0x01
346 #define ov5640_PWRDN_ACTIVE 0x01
347 #define ov5642_PWRDN_ACTIVE 0x01
349 #define s5k6aa_PWRDN_ACTIVE 0x00
350 #define s5k5ca_PWRDN_ACTIVE 0x00
352 #define mt9d112_PWRDN_ACTIVE 0x01
353 #define mt9d113_PWRDN_ACTIVE 0x01
354 #define mt9t111_PWRDN_ACTIVE 0x01
355 #define mt9p111_PWRDN_ACTIVE 0x01
357 #define gt2005_PWRDN_ACTIVE 0x00
358 #define gc0307_PWRDN_ACTIVE 0x01
359 #define gc0308_PWRDN_ACTIVE 0x01
360 #define gc0328_PWRDN_ACTIVE 0x01
361 #define gc0309_PWRDN_ACTIVE 0x01
362 #define gc0329_PWRDN_ACTIVE 0x01
363 #define gc2015_PWRDN_ACTIVE 0x01
364 #define gc2035_PWRDN_ACTIVE 0x01
366 #define siv120b_PWRDN_ACTIVE INVALID_VALUE
367 #define siv121d_PWRDN_ACTIVE INVALID_VALUE
368 #define sid130B_PWRDN_ACTIVE 0x37
370 #define hi253_PWRDN_ACTIVE 0x01
371 #define hi704_PWRDN_ACTIVE 0x01
373 #define nt99160_PWRDN_ACTIVE 0x01
374 #define nt99240_PWRDN_ACTIVE 0x01
375 #define nt99250_PWRDN_ACTIVE 0x01
376 #define nt99252_PWRDN_ACTIVE 0x01
377 #define nt99340_PWRDN_ACTIVE 0x01
379 #define sp0718_PWRDN_ACTIVE 0x01
380 #define sp0838_PWRDN_ACTIVE 0x01
381 #define sp0a19_PWRDN_ACTIVE 0x01
382 #define sp1628_PWRDN_ACTIVE 0x01
383 #define sp2518_PWRDN_ACTIVE 0x01
384 #define hm2057_PWRDN_ACTIVE 0x01
385 #define hm5065_PWRDN_ACTIVE 0x00
386 #define mtk9335isp_PWRDN_ACTIVE 0x01
387 #define end_PWRDN_ACTIVE INVALID_VALUE
390 //Sensor power up sequence define
392 #define SENSOR_PWRSEQ_BEGIN 0x00
393 #define SENSOR_PWRSEQ_AVDD 0x01
394 #define SENSOR_PWRSEQ_DOVDD 0x02
395 #define SENSOR_PWRSEQ_DVDD 0x03
396 #define SENSOR_PWRSEQ_PWR 0x04
397 #define SENSOR_PWRSEQ_HWRST 0x05
398 #define SENSOR_PWRSEQ_PWRDN 0x06
399 #define SENSOR_PWRSEQ_CLKIN 0x07
400 #define SENSOR_PWRSEQ_END 0x0F
402 #define SENSOR_PWRSEQ_SET(type,idx) (type<<(idx*4))
403 #define SENSOR_PWRSEQ_GET(seq,idx) ((seq>>(idx*4))&0x0f)
405 #define sensor_PWRSEQ_DEFAULT (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,0)|\
406 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,1)|\
407 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWRDN,2)|\
408 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,3))
410 #define ov7675_PWRSEQ sensor_PWRSEQ_DEFAULT
411 #define ov9650_PWRSEQ sensor_PWRSEQ_DEFAULT
412 #define ov2640_PWRSEQ sensor_PWRSEQ_DEFAULT
413 #define ov2655_PWRSEQ sensor_PWRSEQ_DEFAULT
414 #define ov2659_PWRSEQ sensor_PWRSEQ_DEFAULT
415 #define ov7690_PWRSEQ sensor_PWRSEQ_DEFAULT
416 #define ov3640_PWRSEQ sensor_PWRSEQ_DEFAULT
417 #define ov3660_PWRSEQ sensor_PWRSEQ_DEFAULT
418 #define ov5640_PWRSEQ sensor_PWRSEQ_DEFAULT
419 #define ov5642_PWRSEQ sensor_PWRSEQ_DEFAULT
421 #define s5k6aa_PWRSEQ sensor_PWRSEQ_DEFAULT
422 #define s5k5ca_PWRSEQ sensor_PWRSEQ_DEFAULT
424 #define mt9d112_PWRSEQ sensor_PWRSEQ_DEFAULT
425 #define mt9d113_PWRSEQ sensor_PWRSEQ_DEFAULT
426 #define mt9t111_PWRSEQ sensor_PWRSEQ_DEFAULT
427 #define mt9p111_PWRSEQ sensor_PWRSEQ_DEFAULT
429 #define gt2005_PWRSEQ sensor_PWRSEQ_DEFAULT
430 #define gc0307_PWRSEQ sensor_PWRSEQ_DEFAULT
431 #define gc0308_PWRSEQ sensor_PWRSEQ_DEFAULT
432 #define gc0328_PWRSEQ sensor_PWRSEQ_DEFAULT
433 #define gc0309_PWRSEQ sensor_PWRSEQ_DEFAULT
434 #define gc0329_PWRSEQ sensor_PWRSEQ_DEFAULT
435 #define gc2015_PWRSEQ sensor_PWRSEQ_DEFAULT
436 #define gc2035_PWRSEQ sensor_PWRSEQ_DEFAULT
438 #define siv120b_PWRSEQ sensor_PWRSEQ_DEFAULT
439 #define siv121d_PWRSEQ sensor_PWRSEQ_DEFAULT
440 #define sid130B_PWRSEQ sensor_PWRSEQ_DEFAULT
442 #define hi253_PWRSEQ sensor_PWRSEQ_DEFAULT
443 #define hi704_PWRSEQ sensor_PWRSEQ_DEFAULT
445 #define nt99160_PWRSEQ sensor_PWRSEQ_DEFAULT
446 #define nt99240_PWRSEQ sensor_PWRSEQ_DEFAULT
447 #define nt99250_PWRSEQ sensor_PWRSEQ_DEFAULT
448 #define nt99252_PWRSEQ sensor_PWRSEQ_DEFAULT
449 #define nt99340_PWRSEQ sensor_PWRSEQ_DEFAULT
451 #define sp0718_PWRSEQ sensor_PWRSEQ_DEFAULT
452 #define sp0838_PWRSEQ sensor_PWRSEQ_DEFAULT
453 #define sp0a19_PWRSEQ sensor_PWRSEQ_DEFAULT
454 #define sp1628_PWRSEQ sensor_PWRSEQ_DEFAULT
455 #define sp2518_PWRSEQ sensor_PWRSEQ_DEFAULT
456 #define hm2057_PWRSEQ sensor_PWRSEQ_DEFAULT
457 #define hm5065_PWRSEQ (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,1)|\
458 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,2)|\
459 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWRDN,0)|\
460 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,3))
461 #define mtk9335isp_PWRSEQ sensor_PWRSEQ_DEFAULT
462 #define end_PWRSEQ 0xffffffff
466 /*---------------- Camera Sensor Must Define Macro End ------------------------*/
469 //#define RK29_CAM_POWERACTIVE_BITPOS 0x00
470 #define RK29_CAM_POWERACTIVE_MASK (1<<RK29_CAM_POWERACTIVE_BITPOS)
471 #define RK29_CAM_POWERACTIVE_H (0x01<<RK29_CAM_POWERACTIVE_BITPOS)
472 #define RK29_CAM_POWERACTIVE_L (0x00<<RK29_CAM_POWERACTIVE_BITPOS)
474 //#define RK29_CAM_RESETACTIVE_BITPOS 0x01
475 #define RK29_CAM_RESETACTIVE_MASK (1<<RK29_CAM_RESETACTIVE_BITPOS)
476 #define RK29_CAM_RESETACTIVE_H (0x01<<RK29_CAM_RESETACTIVE_BITPOS)
477 #define RK29_CAM_RESETACTIVE_L (0x00<<RK29_CAM_RESETACTIVE_BITPOS)
479 //#define RK29_CAM_POWERDNACTIVE_BITPOS 0x02
480 #define RK29_CAM_POWERDNACTIVE_MASK (1<<RK29_CAM_POWERDNACTIVE_BITPOS)
481 #define RK29_CAM_POWERDNACTIVE_H (0x01<<RK29_CAM_POWERDNACTIVE_BITPOS)
482 #define RK29_CAM_POWERDNACTIVE_L (0x00<<RK29_CAM_POWERDNACTIVE_BITPOS)
484 //#define RK29_CAM_FLASHACTIVE_BITPOS 0x03
485 #define RK29_CAM_FLASHACTIVE_MASK (1<<RK29_CAM_FLASHACTIVE_BITPOS)
486 #define RK29_CAM_FLASHACTIVE_H (0x01<<RK29_CAM_FLASHACTIVE_BITPOS)
487 #define RK29_CAM_FLASHACTIVE_L (0x00<<RK29_CAM_FLASHACTIVE_BITPOS)
490 #define RK_CAM_SCALE_CROP_ARM 0
491 #define RK_CAM_SCALE_CROP_IPP 1
492 #define RK_CAM_SCALE_CROP_RGA 2
493 #define RK_CAM_SCALE_CROP_PP 3
495 #define RK_CAM_INPUT_FMT_YUV422 (1<<0)
496 #define RK_CAM_INPUT_FMT_RAW10 (1<<1)
497 #define RK_CAM_INPUT_FMT_RAW12 (1<<2)
499 /* v4l2_subdev_core_ops.ioctl ioctl_cmd macro */
500 #define RK29_CAM_SUBDEV_ACTIVATE 0x00
501 #define RK29_CAM_SUBDEV_DEACTIVATE 0x01
502 #define RK29_CAM_SUBDEV_IOREQUEST 0x02
503 #define RK29_CAM_SUBDEV_CB_REGISTER 0x03
505 #define Sensor_HasBeen_PwrOff(a) (a&0x01)
506 #define Sensor_Support_DirectResume(a) ((a&0x10)==0x10)
508 enum rk29camera_ioctrl_cmd
517 enum rk29sensor_power_cmd
525 enum rk29camera_flash_cmd
532 struct rk29camera_gpio_res {
533 unsigned int gpio_reset;
534 unsigned int gpio_power;
535 unsigned int gpio_powerdown;
536 unsigned int gpio_flash;
537 unsigned int gpio_flag;
538 unsigned int gpio_init;
539 const char *dev_name;
542 struct rk29camera_mem_res {
548 struct rk29camera_info {
549 const char *dev_name;
550 unsigned int orientation;
551 struct v4l2_frmivalenum fival[10];
561 typedef struct rk_sensor_user_init_data{
562 int rk_sensor_init_width;
563 int rk_sensor_init_height;
564 unsigned long rk_sensor_init_bus_param;
565 enum v4l2_mbus_pixelcode rk_sensor_init_pixelcode;
566 struct reginfo_t * rk_sensor_init_data;
567 int rk_sensor_winseq_size;
568 struct reginfo_t * rk_sensor_init_winseq;
569 int rk_sensor_init_data_size;
570 }rk_sensor_user_init_data_s;
572 typedef struct rk_camera_device_register_info {
573 struct i2c_board_info i2c_cam_info;
574 struct soc_camera_link link_info;
575 struct platform_device device_info;
576 }rk_camera_device_register_info_t;
578 struct rkcamera_platform_data {
579 rk_camera_device_register_info_t dev;
581 struct rk29camera_gpio_res io;
584 int mirror; /* bit0: 0: mirror off
589 int i2c_rate; /* 100KHz = 100000 */
590 bool flash; /* true: the sensor attached flash;
591 false: the sensor haven't attach flash;
594 int pwdn_info; /* bit4: 1: sensor isn't need to be init after exit stanby, it can streaming directly
595 0: sensor must be init after exit standby;
597 bit0: 1: sensor power have been turn off;
598 0: sensor power is always on;
601 long powerup_sequence; /*
602 bit0-bit3 --- power up sequence first step;
603 bit4-bit7 --- power up sequence second step;
606 int mclk_rate; /* MHz : 24/48 */
610 struct rk29camera_platform_data {
611 int (*io_init)(void);
612 int (*io_deinit)(int sensor);
613 int (*iomux)(int pin);
614 int (*sensor_ioctrl)(struct device *dev,enum rk29camera_ioctrl_cmd cmd,int on);
616 int (*sensor_register)(void);
617 int (*sensor_mclk)(int cif_idx, int on, int clk_rate);
619 rk_sensor_user_init_data_s* sensor_init_data[RK_CAM_NUM];
620 struct rk29camera_gpio_res gpio_res[RK_CAM_NUM];
621 struct rk29camera_mem_res meminfo;
622 struct rk29camera_mem_res meminfo_cif1;
623 struct rk29camera_info info[RK_CAM_NUM];
624 rk_camera_device_register_info_t register_dev[RK_CAM_NUM];
625 struct rkcamera_platform_data *register_dev_new;
628 struct rk29camera_platform_ioctl_cb {
629 int (*sensor_power_cb)(struct rk29camera_gpio_res *res, int on);
630 int (*sensor_reset_cb)(struct rk29camera_gpio_res *res, int on);
631 int (*sensor_powerdown_cb)(struct rk29camera_gpio_res *res, int on);
632 int (*sensor_flash_cb)(struct rk29camera_gpio_res *res, int on);
635 typedef struct rk29_camera_sensor_cb {
636 int (*sensor_cb)(void *arg);
637 int (*scale_crop_cb)(struct work_struct *work);
638 }rk29_camera_sensor_cb_s;
639 #endif /* __ASM_ARCH_CAMERA_H_ */