Exemplo n.º 1
0
static void lm3530_wakeup(struct lm3530_driver_data *drvdata)
{
//	unsigned int lm3530_intensity;

	if (!drvdata || drvdata->state == NORMAL_STATE)
		return;

	dprintk("operation mode is %s\n", (drvdata->mode == NORMAL_MODE) ? "normal_mode" : "alc_mode");

	bl_config_gpio(1);
	lm3530_hw_reset(drvdata);

	if (drvdata->state == POWEROFF_STATE) {
		lm3530_poweron(drvdata);
		/* LGE_CHANGE
		 * Because the lm3530_go_opmode is called in the lm3530_poweron above, so I remove below function.
		 * If it is called two times when the previous state of AAT2862 is POWEROFF_STATE, it causes malfucction.
		 * 2010-07-31. [email protected]
		 */
		//lm3530_go_opmode(drvdata);
	} else if (drvdata->state == SLEEP_STATE) {
		if (drvdata->mode == NORMAL_MODE) {
				lm3530_set_table(drvdata, drvdata->cmds.normal);
				lm3530_write(drvdata->client, drvdata->reg_addrs.bl_m, drvdata->intensity);
			drvdata->state = NORMAL_STATE;
		} else if (drvdata->mode == ALC_MODE) {
			/* LGE_CHANGE
			 * Remove ALC mode
			 * 2010-07-26. [email protected]
			 */
			//lm3530_set_table(drvdata, drvdata->cmds.alc);
			//drvdata->state = NORMAL_STATE;
		}
	}
}
Exemplo n.º 2
0
void lm3530_switch_mode(struct device *dev, int next_mode)
{
	struct lm3530_driver_data *drvdata = dev_get_drvdata(dev);
//	unsigned int lm3530_intensity;

	if (!drvdata || drvdata->mode == next_mode)
		return;

	if (next_mode == ALC_MODE) {
		/* LGE_CHANGE
		 * Remove ALC mode
		 * 2010-07-26. [email protected]
		 */
		//lm3530_set_table(drvdata, drvdata->cmds.alc);
	}
	else if (next_mode == NORMAL_MODE) {
		lm3530_set_table(drvdata, drvdata->cmds.alc);

		lm3530_write(drvdata->client, drvdata->reg_addrs.bl_m, drvdata->intensity);
	} else {
		printk(KERN_ERR "%s: invalid mode(%d)!!!\n", __func__, next_mode);
		return;
	}

	drvdata->mode = next_mode;
	return;
}
Exemplo n.º 3
0
static void lm3530_sleep(struct lm3530_driver_data *drvdata)
{
	if (!drvdata || drvdata->state == SLEEP_STATE)
		return;

	dprintk("operation mode is %s\n", (drvdata->mode == NORMAL_MODE) ? "normal_mode" : "alc_mode");
	
	switch (drvdata->mode) {
		case NORMAL_MODE:
			drvdata->state = SLEEP_STATE;
			lm3530_set_table(drvdata, drvdata->cmds.sleep);
			break;

		case ALC_MODE:
			/* LGE_CHANGE
			 * Remove ALC mode
			 * 2010-07-26. [email protected]
			 */
			//drvdata->state = SLEEP_STATE;
			//lm3530_set_table(drvdata, drvdata->cmds.sleep);
			//udelay(500);
			//break;

		default:
			eprintk("Invalid Mode\n");
			break;
	}
	
	// [email protected] 20111024 set lcd_bl_en low for sleep current
	//#define LCD_BL_EN 124
	gpio_tlmm_config(GPIO_CFG(124, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
    	gpio_set_value(124, 0);    
    lm3530_current_state = SLEEP_STATE;
}
Exemplo n.º 4
0
static void lm3530_sleep(struct lm3530_driver_data *drvdata)
{
	if (!drvdata || drvdata->state == SLEEP_STATE)
		return;

	dprintk("operation mode is %s\n", (drvdata->mode == NORMAL_MODE) ? "normal_mode" : "alc_mode");
	
	switch (drvdata->mode) {
		case NORMAL_MODE:
			drvdata->state = SLEEP_STATE;
			lm3530_set_table(drvdata, drvdata->cmds.sleep);
			break;

		case ALC_MODE:
			/* LGE_CHANGE
			 * Remove ALC mode
			 * 2010-07-26. [email protected]
			 */
			//drvdata->state = SLEEP_STATE;
			//lm3530_set_table(drvdata, drvdata->cmds.sleep);
			//udelay(500);
			//break;

		default:
			eprintk("Invalid Mode\n");
			break;
	}

	if (drvdata->client && gpio_is_valid(drvdata->gpio)) {
		gpio_tlmm_config(GPIO_CFG(drvdata->gpio, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
		bl_config_gpio(0);
		udelay(10);
		gpio_set_value(drvdata->gpio, 0);
	}	
}
Exemplo n.º 5
0
static void lm3530_sleep(struct lm3530_driver_data *drvdata)
{
	if (!drvdata || drvdata->state == SLEEP_STATE)
		return;

	dprintk("operation mode is %s\n", (drvdata->mode == NORMAL_MODE) ? "normal_mode" : "alc_mode");
	
	switch (drvdata->mode) {
		case NORMAL_MODE:
			drvdata->state = SLEEP_STATE;
			lm3530_set_table(drvdata, drvdata->cmds.sleep);
			break;

		case ALC_MODE:
			/* LGE_CHANGE
			 * Remove ALC mode
			 * 2010-07-26. [email protected]
			 */
			//drvdata->state = SLEEP_STATE;
			//lm3530_set_table(drvdata, drvdata->cmds.sleep);
			//udelay(500);
			//break;

		default:
			eprintk("Invalid Mode\n");
			break;
	}
    lm3530_current_state = SLEEP_STATE;
}
Exemplo n.º 6
0
static void lm3530_wakeup(struct lm3530_driver_data *drvdata)
{
//	unsigned int lm3530_intensity;

	if (!drvdata || drvdata->state == NORMAL_STATE)
		return;

	// [email protected] 20111024 set lcd_bl_en & sub_pm_en high when wake up
	//#define LCD_BL_EN 124
    	gpio_tlmm_config(GPIO_CFG(124, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
    	gpio_set_value(124, 1); 

	dprintk("operation mode is %s\n", (drvdata->mode == NORMAL_MODE) ? "normal_mode" : "alc_mode");

	if (drvdata->state == POWEROFF_STATE) {
		lm3530_poweron(drvdata);
		/* LGE_CHANGE
		 * Because the lm3530_go_opmode is called in the lm3530_poweron above, so I remove below function.
		 * If it is called two times when the previous state of AAT2862 is POWEROFF_STATE, it causes malfucction.
		 * 2010-07-31. [email protected]
		 */
		//lm3530_go_opmode(drvdata);
	} else if (drvdata->state == SLEEP_STATE) {
		if (drvdata->mode == NORMAL_MODE) {
				lm3530_set_table(drvdata, drvdata->cmds.normal);

				/* LGE_CHANGE_S : [email protected] work around code in case miss the brightness level value from android
				 *  if brightness value be a zero, then set to default value.
				 *  Atherwise the change is not zero, then set the brightness value received from android
				 */
				if(drvdata->intensity > 0)
				{
					printk("%s : brightness : SET VALUE : %d\n",__func__, drvdata->intensity);
				lm3530_write(drvdata->client, drvdata->reg_addrs.bl_m, drvdata->intensity);
				}
				else
					printk("%s : brightness : SET DEFAULT \n",__func__);
				/*LGE_CHANGE_E : [email protected] work around code in case miss the brightness level value from android */
				
			drvdata->state = NORMAL_STATE;
		} else if (drvdata->mode == ALC_MODE) {
			/* LGE_CHANGE
			 * Remove ALC mode
			 * 2010-07-26. [email protected]
			 */
			//lm3530_set_table(drvdata, drvdata->cmds.alc);
			//drvdata->state = NORMAL_STATE;
		}
	}
}
Exemplo n.º 7
0
static void lm3530_wakeup(struct lm3530_driver_data *drvdata)
{
//	unsigned int lm3530_intensity;

	if (!drvdata || drvdata->state == NORMAL_STATE)
		return;

	// [email protected] 20111024 set lcd_bl_en & sub_pm_en high when wake up
	//#define LCD_BL_EN 124
    	gpio_tlmm_config(GPIO_CFG(124, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
    	gpio_set_value(124, 1); 
	//udelay(10);
	msleep(150);  /* [email protected] 2011-12-27  */
    lm3530_current_state = NORMAL_STATE;
	
	dprintk("operation mode is %s\n", (drvdata->mode == NORMAL_MODE) ? "normal_mode" : "alc_mode");

	if (drvdata->state == POWEROFF_STATE) {
		lm3530_poweron(drvdata);
		/* LGE_CHANGE
		 * Because the lm3530_go_opmode is called in the lm3530_poweron above, so I remove below function.
		 * If it is called two times when the previous state of AAT2862 is POWEROFF_STATE, it causes malfucction.
		 * 2010-07-31. [email protected]
		 */
		//lm3530_go_opmode(drvdata);
	} else if (drvdata->state == SLEEP_STATE) {
		if (drvdata->mode == NORMAL_MODE) {
				lm3530_set_table(drvdata, drvdata->cmds.normal);
				lm3530_write(drvdata->client, drvdata->reg_addrs.bl_m, drvdata->intensity);
			drvdata->state = NORMAL_STATE;
		} else if (drvdata->mode == ALC_MODE) {
			/* LGE_CHANGE
			 * Remove ALC mode
			 * 2010-07-26. [email protected]
			 */
			//lm3530_set_table(drvdata, drvdata->cmds.alc);
			//drvdata->state = NORMAL_STATE;
		}
	}

	if(LGF_TestMode_Is_SleepMode())
	{
		msleep(500);
	    LGF_SendKey(116);	// power key
	}
}
Exemplo n.º 8
0
static void lm3530_go_opmode(struct lm3530_driver_data *drvdata)
{
	dprintk("operation mode is %s\n", (drvdata->mode == NORMAL_MODE) ? "normal_mode" : "alc_mode");
	
	switch (drvdata->mode) {
		case NORMAL_MODE:
			lm3530_set_table(drvdata, drvdata->cmds.normal);
			drvdata->state = NORMAL_STATE;
			break;
		case ALC_MODE:
			/* LGE_CHANGE
			 * Remove ALC mode
			 * 2010-07-26. [email protected]
			 */
			//lm3530_set_table(drvdata, drvdata->cmds.alc);
			//drvdata->state = NORMAL_STATE;
			//break;
		default:
			eprintk("Invalid Mode\n");
			break;
	}
}
Exemplo n.º 9
0
static void lm3530_wakeup(struct lm3530_driver_data *drvdata)
{
//	unsigned int lm3530_intensity;

	if (!drvdata || drvdata->state == NORMAL_STATE)
		return;

	// [email protected] 20111024 set lcd_bl_en & sub_pm_en high when wake up
	//#define LCD_BL_EN 124
    gpio_tlmm_config(GPIO_CFG(124, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
    gpio_set_value(124, 1); 
	
	/*LGE_CHANGE_S, [email protected], 13-01-03, for V7 lcd backlight timing code*/
	#if defined(CONFIG_MACH_MSM8X25_V7)
	while(1){		
		msleep(50);
		if(lcd_on_completed == 1)
			break;	
	}
	
	msleep(50);
	lcd_on_completed = 0;
	#endif
	/*LGE_CHANGE_E, [email protected], 13-01-03, for V7 lcd backlight timing code*/	

	dprintk("operation mode is %s\n", (drvdata->mode == NORMAL_MODE) ? "normal_mode" : "alc_mode");

	if (drvdata->state == POWEROFF_STATE) {
		lm3530_poweron(drvdata);
		/* LGE_CHANGE
		 * Because the lm3530_go_opmode is called in the lm3530_poweron above, so I remove below function.
		 * If it is called two times when the previous state of AAT2862 is POWEROFF_STATE, it causes malfucction.
		 * 2010-07-31. [email protected]
		 */
		//lm3530_go_opmode(drvdata);
	} else if (drvdata->state == SLEEP_STATE) {
		if (drvdata->mode == NORMAL_MODE) {

				/* LGE_CHANGE
		 		 * [V7] Backlight setting value is coming lately than late_resume, please wait the non zero value.
		 		 * 2013-02-06. [email protected]
		 		 */
		 		late_resume_count = 0;
				if(late_resume_value == 0){
					while(1){	
						msleep(50);
						if((late_resume_value != 0) || (late_resume_count == 6)){
							printk("zero value is coming, wait the next value %d\n", late_resume_value);
							late_resume_value = 0;
							break;
						}						
						late_resume_count++;
					}
				}
				
				lm3530_set_table(drvdata, drvdata->cmds.normal);				

				/* LGE_CHANGE_S : [email protected] work around code in case miss the brightness level value from android
				 *  if brightness value be a zero, then set to default value.
				 *  Atherwise the change is not zero, then set the brightness value received from android
				 */
				if(drvdata->intensity > 0)
				{
					printk("%s : brightness : SET VALUE : %d\n",__func__, drvdata->intensity);
					lm3530_write(drvdata->client, drvdata->reg_addrs.bl_m, drvdata->intensity);
				}
				else
					printk("%s : brightness : SET DEFAULT \n",__func__);
				/*LGE_CHANGE_E : [email protected] work around code in case miss the brightness level value from android */
				
			drvdata->state = NORMAL_STATE;
		} else if (drvdata->mode == ALC_MODE) {
			/* LGE_CHANGE
			 * Remove ALC mode
			 * 2010-07-26. [email protected]
			 */
			//lm3530_set_table(drvdata, drvdata->cmds.alc);
			//drvdata->state = NORMAL_STATE;
		}
	}
}