From 81b6065911b0861d57e4a072cad00312d1aad681 Mon Sep 17 00:00:00 2001 From: zyc Date: Tue, 2 Sep 2014 11:59:50 +0800 Subject: [PATCH] rk312x : cif : cif driver v0.0x1.2 --- arch/arm/boot/dts/rk3126-cif-sensor.dtsi | 54 +++++++++++++++++++ arch/arm/boot/dts/rk3126-sdk.dts | 4 ++ ...cif-sensor.dtsi => rk3128-cif-sensor.dtsi} | 9 ++-- arch/arm/boot/dts/rk3128-sdk.dts | 5 ++ arch/arm/boot/dts/rk312x-sdk.dtsi | 10 ++-- arch/arm/mach-rockchip/rk_camera.c | 7 +-- drivers/media/video/Kconfig | 1 + drivers/media/video/rk30_camera_oneframe.c | 5 +- 8 files changed, 79 insertions(+), 16 deletions(-) create mode 100755 arch/arm/boot/dts/rk3126-cif-sensor.dtsi rename arch/arm/boot/dts/{rk312x-cif-sensor.dtsi => rk3128-cif-sensor.dtsi} (89%) mode change 100644 => 100755 diff --git a/arch/arm/boot/dts/rk3126-cif-sensor.dtsi b/arch/arm/boot/dts/rk3126-cif-sensor.dtsi new file mode 100755 index 000000000000..ce968112d26e --- /dev/null +++ b/arch/arm/boot/dts/rk3126-cif-sensor.dtsi @@ -0,0 +1,54 @@ +#include "rk312x.dtsi" +#include "rk312x-pinctrl.dtsi" +#include "../../mach-rockchip/rk_camera_sensor_info.h" +/{ + rk3126_cif_sensor: rk3126_cif_sensor{ + compatible = "rockchip,sensor"; + status = "disabled"; + CONFIG_SENSOR_POWER_IOCTL_USR = <1>; + CONFIG_SENSOR_RESET_IOCTL_USR = <0>; + CONFIG_SENSOR_POWERDOWN_IOCTL_USR = <0>; + CONFIG_SENSOR_FLASH_IOCTL_USR = <0>; + CONFIG_SENSOR_AF_IOCTL_USR = <0>; + + ov2659{ + is_front = <1>; + rockchip,powerdown = <&gpio3 GPIO_B3 GPIO_ACTIVE_HIGH>; + pwdn_active = ; + #rockchip,power = <>; + #pwr_active = <>; + #rockchip,reset = <>; + #rst_active = <>; + mir = <0>; + flash_attach = <0>; + resolution = ; + powerup_sequence = ; + orientation = <0>; + i2c_add = ; + i2c_rata = <100000>; + i2c_chl = <1>; + cif_chl = <0>; + mclk_rate = <24>; + }; + gc0329{ + is_front = <1>; + rockchip,powerdown = <&gpio3 GPIO_B3 GPIO_ACTIVE_HIGH>; + pwdn_active = ; + #rockchip,power = <>; + #pwr_active = <>; + #rockchip,reset = <>; + #rst_active = <>; + mir = <0>; + flash_attach = <0>; + resolution = ; + powerup_sequence = ; + orientation = <0>; + i2c_add = ; + i2c_rata = <100000>; + i2c_chl = <1>; + cif_chl = <0>; + mclk_rate = <24>; + }; + }; +}; + diff --git a/arch/arm/boot/dts/rk3126-sdk.dts b/arch/arm/boot/dts/rk3126-sdk.dts index 7015997943d4..778b25b95112 100755 --- a/arch/arm/boot/dts/rk3126-sdk.dts +++ b/arch/arm/boot/dts/rk3126-sdk.dts @@ -108,3 +108,7 @@ status = "disabled"; }; }; + +&rk3126_cif_sensor{ + status = "okay"; +}; diff --git a/arch/arm/boot/dts/rk312x-cif-sensor.dtsi b/arch/arm/boot/dts/rk3128-cif-sensor.dtsi old mode 100644 new mode 100755 similarity index 89% rename from arch/arm/boot/dts/rk312x-cif-sensor.dtsi rename to arch/arm/boot/dts/rk3128-cif-sensor.dtsi index 029cc5175e41..209c9b1e050d --- a/arch/arm/boot/dts/rk312x-cif-sensor.dtsi +++ b/arch/arm/boot/dts/rk3128-cif-sensor.dtsi @@ -2,8 +2,9 @@ #include "rk312x-pinctrl.dtsi" #include "../../mach-rockchip/rk_camera_sensor_info.h" /{ - cif_sensor: cif_sensor{ + rk3128_cif_sensor: rk3128_cif_sensor{ compatible = "rockchip,sensor"; + status = "disabled"; CONFIG_SENSOR_POWER_IOCTL_USR = <1>; CONFIG_SENSOR_RESET_IOCTL_USR = <0>; CONFIG_SENSOR_POWERDOWN_IOCTL_USR = <0>; @@ -13,7 +14,7 @@ ov2659{ is_front = <1>; rockchip,powerdown = <&gpio3 GPIO_D7 GPIO_ACTIVE_HIGH>; - #pwdn_active = <>; + pwdn_active = ; #rockchip,power = <>; #pwr_active = <>; #rockchip,reset = <>; @@ -21,7 +22,6 @@ mir = <0>; flash_attach = <0>; resolution = ; - pwdn_info = ; powerup_sequence = ; orientation = <0>; i2c_add = ; @@ -33,7 +33,7 @@ gc0329{ is_front = <1>; rockchip,powerdown = <&gpio3 GPIO_D7 GPIO_ACTIVE_HIGH>; - #pwdn_active = <>; + pwdn_active = ; #rockchip,power = <>; #pwr_active = <>; #rockchip,reset = <>; @@ -41,7 +41,6 @@ mir = <0>; flash_attach = <0>; resolution = ; - pwdn_info = ; powerup_sequence = ; orientation = <0>; i2c_add = ; diff --git a/arch/arm/boot/dts/rk3128-sdk.dts b/arch/arm/boot/dts/rk3128-sdk.dts index 209a4ca02f7c..c22d460b48d6 100755 --- a/arch/arm/boot/dts/rk3128-sdk.dts +++ b/arch/arm/boot/dts/rk3128-sdk.dts @@ -89,3 +89,8 @@ gpio_debug = <1>; codec_hp_det = <0>; }; + +&rk3128_cif_sensor{ + status = "okay"; +}; + diff --git a/arch/arm/boot/dts/rk312x-sdk.dtsi b/arch/arm/boot/dts/rk312x-sdk.dtsi index 47cfe8a8bf12..99894420a8ff 100755 --- a/arch/arm/boot/dts/rk312x-sdk.dtsi +++ b/arch/arm/boot/dts/rk312x-sdk.dtsi @@ -1,8 +1,9 @@ /dts-v1/; #include "rk312x.dtsi" +#include "rk3126-cif-sensor.dtsi" +#include "rk3128-cif-sensor.dtsi" -#include "rk312x-cif-sensor.dtsi" / { fiq-debugger { status = "okay"; @@ -174,6 +175,10 @@ status = "okay"; }; }; +&i2c1 { + status = "okay"; +}; + &i2c2 { status = "okay"; ts@55 { @@ -533,6 +538,3 @@ status = "okay"; }; -&cif_sensor{ - status = "okay"; -}; diff --git a/arch/arm/mach-rockchip/rk_camera.c b/arch/arm/mach-rockchip/rk_camera.c index b899d6f76e73..350d759379f6 100644 --- a/arch/arm/mach-rockchip/rk_camera.c +++ b/arch/arm/mach-rockchip/rk_camera.c @@ -158,7 +158,7 @@ static int rk_dts_sensor_probe(struct platform_device *pdev) for_each_child_of_node(np, cp) { u32 flash_attach = 0,mir = 0,i2c_rata = 0,i2c_chl = 0,i2c_add = 0; u32 cif_chl = 0, mclk_rate = 0, is_front = 0; - u32 resolution = 0, pwdn_info = 0, powerup_sequence = 0; + u32 resolution = 0, powerup_sequence = 0; u32 powerdown = INVALID_GPIO,power = INVALID_GPIO,reset = INVALID_GPIO; u32 af = INVALID_GPIO,flash = INVALID_GPIO; @@ -228,9 +228,6 @@ static int rk_dts_sensor_probe(struct platform_device *pdev) if (of_property_read_u32(cp, "resolution", &resolution)) { printk("%s:Get %s rockchip,resolution failed!\n",__func__, cp->name); } - if (of_property_read_u32(cp, "pwdn_info", &pwdn_info)) { - printk("%s:Get %s rockchip,pwdn_info failed!\n",__func__, cp->name); - } if (of_property_read_u32(cp, "powerup_sequence", &powerup_sequence)) { printk("%s:Get %s rockchip,powerup_sequence failed!\n",__func__, cp->name); } @@ -260,7 +257,7 @@ static int rk_dts_sensor_probe(struct platform_device *pdev) new_camera->mirror = mir; new_camera->i2c_rate = i2c_rata; new_camera->flash = flash_attach; - new_camera->pwdn_info = ((pwdn_info&0x10)|0x01); + new_camera->pwdn_info = ((pwdn_active&0x10)|0x01); new_camera->powerup_sequence = powerup_sequence; new_camera->mclk_rate = mclk_rate; new_camera->of_node = cp; diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 2ed6a1343b86..54ddb6565f7b 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -31,6 +31,7 @@ menu "rockchip camera sensor interface driver" config GC0329 tristate "gc0329,support" + default y config GC2015 tristate "gc2015,support" diff --git a/drivers/media/video/rk30_camera_oneframe.c b/drivers/media/video/rk30_camera_oneframe.c index 0e3a6ec2cd50..c60920394141 100755 --- a/drivers/media/video/rk30_camera_oneframe.c +++ b/drivers/media/video/rk30_camera_oneframe.c @@ -258,8 +258,10 @@ static u32 DISABLE_INVERT_PCLK_CIF1; *v0.1.1: 1. spin lock in struct rk_cif_clk is not neccessary,and scheduled func clk_get called in this spin lock scope cause warning, so remove this spin lock . +*v0.1.2: + 1. rk3126 and rk3128 use different dts file. */ -#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 1, 0x1) +#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 1, 0x2) static int version = RK_CAM_VERSION_CODE; module_param(version, int, S_IRUGO); @@ -492,7 +494,6 @@ static void rk_camera_cif_reset(struct rk_camera_dev *pcdev, int only_rst) int ctrl_reg,inten_reg,crop_reg,set_size_reg,for_reg,vir_line_width_reg,scl_reg,y_reg,uv_reg; u32 RK_CRU_SOFTRST_CON = 0; debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__); - printk("&&&&&&&&&&&&&&&&&&&%s&&&&&&&&&&&&&&&\n",pcdev->pdata->rockchip_name); if(strstr(pcdev->pdata->rockchip_name,"3128")||strstr(pcdev->pdata->rockchip_name,"3126")) RK_CRU_SOFTRST_CON = RK312X_CRU_SOFTRSTS_CON(6); -- 2.34.1