Ejemplo n.º 1
0
int camera_power_on (void)
{
	int rc;
	struct device *dev = gelato_backlight_dev();
	int retry  = 0;

	/* clear RESET, PWDN to Low*/
	gpio_set_value(GPIO_CAM_RESET, 0);
	gpio_set_value(GPIO_CAM_PWDN, 0);

	aat28xx_power(dev, 1);

	/*
	 * 2011-04-23, [email protected]
	 * wait for Backlight IC enable.
	 * because camera application does not work well permanently after power on failure.
	 */
	for (retry = 100; retry != 0; retry--) {
		/* FIXME: check the Backlight IC enable status using another method */
		rc = aat28xx_ldo_set_level(dev, LDO_CAM_AF_NO, 2800);
		if (rc < 0) {
			//printk("%s, wait for Backlight IC enabling, ramian retry %d\n", __func__, retry);
			msleep(50);
		} else {
			break;
		}
	}

	/*AVDD power 2.8V*/
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_AF_NO, 2800);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_AF_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_AF_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_AF_NO);
		goto power_on_fail;
	}

  /* DVDD power 1.2V */
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_DVDD_NO, 1800);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_DVDD_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_DVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_DVDD_NO);
		goto power_on_fail;
	}

	udelay(500);

	/*AVDD power  2.7V*/
	/* LGE_CHANGE 
	  * Change AVDD level from 2.7V to 2.8V in order to reduce camera noise in dard environment.
	  * 2010-08-03. [email protected]
	  */
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_AVDD_NO, 2800);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_AVDD_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_AVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_AVDD_NO);
		goto power_on_fail;
	}	

	udelay(100);
		
  /*IOVDD power 2.6V*/
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_IOVDD_NO, 2800);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_IOVDD_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_IOVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_IOVDD_NO);
		goto power_on_fail;
	}


	mdelay(5);
	/*M Clock -24Mhz*/
	msm_camio_clk_rate_set(mclk_rate);
	mdelay(5);
	msm_camio_camif_pad_reg_reset();
	mdelay(5);

	/*Nstandby high*/
	gpio_set_value(GPIO_CAM_PWDN, 1);

	udelay(20);

	/*reset high*/
	gpio_set_value(GPIO_CAM_RESET, 1);
	mdelay(5); 
	camera_power_state = CAM_POWER_ON;

	/*Hitachi LCD LUT*/
	if(gelato_panel_id==1){
		mdp_load_hitachi_lut(2);
	}
power_on_fail:
	return rc;
}
Ejemplo n.º 2
0
int camera_power_off (void)
{
	int rc;
	struct device *dev = gelato_backlight_dev();

	/*Nstandby low*/
	gpio_set_value(GPIO_CAM_PWDN, 0);
	mdelay(5);

	/*reset low*/
	gpio_set_value(GPIO_CAM_RESET, 0);

	mdelay(1);
	gpio_set_value(GPIO_CAM_PWDN, 0);

	/*AVDD power 2.8V*/
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_AF_NO, 0);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_AF_NO);
		goto power_off_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_AF_NO, 0);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_AF_NO);
		goto power_off_fail;
	}

	/*IOVDD power 2.6V*/
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_IOVDD_NO, 0);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_IOVDD_NO);
		goto power_off_fail;
	}

	rc = aat28xx_ldo_enable(dev, LDO_CAM_IOVDD_NO, 0);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_IOVDD_NO);
		goto power_off_fail;
	}

	/*AVDD power 2.7V*/
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_AVDD_NO, 0);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_AVDD_NO);
		goto power_off_fail;
	}

	rc = aat28xx_ldo_enable(dev, LDO_CAM_AVDD_NO, 0);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_AVDD_NO);
		goto power_off_fail;
	}

	/* DVDD power 1.2V*/
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_DVDD_NO, 0);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_DVDD_NO);
		goto power_off_fail;
	}

	rc = aat28xx_ldo_enable(dev, LDO_CAM_DVDD_NO, 0);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_DVDD_NO);
		goto power_off_fail;
	}

	aat28xx_power(dev, 0);
	camera_power_state = CAM_POWER_OFF;

	/*Hitachi LCD LUT*/
	if(gelato_panel_id==1){
		mdp_load_hitachi_lut(1);
	}
power_off_fail:
	return rc;
}
int gelato_vibrator_power_set(int enable)
{
//#ifdef	LG_FW_AUDIO_GELATO_MOTOR
#if 1
	struct vreg *vreg_motor;
		
		printk("[Touch] %s() onoff:%d\n",__FUNCTION__, enable);
	
		vreg_motor = vreg_get(0, "gp1");
		
	
		if((IS_ERR(vreg_motor)) ){
			printk("[motor] vreg_get fail : motor\n");
			return -1;
		}
	
		if (enable) {	
			vreg_enable(vreg_motor);
	
		} else {
			vreg_disable(vreg_motor);
			
		}
		return 0;
#else
#if 0
	static int is_enabled = 0;
	struct device *dev = gelato_backlight_dev();

	if (dev==NULL) {
		printk(KERN_ERR "%s: backlight devive get failed\n", __FUNCTION__);
		return -1;
	}

	if (enable) {
		if (is_enabled) {
			//printk(KERN_INFO "vibrator power was enabled, already\n");
			return 0;
		}
		/* 3300 mV for Motor IC */				
		if (aat28xx_ldo_set_level(dev, 1, VIBE_IC_VOLTAGE) < 0) {
			printk(KERN_ERR "%s: vibrator LDO set failed\n", __FUNCTION__);
			return -EIO;
		}
		if (aat28xx_ldo_enable(dev, 1, 1) < 0) {
			printk(KERN_ERR "%s: vibrator LDO enable failed\n", __FUNCTION__);
			return -EIO;
		}
		is_enabled = 1;
	} else {
		if (!is_enabled) {
			//printk(KERN_INFO "vibrator power was disabled, already\n");
			return 0;
		}
		if (aat28xx_ldo_set_level(dev, 1, 0) < 0) {		
			printk(KERN_ERR "%s: vibrator LDO set failed\n", __FUNCTION__);
			return -EIO;
		}
		if (aat28xx_ldo_enable(dev, 1, 0) < 0) {
			printk(KERN_ERR "%s: vibrator LDO disable failed\n", __FUNCTION__);
			return -EIO;
		}
		is_enabled = 0;
	}
	return 0;
#endif 	
#endif
}