コード例 #1
0
/*++ AT_Command[Flash mode] : [email protected]_20121012 ++*/
void camera_flash_on_off(int value) // Flash
{
	if(value == POWER_ON)
	{
		Cam_Printk("Camera Flash ON..\n");
#if defined(CONFIG_LEDS_RT8547)
		rear_camera = TRUE;
		rt8547_set_led_low();
#else
		gpio_direction_output(camera_flash_en, 0);	/*Enable */
		gpio_direction_output(camera_flash_set, 1);
		rear_camera = TRUE;
#endif
	}
	else
	{
		Cam_Printk("Camera Flash OFF..\n");
#if defined(CONFIG_LEDS_RT8547)
		rear_camera = FALSE;
		rt8547_set_led_off();
#else
		gpio_direction_output(camera_flash_en, 0);	/*Disable */
		gpio_direction_output(camera_flash_set, 0);
		rear_camera = FALSE;
#endif
	}
}
コード例 #2
0
/*++ AT_Command[Flash mode] : [email protected]_20121012 ++*/
void camera_flash_on_off(int value) // Flash
{
#ifdef CONFIG_FLED_RT5033
	rt_fled_info_t *rt5033_fled;
	rt5033_fled=rt_fled_get_info_by_name(NULL);
#endif

	if(value == POWER_ON)
	{
		Cam_Printk("Camera Flash ON..\n");
#ifdef CONFIG_FLED_RT5033		
		rt5033_fled->hal->fled_set_mode(rt5033_fled,FLASHLIGHT_MODE_TORCH);
#elif CONFIG_LEDS_RT8547
		rt8547_set_led_low();
#endif
		rear_camera = TRUE;
	}
	else
	{
		Cam_Printk("Camera Flash OFF..\n");
#ifdef CONFIG_FLED_RT5033		
		rt5033_fled->hal->fled_set_mode(rt5033_fled,FLASHLIGHT_MODE_OFF);
#elif CONFIG_LEDS_RT8547
		rt8547_set_led_off();
#endif		
		rear_camera = FALSE;
	}
}
コード例 #3
0
void init_samsung_cam(void)
{

	int ret;
	Cam_Printk("---camera---call--init_samsung_cam --for init!!!--------\n");
	ret= sr352_pin_init();
	if (ret) {
		Cam_Printk("---error!!!!-----sr352_pin_init --failed!!!--------\n");
		return;
	}

	ret= sr130pc10_pin_init();
	if (ret) {
		Cam_Printk("---error!!!!-----sr130pc10_pin_init --failed!!!--------\n");
		return;
	}

#if defined (CONFIG_SOC_CAMERA_SR130PC10)
	//pr_info("add i2c device: CONFIG_SOC_CAMERA_SR130PC10!!\n");
	//platform_device_register(&i2c_subsensor_bus_device);
	//i2c_register_board_info(4, ARRAY_AND_SIZE(mms136_i2c_devices));
#endif

	if (system_rev <= LT02_R0_0)
		platform_add_devices(ARRAY_AND_SIZE(camera_platform_devices));
	else {
		platform_device_register(&i2c_subsensor_bus_device);
		platform_add_devices(ARRAY_AND_SIZE(camera_platform_devices_r01));
	}
	pxa988_add_cam(&mv_cam_data_forssg);
}
コード例 #4
0
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;
}
コード例 #5
0
/*-- AT_Command[Flash mode] --*/
void __init init_samsung_cam(void)
{
	int ret;
	struct device *dev_r;
	struct device *dev_f;
#if defined(CONFIG_MACH_WILCOX)
	if(system_rev != 1) {
		camera_flash_en = mfp_to_gpio(MFP_PIN_GPIO20);
		camera_flash_set = mfp_to_gpio(MFP_PIN_GPIO97);
	}
#elif defined(CONFIG_MACH_CS02)

#elif defined(CONFIG_MACH_BAFFIN)
	Cam_Printk("Skip to set Flash GPIO\n"); // Set LED gpio at the rt8547.c file
#else
	camera_flash_en = mfp_to_gpio(MFP_PIN_GPIO20);
	camera_flash_set = mfp_to_gpio(MFP_PIN_GPIO97);
#endif

	ret= s5k43_pin_init();
	if (ret) {
		Cam_Printk("---error!!!!-----s5k43_pin_init --failed!!!--------\n");
		return;
	}

	ret= sr030pc30_pin_init();
	if (ret) {
		Cam_Printk("---error!!!!-----sr030pc30_pin_init --failed!!!--------\n");
		return;
	}

	ret= subsensor_pin_init();
	if (ret) {
		Cam_Printk("---error!!!!-----subsensor_pin_init --failed!!!--------\n");
		return;
	}

	platform_add_devices(ARRAY_AND_SIZE(camera_platform_devices));
	pxa988_add_cam(&mv_cam_data_forssg);

#if defined(CONFIG_MACH_WILCOX)
	if(system_rev != 1) {
		if (camera_flash_en && gpio_request(camera_flash_en, "CAM_HI_SENSOR_PWD_20")) {
			printk(KERN_ERR "Request GPIO failed,"
					"gpio: %d\n", camera_flash_en);
			camera_flash_en = 0;
			return;
		}
		if (camera_flash_set && gpio_request(camera_flash_set, "CAM_HI_SENSOR_PWD_8")) {
			printk(KERN_ERR "Request GPIO failed,"
					"gpio: %d\n", camera_flash_set);
			camera_flash_set = 0;
			return;
		}
	}
#else
	if (camera_flash_en && gpio_request(camera_flash_en, "CAM_HI_SENSOR_PWD_20")) {
		printk(KERN_ERR "Request GPIO failed,"
				"gpio: %d\n", camera_flash_en);
		camera_flash_en = 0;
		return;
	}
	if (camera_flash_set && gpio_request(camera_flash_set, "CAM_HI_SENSOR_PWD_8")) {
		printk(KERN_ERR "Request GPIO failed,"
				"gpio: %d\n", camera_flash_set);
		camera_flash_set = 0;
		return;
	}
#endif
//	gpio_direction_output(camera_flash_en, 0);
//	gpio_direction_output(camera_flash_set, 0);

/*++ AT_Command[Flash mode] : [email protected]_20121012 ++*/
	camera_class = class_create(THIS_MODULE, "camera");
	
	if (IS_ERR(camera_class)) 
	{
	 printk("Failed to create camera_class!\n");
	 return PTR_ERR( camera_class );
        }
	
	dev_f= device_create(camera_class, NULL, 0, "%s", "front");	
	if (device_create_file(dev_f, &dev_attr_front_type) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_front_type.attr.name);
	if (device_create_file(dev_f, &dev_attr_front_camfw) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_front_camfw.attr.name);

	dev_r = device_create(camera_class, NULL, 0, "%s", "rear");		
	if (device_create_file(dev_r, &dev_attr_rear_type) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_rear_type.attr.name);
	if (device_create_file(dev_r, &dev_attr_rear_camfw) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_rear_camfw.attr.name);
	if (device_create_file(dev_r, &dev_attr_rear_flash) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_rear_flash.attr.name);
	if (device_create_file(dev_r, &dev_attr_rear_vendorid) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_rear_vendorid.attr.name);

/*-- AT_Command[Flash mode] --*/
}
コード例 #6
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;
}
コード例 #7
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;
}
コード例 #8
0
/*-- AT_Command[Flash mode] --*/
void __init init_samsung_cam(void)
{
	int ret;
	struct device *dev_r;
	struct device *dev_f;

	camera_flash_en = mfp_to_gpio(MFP_PIN_GPIO20);
	camera_flash_set = mfp_to_gpio(MFP_PIN_GPIO97);

	ret= s5k43_pin_init();
	if (ret) {
		Cam_Printk("---error!!!!-----s5k43_pin_init --failed!!!--------\n");
		return;
	}

	ret= sr030pc30_pin_init();
	if (ret) {
		Cam_Printk("---error!!!!-----sr030pc30_pin_init --failed!!!--------\n");
		return;
	}

	ret= subsensor_pin_init();
	if (ret) {
		Cam_Printk("---error!!!!-----subsensor_pin_init --failed!!!--------\n");
		return;
	}

	platform_add_devices(ARRAY_AND_SIZE(camera_platform_devices));
	pxa988_add_cam(&mv_cam_data_forssg);

	if (camera_flash_en && gpio_request(camera_flash_en, "CAM_HI_SENSOR_PWD_20")) {
		printk(KERN_ERR "Request GPIO failed,"
				"gpio: %d\n", camera_flash_en);
		camera_flash_en = 0;
		return;
	}
	if (camera_flash_set && gpio_request(camera_flash_set, "CAM_HI_SENSOR_PWD_8")) {
		printk(KERN_ERR "Request GPIO failed,"
				"gpio: %d\n", camera_flash_set);
		camera_flash_set = 0;
		return;
	}

	/*++ AT_Command[Flash mode] : [email protected]_20121012 ++*/
	camera_class = class_create(THIS_MODULE, "camera");
	
	if (IS_ERR(camera_class)) 
	{
		printk("Failed to create camera_class!\n");
		return PTR_ERR( camera_class );
	}
	
	dev_f= device_create(camera_class, NULL, 0, "%s", "front");	
	if (device_create_file(dev_f, &dev_attr_front_type) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_front_type.attr.name);
	if (device_create_file(dev_f, &dev_attr_front_camfw) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_front_camfw.attr.name);

	dev_r = device_create(camera_class, NULL, 0, "%s", "rear");		
	if (device_create_file(dev_r, &dev_attr_rear_type) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_rear_type.attr.name);
	if (device_create_file(dev_r, &dev_attr_rear_camfw) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_rear_camfw.attr.name);
	if (device_create_file(dev_r, &dev_attr_rear_flash) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_rear_flash.attr.name);
	if (device_create_file(dev_r, &dev_attr_rear_vendorid) < 0)
	 printk("Failed to create device file(%s)!\n", dev_attr_rear_vendorid.attr.name);

	/*-- AT_Command[Flash mode] --*/
}
コード例 #9
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;
}
コード例 #10
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;
}
コード例 #11
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;
}