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_H_
23 #define __ASM_ARCH_CAMERA_H_
25 #include <linux/videodev2.h>
27 #define RK29_CAM_DRV_NAME "rk29xx-camera"
28 #define RK29_CAM_PLATFORM_DEV_ID 33
30 #define INVALID_GPIO -1
32 #define RK29_CAM_IO_SUCCESS 0
33 #define RK29_CAM_EIO_INVALID -1
34 #define RK29_CAM_EIO_REQUESTFAIL -2
36 /*---------------- Camera Sensor Must Define Macro Begin ------------------------*/
37 #define RK29_CAM_SENSOR_OV7675 ov7675
38 #define RK29_CAM_SENSOR_OV9650 ov9650
39 #define RK29_CAM_SENSOR_OV2640 ov2640
40 #define RK29_CAM_SENSOR_OV2655 ov2655
41 #define RK29_CAM_SENSOR_OV2659 ov2659
42 #define RK29_CAM_SENSOR_OV7690 ov7690
43 #define RK29_CAM_SENSOR_OV3640 ov3640
44 #define RK29_CAM_SENSOR_OV5640 ov5640
45 #define RK29_CAM_SENSOR_OV5642 ov5642
46 #define RK29_CAM_SENSOR_S5K6AA s5k6aa
47 #define RK29_CAM_SENSOR_MT9D112 mt9d112
48 #define RK29_CAM_SENSOR_MT9D113 mt9d113
49 #define RK29_CAM_SENSOR_MT9P111 mt9p111
50 #define RK29_CAM_SENSOR_MT9T111 mt9t111
51 #define RK29_CAM_SENSOR_GT2005 gt2005
52 #define RK29_CAM_SENSOR_GC0307 gc0307
53 #define RK29_CAM_SENSOR_GC0308 gc0308
54 #define RK29_CAM_SENSOR_GC0309 gc0309
55 #define RK29_CAM_SENSOR_GC2015 gc2015
56 #define RK29_CAM_SENSOR_SIV120B siv120b
57 #define RK29_CAM_SENSOR_SID130B sid130B
58 #define RK29_CAM_SENSOR_HI253 hi253
59 #define RK29_CAM_SENSOR_HI704 hi704
60 #define RK29_CAM_SENSOR_NT99250 nt99250
62 #define RK29_CAM_SENSOR_NAME_OV7675 "ov7675"
63 #define RK29_CAM_SENSOR_NAME_OV9650 "ov9650"
64 #define RK29_CAM_SENSOR_NAME_OV2640 "ov2640"
65 #define RK29_CAM_SENSOR_NAME_OV2655 "ov2655"
66 #define RK29_CAM_SENSOR_NAME_OV2659 "ov2659"
67 #define RK29_CAM_SENSOR_NAME_OV7690 "ov7690"
68 #define RK29_CAM_SENSOR_NAME_OV3640 "ov3640"
69 #define RK29_CAM_SENSOR_NAME_OV5640 "ov5640"
70 #define RK29_CAM_SENSOR_NAME_OV5642 "ov5642"
71 #define RK29_CAM_SENSOR_NAME_S5K6AA "s5k6aa"
72 #define RK29_CAM_SENSOR_NAME_MT9D112 "mt9d112"
73 #define RK29_CAM_SENSOR_NAME_MT9D113 "mt9d113"
74 #define RK29_CAM_SENSOR_NAME_MT9P111 "mt9p111"
75 #define RK29_CAM_SENSOR_NAME_MT9T111 "mt9t111"
76 #define RK29_CAM_SENSOR_NAME_GT2005 "gt2005"
77 #define RK29_CAM_SENSOR_NAME_GC0307 "gc0307"
78 #define RK29_CAM_SENSOR_NAME_GC0308 "gc0308"
79 #define RK29_CAM_SENSOR_NAME_GC0309 "gc0309"
80 #define RK29_CAM_SENSOR_NAME_GC2015 "gc2015"
81 #define RK29_CAM_SENSOR_NAME_SIV120B "siv120b"
82 #define RK29_CAM_SENSOR_NAME_SID130B "sid130B"
83 #define RK29_CAM_SENSOR_NAME_HI253 "hi253"
84 #define RK29_CAM_SENSOR_NAME_HI704 "hi704"
85 #define RK29_CAM_SENSOR_NAME_NT99250 "nt99250"
87 #define ov7675_FULL_RESOLUTION 0x30000 // 0.3 megapixel
88 #define ov9650_FULL_RESOLUTION 0x130000 // 1.3 megapixel
89 #define ov2640_FULL_RESOLUTION 0x200000 // 2 megapixel
90 #define ov2655_FULL_RESOLUTION 0x200000 // 2 megapixel
91 #define ov2659_FULL_RESOLUTION 0x200000 // 2 megapixel
92 #define ov7690_FULL_RESOLUTION 0x300000 // 2 megapixel
93 #define ov3640_FULL_RESOLUTION 0x300000 // 3 megapixel
94 #define ov5640_FULL_RESOLUTION 0x500000 // 5 megapixel
95 #define ov5642_FULL_RESOLUTION 0x500000 // 5 megapixel
96 #define s5k6aa_FULL_RESOLUTION 0x130000 // 1.3 megapixel
97 #define mt9d112_FULL_RESOLUTION 0x200000 // 2 megapixel
98 #define mt9d113_FULL_RESOLUTION 0x200000 // 2 megapixel
99 #define mt9t111_FULL_RESOLUTION 0x300000 // 3 megapixel
100 #define mt9p111_FULL_RESOLUTION 0x500000 // 5 megapixel
101 #define gt2005_FULL_RESOLUTION 0x200000 // 2 megapixel
102 #define gc0308_FULL_RESOLUTION 0x30000 // 0.3 megapixel
103 #define gc0309_FULL_RESOLUTION 0x30000 // 0.3 megapixel
104 #define gc2015_FULL_RESOLUTION 0x200000 // 2 megapixel
105 #define siv120b_FULL_RESOLUTION 0x30000 // 0.3 megapixel
106 #define sid130B_FULL_RESOLUTION 0x200000 // 2 megapixel
107 #define hi253_FULL_RESOLUTION 0x200000 // 2 megapixel
108 #define hi704_FULL_RESOLUTION 0x30000 // 0.3 megapixel
109 #define nt99250_FULL_RESOLUTION 0x200000 // 2 megapixel
110 /*---------------- Camera Sensor Must Define Macro End ------------------------*/
113 #define RK29_CAM_POWERACTIVE_BITPOS 0x00
114 #define RK29_CAM_POWERACTIVE_MASK (1<<RK29_CAM_POWERACTIVE_BITPOS)
115 #define RK29_CAM_POWERACTIVE_H (0x01<<RK29_CAM_POWERACTIVE_BITPOS)
116 #define RK29_CAM_POWERACTIVE_L (0x00<<RK29_CAM_POWERACTIVE_BITPOS)
118 #define RK29_CAM_RESETACTIVE_BITPOS 0x01
119 #define RK29_CAM_RESETACTIVE_MASK (1<<RK29_CAM_RESETACTIVE_BITPOS)
120 #define RK29_CAM_RESETACTIVE_H (0x01<<RK29_CAM_RESETACTIVE_BITPOS)
121 #define RK29_CAM_RESETACTIVE_L (0x00<<RK29_CAM_RESETACTIVE_BITPOS)
123 #define RK29_CAM_POWERDNACTIVE_BITPOS 0x02
124 #define RK29_CAM_POWERDNACTIVE_MASK (1<<RK29_CAM_POWERDNACTIVE_BITPOS)
125 #define RK29_CAM_POWERDNACTIVE_H (0x01<<RK29_CAM_POWERDNACTIVE_BITPOS)
126 #define RK29_CAM_POWERDNACTIVE_L (0x00<<RK29_CAM_POWERDNACTIVE_BITPOS)
128 #define RK29_CAM_FLASHACTIVE_BITPOS 0x03
129 #define RK29_CAM_FLASHACTIVE_MASK (1<<RK29_CAM_FLASHACTIVE_BITPOS)
130 #define RK29_CAM_FLASHACTIVE_H (0x01<<RK29_CAM_FLASHACTIVE_BITPOS)
131 #define RK29_CAM_FLASHACTIVE_L (0x00<<RK29_CAM_FLASHACTIVE_BITPOS)
133 /* v4l2_subdev_core_ops.ioctl ioctl_cmd macro */
134 #define RK29_CAM_SUBDEV_ACTIVATE 0x00
135 #define RK29_CAM_SUBDEV_DEACTIVATE 0x01
136 #define RK29_CAM_SUBDEV_IOREQUEST 0x02
137 #define RK29_CAM_SUBDEV_CB_REGISTER 0x03
139 enum rk29camera_ioctrl_cmd
147 enum rk29sensor_power_cmd
154 enum rk29camera_flash_cmd
161 struct rk29camera_gpio_res {
162 unsigned int gpio_reset;
163 unsigned int gpio_power;
164 unsigned int gpio_powerdown;
165 unsigned int gpio_flash;
166 unsigned int gpio_flag;
167 unsigned int gpio_init;
169 const char *dev_name;
172 struct rk29camera_mem_res {
177 struct rk29camera_info {
178 const char *dev_name;
179 unsigned int orientation;
180 struct v4l2_frmivalenum fival[10];
182 struct rk29camera_platform_data {
183 int (*io_init)(void);
184 int (*io_deinit)(int sensor);
185 int (*sensor_ioctrl)(struct device *dev,enum rk29camera_ioctrl_cmd cmd,int on);
186 struct rk29camera_gpio_res gpio_res[2];
187 struct rk29camera_mem_res meminfo;
188 struct rk29camera_info info[2];
191 struct rk29camera_platform_ioctl_cb {
192 int (*sensor_power_cb)(struct rk29camera_gpio_res *res, int on);
193 int (*sensor_reset_cb)(struct rk29camera_gpio_res *res, int on);
194 int (*sensor_powerdown_cb)(struct rk29camera_gpio_res *res, int on);
195 int (*sensor_flash_cb)(struct rk29camera_gpio_res *res, int on);
198 typedef struct rk29_camera_sensor_cb {
199 int (*sensor_cb)(void *arg);
200 }rk29_camera_sensor_cb_s;
202 #endif /* __ASM_ARCH_CAMERA_H_ */