rk312x camera : oneframe v0.1.9,pingpong v0.1.9

This commit is contained in:
zyc
2014-11-03 17:42:04 +08:00
parent 24a2be857b
commit b92010b3de
9 changed files with 1370 additions and 2117 deletions

View File

@@ -48,7 +48,7 @@
};
gc0309{
gc0329{
is_front = <0>;
//rockchip,power = <&gpio2 GPIO_B2 GPIO_ACTIVE_HIGH>;
//rockchip,power_pmu_name1 = "rk818_ldo4";
@@ -58,14 +58,16 @@
rockchip,powerdown = <&gpio3 GPIO_B3 GPIO_ACTIVE_HIGH>;
//rockchip,powerdown_pmu = "";
//rockchip,powerdown_pmu_voltage = <3000000>;
pwdn_active = <gc0309_PWRDN_ACTIVE>;
pwdn_active = <gc0329_PWRDN_ACTIVE>;
pwr_active = <PWR_ACTIVE_HIGH>;
mir = <0>;
flash_attach = <0>;
resolution = <gc0309_FULL_RESOLUTION>;
powerup_sequence = <gc0309_PWRSEQ>;
flash_attach = <1>;
//rockchip,flash = <>;
flash_active = <1>;
resolution = <gc0329_FULL_RESOLUTION>;
powerup_sequence = <gc0329_PWRSEQ>;
orientation = <0>;
i2c_add = <gc0309_I2C_ADDR>;
i2c_add = <gc0329_I2C_ADDR>;
i2c_rata = <100000>;
i2c_chl = <1>;
cif_chl = <0>;

View File

@@ -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 = 0, rst_active = 0, pwdn_active = 0;
int pwr_active = 0, rst_active = 0, pwdn_active = 0,flash_active = 0;
int orientation = 0;
struct rkcamera_platform_data *new_camera;
@@ -231,6 +231,9 @@ static int rk_dts_sensor_probe(struct platform_device *pdev)
}
if (of_property_read_u32(cp, "rockchip,flash", &flash)) {
dprintk("%s:Get %s rockchip,flash failed!\n",__func__, cp->name);
}
if (of_property_read_u32(cp, "flash_active", &flash_active)) {
dprintk("%s:Get %s flash_active 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);
@@ -261,7 +264,10 @@ static int rk_dts_sensor_probe(struct platform_device *pdev)
new_camera->io.gpio_power = power;
new_camera->io.gpio_af = af;
new_camera->io.gpio_flash = flash;
new_camera->io.gpio_flag = ((pwr_active&0x01)<<RK29_CAM_POWERACTIVE_BITPOS)|((rst_active&0x01)<<RK29_CAM_RESETACTIVE_BITPOS)|((pwdn_active&0x01)<<RK29_CAM_POWERDNACTIVE_BITPOS);
new_camera->io.gpio_flag = ((pwr_active&0x01)<<RK29_CAM_POWERACTIVE_BITPOS)
|((rst_active&0x01)<<RK29_CAM_RESETACTIVE_BITPOS)
|((pwdn_active&0x01)<<RK29_CAM_POWERDNACTIVE_BITPOS)
|((flash_active&0x01)<<RK29_CAM_FLASHACTIVE_BITPOS);
new_camera->orientation = orientation;
new_camera->resolution = resolution;
new_camera->mirror = mir;
@@ -524,7 +530,6 @@ static int sensor_flash_default_cb (struct rk29camera_gpio_res *res, int on)
debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
if (camera_flash != INVALID_GPIO) {
if (camera_io_init & RK29_CAM_FLASHACTIVE_MASK) {
switch (on)

View File

@@ -26,6 +26,7 @@
#include <media/soc_camera.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include "rk_camera_sensor_info.h"
#define RK29_CAM_PLATFORM_DEV_ID 33
#define RK_CAM_PLATFORM_DEV_ID_0 RK29_CAM_PLATFORM_DEV_ID
@@ -44,8 +45,6 @@
#define RK29_CAM_FLASHACTIVE_BITPOS 0x03
#define RK29_CAM_AFACTIVE_BITPOS 0x04
#define RK_CAM_NUM 0 //YZM
#define RK29_CAM_SUPPORT_NUMS RK_CAM_NUM
#define RK_CAM_SUPPORT_RESOLUTION 0x800000
#define _CONS(a,b) a##b
@@ -60,381 +59,9 @@
/*---------------- Camera Sensor Must Define Macro Begin ------------------------*/
#define RK29_CAM_SENSOR_OV7675 ov7675
#define RK29_CAM_SENSOR_OV9650 ov9650
#define RK29_CAM_SENSOR_OV2640 ov2640
#define RK29_CAM_SENSOR_OV2655 ov2655
#define RK29_CAM_SENSOR_OV2659 ov2659
#define RK29_CAM_SENSOR_OV2660 ov2660 /*yzm*/
#define RK29_CAM_SENSOR_OV7690 ov7690
#define RK29_CAM_SENSOR_OV3640 ov3640
#define RK29_CAM_SENSOR_OV3660 ov3660
#define RK29_CAM_SENSOR_OV5640 ov5640
#define RK29_CAM_SENSOR_OV5642 ov5642
#define RK29_CAM_SENSOR_S5K6AA s5k6aa
#define RK29_CAM_SENSOR_MT9D112 mt9d112
#define RK29_CAM_SENSOR_MT9D113 mt9d113
#define RK29_CAM_SENSOR_MT9P111 mt9p111
#define RK29_CAM_SENSOR_MT9T111 mt9t111
#define RK29_CAM_SENSOR_GT2005 gt2005
#define RK29_CAM_SENSOR_GC0307 gc0307
#define RK29_CAM_SENSOR_GC0308 gc0308
#define RK29_CAM_SENSOR_GC0309 gc0309
#define RK29_CAM_SENSOR_GC2015 gc2015
#define RK29_CAM_SENSOR_GC0328 gc0328
#define RK29_CAM_SENSOR_GC0329 gc0329
#define RK29_CAM_SENSOR_GC2035 gc2035
#define RK29_CAM_SENSOR_SIV120B siv120b
#define RK29_CAM_SENSOR_SIV121D siv121d
#define RK29_CAM_SENSOR_SID130B sid130B
#define RK29_CAM_SENSOR_HI253 hi253
#define RK29_CAM_SENSOR_HI704 hi704
#define RK29_CAM_SENSOR_NT99250 nt99250
#define RK29_CAM_SENSOR_SP0718 sp0718
#define RK29_CAM_SENSOR_SP0838 sp0838
#define RK29_CAM_SENSOR_SP2518 sp2518
#define RK29_CAM_SENSOR_S5K5CA s5k5ca
#define RK29_CAM_ISP_MTK9335 mtk9335isp
#define RK29_CAM_SENSOR_HM2057 hm2057
#define RK29_CAM_SENSOR_HM5065 hm5065
#define RK29_CAM_SENSOR_NT99160 nt99160 //oyyf@rock-chips.com
#define RK29_CAM_SENSOR_NT99240 nt99240 //oyyf@rock-chips.com
#define RK29_CAM_SENSOR_NT99252 nt99252 //oyyf@rock-chips.com
#define RK29_CAM_SENSOR_NT99340 nt99340 //oyyf@rock-chips.com
#define RK29_CAM_ISP_ICATCH7002_MI1040 icatchmi1040
#define RK29_CAM_ISP_ICATCH7002_OV5693 icatchov5693
#define RK29_CAM_ISP_ICATCH7002_OV8825 icatchov8825 //zyt
#define RK29_CAM_ISP_ICATCH7002_OV2720 icatchov2720 //zyt
#define RK29_CAM_SENSOR_NAME_OV7675 "ov7675"
#define RK29_CAM_SENSOR_NAME_OV9650 "ov9650"
#define RK29_CAM_SENSOR_NAME_OV2640 "ov2640"
#define RK29_CAM_SENSOR_NAME_OV2655 "ov2655"
#define RK29_CAM_SENSOR_NAME_OV2659 "ov2659"
#define RK29_CAM_SENSOR_NAME_OV2660 "ov2660" /*yzm*/
#define RK29_CAM_SENSOR_NAME_OV7690 "ov7690"
#define RK29_CAM_SENSOR_NAME_OV3640 "ov3640"
#define RK29_CAM_SENSOR_NAME_OV3660 "ov3660"
#define RK29_CAM_SENSOR_NAME_OV5640 "ov5640"
#define RK29_CAM_SENSOR_NAME_OV5642 "ov5642"
#define RK29_CAM_SENSOR_NAME_S5K6AA "s5k6aa"
#define RK29_CAM_SENSOR_NAME_MT9D112 "mt9d112"
#define RK29_CAM_SENSOR_NAME_MT9D113 "mt9d113"
#define RK29_CAM_SENSOR_NAME_MT9P111 "mt9p111"
#define RK29_CAM_SENSOR_NAME_MT9T111 "mt9t111"
#define RK29_CAM_SENSOR_NAME_GT2005 "gt2005"
#define RK29_CAM_SENSOR_NAME_GC0307 "gc0307"
#define RK29_CAM_SENSOR_NAME_GC0308 "gc0308"
#define RK29_CAM_SENSOR_NAME_GC0309 "gc0309"
#define RK29_CAM_SENSOR_NAME_GC2015 "gc2015"
#define RK29_CAM_SENSOR_NAME_GC0328 "gc0328"
#define RK29_CAM_SENSOR_NAME_GC2035 "gc2035"
#define RK29_CAM_SENSOR_NAME_GC0329 "gc0329"
#define RK29_CAM_SENSOR_NAME_SIV120B "siv120b"
#define RK29_CAM_SENSOR_NAME_SIV121D "siv121d"
#define RK29_CAM_SENSOR_NAME_SID130B "sid130B"
#define RK29_CAM_SENSOR_NAME_HI253 "hi253"
#define RK29_CAM_SENSOR_NAME_HI704 "hi704"
#define RK29_CAM_SENSOR_NAME_NT99250 "nt99250"
#define RK29_CAM_SENSOR_NAME_SP0718 "sp0718"
#define RK29_CAM_SENSOR_NAME_SP0838 "sp0838"
#define RK29_CAM_SENSOR_NAME_SP2518 "sp2518"
#define RK29_CAM_SENSOR_NAME_S5K5CA "s5k5ca"
#define RK29_CAM_ISP_NAME_MTK9335ISP "mtk9335isp"
#define RK29_CAM_SENSOR_NAME_HM2057 "hm2057"
#define RK29_CAM_SENSOR_NAME_HM5065 "hm5065"
#define RK29_CAM_ISP_NAME_ICATCH7002_MI1040 "icatchmi1040"
#define RK29_CAM_ISP_NAME_ICATCH7002_OV5693 "icatchov5693"
#define RK29_CAM_ISP_NAME_ICATCH7002_OV8825 "icatchov8825" //zyt
#define RK29_CAM_ISP_NAME_ICATCH7002_OV2720 "icatchov2720" //zyt
//Sensor full resolution define
#define ov7675_FULL_RESOLUTION 0x30000 // 0.3 megapixel
#define ov9650_FULL_RESOLUTION 0x130000 // 1.3 megapixel
#define ov2640_FULL_RESOLUTION 0x200000 // 2 megapixel
#define ov2655_FULL_RESOLUTION 0x200000 // 2 megapixel
#define ov2659_FULL_RESOLUTION 0x200000 // 2 megapixel
#define ov2660_FULL_RESOLUTION 0x200000 // 2 megapixel
#define ov7690_FULL_RESOLUTION 0x300000 // 2 megapixel
#define ov3640_FULL_RESOLUTION 0x300000 // 3 megapixel
#define ov3660_FULL_RESOLUTION 0x300000 // 3 megapixel
#define ov5640_FULL_RESOLUTION 0x500000 // 5 megapixel
#if defined(CONFIG_SOC_CAMERA_OV5642_INTERPOLATION_8M)
#define ov5642_FULL_RESOLUTION 0x800000 // 8 megapixel
#else
#define ov5642_FULL_RESOLUTION 0x500000 // 5 megapixel
#endif
#define s5k6aa_FULL_RESOLUTION 0x130000 // 1.3 megapixel
#define mt9d112_FULL_RESOLUTION 0x200000 // 2 megapixel
#define mt9d113_FULL_RESOLUTION 0x200000 // 2 megapixel
#define mt9t111_FULL_RESOLUTION 0x300000 // 3 megapixel
#define mt9p111_FULL_RESOLUTION 0x500000 // 5 megapixel
#define gt2005_FULL_RESOLUTION 0x200000 // 2 megapixel
#if defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_5M)
#define gc0308_FULL_RESOLUTION 0x500000 // 5 megapixel
#elif defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_3M)
#define gc0308_FULL_RESOLUTION 0x300000 // 3 megapixel
#elif defined(CONFIG_SOC_CAMERA_GC0308_INTERPOLATION_2M)
#define gc0308_FULL_RESOLUTION 0x200000 // 2 megapixel
#else
#define gc0308_FULL_RESOLUTION 0x30000 // 0.3 megapixel#endif
#endif
#define gc0328_FULL_RESOLUTION 0x30000 // 0.3 megapixel
#define gc0307_FULL_RESOLUTION 0x30000 // 0.3 megapixel
#define gc0309_FULL_RESOLUTION 0x30000 // 0.3 megapixel
#define gc2015_FULL_RESOLUTION 0x200000 // 2 megapixel
#define siv120b_FULL_RESOLUTION 0x30000 // 0.3 megapixel
#define siv121d_FULL_RESOLUTION 0x30000 // 0.3 megapixel
#define sid130B_FULL_RESOLUTION 0x200000 // 2 megapixel
#if defined(CONFIG_SOC_CAMERA_HI253_INTERPOLATION_5M)
#define hi253_FULL_RESOLUTION 0x500000 // 5 megapixel
#elif defined(CONFIG_SOC_CAMERA_HI253_INTERPOLATION_3M)
#define hi253_FULL_RESOLUTION 0x300000 // 3 megapixel
#else
#define hi253_FULL_RESOLUTION 0x200000 // 2 megapixel
#endif
#define hi704_FULL_RESOLUTION 0x30000 // 0.3 megapixel
#define nt99250_FULL_RESOLUTION 0x200000 // 2 megapixel
#define sp0718_FULL_RESOLUTION 0x30000 // 0.3 megapixel
#define sp0838_FULL_RESOLUTION 0x30000 // 0.3 megapixel
#define sp2518_FULL_RESOLUTION 0x200000 // 2 megapixel
#define gc0329_FULL_RESOLUTION 0x30000 // 0.3 megapixel
#define s5k5ca_FULL_RESOLUTION 0x300000 // 3 megapixel
#define mtk9335isp_FULL_RESOLUTION 0x500000 //5 megapixel
#define gc2035_FULL_RESOLUTION 0x200000 // 2 megapixel
#define hm2057_FULL_RESOLUTION 0x200000 // 2 megapixel
#define hm5065_FULL_RESOLUTION 0x500000 // 5 megapixel
#define nt99160_FULL_RESOLUTION 0x100000 // oyyf@rock-chips.com: 1 megapixel 1280*720
#define nt99240_FULL_RESOLUTION 0x200000 // oyyf@rock-chips.com: 2 megapixel 1600*1200
#define nt99252_FULL_RESOLUTION 0x200000 // oyyf@rock-chips.com: 2 megapixel 1600*1200
#define nt99340_FULL_RESOLUTION 0x300000 // oyyf@rock-chips.com: 3 megapixel 2048*1536
#define icatchmi1040_FULL_RESOLUTION 0x200000
#define icatchov5693_FULL_RESOLUTION 0x500000
#define icatchov8825_FULL_RESOLUTION 0x800000 //zyt
#define icatchov2720_FULL_RESOLUTION 0x210000 //zyt
#define end_FULL_RESOLUTION 0x00
//Sensor i2c addr define
#define ov7675_I2C_ADDR 0x78
#define ov9650_I2C_ADDR 0x60
#define ov2640_I2C_ADDR 0x60
#define ov2655_I2C_ADDR 0x60
#define ov2659_I2C_ADDR 0x60
#define ov2660_I2C_ADDR 0x60 /*yzm*/
#define ov7690_I2C_ADDR 0x42
#define ov3640_I2C_ADDR 0x78
#define ov3660_I2C_ADDR 0x78
#define ov5640_I2C_ADDR 0x78
#define ov5642_I2C_ADDR 0x78
#define s5k6aa_I2C_ADDR 0x78 //0x5a
#define s5k5ca_I2C_ADDR 0x78 //0x5a
#define mt9d112_I2C_ADDR 0x78
#define mt9d113_I2C_ADDR 0x78
#define mt9t111_I2C_ADDR 0x78 // 0x7a
#define mt9p111_I2C_ADDR 0x78 //0x7a
#define gt2005_I2C_ADDR 0x78
#define gc0307_I2C_ADDR 0x42
#define gc0328_I2C_ADDR 0x42
#define gc0308_I2C_ADDR 0x42
#define gc0309_I2C_ADDR 0x42
#define gc0329_I2C_ADDR 0x62
#define gc2015_I2C_ADDR 0x60
#define gc2035_I2C_ADDR 0x78
#define siv120b_I2C_ADDR INVALID_VALUE
#define siv121d_I2C_ADDR INVALID_VALUE
#define sid130B_I2C_ADDR 0x37
#define hi253_I2C_ADDR 0x40
#define hi704_I2C_ADDR 0x60
#define nt99160_I2C_ADDR 0x54
#define nt99240_I2C_ADDR 0x6c
#define nt99250_I2C_ADDR 0x6c
#define nt99252_I2C_ADDR 0x6c
#define nt99340_I2C_ADDR 0x76
#define sp0718_I2C_ADDR 0x42
#define sp0838_I2C_ADDR INVALID_VALUE
#define sp0a19_I2C_ADDR 0x7a
#define sp1628_I2C_ADDR 0x78
#define sp2518_I2C_ADDR 0x60
#define mtk9335isp_I2C_ADDR 0x50
#define hm2057_I2C_ADDR 0x48
#define hm5065_I2C_ADDR 0x3e
#define icatchmi1040_I2C_ADDR 0x78
#define icatchov5693_I2C_ADDR 0x78
#define icatchov8825_I2C_ADDR 0x78 //zyt
#define icatchov2720_I2C_ADDR 0x78 //zyt
#define end_I2C_ADDR INVALID_VALUE
//Sensor power down active level define
#define ov7675_PWRDN_ACTIVE 0x01
#define ov9650_PWRDN_ACTIVE 0x01
#define ov2640_PWRDN_ACTIVE 0x01
#define ov2655_PWRDN_ACTIVE 0x01
#define ov2659_PWRDN_ACTIVE 0x01
#define ov2660_PWRDN_ACTIVE 0x01 /*yzm*/
#define ov7690_PWRDN_ACTIVE 0x01
#define ov3640_PWRDN_ACTIVE 0x01
#define ov3660_PWRDN_ACTIVE 0x01
#define ov5640_PWRDN_ACTIVE 0x01
#define ov5642_PWRDN_ACTIVE 0x01
#define s5k6aa_PWRDN_ACTIVE 0x00
#define s5k5ca_PWRDN_ACTIVE 0x00
#define mt9d112_PWRDN_ACTIVE 0x01
#define mt9d113_PWRDN_ACTIVE 0x01
#define mt9t111_PWRDN_ACTIVE 0x01
#define mt9p111_PWRDN_ACTIVE 0x01
#define gt2005_PWRDN_ACTIVE 0x00
#define gc0307_PWRDN_ACTIVE 0x01
#define gc0308_PWRDN_ACTIVE 0x01
#define gc0328_PWRDN_ACTIVE 0x01
#define gc0309_PWRDN_ACTIVE 0x01
#define gc0329_PWRDN_ACTIVE 0x01
#define gc2015_PWRDN_ACTIVE 0x01
#define gc2035_PWRDN_ACTIVE 0x01
#define siv120b_PWRDN_ACTIVE INVALID_VALUE
#define siv121d_PWRDN_ACTIVE INVALID_VALUE
#define sid130B_PWRDN_ACTIVE 0x37
#define hi253_PWRDN_ACTIVE 0x01
#define hi704_PWRDN_ACTIVE 0x01
#define nt99160_PWRDN_ACTIVE 0x01
#define nt99240_PWRDN_ACTIVE 0x01
#define nt99250_PWRDN_ACTIVE 0x01
#define nt99252_PWRDN_ACTIVE 0x01
#define nt99340_PWRDN_ACTIVE 0x01
#define sp0718_PWRDN_ACTIVE 0x01
#define sp0838_PWRDN_ACTIVE 0x01
#define sp0a19_PWRDN_ACTIVE 0x01
#define sp1628_PWRDN_ACTIVE 0x01
#define sp2518_PWRDN_ACTIVE 0x01
#define hm2057_PWRDN_ACTIVE 0x01
#define hm5065_PWRDN_ACTIVE 0x00
#define mtk9335isp_PWRDN_ACTIVE 0x01
#define end_PWRDN_ACTIVE INVALID_VALUE
//Sensor power up sequence define
//type: bit0-bit4
#define SENSOR_PWRSEQ_BEGIN 0x00
#define SENSOR_PWRSEQ_AVDD 0x01
#define SENSOR_PWRSEQ_DOVDD 0x02
#define SENSOR_PWRSEQ_DVDD 0x03
#define SENSOR_PWRSEQ_PWR 0x04
#define SENSOR_PWRSEQ_HWRST 0x05
#define SENSOR_PWRSEQ_PWRDN 0x06
#define SENSOR_PWRSEQ_CLKIN 0x07
#define SENSOR_PWRSEQ_END 0x0F
#define SENSOR_PWRSEQ_SET(type,idx) (type<<(idx*4))
#define SENSOR_PWRSEQ_GET(seq,idx) ((seq>>(idx*4))&0x0f)
#define sensor_PWRSEQ_DEFAULT (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,0)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,1)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWRDN,2)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,3))
#define ov7675_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov9650_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov2640_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov2655_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov2659_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov2660_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov7690_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov3640_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov3660_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov5640_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov5642_PWRSEQ sensor_PWRSEQ_DEFAULT
#define s5k6aa_PWRSEQ sensor_PWRSEQ_DEFAULT
#define s5k5ca_PWRSEQ sensor_PWRSEQ_DEFAULT
#define mt9d112_PWRSEQ sensor_PWRSEQ_DEFAULT
#define mt9d113_PWRSEQ sensor_PWRSEQ_DEFAULT
#define mt9t111_PWRSEQ sensor_PWRSEQ_DEFAULT
#define mt9p111_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gt2005_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc0307_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc0308_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc0328_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc0309_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc0329_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc2015_PWRSEQ sensor_PWRSEQ_DEFAULT
#define gc2035_PWRSEQ sensor_PWRSEQ_DEFAULT
#define siv120b_PWRSEQ sensor_PWRSEQ_DEFAULT
#define siv121d_PWRSEQ sensor_PWRSEQ_DEFAULT
#define sid130B_PWRSEQ sensor_PWRSEQ_DEFAULT
#define hi253_PWRSEQ sensor_PWRSEQ_DEFAULT
#define hi704_PWRSEQ sensor_PWRSEQ_DEFAULT
#define nt99160_PWRSEQ sensor_PWRSEQ_DEFAULT
#define nt99240_PWRSEQ sensor_PWRSEQ_DEFAULT
#define nt99250_PWRSEQ sensor_PWRSEQ_DEFAULT
#define nt99252_PWRSEQ sensor_PWRSEQ_DEFAULT
#define nt99340_PWRSEQ sensor_PWRSEQ_DEFAULT
#define sp0718_PWRSEQ sensor_PWRSEQ_DEFAULT
#define sp0838_PWRSEQ sensor_PWRSEQ_DEFAULT
#define sp0a19_PWRSEQ sensor_PWRSEQ_DEFAULT
#define sp1628_PWRSEQ sensor_PWRSEQ_DEFAULT
#define sp2518_PWRSEQ sensor_PWRSEQ_DEFAULT
#define hm2057_PWRSEQ sensor_PWRSEQ_DEFAULT
#define hm5065_PWRSEQ (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,1)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,2)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWRDN,0)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,3))
#define mtk9335isp_PWRSEQ sensor_PWRSEQ_DEFAULT
#define icatchov5693_PWRSEQ (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,0)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,2)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,1))
#define icatchov8825_PWRSEQ (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,0)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,2)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,1)) //zyt
#define icatchov2720_PWRSEQ (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,0)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,2)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,1)) //zyt
#define icatchmi1040_PWRSEQ (SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_PWR,0)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_HWRST,2)|\
SENSOR_PWRSEQ_SET(SENSOR_PWRSEQ_CLKIN,1))
#define end_PWRSEQ 0xffffffff
/*
move to rk_camera_sensor_info.h yzm
*/
/*---------------- Camera Sensor Must Define Macro End ------------------------*/

View File

@@ -8,9 +8,6 @@
#define RK29_CAM_SENSOR_OV2640 ov2640
#define RK29_CAM_SENSOR_OV2655 ov2655
#define RK29_CAM_SENSOR_OV2659 ov2659
#define RK29_CAM_SENSOR_OV2660 ov2660 /*yzm*/
#define RK29_CAM_SENSOR_OV7690 ov7690
#define RK29_CAM_SENSOR_OV3640 ov3640
#define RK29_CAM_SENSOR_OV3660 ov3660
@@ -56,10 +53,6 @@
#define RK29_CAM_SENSOR_NAME_OV2640 "ov2640"
#define RK29_CAM_SENSOR_NAME_OV2655 "ov2655"
#define RK29_CAM_SENSOR_NAME_OV2659 "ov2659"
#define RK29_CAM_SENSOR_NAME_OV2660 "ov2660" /*yzm*/
#define RK29_CAM_SENSOR_NAME_OV7690 "ov7690"
#define RK29_CAM_SENSOR_NAME_OV3640 "ov3640"
#define RK29_CAM_SENSOR_NAME_OV3660 "ov3660"
@@ -172,9 +165,6 @@
#define ov2640_I2C_ADDR 0x60
#define ov2655_I2C_ADDR 0x60
#define ov2659_I2C_ADDR 0x60
#define ov2660_I2C_ADDR 0x60 /*yzm*/
#define ov7690_I2C_ADDR 0x42
#define ov3640_I2C_ADDR 0x78
#define ov3660_I2C_ADDR 0x78
@@ -235,9 +225,6 @@
#define ov2640_PWRDN_ACTIVE 0x01
#define ov2655_PWRDN_ACTIVE 0x01
#define ov2659_PWRDN_ACTIVE 0x01
#define ov2660_PWRDN_ACTIVE 0x01 /*yzm*/
#define ov7690_PWRDN_ACTIVE 0x01
#define ov3640_PWRDN_ACTIVE 0x01
#define ov3660_PWRDN_ACTIVE 0x01
@@ -310,9 +297,6 @@
#define ov2640_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov2655_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov2659_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov2660_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov7690_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov3640_PWRSEQ sensor_PWRSEQ_DEFAULT
#define ov3660_PWRSEQ sensor_PWRSEQ_DEFAULT

View File

@@ -16,4 +16,8 @@ menu "rockchip camera sensor interface driver"
depends on ROCKCHIP_CAMERA_SENSOR_INTERFACE
default y
config RK30_CAMERA_PINGPONG
tristate "rk30_camera_pingpong"
depends on ROCKCHIP_CAMERA_SENSOR_INTERFACE
endmenu

View File

@@ -1,3 +1,21 @@
obj-$(CONFIG_RK30_CAMERA_PINGPONG) += rk30_camera_pingpong.o generic_sensor.o \
gc0307.o \
gc0308.o \
gc0309.o \
gc0328.o \
gc0329.o \
gc2015.o \
gc2035.o \
gt2005.o \
hm2057.o \
hm5065.o \
mt9p111.o \
nt99160_2way.o \
nt99240_2way.o \
ov2659.o \
ov5640.o \
sp0838.o \
sp2518.o
obj-$(CONFIG_RK30_CAMERA_ONEFRAME) += rk30_camera_oneframe.o generic_sensor.o \
gc0307.o \
gc0308.o \

View File

@@ -517,6 +517,14 @@ static inline int sensor_v4l2ctrl_flash_cb(struct soc_camera_device *icd, struct
//struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
int value = ext_ctrl->value;
if(value == 0xfefe5a5a){
if ((ctrl_info->cur_value == 2) || (ctrl_info->cur_value == 1)) {
generic_sensor_ioctrl(icd, Sensor_Flash, Flash_On);
}
return 0;
}
if ((value < ctrl_info->qctrl->minimum) || (value > ctrl_info->qctrl->maximum)) {
printk(KERN_ERR "%s(%d): value(0x%x) isn't between in (0x%x,0x%x)\n",__FUNCTION__,__LINE__,value,
ctrl_info->qctrl->minimum,ctrl_info->qctrl->maximum);

View File

@@ -193,11 +193,16 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
/*********yzm**********/
static u32 CRU_PCLK_REG30;
static u32 CRU_CLK_OUT;
static u32 clk_cif_out_src_gate_en;
static u32 CRU_CLKSEL29_CON;
static u32 cif0_clk_sel;
static u32 ENANABLE_INVERT_PCLK_CIF0;
static u32 DISABLE_INVERT_PCLK_CIF0;
static u32 ENANABLE_INVERT_PCLK_CIF1;
static u32 DISABLE_INVERT_PCLK_CIF1;
static u32 CHIP_NAME;
#define write_cru_reg(addr, val) __raw_writel(val, addr+RK_CRU_VIRT)
#define read_cru_reg(addr) __raw_readl(addr+RK_CRU_VIRT)
#define mask_cru_reg(addr, msk, val) write_cru_reg(addr,(val)|((~(msk))&read_cru_reg(addr)))
@@ -272,8 +277,13 @@ static u32 DISABLE_INVERT_PCLK_CIF1;
1. Add power and powerdown controled by PMU.
*v0.1.8:
1. Support front and rear camera support are the same.
*v0.1.9:
1. Support pingpong mode.
2. Fix cif_clk_out cannot close which base on XIN24M and cannot turn to 0
3. Move Camera Sensor Macro from rk_camera.h to rk_camera_sensor_info.h
4. Support flash control when preview size == picture size
*/
#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 1, 0x8)
#define RK_CAM_VERSION_CODE KERNEL_VERSION(0, 1, 0x9)
static int version = RK_CAM_VERSION_CODE;
module_param(version, int, S_IRUGO);
@@ -491,6 +501,13 @@ static void rk_camera_diffchips(const char *rockchip_name)
DISABLE_INVERT_PCLK_CIF0 = ((0x1<<23)|(0x0<<7));
ENANABLE_INVERT_PCLK_CIF1 = ENANABLE_INVERT_PCLK_CIF0;
DISABLE_INVERT_PCLK_CIF1 = DISABLE_INVERT_PCLK_CIF0;
CRU_CLK_OUT = 0xdc;
clk_cif_out_src_gate_en = ((0x1<<23)|(0x1<<7));
CRU_CLKSEL29_CON = 0xb8;
cif0_clk_sel = ((0x1<<23)|(0x0<<7));
CHIP_NAME = 3126;
}
}
static inline void rk_cru_set_soft_reset(u32 idx, bool on , u32 RK_CRU_SOFTRST_CON)
@@ -562,7 +579,7 @@ static int rk_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
int bytes_per_line_host;
fmt.packing = SOC_MBUS_PACKING_1_5X8;
debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()/n", __FILE__, __LINE__,__FUNCTION__);
debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
bytes_per_line = soc_mbus_bytes_per_line(icd->user_width,
@@ -1217,7 +1234,6 @@ static int rk_camera_mclk_ctrl(int cif_idx, int on, int clk_rate)
{
int err = 0,cif;
struct rk_cif_clk *clk;
struct clk *cif_clk_out_div;
debug_printk( "/$$$$$$$$$$$$$$$$$$$$$$//n Here I am: %s:%i-------%s()\n", __FILE__, __LINE__,__FUNCTION__);
@@ -1247,31 +1263,19 @@ static int rk_camera_mclk_ctrl(int cif_idx, int on, int clk_rate)
clk_set_rate(clk->cif_clk_out,clk_rate);
clk->on = true;
} else if (!on && clk->on) {
clk_set_rate(clk->cif_clk_out,36000000);/*yzm :just for close clk which base on XIN24M */
msleep(100);
clk_disable_unprepare(clk->aclk_cif);
clk_disable_unprepare(clk->hclk_cif);
clk_disable_unprepare(clk->cif_clk_in);
if(CHIP_NAME == 3126){
write_cru_reg(CRU_CLKSEL29_CON, 0x007c0000);
write_cru_reg(CRU_CLK_OUT, 0x00800080);
}
clk_disable_unprepare(clk->cif_clk_out);
clk_disable_unprepare(clk->pd_cif);
clk->on = false;
if(cif){
cif_clk_out_div = clk_get(NULL, "cif1_out_div");
}else{
cif_clk_out_div = clk_get(NULL, "cif0_out_div");
if(IS_ERR_OR_NULL(cif_clk_out_div)) {
cif_clk_out_div = clk_get(NULL, "cif_out_div");
}
}
if(!IS_ERR_OR_NULL(cif_clk_out_div)) { /* ddl@rock-chips.com: v0.3.0x13 */
err = clk_set_parent(clk->cif_clk_out, cif_clk_out_div);
clk_put(cif_clk_out_div);
} else {
err = -1;
}
if(err)
RKCAMERA_TR("WARNING %s_%s_%d: camera sensor mclk maybe not close, please check!!!\n", __FILE__, __FUNCTION__, __LINE__);
clk->on = false;
}
//spin_unlock(&clk->lock);
rk_camera_clk_ctrl_end:
@@ -1536,7 +1540,7 @@ static int rk_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
}
} else {
if(IS_CIF0()){
write_cru_reg(CRU_PCLK_REG30, (read_cru_reg(CRU_PCLK_REG30) & 0xFFFFEFF ) | DISABLE_INVERT_PCLK_CIF0);
write_cru_reg(CRU_PCLK_REG30, (read_cru_reg(CRU_PCLK_REG30) & 0xFFFFFF7F ) | DISABLE_INVERT_PCLK_CIF0);
} else {
write_cru_reg(CRU_PCLK_REG30, (read_cru_reg(CRU_PCLK_REG30) & 0xFFFEFFF) | DISABLE_INVERT_PCLK_CIF1);
}
@@ -2651,7 +2655,7 @@ static int rk_camera_s_stream(struct soc_camera_device *icd, int enable)
cif_ctrl_val |= ENABLE_CAPTURE;
write_cif_reg(pcdev->base,CIF_CIF_CTRL, cif_ctrl_val);
spin_unlock_irqrestore(&pcdev->lock,flags);
printk("%s:stream enable CIF_CIF_CTRL 0x%lx",__func__,read_cif_reg(pcdev->base,CIF_CIF_CTRL));
printk("%s:stream enable CIF_CIF_CTRL 0x%lx\n",__func__,read_cif_reg(pcdev->base,CIF_CIF_CTRL));
hrtimer_start(&(pcdev->fps_timer.timer),ktime_set(3, 0),HRTIMER_MODE_REL);
pcdev->fps_timer.istarted = true;
} else {

File diff suppressed because it is too large Load Diff