static int subsensor_power(struct device *dev, int flag){
	Cam_Printk("---sub camera power-----flag: %d-----\n", flag);
	/* Ccic Mclk enbale, enable/disable clk api is in mmp_camera.c */
	if (flag) {
		pxa_ccic_enable_mclk(samsung_camera.pcdev, V4L2_MBUS_PARALLEL);
	}else {
		pxa_ccic_disable_mclk(samsung_camera.pcdev, V4L2_MBUS_PARALLEL);
	}
	return 0;
}
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 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 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)
{
#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;
}
static int sr130pc10_power(struct device *dev, int flag)
{
	if (!V_CAM_IO_1dot8V_LDO11) {
		V_CAM_IO_1dot8V_LDO11 = regulator_get(dev, "v_cam_io");
		if (IS_ERR(V_CAM_IO_1dot8V_LDO11)) {
			V_CAM_IO_1dot8V_LDO11 = NULL;
			pr_err(KERN_ERR "Enable V_CAM_IO_1dot8V_LDO11 failed!\n");
			return -EIO;
		}
		regulator_set_voltage(V_CAM_IO_1dot8V_LDO11, 1800000, 1800000);
	}

	if (!V_3M_CAM_CORE_1dot2V_BUCK5) {
		V_3M_CAM_CORE_1dot2V_BUCK5 = regulator_get(dev, "v_cam_c");
		if (IS_ERR(V_3M_CAM_CORE_1dot2V_BUCK5)) {
			V_3M_CAM_CORE_1dot2V_BUCK5 = NULL;
			pr_err(KERN_ERR "Enable V_3M_CAM_CORE_1dot2V_BUCK5 failed!\n");
			return -EIO;
		}
		regulator_set_voltage(V_3M_CAM_CORE_1dot2V_BUCK5, 1250000, 1250000);
	}

	if (flag) {
		Cam_Printk("\n--------------------- sr130pc10_power ON Start--------------------\n");

		//Cam_Printk("---sr130pc10_power  power ON -----the (1) step-----camera: Main Enable OFF-----------\n");
		gpio_direction_output(pwd_main_en, 0);	/* disable */

		//Cam_Printk("---sr130pc10_power  power ON -----the (2) step-----camera: Main Reset OFF-----------\n");
		gpio_direction_output(pwd_main_rst, 0);	/* disable */

		//Cam_Printk("---sr130pc10_power  power ON -----the (3) step-----camera: LDO ON-----------\n");
		//Cam_Printk("---sr130pc10_power  power ON -----the (4) step-----camera: Sensor I/O (1.80V) ON-----------\n");
		regulator_enable(V_CAM_IO_1dot8V_LDO11);
		udelay(500);

		//Cam_Printk("---sr130pc10_power  power ON -----the (5) step-----camera: Sensor AVDD ON-----------\n");
		gpio_direction_output(SUB_EN_VT_2dot8V, 1);	/* enable */

		udelay(500);
		//Cam_Printk("---sr130pc10_power  power ON -----the (6) step-----camera: VT Sensor Core ON-----------\n");
		gpio_direction_output(SUB_EN_VT_1dot8V, 1);	/* enable */

		//Cam_Printk("---sr130pc10_power  power ON -----the (7) step-----camera: Main Sensor Core ON-----------\n");
		regulator_enable(V_3M_CAM_CORE_1dot2V_BUCK5);
		msleep(2);

		//Cam_Printk("---sr130pc10_power power ON -----the (8) step-----camera: set sensor mclk = 24 MHz-----------\n");
		pxa_ccic_enable_mclk(s5k_cam_mclk_en.pcdev, BUS_PARALLEL);

		//Cam_Printk("---sr130pc10_power power ON -----the (9) step-----camera: standby ON-----------\n");
		gpio_direction_output(pwd_sub_en, 1);	/* enable */
		msleep(10);

		//Cam_Printk(" ---sr130pc10_power power ON -----the (10) step-----camera: reset ON-----------\n");
		gpio_direction_output(pwd_sub_rst, 0);	/* disable */
		msleep(20);
		gpio_direction_output(pwd_sub_rst, 1);	/* enable */

		/*for s5k power off maybe pull down the i2c data pin, so we have to reset i2c controller */
		s5k_cam_mclk_en.i2c_pxa_reset(s5k_cam_mclk_en.i2c);

		Cam_Printk("\n--------------------- sr130pc10_power ON End--------------------\n");
	}else {
		Cam_Printk("\n--------------------- sr130pc10_power OFF Start--------------------\n");

		//Cam_Printk("---sr130pc10_power  power OFF -----the (1) step-----camera: Main Enable OFF-----------\n");
		gpio_direction_output(pwd_main_en, 0);	/* disable */

		//Cam_Printk("---sr130pc10_power  power OFF -----the (2) step-----camera: Main Reset OFF-----------\n");
		gpio_direction_output(pwd_main_rst, 0);	/* disable */

		//Cam_Printk("---sr130pc10_power power OFF -----the (3) step-----camera: reset OFF-----------\n");
		gpio_direction_output(pwd_sub_rst, 0);	/* disable */
		msleep(2);

		// mipi disable
		//Cam_Printk("---sr130pc10_power power OFF -----the (4) step-----camera: disable sensor mclk-----------\n");
		pxa_ccic_disable_mclk(s5k_cam_mclk_en.pcdev, BUS_PARALLEL);

		//Cam_Printk("---sr130pc10_power power OFF -----the (5) step-----camera: standby OFF-----------\n");
		gpio_direction_output(pwd_sub_en, 0);	/* disable */

		//Cam_Printk("---sr130pc10_power power OFF -----the (6) step-----camera: LDO OFF-----------\n");
		//Cam_Printk("---sr130pc10_power power OFF -----the (7) step-----camera: Main Sensor Core OFF-----------\n");
		regulator_disable(V_3M_CAM_CORE_1dot2V_BUCK5);

		//Cam_Printk("---sr130pc10_power power OFF -----the (8) step-----camera: VT Sensor Core OFF-----------\n");
		gpio_direction_output(SUB_EN_VT_1dot8V, 0);	/* disable */

		//Cam_Printk("---sr130pc10_power power OFF -----the (9) step-----camera: Sensor AVDD OFF-----------\n");
		gpio_direction_output(SUB_EN_VT_2dot8V, 0);	/* disable */

		//Cam_Printk("---sr130pc10_power power OFF -----the (10) step-----camera: Sensor I/O OFF-----------\n");
		regulator_disable(V_CAM_IO_1dot8V_LDO11);

		Cam_Printk("\n--------------------- sr130pc10_power OFF End--------------------\n");
	}

	return 0;
}