1 #ifdef CONFIG_VIDEO_RK29
3 #include <plat/rk_camera.h>
6 Simple camera device registration:
8 new_camera_device(sensor_name,\ // sensor name, it is equal to CONFIG_SENSOR_X
9 face,\ // sensor face information, it can be back or front
10 pwdn_io,\ // power down gpio configuration, it is equal to CONFIG_SENSOR_POWERDN_PIN_XX
11 flash_attach,\ // sensor is attach flash or not
12 mir,\ // sensor image mirror and flip control information
13 i2c_chl,\ // i2c channel which the sensor attached in hardware, it is equal to CONFIG_SENSOR_IIC_ADAPTER_ID_X
14 cif_chl) \ // cif channel which the sensor attached in hardware, it is equal to CONFIG_SENSOR_CIF_INDEX_X
16 Comprehensive camera device registration:
18 new_camera_device_ex(sensor_name,\
20 ori,\ // sensor orientation, it is equal to CONFIG_SENSOR_ORIENTATION_X
21 pwr_io,\ // sensor power gpio configuration, it is equal to CONFIG_SENSOR_POWER_PIN_XX
22 pwr_active,\ // sensor power active level, is equal to CONFIG_SENSOR_RESETACTIVE_LEVEL_X
23 rst_io,\ // sensor reset gpio configuration, it is equal to CONFIG_SENSOR_RESET_PIN_XX
24 rst_active,\ // sensor reset active level, is equal to CONFIG_SENSOR_RESETACTIVE_LEVEL_X
26 pwdn_active,\ // sensor power down active level, is equal to CONFIG_SENSOR_POWERDNACTIVE_LEVEL_X
28 res,\ // sensor resolution, this is real resolution or resoltuion after interpolate
31 i2c_spd,\ // i2c speed , 100000 = 100KHz
32 i2c_addr,\ // the i2c slave device address for sensor
34 mclk)\ // sensor input clock rate, 24 or 48
37 static struct rkcamera_platform_data new_camera[] = {
38 new_camera_device(RK29_CAM_SENSOR_OV5640,
47 new_camera_device(RK29_CAM_SENSOR_OV5642,
55 new_camera_device(RK29_CAM_SENSOR_HM5065,
65 new_camera_device_ex(RK29_CAM_SENSOR_MT9P111,
73 CONS(RK29_CAM_SENSOR_MT9P111,_PWRDN_ACTIVE),
75 CONS(RK29_CAM_SENSOR_MT9P111,_FULL_RESOLUTION),
79 CONS(RK29_CAM_SENSOR_MT9P111,_I2C_ADDR),
86 new_camera_device(RK29_CAM_SENSOR_SP2518,
95 new_camera_device(RK29_CAM_SENSOR_GC2035,
105 new_camera_device(RK29_CAM_SENSOR_OV2659,
114 new_camera_device_end
116 #endif //#ifdef CONFIG_VIDEO_RK29
118 /*---------------- Camera Sensor Configuration Macro End------------------------*/
119 #include "../../../drivers/media/video/rk30_camera.c"
120 /*---------------- Camera Sensor Macro Define End ---------*/
122 #define PMEM_CAM_SIZE PMEM_CAM_NECESSARY
123 /*****************************************************************************************
125 * author: ddl@rock-chips.com
126 *****************************************************************************************/
127 #ifdef CONFIG_VIDEO_RK29
128 #define CONFIG_SENSOR_POWER_IOCTL_USR 1 //define this refer to your board layout
129 #define CONFIG_SENSOR_RESET_IOCTL_USR 0
130 #define CONFIG_SENSOR_POWERDOWN_IOCTL_USR 0
131 #define CONFIG_SENSOR_FLASH_IOCTL_USR 0
133 #if CONFIG_SENSOR_POWER_IOCTL_USR
134 static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
136 //#error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
137 struct regulator *ldo_18,*ldo_28;
139 ldo_28 = regulator_get(NULL, "ldo7"); // vcc28_cif
140 ldo_18 = regulator_get(NULL, "ldo1"); // vcc18_cif
141 if (ldo_28 == NULL || IS_ERR(ldo_28) || ldo_18 == NULL || IS_ERR(ldo_18)){
142 printk("get cif ldo failed!\n");
146 while(regulator_is_enabled(ldo_28)>0)
147 regulator_disable(ldo_28);
148 regulator_put(ldo_28);
149 while(regulator_is_enabled(ldo_18)>0)
150 regulator_disable(ldo_18);
151 regulator_put(ldo_18);
154 regulator_set_voltage(ldo_28, 2800000, 2800000);
155 regulator_enable(ldo_28);
156 //printk("%s set ldo7 vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_28));
157 regulator_put(ldo_28);
159 regulator_set_voltage(ldo_18, 1800000, 1800000);
160 //regulator_set_suspend_voltage(ldo, 1800000);
161 regulator_enable(ldo_18);
162 //printk("%s set ldo1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_18));
163 regulator_put(ldo_18);
170 #if CONFIG_SENSOR_RESET_IOCTL_USR
171 static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
173 #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
177 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
178 static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
180 #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
184 #if CONFIG_SENSOR_FLASH_IOCTL_USR
185 static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
187 #error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
191 static struct rk29camera_platform_ioctl_cb sensor_ioctl_cb = {
192 #if CONFIG_SENSOR_POWER_IOCTL_USR
193 .sensor_power_cb = sensor_power_usr_cb,
195 .sensor_power_cb = NULL,
198 #if CONFIG_SENSOR_RESET_IOCTL_USR
199 .sensor_reset_cb = sensor_reset_usr_cb,
201 .sensor_reset_cb = NULL,
204 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
205 .sensor_powerdown_cb = sensor_powerdown_usr_cb,
207 .sensor_powerdown_cb = NULL,
210 #if CONFIG_SENSOR_FLASH_IOCTL_USR
211 .sensor_flash_cb = sensor_flash_usr_cb,
213 .sensor_flash_cb = NULL,
218 static rk_sensor_user_init_data_s rk_init_data_sensor[RK_CAM_NUM] ;
219 #include "../../../drivers/media/video/rk30_camera.c"
221 #endif /* CONFIG_VIDEO_RK29 */