static irqreturn_t esd_interrupt_handler(int irq, void *data) { struct vivaltonfc_dsi_lcd *lcd = data; printk("[LCD] %s(), esd_enable=%d, esd_processing=%d, gpio_input=%d\n", __func__, lcd->esd_enable, lcd->esd_processing, gpio_get_value(lcd->esd_port)); if (gpio_get_value(lcd->esd_port) == 0) { printk("[LCD] %s(), skip esd_interrupt_handlert because gpio_input is low\n", __func__); return IRQ_HANDLED; } if (lcd->esd_enable && !lcd->esd_processing/* && !battpwroff_charging*/) { pr_info("ESD PORT =[%d]\n", gpio_get_value(lcd->esd_port)); lcd->esd_processing = true; mutex_lock(&lcd->lock); kona_fb_esd_hw_reset(); mutex_unlock(&lcd->lock); msleep(500); #ifdef CONFIG_BACKLIGHT_KTD2801 backlight_control(tune_level); #endif lcd->esd_processing = false; } return IRQ_HANDLED; }
/* input: intensity in percentage 0% - 100% */ static int tps61158_backlight_update_status(struct backlight_device *bd) { int user_intensity = bd->props.brightness; int tune_level = 0; int i; BLDBG("[BACKLIGHT] tps61158_backlight_update_status ==> user_intensity : %d\n", user_intensity); if (bd->props.power != FB_BLANK_UNBLANK) user_intensity = 0; if (bd->props.fb_blank != FB_BLANK_UNBLANK) user_intensity = 0; if (bd->props.state & BL_CORE_SUSPENDED) user_intensity = 0; if(backlight_mode != BACKLIGHT_RESUME) { // BLDBG("[BACKLIGHT] Returned with invalid backlight mode %d\n", backlight_mode); return 0; } if(user_intensity > 0) { if(user_intensity < MIN_BRIGHTNESS_VALUE) { tune_level = DIMMING_VALUE; //DIMMING } else if (user_intensity == MAX_BRIGHTNESS_VALUE) { tune_level = brt_table[MAX_BRT_STAGE-1].tune_level; } else { for(i = 0; i < MAX_BRT_STAGE; i++) { if(user_intensity <= brt_table[i].level ) { tune_level = brt_table[i].tune_level; break; } } } } BLDBG("[BACKLIGHT] tps61158_backlight_update_status ==> tune_level : %d\n", tune_level); backlight_control(tune_level); return 0; }