c452b6cd1d5ed458bc0230c4a9760ee8226591ce
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk29 / include / mach / rk29_camera.h
1 /*
2     camera.h - PXA camera driver header file
3
4     Copyright (C) 2003, Intel Corporation
5     Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
6
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.
11
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.
16
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.
20 */
21
22 #ifndef __ASM_ARCH_CAMERA_H_
23 #define __ASM_ARCH_CAMERA_H_
24
25
26 #define RK29_CAM_DRV_NAME "rk29xx-camera"
27 #define RK29_CAM_PLATFORM_DEV_ID 33
28
29 #define INVALID_GPIO -1
30
31 #define RK29_CAM_IO_SUCCESS 0
32 #define RK29_CAM_EIO_INVALID -1
33 #define RK29_CAM_EIO_REQUESTFAIL -2
34
35 #define RK29_CAM_SENSOR_OV7675 ov7675
36 #define RK29_CAM_SENSOR_OV9650 ov9650
37 #define RK29_CAM_SENSOR_OV2655 ov2655
38 #define RK29_CAM_SENSOR_OV2659 ov2659
39 #define RK29_CAM_SENSOR_OV3640 ov3640
40 #define RK29_CAM_SENSOR_OV5640 ov5640
41 #define RK29_CAM_SENSOR_OV5642 ov5642
42 #define RK29_CAM_SENSOR_S5K6AA s5k6aa
43 #define RK29_CAM_SENSOR_MT9D112 mt9d112
44 #define RK29_CAM_SENSOR_MT9D113 mt9d113
45 #define RK29_CAM_SENSOR_MT9P111 mt9p111
46 #define RK29_CAM_SENSOR_GT2005  gt2005
47 #define RK29_CAM_SENSOR_GC0308  gc0308
48 #define RK29_CAM_SENSOR_SIV120B  siv120b
49
50 #define RK29_CAM_SENSOR_NAME_OV7675 "ov7675"
51 #define RK29_CAM_SENSOR_NAME_OV9650 "ov9650"
52 #define RK29_CAM_SENSOR_NAME_OV2655 "ov2655"
53 #define RK29_CAM_SENSOR_NAME_OV2659 "ov2659"
54 #define RK29_CAM_SENSOR_NAME_OV3640 "ov3640"
55 #define RK29_CAM_SENSOR_NAME_OV5640 "ov5640"
56 #define RK29_CAM_SENSOR_NAME_OV5642 "ov5642"
57 #define RK29_CAM_SENSOR_NAME_S5K6AA "s5k6aa"
58 #define RK29_CAM_SENSOR_NAME_MT9D112 "mt9d112"
59 #define RK29_CAM_SENSOR_NAME_MT9D113 "mt9d113"
60 #define RK29_CAM_SENSOR_NAME_MT9P111 "mt9p111"
61 #define RK29_CAM_SENSOR_NAME_GT2005  "gt2005"
62 #define RK29_CAM_SENSOR_NAME_GC0308  "gc0308"
63 #define RK29_CAM_SENSOR_NAME_SIV120B "siv120b"
64
65 #define RK29_CAM_POWERACTIVE_BITPOS     0x00
66 #define RK29_CAM_POWERACTIVE_MASK       (1<<RK29_CAM_POWERACTIVE_BITPOS)
67 #define RK29_CAM_POWERACTIVE_H  (0x01<<RK29_CAM_POWERACTIVE_BITPOS)
68 #define RK29_CAM_POWERACTIVE_L  (0x00<<RK29_CAM_POWERACTIVE_BITPOS)
69
70 #define RK29_CAM_RESETACTIVE_BITPOS     0x01
71 #define RK29_CAM_RESETACTIVE_MASK       (1<<RK29_CAM_RESETACTIVE_BITPOS)
72 #define RK29_CAM_RESETACTIVE_H  (0x01<<RK29_CAM_RESETACTIVE_BITPOS)
73 #define RK29_CAM_RESETACTIVE_L  (0x00<<RK29_CAM_RESETACTIVE_BITPOS)
74
75 #define RK29_CAM_POWERDNACTIVE_BITPOS   0x02
76 #define RK29_CAM_POWERDNACTIVE_MASK     (1<<RK29_CAM_POWERDNACTIVE_BITPOS)
77 #define RK29_CAM_POWERDNACTIVE_H        (0x01<<RK29_CAM_POWERDNACTIVE_BITPOS)
78 #define RK29_CAM_POWERDNACTIVE_L        (0x00<<RK29_CAM_POWERDNACTIVE_BITPOS)
79
80 #define RK29_CAM_FLASHACTIVE_BITPOS     0x03
81 #define RK29_CAM_FLASHACTIVE_MASK       (1<<RK29_CAM_FLASHACTIVE_BITPOS)
82 #define RK29_CAM_FLASHACTIVE_H  (0x01<<RK29_CAM_FLASHACTIVE_BITPOS)
83 #define RK29_CAM_FLASHACTIVE_L  (0x00<<RK29_CAM_FLASHACTIVE_BITPOS)
84
85 /* v4l2_subdev_core_ops.ioctl  ioctl_cmd macro */
86 #define RK29_CAM_SUBDEV_ACTIVATE            0x00
87 #define RK29_CAM_SUBDEV_DEACTIVATE          0x01
88 #define RK29_CAM_SUBDEV_IOREQUEST                       0x02
89
90 enum rk29camera_ioctrl_cmd
91 {
92         Cam_Power,
93         Cam_Reset,
94         Cam_PowerDown,
95         Cam_Flash
96 };
97
98 enum rk29sensor_power_cmd
99 {
100         Sensor_Reset,
101         Sensor_PowerDown,
102         Sensor_Flash
103 };
104
105 enum rk29camera_flash_cmd
106 {
107     Flash_Off,
108     Flash_On,
109     Flash_Torch
110 };
111
112 struct rk29camera_gpio_res {
113     unsigned int gpio_reset;
114     unsigned int gpio_power;
115         unsigned int gpio_powerdown;
116         unsigned int gpio_flash;
117     unsigned int gpio_flag;
118         unsigned int gpio_init;
119     const char *dev_name;
120 };
121
122 struct rk29camera_mem_res {
123         const char *name;
124         unsigned int start;
125         unsigned int size;
126 };
127 struct rk29camera_platform_data {
128     int (*io_init)(void);
129     int (*io_deinit)(int sensor);
130         int (*sensor_ioctrl)(struct device *dev,enum rk29camera_ioctrl_cmd cmd,int on);
131     struct rk29camera_gpio_res gpio_res[2];
132         struct rk29camera_mem_res meminfo;
133 };
134
135 #endif /* __ASM_ARCH_CAMERA_H_ */
136