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>
28 #include <linux/platform_device.h>
30 #define RK29_CAM_PLATFORM_DEV_ID 33
31 #define RK_CAM_PLATFORM_DEV_ID_0 RK29_CAM_PLATFORM_DEV_ID
32 #define RK_CAM_PLATFORM_DEV_ID_1 (RK_CAM_PLATFORM_DEV_ID_0+1)
33 #define INVALID_VALUE -1
35 #define INVALID_GPIO INVALID_VALUE
37 #define RK29_CAM_IO_SUCCESS 0
38 #define RK29_CAM_EIO_INVALID -3
39 #define RK29_CAM_EIO_REQUESTFAIL -2
41 #define RK29_CAM_POWERACTIVE_BITPOS 0x00
42 #define RK29_CAM_RESETACTIVE_BITPOS 0x01
43 #define RK29_CAM_POWERDNACTIVE_BITPOS 0x02
44 #define RK29_CAM_FLASHACTIVE_BITPOS 0x03
45 #define RK29_CAM_AFACTIVE_BITPOS 0x04
47 #define RK_CAM_NUM 0 //YZM
48 #define RK29_CAM_SUPPORT_NUMS RK_CAM_NUM
49 #define RK_CAM_SUPPORT_RESOLUTION 0x800000
51 #define _CONS(a,b) a##b
52 #define CONS(a,b) _CONS(a,b)
54 #define _CONS4(a,b,c,d) a##b##c##d
55 #define CONS4(a,b,c,d) _CONS4(a,b,c,d)
58 #define _STR(x) __STR(x)
59 #define STR(x) _STR(x)
62 /*---------------- Camera Sensor Must Define Macro Begin ------------------------*/
64 #define RK29_CAM_SENSOR_OV7675 ov7675
65 #define RK29_CAM_SENSOR_OV9650 ov9650
66 #define RK29_CAM_SENSOR_OV2640 ov2640
67 #define RK29_CAM_SENSOR_OV2655 ov2655
68 #define RK29_CAM_SENSOR_OV2659 ov2659
70 #define RK29_CAM_SENSOR_OV2660 ov2660 //yzm
72 #define RK29_CAM_SENSOR_OV7690 ov7690
73 #define RK29_CAM_SENSOR_OV3640 ov3640
74 #define RK29_CAM_SENSOR_OV3660 ov3660
75 #define RK29_CAM_SENSOR_OV5640 ov5640
76 #define RK29_CAM_SENSOR_OV5642 ov5642
77 #define RK29_CAM_SENSOR_S5K6AA s5k6aa
78 #define RK29_CAM_SENSOR_MT9D112 mt9d112
79 #define RK29_CAM_SENSOR_MT9D113 mt9d113
80 #define RK29_CAM_SENSOR_MT9P111 mt9p111
81 #define RK29_CAM_SENSOR_MT9T111 mt9t111
82 #define RK29_CAM_SENSOR_GT2005 gt2005
83 #define RK29_CAM_SENSOR_GC0307 gc0307
84 #define RK29_CAM_SENSOR_GC0308 gc0308
85 #define RK29_CAM_SENSOR_GC0309 gc0309
86 #define RK29_CAM_SENSOR_GC2015 gc2015
87 #define RK29_CAM_SENSOR_GC0328 gc0328
88 #define RK29_CAM_SENSOR_GC0329 gc0329
89 #define RK29_CAM_SENSOR_GC2035 gc2035
90 #define RK29_CAM_SENSOR_SIV120B siv120b
91 #define RK29_CAM_SENSOR_SIV121D siv121d
92 #define RK29_CAM_SENSOR_SID130B sid130B
93 #define RK29_CAM_SENSOR_HI253 hi253
94 #define RK29_CAM_SENSOR_HI704 hi704
95 #define RK29_CAM_SENSOR_NT99250 nt99250
96 #define RK29_CAM_SENSOR_SP0718 sp0718
97 #define RK29_CAM_SENSOR_SP0838 sp0838
98 #define RK29_CAM_SENSOR_SP2518 sp2518
99 #define RK29_CAM_SENSOR_S5K5CA s5k5ca
100 #define RK29_CAM_ISP_MTK9335 mtk9335isp
101 #define RK29_CAM_SENSOR_HM2057 hm2057
102 #define RK29_CAM_SENSOR_HM5065 hm5065
103 #define RK29_CAM_SENSOR_NT99160 nt99160 //oyyf@rock-chips.com
104 #define RK29_CAM_SENSOR_NT99240 nt99240 //oyyf@rock-chips.com
105 #define RK29_CAM_SENSOR_NT99252 nt99252 //oyyf@rock-chips.com
106 #define RK29_CAM_SENSOR_NT99340 nt99340 //oyyf@rock-chips.com
107 #define RK29_CAM_ISP_ICATCH7002_MI1040 icatchmi1040
108 #define RK29_CAM_ISP_ICATCH7002_OV5693 icatchov5693
109 #define RK29_CAM_ISP_ICATCH7002_OV8825 icatchov8825 //zyt
110 #define RK29_CAM_ISP_ICATCH7002_OV2720 icatchov2720 //zyt
112 #define RK29_CAM_SENSOR_NAME_OV7675 "ov7675"
113 #define RK29_CAM_SENSOR_NAME_OV9650 "ov9650"
114 #define RK29_CAM_SENSOR_NAME_OV2640 "ov2640"
115 #define RK29_CAM_SENSOR_NAME_OV2655 "ov2655"
116 #define RK29_CAM_SENSOR_NAME_OV2659 "ov2659"
118 #define RK29_CAM_SENSOR_NAME_OV2660 "ov2660" //yzm
121 #define RK29_CAM_SENSOR_NAME_OV7690 "ov7690"
122 #define RK29_CAM_SENSOR_NAME_OV3640 "ov3640"
123 #define RK29_CAM_SENSOR_NAME_OV3660 "ov3660"
124 #define RK29_CAM_SENSOR_NAME_OV5640 "ov5640"
125 #define RK29_CAM_SENSOR_NAME_OV5642 "ov5642"
126 #define RK29_CAM_SENSOR_NAME_S5K6AA "s5k6aa"
127 #define RK29_CAM_SENSOR_NAME_MT9D112 "mt9d112"
128 #define RK29_CAM_SENSOR_NAME_MT9D113 "mt9d113"
129 #define RK29_CAM_SENSOR_NAME_MT9P111 "mt9p111"
130 #define RK29_CAM_SENSOR_NAME_MT9T111 "mt9t111"
131 #define RK29_CAM_SENSOR_NAME_GT2005 "gt2005"
132 #define RK29_CAM_SENSOR_NAME_GC0307 "gc0307"
133 #define RK29_CAM_SENSOR_NAME_GC0308 "gc0308"
134 #define RK29_CAM_SENSOR_NAME_GC0309 "gc0309"
135 #define RK29_CAM_SENSOR_NAME_GC2015 "gc2015"
136 #define RK29_CAM_SENSOR_NAME_GC0328 "gc0328"
137 #define RK29_CAM_SENSOR_NAME_GC2035 "gc2035"
138 #define RK29_CAM_SENSOR_NAME_GC0329 "gc0329"
139 #define RK29_CAM_SENSOR_NAME_SIV120B "siv120b"
140 #define RK29_CAM_SENSOR_NAME_SIV121D "siv121d"
141 #define RK29_CAM_SENSOR_NAME_SID130B "sid130B"
142 #define RK29_CAM_SENSOR_NAME_HI253 "hi253"
143 #define RK29_CAM_SENSOR_NAME_HI704 "hi704"
144 #define RK29_CAM_SENSOR_NAME_NT99250 "nt99250"
145 #define RK29_CAM_SENSOR_NAME_SP0718 "sp0718"
146 #define RK29_CAM_SENSOR_NAME_SP0838 "sp0838"
147 #define RK29_CAM_SENSOR_NAME_SP2518 "sp2518"
148 #define RK29_CAM_SENSOR_NAME_S5K5CA "s5k5ca"
149 #define RK29_CAM_ISP_NAME_MTK9335ISP "mtk9335isp"
150 #define RK29_CAM_SENSOR_NAME_HM2057 "hm2057"
151 #define RK29_CAM_SENSOR_NAME_HM5065 "hm5065"
152 #define RK29_CAM_ISP_NAME_ICATCH7002_MI1040 "icatchmi1040"
153 #define RK29_CAM_ISP_NAME_ICATCH7002_OV5693 "icatchov5693"
154 #define RK29_CAM_ISP_NAME_ICATCH7002_OV8825 "icatchov8825" //zyt
155 #define RK29_CAM_ISP_NAME_ICATCH7002_OV2720 "icatchov2720" //zyt
157 //Sensor full resolution define
158 #define ov7675_FULL_RESOLUTION 0x30000 // 0.3 megapixel
159 #define ov9650_FULL_RESOLUTION 0x130000 // 1.3 megapixel
160 #define ov2640_FULL_RESOLUTION 0x200000 // 2 megapixel
161 #define ov2655_FULL_RESOLUTION 0x200000 // 2 megapixel
162 #define ov2659_FULL_RESOLUTION 0x200000 // 2 megapixel
164 #define ov2660_FULL_RESOLUTION 0x200000 // 2 megapixel
166 #define ov7690_FULL_RESOLUTION 0x300000 // 2 megapixel
167 #define ov3640_FULL_RESOLUTION 0x300000 // 3 megapixel
168 #define ov3660_FULL_RESOLUTION 0x300000 // 3 megapixel
169 #define ov5640_FULL_RESOLUTION 0x500000 // 5 megapixel
170 #if defined(CONFIG_SOC_CAMERA_OV5642_INTERPOLATION_8M)
171 #define ov5642_FULL_RESOLUTION 0x800000 // 8 megapixel
173 #define ov5642_FULL_RESOLUTION 0x500000 // 5 megapixel
175 #define s5k6aa_FULL_RESOLUTION 0x130000 // 1.3 megapixel
176 #define mt9d112_FULL_RESOLUTION 0x200000 // 2 megapixel
177 #define mt9d113_FULL_RESOLUTION 0x200000 // 2 megapixel
178 #define mt9t111_FULL_RESOLUTION 0x300000 // 3 megapixel
179 #define mt9p111_FULL_RESOLUTION 0x500000 // 5 megapixel
180 #define gt2005_FULL_RESOLUTION 0x200000 // 2 megapixel
181 #if defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_5M)
182 #define gc0308_FULL_RESOLUTION 0x500000 // 5 megapixel
183 #elif defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_3M)
184 #define gc0308_FULL_RESOLUTION 0x300000 // 3 megapixel
185 #elif defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_2M)
186 #define gc0308_FULL_RESOLUTION 0x200000 // 2 megapixel
188 #define gc0308_FULL_RESOLUTION 0x30000 // 0.3 megapixel#endif
190 #define gc0328_FULL_RESOLUTION 0x30000 // 0.3 megapixel
191 #define gc0307_FULL_RESOLUTION 0x30000 // 0.3 megapixel
192 #define gc0309_FULL_RESOLUTION 0x30000 // 0.3 megapixel
193 #define gc2015_FULL_RESOLUTION 0x200000 // 2 megapixel
194 #define siv120b_FULL_RESOLUTION 0x30000 // 0.3 megapixel
195 #define siv121d_FULL_RESOLUTION 0x30000 // 0.3 megapixel
196 #define sid130B_FULL_RESOLUTION 0x200000 // 2 megapixel
198 #if defined(CONFIG_SOC_CAMERA_HI253_INTERPOLATION_5M)
199 #define hi253_FULL_RESOLUTION 0x500000 // 5 megapixel
200 #elif defined(CONFIG_SOC_CAMERA_HI253_INTERPOLATION_3M)
201 #define hi253_FULL_RESOLUTION 0x300000 // 3 megapixel
203 #define hi253_FULL_RESOLUTION 0x200000 // 2 megapixel
206 #define hi704_FULL_RESOLUTION 0x30000 // 0.3 megapixel
207 #define nt99250_FULL_RESOLUTION 0x200000 // 2 megapixel
208 #define sp0718_FULL_RESOLUTION 0x30000 // 0.3 megapixel
209 #define sp0838_FULL_RESOLUTION 0x30000 // 0.3 megapixel
210 #define sp2518_FULL_RESOLUTION 0x200000 // 2 megapixel
211 #define gc0329_FULL_RESOLUTION 0x30000 // 0.3 megapixel
212 #define s5k5ca_FULL_RESOLUTION 0x300000 // 3 megapixel
213 #define mtk9335isp_FULL_RESOLUTION 0x500000 //5 megapixel
214 #define gc2035_FULL_RESOLUTION 0x200000 // 2 megapixel
215 #define hm2057_FULL_RESOLUTION 0x200000 // 2 megapixel
216 #define hm5065_FULL_RESOLUTION 0x500000 // 5 megapixel
217 #define nt99160_FULL_RESOLUTION 0x100000 // oyyf@rock-chips.com: 1 megapixel 1280*720
218 #define nt99240_FULL_RESOLUTION 0x200000 // oyyf@rock-chips.com: 2 megapixel 1600*1200
219 #define nt99252_FULL_RESOLUTION 0x200000 // oyyf@rock-chips.com: 2 megapixel 1600*1200
220 #define nt99340_FULL_RESOLUTION 0x300000 // oyyf@rock-chips.com: 3 megapixel 2048*1536
221 #define icatchmi1040_FULL_RESOLUTION 0x200000
222 #define icatchov5693_FULL_RESOLUTION 0x500000
223 #define icatchov8825_FULL_RESOLUTION 0x800000 //zyt
224 #define icatchov2720_FULL_RESOLUTION 0x210000 //zyt
225 #define end_FULL_RESOLUTION 0x00
227 //Sensor i2c addr define
228 #define ov7675_I2C_ADDR 0x78
229 #define ov9650_I2C_ADDR 0x60
230 #define ov2640_I2C_ADDR 0x60
231 #define ov2655_I2C_ADDR 0x60
232 #define ov2659_I2C_ADDR 0x60
234 #define ov2660_I2C_ADDR 0x60 //yzm
236 #define ov7690_I2C_ADDR 0x42
237 #define ov3640_I2C_ADDR 0x78
238 #define ov3660_I2C_ADDR 0x78
239 #define ov5640_I2C_ADDR 0x78
240 #define ov5642_I2C_ADDR 0x78
242 #define s5k6aa_I2C_ADDR 0x78 //0x5a
243 #define s5k5ca_I2C_ADDR 0x78 //0x5a
245 #define mt9d112_I2C_ADDR 0x78
246 #define mt9d113_I2C_ADDR 0x78
247 #define mt9t111_I2C_ADDR 0x78 // 0x7a
249 #define mt9p111_I2C_ADDR 0x78 //0x7a
250 #define gt2005_I2C_ADDR 0x78
251 #define gc0307_I2C_ADDR 0x42
252 #define gc0328_I2C_ADDR 0x42
253 #define gc0308_I2C_ADDR 0x42
254 #define gc0309_I2C_ADDR 0x42
255 #define gc0329_I2C_ADDR 0x62
256 #define gc2015_I2C_ADDR 0x60
257 #define gc2035_I2C_ADDR 0x78
259 #define siv120b_I2C_ADDR INVALID_VALUE
260 #define siv121d_I2C_ADDR INVALID_VALUE
261 #define sid130B_I2C_ADDR 0x37
263 #define hi253_I2C_ADDR 0x40
264 #define hi704_I2C_ADDR 0x60
266 #define nt99160_I2C_ADDR 0x54
267 #define nt99240_I2C_ADDR 0x6c
268 #define nt99250_I2C_ADDR 0x6c
269 #define nt99252_I2C_ADDR 0x6c
270 #define nt99340_I2C_ADDR 0x76
272 #define sp0718_I2C_ADDR 0x42
273 #define sp0838_I2C_ADDR INVALID_VALUE
274 #define sp0a19_I2C_ADDR 0x7a
275 #define sp1628_I2C_ADDR 0x78
276 #define sp2518_I2C_ADDR 0x60
277 #define mtk9335isp_I2C_ADDR 0x50
278 #define hm2057_I2C_ADDR 0x48
279 #define hm5065_I2C_ADDR 0x3e
280 #define icatchmi1040_I2C_ADDR 0x78
281 #define icatchov5693_I2C_ADDR 0x78
282 #define icatchov8825_I2C_ADDR 0x78 //zyt
283 #define icatchov2720_I2C_ADDR 0x78 //zyt
284 #define end_I2C_ADDR INVALID_VALUE
287 //Sensor power down active level define
288 #define ov7675_PWRDN_ACTIVE 0x01
289 #define ov9650_PWRDN_ACTIVE 0x01
290 #define ov2640_PWRDN_ACTIVE 0x01
291 #define ov2655_PWRDN_ACTIVE 0x01
292 #define ov2659_PWRDN_ACTIVE 0x01
294 #define ov2660_PWRDN_ACTIVE 0x01 //yzm
296 #define ov7690_PWRDN_ACTIVE 0x01
297 #define ov3640_PWRDN_ACTIVE 0x01
298 #define ov3660_PWRDN_ACTIVE 0x01
299 #define ov5640_PWRDN_ACTIVE 0x01
300 #define ov5642_PWRDN_ACTIVE 0x01
302 #define s5k6aa_PWRDN_ACTIVE 0x00
303 #define s5k5ca_PWRDN_ACTIVE 0x00
305 #define mt9d112_PWRDN_ACTIVE 0x01
306 #define mt9d113_PWRDN_ACTIVE 0x01
307 #define mt9t111_PWRDN_ACTIVE 0x01
308 #define mt9p111_PWRDN_ACTIVE 0x01
310 #define gt2005_PWRDN_ACTIVE 0x00
311 #define gc0307_PWRDN_ACTIVE 0x01
312 #define gc0308_PWRDN_ACTIVE 0x01
313 #define gc0328_PWRDN_ACTIVE 0x01
314 #define gc0309_PWRDN_ACTIVE 0x01
315 #define gc0329_PWRDN_ACTIVE 0x01
316 #define gc2015_PWRDN_ACTIVE 0x01
317 #define gc2035_PWRDN_ACTIVE 0x01
319 #define siv120b_PWRDN_ACTIVE INVALID_VALUE
320 #define siv121d_PWRDN_ACTIVE INVALID_VALUE
321 #define sid130B_PWRDN_ACTIVE 0x37
323 #define hi253_PWRDN_ACTIVE 0x01
324 #define hi704_PWRDN_ACTIVE 0x01
326 #define nt99160_PWRDN_ACTIVE 0x01
327 #define nt99240_PWRDN_ACTIVE 0x01
328 #define nt99250_PWRDN_ACTIVE 0x01
329 #define nt99252_PWRDN_ACTIVE 0x01
330 #define nt99340_PWRDN_ACTIVE 0x01
332 #define sp0718_PWRDN_ACTIVE 0x01
333 #define sp0838_PWRDN_ACTIVE 0x01
334 #define sp0a19_PWRDN_ACTIVE 0x01
335 #define sp1628_PWRDN_ACTIVE 0x01
336 #define sp2518_PWRDN_ACTIVE 0x01
337 #define hm2057_PWRDN_ACTIVE 0x01
338 #define hm5065_PWRDN_ACTIVE 0x00
339 #define mtk9335isp_PWRDN_ACTIVE 0x01
340 #define end_PWRDN_ACTIVE INVALID_VALUE
343 //Sensor power up sequence define
345 #define SENSOR_PWRSEQ_BEGIN 0x00
346 #define SENSOR_PWRSEQ_AVDD 0x01
347 #define SENSOR_PWRSEQ_DOVDD 0x02
348 #define SENSOR_PWRSEQ_DVDD 0x03
349 #define SENSOR_PWRSEQ_PWR 0x04
350 #define SENSOR_PWRSEQ_HWRST 0x05
351 #define SENSOR_PWRSEQ_PWRDN 0x06
352 #define SENSOR_PWRSEQ_CLKIN 0x07
353 #define SENSOR_PWRSEQ_END 0x0F
355 #define SENSOR_PWRSEQ_SET(type,idx) (type<<(idx*4))
356 #define SENSOR_PWRSEQ_GET(seq,idx) ((seq>>(idx*4))&0x0f)
358 #define sensor_PWRSEQ_DEFAULT (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,0)|\
359 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,1)|\
360 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWRDN,2)|\
361 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,3))
363 #define ov7675_PWRSEQ sensor_PWRSEQ_DEFAULT
364 #define ov9650_PWRSEQ sensor_PWRSEQ_DEFAULT
365 #define ov2640_PWRSEQ sensor_PWRSEQ_DEFAULT
366 #define ov2655_PWRSEQ sensor_PWRSEQ_DEFAULT
367 #define ov2659_PWRSEQ sensor_PWRSEQ_DEFAULT
369 #define ov2660_PWRSEQ sensor_PWRSEQ_DEFAULT
371 #define ov7690_PWRSEQ sensor_PWRSEQ_DEFAULT
372 #define ov3640_PWRSEQ sensor_PWRSEQ_DEFAULT
373 #define ov3660_PWRSEQ sensor_PWRSEQ_DEFAULT
374 #define ov5640_PWRSEQ sensor_PWRSEQ_DEFAULT
375 #define ov5642_PWRSEQ sensor_PWRSEQ_DEFAULT
377 #define s5k6aa_PWRSEQ sensor_PWRSEQ_DEFAULT
378 #define s5k5ca_PWRSEQ sensor_PWRSEQ_DEFAULT
380 #define mt9d112_PWRSEQ sensor_PWRSEQ_DEFAULT
381 #define mt9d113_PWRSEQ sensor_PWRSEQ_DEFAULT
382 #define mt9t111_PWRSEQ sensor_PWRSEQ_DEFAULT
383 #define mt9p111_PWRSEQ sensor_PWRSEQ_DEFAULT
385 #define gt2005_PWRSEQ sensor_PWRSEQ_DEFAULT
386 #define gc0307_PWRSEQ sensor_PWRSEQ_DEFAULT
387 #define gc0308_PWRSEQ sensor_PWRSEQ_DEFAULT
388 #define gc0328_PWRSEQ sensor_PWRSEQ_DEFAULT
389 #define gc0309_PWRSEQ sensor_PWRSEQ_DEFAULT
390 #define gc0329_PWRSEQ sensor_PWRSEQ_DEFAULT
391 #define gc2015_PWRSEQ sensor_PWRSEQ_DEFAULT
392 #define gc2035_PWRSEQ sensor_PWRSEQ_DEFAULT
394 #define siv120b_PWRSEQ sensor_PWRSEQ_DEFAULT
395 #define siv121d_PWRSEQ sensor_PWRSEQ_DEFAULT
396 #define sid130B_PWRSEQ sensor_PWRSEQ_DEFAULT
398 #define hi253_PWRSEQ sensor_PWRSEQ_DEFAULT
399 #define hi704_PWRSEQ sensor_PWRSEQ_DEFAULT
401 #define nt99160_PWRSEQ sensor_PWRSEQ_DEFAULT
402 #define nt99240_PWRSEQ sensor_PWRSEQ_DEFAULT
403 #define nt99250_PWRSEQ sensor_PWRSEQ_DEFAULT
404 #define nt99252_PWRSEQ sensor_PWRSEQ_DEFAULT
405 #define nt99340_PWRSEQ sensor_PWRSEQ_DEFAULT
407 #define sp0718_PWRSEQ sensor_PWRSEQ_DEFAULT
408 #define sp0838_PWRSEQ sensor_PWRSEQ_DEFAULT
409 #define sp0a19_PWRSEQ sensor_PWRSEQ_DEFAULT
410 #define sp1628_PWRSEQ sensor_PWRSEQ_DEFAULT
411 #define sp2518_PWRSEQ sensor_PWRSEQ_DEFAULT
412 #define hm2057_PWRSEQ sensor_PWRSEQ_DEFAULT
413 #define hm5065_PWRSEQ (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,1)|\
414 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,2)|\
415 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWRDN,0)|\
416 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,3))
417 #define mtk9335isp_PWRSEQ sensor_PWRSEQ_DEFAULT
418 #define icatchov5693_PWRSEQ (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,0)|\
419 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,2)|\
420 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,1))
422 #define icatchov8825_PWRSEQ (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,0)|\
423 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,2)|\
424 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,1)) //zyt
426 #define icatchov2720_PWRSEQ (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,0)|\
427 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,2)|\
428 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,1)) //zyt
430 #define icatchmi1040_PWRSEQ (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,0)|\
431 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,2)|\
432 SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,1))
434 #define end_PWRSEQ 0xffffffff
438 /*---------------- Camera Sensor Must Define Macro End ------------------------*/
441 //#define RK29_CAM_POWERACTIVE_BITPOS 0x00
442 #define RK29_CAM_POWERACTIVE_MASK (1<<RK29_CAM_POWERACTIVE_BITPOS)
443 #define RK29_CAM_POWERACTIVE_H (0x01<<RK29_CAM_POWERACTIVE_BITPOS)
444 #define RK29_CAM_POWERACTIVE_L (0x00<<RK29_CAM_POWERACTIVE_BITPOS)
446 //#define RK29_CAM_RESETACTIVE_BITPOS 0x01
447 #define RK29_CAM_RESETACTIVE_MASK (1<<RK29_CAM_RESETACTIVE_BITPOS)
448 #define RK29_CAM_RESETACTIVE_H (0x01<<RK29_CAM_RESETACTIVE_BITPOS)
449 #define RK29_CAM_RESETACTIVE_L (0x00<<RK29_CAM_RESETACTIVE_BITPOS)
451 //#define RK29_CAM_POWERDNACTIVE_BITPOS 0x02
452 #define RK29_CAM_POWERDNACTIVE_MASK (1<<RK29_CAM_POWERDNACTIVE_BITPOS)
453 #define RK29_CAM_POWERDNACTIVE_H (0x01<<RK29_CAM_POWERDNACTIVE_BITPOS)
454 #define RK29_CAM_POWERDNACTIVE_L (0x00<<RK29_CAM_POWERDNACTIVE_BITPOS)
456 //#define RK29_CAM_FLASHACTIVE_BITPOS 0x03
457 #define RK29_CAM_FLASHACTIVE_MASK (1<<RK29_CAM_FLASHACTIVE_BITPOS)
458 #define RK29_CAM_FLASHACTIVE_H (0x01<<RK29_CAM_FLASHACTIVE_BITPOS)
459 #define RK29_CAM_FLASHACTIVE_L (0x00<<RK29_CAM_FLASHACTIVE_BITPOS)
462 //#define RK29_CAM_AFACTIVE_BITPOS 0x04
463 #define RK29_CAM_AFACTIVE_MASK (1<<RK29_CAM_AFACTIVE_BITPOS)
464 #define RK29_CAM_AFACTIVE_H (0x01<<RK29_CAM_AFACTIVE_BITPOS)
465 #define RK29_CAM_AFACTIVE_L (0x00<<RK29_CAM_AFACTIVE_BITPOS)
469 #define RK_CAM_SCALE_CROP_ARM 0
470 #define RK_CAM_SCALE_CROP_IPP 1
471 #define RK_CAM_SCALE_CROP_RGA 2
472 #define RK_CAM_SCALE_CROP_PP 3
474 #define RK_CAM_INPUT_FMT_YUV422 (1<<0)
475 #define RK_CAM_INPUT_FMT_RAW10 (1<<1)
476 #define RK_CAM_INPUT_FMT_RAW12 (1<<2)
478 /* v4l2_subdev_core_ops.ioctl ioctl_cmd macro */
479 #define RK29_CAM_SUBDEV_ACTIVATE 0x00
480 #define RK29_CAM_SUBDEV_DEACTIVATE 0x01
481 #define RK29_CAM_SUBDEV_IOREQUEST 0x02
482 #define RK29_CAM_SUBDEV_CB_REGISTER 0x03
484 #define Sensor_HasBeen_PwrOff(a) (a&0x01)
485 #define Sensor_Support_DirectResume(a) ((a&0x10)==0x10)
487 #define Sensor_CropSet(a,b) a->reserved[1] = b;
488 #define Sensor_CropGet(a) a->reserved[1]
490 #define RK29_CAM_SUBDEV_HDR_EXPOSURE 0x04
492 #define RK_VIDEOBUF_HDR_EXPOSURE_MINUS_1 0x00
493 #define RK_VIDEOBUF_HDR_EXPOSURE_NORMAL 0x01
494 #define RK_VIDEOBUF_HDR_EXPOSURE_PLUS_1 0x02
495 #define RK_VIDEOBUF_HDR_EXPOSURE_FINISH 0x03
496 #define RK_VIDEOBUF_CODE_SET(rk_code,type) rk_code = (('R'<<24)|('K'<<16)|type)
497 #define RK_VIDEOBUF_CODE_CHK(rk_code) ((rk_code&(('R'<<24)|('K'<<16)))==(('R'<<24)|('K'<<16)))
499 enum rk29camera_ioctrl_cmd
509 enum rk29sensor_power_cmd
518 enum rk29camera_flash_cmd
525 struct rk29camera_gpio_res {
526 unsigned int gpio_reset;
527 unsigned int gpio_power;
528 unsigned int gpio_powerdown;
529 unsigned int gpio_flash;
530 unsigned int gpio_af;
531 unsigned int gpio_flag;
532 unsigned int gpio_init;
533 const char *dev_name;
536 struct rk29camera_mem_res {
540 void __iomem *vbase; //Ö¸ÏòIO¿Õ¼äµÄÖ¸Õ룬ΪÁËÇý¶¯³ÌÐòµÄͨÓÃÐÔ¿¼ÂÇ
542 struct rk29camera_info {
543 const char *dev_name;
544 unsigned int orientation;
545 struct v4l2_frmivalenum fival[10];
555 typedef struct rk_sensor_user_init_data{
556 int rk_sensor_init_width;
557 int rk_sensor_init_height;
558 unsigned long rk_sensor_init_bus_param;
559 enum v4l2_mbus_pixelcode rk_sensor_init_pixelcode;
560 struct reginfo_t * rk_sensor_init_data;
561 int rk_sensor_winseq_size;
562 struct reginfo_t * rk_sensor_init_winseq;
563 int rk_sensor_init_data_size;
564 }rk_sensor_user_init_data_s;
566 typedef struct rk_camera_device_register_info {
567 struct i2c_board_info i2c_cam_info;
568 struct soc_camera_desc desc_info;//yzm
569 struct platform_device device_info;
570 }rk_camera_device_register_info_t;
572 struct rkcamera_platform_data {
573 rk_camera_device_register_info_t dev;
575 struct rk29camera_gpio_res io;
578 int mirror; /* bit0: 0: mirror off
583 int i2c_rate; /* 100KHz = 100000 */
584 bool flash; /* true: the sensor attached flash;
585 false: the sensor haven't attach flash;
588 int pwdn_info; /* bit4: 1: sensor isn't need to be init after exit stanby, it can streaming directly
589 0: sensor must be init after exit standby;
591 bit0: 1: sensor power have been turn off;
592 0: sensor power is always on;
595 long powerup_sequence; /*
596 bit0-bit3 --- power up sequence first step;
597 bit4-bit7 --- power up sequence second step;
600 int mclk_rate; /* MHz : 24/48 */
601 int fov_h; /* fied of view horizontal */
602 int fov_v; /* fied of view vertical */
603 struct device_node *of_node;
604 struct rkcamera_platform_data *next_camera;//yzm
608 struct rk29camera_platform_data {
609 int (*io_init)(void);
610 int (*io_deinit)(int sensor);
611 int (*sensor_ioctrl)(struct device *dev,enum rk29camera_ioctrl_cmd cmd,int on);
613 int (*sensor_register)(void);
614 int (*sensor_mclk)(int cif_idx, int on, int clk_rate);
616 struct rkcamera_platform_data *register_dev_new; //sensor
617 struct device *cif_dev;//yzm host
620 struct rk29camera_platform_ioctl_cb {
621 int (*sensor_power_cb)(struct rk29camera_gpio_res *res, int on);
622 int (*sensor_reset_cb)(struct rk29camera_gpio_res *res, int on);
623 int (*sensor_powerdown_cb)(struct rk29camera_gpio_res *res, int on);
624 int (*sensor_flash_cb)(struct rk29camera_gpio_res *res, int on);
625 int (*sensor_af_cb)(struct rk29camera_gpio_res *res, int on);
628 typedef struct rk29_camera_sensor_cb {
629 int (*sensor_cb)(void *arg);
630 int (*scale_crop_cb)(struct work_struct *work);
631 }rk29_camera_sensor_cb_s;
633 #endif /* __ASM_ARCH_CAMERA_H_ */