mirror of
https://github.com/torvalds/linux.git
synced 2026-06-10 23:53:52 +02:00
rk312x : cif : cif driver v0.0x1.5
This commit is contained in:
parent
3936e240c2
commit
f655f9dbef
|
|
@ -16,9 +16,11 @@ ov2659{
|
|||
rockchip,powerdown = <&gpio3 GPIO_B3 GPIO_ACTIVE_HIGH>;
|
||||
pwdn_active = <ov2659_PWRDN_ACTIVE>;
|
||||
#rockchip,power = <>;
|
||||
#pwr_active = <>;
|
||||
pwr_active = <PWR_ACTIVE_HIGH>;
|
||||
#rockchip,reset = <>;
|
||||
#rst_active = <>;
|
||||
#rockchip,flash = <>;
|
||||
#rockchip,af = <>;
|
||||
mir = <0>;
|
||||
flash_attach = <0>;
|
||||
resolution = <ov2659_FULL_RESOLUTION>;
|
||||
|
|
@ -35,9 +37,11 @@ gc0329{
|
|||
rockchip,powerdown = <&gpio3 GPIO_B3 GPIO_ACTIVE_HIGH>;
|
||||
pwdn_active = <gc0329_PWRDN_ACTIVE>;
|
||||
#rockchip,power = <>;
|
||||
#pwr_active = <>;
|
||||
pwr_active = <PWR_ACTIVE_HIGH>;
|
||||
#rockchip,reset = <>;
|
||||
#rst_active = <>;
|
||||
#rockchip,flash = <>;
|
||||
#rockchip,af = <>;
|
||||
mir = <0>;
|
||||
flash_attach = <0>;
|
||||
resolution = <gc0329_FULL_RESOLUTION>;
|
||||
|
|
|
|||
|
|
@ -16,9 +16,11 @@ ov2659{
|
|||
rockchip,powerdown = <&gpio3 GPIO_D7 GPIO_ACTIVE_HIGH>;
|
||||
pwdn_active = <ov2659_PWRDN_ACTIVE>;
|
||||
#rockchip,power = <>;
|
||||
#pwr_active = <>;
|
||||
pwr_active = <PWR_ACTIVE_HIGH>;
|
||||
#rockchip,reset = <>;
|
||||
#rst_active = <>;
|
||||
#rockchip,flash = <>;
|
||||
#rockchip,af = <>;
|
||||
mir = <0>;
|
||||
flash_attach = <0>;
|
||||
resolution = <ov2659_FULL_RESOLUTION>;
|
||||
|
|
@ -35,9 +37,11 @@ gc0329{
|
|||
rockchip,powerdown = <&gpio3 GPIO_D7 GPIO_ACTIVE_HIGH>;
|
||||
pwdn_active = <gc0329_PWRDN_ACTIVE>;
|
||||
#rockchip,power = <>;
|
||||
#pwr_active = <>;
|
||||
pwr_active = <PWR_ACTIVE_HIGH>;
|
||||
#rockchip,reset = <>;
|
||||
#rst_active = <>;
|
||||
#rockchip,flash = <>;
|
||||
#rockchip,af = <>;
|
||||
mir = <0>;
|
||||
flash_attach = <0>;
|
||||
resolution = <gc0329_FULL_RESOLUTION>;
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ static int rk_dts_sensor_probe(struct platform_device *pdev)
|
|||
u32 powerdown = INVALID_GPIO,power = INVALID_GPIO,reset = INVALID_GPIO;
|
||||
u32 af = INVALID_GPIO,flash = INVALID_GPIO;
|
||||
|
||||
int pwr_active = INVALID_VALUE, rst_active = INVALID_VALUE, pwdn_active = INVALID_VALUE;
|
||||
int pwr_active = 0, rst_active = 0, pwdn_active = 0;
|
||||
int orientation = 0;
|
||||
struct rkcamera_platform_data *new_camera;
|
||||
new_camera = kzalloc(sizeof(struct rkcamera_platform_data),GFP_KERNEL);
|
||||
|
|
@ -211,16 +211,16 @@ static int rk_dts_sensor_probe(struct platform_device *pdev)
|
|||
dprintk("%s:Get %s pwr_active failed!\n",__func__, cp->name);
|
||||
}
|
||||
if (of_property_read_u32(cp, "rockchip,reset", &reset)) {
|
||||
printk("%s:Get %s rockchip,reset failed!\n",__func__, cp->name);
|
||||
dprintk("%s:Get %s rockchip,reset failed!\n",__func__, cp->name);
|
||||
}
|
||||
if (of_property_read_u32(cp, "rst_active", &rst_active)) {
|
||||
dprintk("%s:Get %s rst_active failed!\n",__func__, cp->name);
|
||||
}
|
||||
if (of_property_read_u32(cp, "rockchip,af", &af)) {
|
||||
printk("%s:Get %s rockchip,af failed!\n",__func__, cp->name);
|
||||
dprintk("%s:Get %s rockchip,af failed!\n",__func__, cp->name);
|
||||
}
|
||||
if (of_property_read_u32(cp, "rockchip,flash", &flash)) {
|
||||
printk("%s:Get %s rockchip,flash failed!\n",__func__, cp->name);
|
||||
dprintk("%s:Get %s rockchip,flash failed!\n",__func__, cp->name);
|
||||
}
|
||||
if (of_property_read_u32(cp, "i2c_add", &i2c_add)) {
|
||||
printk("%s:Get %s rockchip,i2c_add failed!\n",__func__, cp->name);
|
||||
|
|
@ -341,13 +341,11 @@ debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE
|
|||
if (camera_power != INVALID_GPIO) {
|
||||
if (camera_io_init & RK29_CAM_POWERACTIVE_MASK) {
|
||||
if (on) {
|
||||
/*gpio_set_value(camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));*/
|
||||
gpio_direction_output(camera_power,1);
|
||||
gpio_set_value(camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
|
||||
dprintk("%s PowerPin=%d ..PinLevel = %x",res->dev_name, camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
|
||||
msleep(10);
|
||||
} else {
|
||||
/*gpio_set_value(camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));*/
|
||||
gpio_direction_output(camera_power,0);
|
||||
gpio_set_value(camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
|
||||
dprintk("%s PowerPin=%d ..PinLevel = %x",res->dev_name, camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
|
||||
}
|
||||
} else {
|
||||
|
|
@ -551,28 +549,25 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res,struct devic
|
|||
dprintk("%s power pin(%d) init success(0x%x)" ,gpio_res->dev_name,camera_power,(((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
|
||||
|
||||
}
|
||||
/*
|
||||
|
||||
if (camera_reset != INVALID_GPIO) {
|
||||
|
||||
camera_power = of_get_named_gpio_flags(of_node,"rockchip,reset",0,&flags);/*yzm*/
|
||||
gpio_res->gpio_reset = camera_reset;/*yzm information back to the IO*/
|
||||
ret = gpio_request(camera_reset, "camera reset");
|
||||
if (ret) {
|
||||
io_requested_in_camera = false;
|
||||
for (i=0; i<RK_CAM_NUM; i++) {
|
||||
io_res = &rk_camera_platform_data.gpio_res[i];
|
||||
if (io_res->gpio_init & RK29_CAM_RESETACTIVE_MASK) {
|
||||
if (io_res->gpio_reset == camera_reset)
|
||||
io_requested_in_camera = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (io_requested_in_camera==false) {
|
||||
i=0;
|
||||
while (strstr(new_camera[i].dev_name,"end")==NULL) {
|
||||
io_res = &new_camera[i].io;
|
||||
|
||||
new_camera = new_camera_head;
|
||||
while (new_camera != NULL) {
|
||||
io_res = &new_camera->io;
|
||||
if (io_res->gpio_init & RK29_CAM_RESETACTIVE_MASK) {
|
||||
if (io_res->gpio_reset == camera_reset)
|
||||
io_requested_in_camera = true;
|
||||
}
|
||||
i++;
|
||||
new_camera = new_camera->next_camera;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -583,13 +578,7 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res,struct devic
|
|||
ret =0;
|
||||
}
|
||||
}
|
||||
|
||||
if (rk_camera_platform_data.iomux(camera_reset,dev) < 0) {
|
||||
ret = -1;
|
||||
eprintk("%s reset pin(%d) iomux init failed", gpio_res->dev_name,camera_reset);
|
||||
goto _rk_sensor_io_init_end_;
|
||||
}
|
||||
|
||||
|
||||
gpio_res->gpio_init |= RK29_CAM_RESETACTIVE_MASK;
|
||||
gpio_set_value(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
|
||||
gpio_direction_output(camera_reset, ((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
|
||||
|
|
@ -597,7 +586,7 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res,struct devic
|
|||
dprintk("%s reset pin(%d) init success(0x%x)" ,gpio_res->dev_name,camera_reset,((camera_ioflag&RK29_CAM_RESETACTIVE_MASK)>>RK29_CAM_RESETACTIVE_BITPOS));
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
if (camera_powerdown != INVALID_GPIO) {
|
||||
debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$/ camera_powerdown = %x\n", camera_powerdown );
|
||||
|
||||
|
|
@ -638,28 +627,25 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res,struct devic
|
|||
dprintk("%s powerdown pin(%d) init success(0x%x)" ,gpio_res->dev_name,camera_powerdown,((camera_ioflag&RK29_CAM_POWERDNACTIVE_BITPOS)>>RK29_CAM_POWERDNACTIVE_BITPOS));
|
||||
|
||||
}
|
||||
/*
|
||||
|
||||
if (camera_flash != INVALID_GPIO) {
|
||||
|
||||
camera_flash = of_get_named_gpio_flags(of_node,"rockchip,flash",0,&flags);/*yzm*/
|
||||
gpio_res->gpio_flash = camera_flash;/*yzm information back to the IO*/
|
||||
ret = gpio_request(camera_flash, "camera flash");
|
||||
if (ret) {
|
||||
io_requested_in_camera = false;
|
||||
for (i=0; i<RK_CAM_NUM; i++) {
|
||||
io_res = &rk_camera_platform_data.gpio_res[i];
|
||||
if (io_res->gpio_init & RK29_CAM_POWERDNACTIVE_MASK) {
|
||||
if (io_res->gpio_powerdown == camera_powerdown)
|
||||
io_requested_in_camera = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (io_requested_in_camera==false) {
|
||||
i=0;
|
||||
while (strstr(new_camera[i].dev_name,"end")==NULL) {
|
||||
io_res = &new_camera[i].io;
|
||||
|
||||
new_camera = new_camera_head;
|
||||
while (new_camera != NULL) {
|
||||
io_res = &new_camera->io;
|
||||
if (io_res->gpio_init & RK29_CAM_POWERDNACTIVE_MASK) {
|
||||
if (io_res->gpio_powerdown == camera_powerdown)
|
||||
io_requested_in_camera = true;
|
||||
}
|
||||
i++;
|
||||
new_camera = new_camera->next_camera;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -671,9 +657,6 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res,struct devic
|
|||
}
|
||||
|
||||
|
||||
if (rk_camera_platform_data.iomux(camera_flash,dev) < 0) {
|
||||
printk("%s flash pin(%d) iomux init failed\n",gpio_res->dev_name,camera_flash);
|
||||
}
|
||||
|
||||
gpio_res->gpio_init |= RK29_CAM_FLASHACTIVE_MASK;
|
||||
gpio_set_value(camera_flash, ((~camera_ioflag&RK29_CAM_FLASHACTIVE_MASK)>>RK29_CAM_FLASHACTIVE_BITPOS)); // falsh off
|
||||
|
|
@ -683,28 +666,24 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res,struct devic
|
|||
|
||||
}
|
||||
|
||||
|
||||
if (camera_af != INVALID_GPIO) {
|
||||
|
||||
camera_af = of_get_named_gpio_flags(of_node,"rockchip,af",0,&flags);/*yzm*/
|
||||
gpio_res->gpio_af = camera_af;/*yzm information back to the IO*/
|
||||
ret = gpio_request(camera_af, "camera af");
|
||||
if (ret) {
|
||||
io_requested_in_camera = false;
|
||||
for (i=0; i<RK_CAM_NUM; i++) {
|
||||
io_res = &rk_camera_platform_data.gpio_res[i];
|
||||
if (io_res->gpio_init & RK29_CAM_AFACTIVE_MASK) {
|
||||
if (io_res->gpio_af == camera_af)
|
||||
io_requested_in_camera = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (io_requested_in_camera==false) {
|
||||
i=0;
|
||||
while (strstr(new_camera[i].dev_name,"end")==NULL) {
|
||||
io_res = &new_camera[i].io;
|
||||
|
||||
new_camera = new_camera_head;
|
||||
while (new_camera != NULL) {
|
||||
io_res = &new_camera->io;
|
||||
if (io_res->gpio_init & RK29_CAM_AFACTIVE_MASK) {
|
||||
if (io_res->gpio_af == camera_af)
|
||||
io_requested_in_camera = true;
|
||||
}
|
||||
i++;
|
||||
new_camera = new_camera->next_camera;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -716,20 +695,12 @@ static int _rk_sensor_io_init_(struct rk29camera_gpio_res *gpio_res,struct devic
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (rk_camera_platform_data.iomux(camera_af,dev) < 0) {
|
||||
ret = -1;
|
||||
eprintk("%s af pin(%d) iomux init failed\n",gpio_res->dev_name,camera_af);
|
||||
goto _rk_sensor_io_init_end_;
|
||||
}
|
||||
|
||||
gpio_res->gpio_init |= RK29_CAM_AFACTIVE_MASK;
|
||||
//gpio_direction_output(camera_af, ((camera_ioflag&RK29_CAM_AFACTIVE_MASK)>>RK29_CAM_AFACTIVE_BITPOS));
|
||||
dprintk("%s af pin(%d) init success",gpio_res->dev_name, camera_af);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
_rk_sensor_io_init_end_:
|
||||
|
|
|
|||
|
|
@ -225,6 +225,9 @@
|
|||
#define icatchov2720_I2C_ADDR 0x78 //zyt
|
||||
#define end_I2C_ADDR INVALID_VALUE
|
||||
|
||||
//Sensor power active level define
|
||||
#define PWR_ACTIVE_HIGH 0x01
|
||||
#define PWR_ACTIVE_LOW 0x0
|
||||
|
||||
//Sensor power down active level define
|
||||
#define ov7675_PWRDN_ACTIVE 0x01
|
||||
|
|
|
|||
|
|
@ -264,8 +264,10 @@ static u32 DISABLE_INVERT_PCLK_CIF1;
|
|||
1. i2c 1 and wifi use the common io in rk3128,so just enable i2c1 in rk3126 dts file
|
||||
*v0.1.4:
|
||||
1. When cif was at work, the aclk is closed ,may cause bus abnormal ,so sleep 100ms before close aclk
|
||||
*v0.1.5:
|
||||
1. Improve the code to support all configuration.reset,af,flash...
|
||||
*/
|
||||
#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 1, 0x4)
|
||||
#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 1, 0x5)
|
||||
static int version = RK_CAM_VERSION_CODE;
|
||||
module_param(version, int, S_IRUGO);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user