static int s5k43_power(struct device *dev, int flag) { static struct regulator *vcamera; // AF static struct regulator *vcamera_ana; // SENSOR IO : 1.8V static struct regulator *vcamera_ana_1; // SENSOR AVDD : 2.8V static struct regulator *vcamera_vbuck5; // 5M CORE : 1.2V static int initialized = FALSE; // for checking is probe state if (!vcamera_vbuck5) { vcamera_vbuck5 = regulator_get(dev, "v_cam_c"); if (IS_ERR(vcamera_vbuck5)) { vcamera_vbuck5 = NULL; pr_err(KERN_ERR "Enable vcamera_vbuck5 failed!\n"); return -EIO; } } if (!vcamera_ana) { vcamera_ana = regulator_get(dev, "v_cam_io"); if (IS_ERR(vcamera_ana)) { vcamera_ana = NULL; pr_err(KERN_ERR "Enable vcamera_ana failed!\n"); return -EIO; } } if (!vcamera_ana_1) { vcamera_ana_1 = regulator_get(dev, "v_cam_avdd"); if (IS_ERR(vcamera_ana_1)) { vcamera_ana_1 = NULL; pr_err(KERN_ERR "Enable vcamera_ana_1 failed!\n"); return -EIO; } } if (!vcamera) { vcamera = regulator_get(dev, "v_cam_af"); if (IS_ERR(vcamera)) { vcamera = NULL; pr_err(KERN_ERR "Enable vcamera failed!\n"); return -EIO; } } #if defined(CONFIG_MACH_CS02) if (flag) { switch_i2c_gpio_mfp(I2C_PIN); Cam_Printk("---camera power ON ----------\n"); /* 5M Core : 1.2V ON */ regulator_set_voltage(vcamera_vbuck5, 1200000, 1200000); regulator_enable(vcamera_vbuck5); msleep(1); /* Sensor AVDD : 2.8V ON */ regulator_set_voltage(vcamera_ana_1, 2800000, 2800000); regulator_enable(vcamera_ana_1); msleep(1); /* Sensor IO : 1.8V ON */ regulator_set_voltage(vcamera_ana, 1800000, 1800000); regulator_enable(vcamera_ana); /* AF : 2.8V ON */ regulator_set_voltage(vcamera, 2800000, 2800000); regulator_enable(vcamera); msleep(1); /* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */ pxa_ccic_enable_mclk(samsung_camera.pcdev, V4L2_MBUS_CSI2); msleep(1); /* 5M STBY Enable */ gpio_direction_output(pwd_main1, 1); /* 5M Reset Enable*/ gpio_direction_output(pwd_main2, 0); msleep(2); gpio_direction_output(pwd_main2, 1); msleep(5); /*for s5k power off maybe pull down the i2c data pin, so we have to reset i2c controller */ samsung_camera.i2c_pxa_reset(samsung_camera.i2c); }else { Cam_Printk("---camera power OFF ----------\n"); if((initialized==TRUE)&&(rear_camera==FALSE)) camera_flash_on_off(POWER_OFF); // Flash Off /* 5M Reset Disable*/ gpio_direction_output(pwd_main2, 0); msleep(1); /* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */ msleep(5); pxa_ccic_disable_mclk(samsung_camera.pcdev, V4L2_MBUS_CSI2); /* 5M STBY Disable */ gpio_direction_output(pwd_main1, 0); /* Sensor IO : 1.8V OFF */ regulator_disable(vcamera_ana); /* Sensor AVDD : 2.8V OFF */ regulator_disable(vcamera_ana_1); /* 5M Core : 1.2V OFF */ regulator_disable(vcamera_vbuck5); /* AF : 2.8V OFF */ regulator_disable(vcamera); switch_i2c_gpio_mfp(GPIO_PIN); if(initialized==FALSE) initialized = TRUE; } #else if (flag) { switch_i2c_gpio_mfp(I2C_PIN); Cam_Printk("---camera power ON ----------\n"); /* Sensor AVDD : 2.8V ON */ regulator_set_voltage(vcamera_ana_1, 2800000, 2800000); regulator_enable(vcamera_ana_1); /* Sensor IO : 1.8V ON */ regulator_set_voltage(vcamera_ana, 1800000, 1800000); regulator_enable(vcamera_ana); /* AF : 2.8V ON */ regulator_set_voltage(vcamera, 2800000, 2800000); regulator_enable(vcamera); msleep(1); /* VT STBY Enable */ gpio_direction_output(pwd_sub_en, 1); /* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */ pxa_ccic_enable_mclk(samsung_camera.pcdev, V4L2_MBUS_CSI2); /* VT Rest Enable */ gpio_direction_output(pwd_sub_rst, 0); msleep(5); gpio_direction_output(pwd_sub_rst, 1); msleep(2); /* VT STBY Disable */ gpio_direction_output(pwd_sub_en, 0); /* 5M Core : 1.2V ON */ regulator_set_voltage(vcamera_vbuck5, 1200000, 1200000); regulator_enable(vcamera_vbuck5); msleep(1); /* 5M STBY Enable */ gpio_direction_output(pwd_main1, 1); /* 5M Reset Enable*/ gpio_direction_output(pwd_main2, 0); msleep(2); gpio_direction_output(pwd_main2, 1); msleep(5); /*for s5k power off maybe pull down the i2c data pin, so we have to reset i2c controller */ samsung_camera.i2c_pxa_reset(samsung_camera.i2c); }else { Cam_Printk("---camera power OFF ----------\n"); if((initialized==TRUE)&&(rear_camera==FALSE)) camera_flash_on_off(POWER_OFF); // Flash Off /* 5M Reset Disable*/ gpio_direction_output(pwd_main2, 0); msleep(1); /* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */ msleep(5); pxa_ccic_disable_mclk(samsung_camera.pcdev, V4L2_MBUS_CSI2); /* 5M STBY Disable */ gpio_direction_output(pwd_main1, 0); /* VT Rest Disable */ gpio_direction_output(pwd_sub_rst, 0); /* 5M Core : 1.2V OFF */ regulator_disable(vcamera_vbuck5); /* Sensor IO : 1.8V OFF */ regulator_disable(vcamera_ana); /* Sensor AVDD : 2.8V OFF */ regulator_disable(vcamera_ana_1); /* AF : 2.8V OFF */ regulator_disable(vcamera); switch_i2c_gpio_mfp(GPIO_PIN); if(initialized==FALSE) initialized = TRUE; } #endif return 0; }
static int s5k43_power(struct device *dev, int flag) { static int initialized = FALSE; // for checking is probe state #ifdef CONFIG_LEDS_RT8547 static struct regulator *vcamera_vbuck5; // 5M CORE : 1.2V if (!vcamera_vbuck5) { vcamera_vbuck5 = regulator_get(dev, "v_cam_c"); if (IS_ERR(vcamera_vbuck5)) { vcamera_vbuck5 = NULL; pr_err(KERN_ERR "Enable vcamera_vbuck5 failed!\n"); return -EIO; } } #endif if (flag) { switch_i2c_gpio_mfp(I2C_PIN); Cam_Printk("---camera power ON ----------\n"); /* Sensor AVDD : 2.8V ON */ gpio_direction_output(CAM_AVDD, 1); msleep(1); /* Sensor IO : 1.8V ON */ gpio_direction_output(CAM_IO, 1); /* AF : 2.8V ON */ gpio_direction_output(CAM_AF, 1); msleep(1); /* VT STBY Enable */ gpio_direction_output(Sub_EN, 1); /* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */ pxa_ccic_enable_mclk(samsung_camera.pcdev, V4L2_MBUS_CSI2); /* VT Rest Enable */ gpio_direction_output(Sub_RST, 0); msleep(5); gpio_direction_output(Sub_RST, 1); msleep(2); /* VT STBY Disable */ gpio_direction_output(Sub_EN, 0); /* 5M Core : 1.2V ON */ #ifdef CONFIG_LEDS_RT8547 regulator_set_voltage(vcamera_vbuck5, 1200000, 1200000); regulator_enable(vcamera_vbuck5); #else gpio_direction_output(CAM_CORE, 1); #endif msleep(1); /* 5M STBY Enable */ gpio_direction_output(Main_STBY, 1); /* 5M Reset Enable*/ gpio_direction_output(Main_RST, 0); msleep(2); gpio_direction_output(Main_RST, 1); msleep(5); /*for s5k power off maybe pull down the i2c data pin, so we have to reset i2c controller */ samsung_camera.i2c_pxa_reset(samsung_camera.i2c); }else { Cam_Printk("---camera power OFF ----------\n"); if((initialized==TRUE)&&(rear_camera==FALSE)) camera_flash_on_off(POWER_OFF); // Flash Off /* 5M Reset Disable*/ gpio_direction_output(Main_RST, 0); msleep(1); /* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */ msleep(5); pxa_ccic_disable_mclk(samsung_camera.pcdev, V4L2_MBUS_CSI2); /* 5M STBY Disable */ gpio_direction_output(Main_STBY, 0); /* VT Rest Disable */ gpio_direction_output(Sub_RST, 0); /* 5M Core : 1.2V OFF */ #ifdef CONFIG_LEDS_RT8547 regulator_disable(vcamera_vbuck5); #else gpio_direction_output(CAM_CORE, 0); #endif /* Sensor IO : 1.8V OFF */ gpio_direction_output(CAM_IO, 0); /* Sensor AVDD : 2.8V OFF */ gpio_direction_output(CAM_AVDD, 0); /* AF : 2.8V OFF */ gpio_direction_output(CAM_AF, 0); switch_i2c_gpio_mfp(GPIO_PIN); if(initialized==FALSE) initialized = TRUE; } return 0; }
static int sr030pc30_power(struct device *dev, int flag){ static struct regulator *vcamera_ana; // SENSOR IO : 1.8V static struct regulator *vcamera_ana_1; // SENSOR AVDD : 2.8V static struct regulator *vcamera_vbuck5; // 5M CORE : 1.2V // VT CORE : 1.8v //pwd_sub_en_power if (!vcamera_vbuck5) { vcamera_vbuck5 = regulator_get(dev, "v_cam_c"); if (IS_ERR(vcamera_vbuck5)) { vcamera_vbuck5 = NULL; pr_err(KERN_ERR "Enable vcamera_vbuck5 failed!\n"); return -EIO; } } if (!vcamera_ana) { vcamera_ana = regulator_get(dev, "v_cam_io"); if (IS_ERR(vcamera_ana)) { vcamera_ana = NULL; pr_err(KERN_ERR "Enable vcamera_ana failed!\n"); return -EIO; } } if (!vcamera_ana_1) { vcamera_ana_1 = regulator_get(dev, "v_cam_avdd"); if (IS_ERR(vcamera_ana_1)) { vcamera_ana_1 = NULL; pr_err(KERN_ERR "Enable vcamera_ana_1 failed!\n"); return -EIO; } } if (flag) { switch_i2c_gpio_mfp(I2C_PIN); Cam_Printk("---sr030pc30_power power ON ----------\n"); /* Sensor AVDD : 2.8V ON */ regulator_set_voltage(vcamera_ana_1, 2800000, 2800000); regulator_enable(vcamera_ana_1); /* VT Core : 1.8V ON */ #if defined(CONFIG_MACH_HELANDELOS) msleep(1); gpio_direction_output(pwd_sub_en_power, 1); #endif /* Sensor IO : 1.8V ON */ regulator_set_voltage(vcamera_ana, 1800000, 1800000); regulator_enable(vcamera_ana); /* 5M Core : 1.2V ON */ regulator_set_voltage(vcamera_vbuck5, 1200000, 1200000); regulator_enable(vcamera_vbuck5); /* 5M Core : 1.2V OFF */ msleep(5); regulator_disable(vcamera_vbuck5); msleep(1); /* VT STBY Enable */ gpio_direction_output(pwd_sub_en, 1); /* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */ pxa_ccic_enable_mclk(samsung_camera.pcdev, V4L2_MBUS_PARALLEL); msleep(1); /* VT Rest Enable */ gpio_direction_output(pwd_sub_rst, 0); msleep(5); gpio_direction_output(pwd_sub_rst, 1); msleep(40); /*for s5k power off maybe pull down the i2c data pin, so we have to reset i2c controller */ samsung_camera.i2c_pxa_reset(samsung_camera.i2c); }else { Cam_Printk("---sr030pc30_power power OFF ----------\n"); /* VT Rest Disable */ gpio_direction_output(pwd_sub_rst, 0); /* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */ msleep(5); pxa_ccic_disable_mclk(samsung_camera.pcdev, V4L2_MBUS_PARALLEL); msleep(5); /* VT STBY Disable */ gpio_direction_output(pwd_sub_en, 0); /* Sensor IO : 1.8V OFF */ regulator_disable(vcamera_ana); #if defined(CONFIG_MACH_HELANDELOS) /* VT Core : 1.8V OFF */ gpio_direction_output(pwd_sub_en_power, 0); #endif /* Sensor AVDD : 2.8V OFF */ regulator_disable(vcamera_ana_1); switch_i2c_gpio_mfp(GPIO_PIN); } return 0; }
static int sr030pc30_power(struct device *dev, int flag) { #ifdef CONFIG_LEDS_RT8547 static struct regulator *vcamera_vbuck5; // 5M CORE : 1.2V if (!vcamera_vbuck5) { vcamera_vbuck5 = regulator_get(dev, "v_cam_c"); if (IS_ERR(vcamera_vbuck5)) { vcamera_vbuck5 = NULL; pr_err(KERN_ERR "Enable vcamera_vbuck5 failed!\n"); return -EIO; } } #endif if (flag) { switch_i2c_gpio_mfp(I2C_PIN); Cam_Printk("---sr030pc30_power power ON ----------\n"); /* Sensor AVDD : 2.8V ON */ gpio_direction_output(CAM_AVDD, 1); udelay(50); /* Sensor IO : 1.8V ON */ gpio_direction_output(CAM_IO, 1); /* 5M Core : 1.2V ON */ #ifdef CONFIG_LEDS_RT8547 regulator_set_voltage(vcamera_vbuck5, 1200000, 1200000); regulator_enable(vcamera_vbuck5); #elif CONFIG_FLED_RT5033 gpio_direction_output(CAM_CORE, 1); #endif /* 5M Core : 1.2V OFF */ msleep(5); #ifdef CONFIG_LEDS_RT8547 regulator_disable(vcamera_vbuck5); #elif CONFIG_FLED_RT5033 gpio_direction_output(CAM_CORE, 0); #endif msleep(1); /* VT STBY Enable */ gpio_direction_output(Sub_EN, 1); /* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */ pxa_ccic_enable_mclk(samsung_camera.pcdev, V4L2_MBUS_PARALLEL); msleep(1); /* VT Rest Enable */ gpio_direction_output(Sub_RST, 0); msleep(5); gpio_direction_output(Sub_RST, 1); msleep(40); /*for s5k power off maybe pull down the i2c data pin, so we have to reset i2c controller */ samsung_camera.i2c_pxa_reset(samsung_camera.i2c); }else { Cam_Printk("---sr030pc30_power power OFF ----------\n"); /* VT Rest Disable */ gpio_direction_output(Sub_RST, 0); /* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */ msleep(5); pxa_ccic_disable_mclk(samsung_camera.pcdev, V4L2_MBUS_PARALLEL); msleep(5); /* VT STBY Disable */ gpio_direction_output(Sub_EN, 0); /* Sensor IO : 1.8V OFF */ gpio_direction_output(CAM_IO, 0); /* Sensor AVDD : 2.8V OFF */ gpio_direction_output(CAM_AVDD, 0); switch_i2c_gpio_mfp(GPIO_PIN); } return 0; }