static int lm3530_set_table(struct lm3530_driver_data *drvdata, struct lm3530_ctrl_tbl *ptbl) { unsigned int i = 0; unsigned long delay = 0; if (ptbl == NULL) { eprintk("input ptr is null\n"); return -EIO; } for( ;;) { if (ptbl->reg == 0xFF) { if (ptbl->val != 0xFE) { delay = (unsigned long)ptbl->val; udelay(delay); } else break; } else { if (lm3530_write(drvdata->client, ptbl->reg, ptbl->val) != 0) dprintk("i2c failed addr:%d, value:%d\n", ptbl->reg, ptbl->val); } ptbl++; i++; } return 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; }
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; } } }
static int lm3530_send_intensity(struct lm3530_driver_data *drvdata, int next) { if (drvdata->mode == NORMAL_MODE) { if (next > drvdata->max_intensity){ next = drvdata->max_intensity; //printk("%s, next : %d, max_intensity : %d \n ",__func__, next, drvdata->max_intensity); } if (next < LCD_LED_MIN) { //printk("%s, next : %d, LCD_LED_MIN : %d \n ",__func__, next, LCD_LED_MIN); next = LCD_LED_MIN; } dprintk("%s, next current is %d\n", __func__, next); if (drvdata->state == NORMAL_STATE && drvdata->intensity != next){ //printk("%s, lm3530_write next %d\n", __func__, next); lm3530_write(drvdata->client, drvdata->reg_addrs.bl_m, next); } drvdata->intensity = next; late_resume_value = next; } else { dprintk("A manual setting for intensity is only permitted in normal mode\n"); } return 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; } } }
static void lm3530_poweron(struct lm3530_driver_data *drvdata) { // unsigned int lm3530_intensity; if (!drvdata || drvdata->state != POWEROFF_STATE) return; dprintk("POWER ON \n"); lm3530_device_init(drvdata); if (drvdata->mode == NORMAL_MODE) { lm3530_write(drvdata->client, drvdata->reg_addrs.bl_m, drvdata->intensity); } }
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 } }
static int lm3530_send_intensity(struct lm3530_driver_data *drvdata, int next) { // int lm3530_bl_next; if (drvdata->mode == NORMAL_MODE) { if (next > drvdata->max_intensity) next = drvdata->max_intensity; if (next < LCD_LED_MIN) next = LCD_LED_MIN; //dprintk("next current is %d\n", next); if (drvdata->state == NORMAL_STATE && drvdata->intensity != next) lm3530_write(drvdata->client, drvdata->reg_addrs.bl_m, next); drvdata->intensity = next; } else { dprintk("A manual setting for intensity is only permitted in normal mode\n"); } return 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; } } }