static void lm3639_set_main_current_level(struct i2c_client *client, int level) { struct lm3639_device *dev = i2c_get_clientdata(client); int min_brightness = dev->min_brightness; int max_brightness = dev->max_brightness; if (level == -BOOT_BRIGHTNESS) level = dev->default_brightness; cur_main_lcd_level = level; dev->bl_dev->props.brightness = cur_main_lcd_level; store_level_used = 0; mutex_lock(&dev->bl_mutex); if (level != 0) { if (level > 0 && level <= min_brightness) level = min_brightness; else if (level > max_brightness) level = max_brightness; if (dev->blmap) { if (level < dev->blmap_size) { cal_value = dev->blmap[level]; lm3639_write_reg(client, 0x05, cal_value); } else dev_warn(&client->dev, "invalid index %d:%d\n", dev->blmap_size, level); } else { cal_value = level; lm3639_write_reg(client, 0x05, cal_value); } } else{ lm3639_write_reg(client, 0x05, 0x00); bl_ctrl = 0; lm3639_read_reg(main_lm3639_dev->client, 0x0A, &bl_ctrl); bl_ctrl &= 0xE6; lm3639_write_reg(main_lm3639_dev->client, 0x0A, bl_ctrl); } mutex_unlock(&dev->bl_mutex); pr_info("[LCD] %s : level=%d, cal_value=%d \n", __func__, level, cal_value); }
static void lm3639_set_main_current_level_no_mapping( struct i2c_client *client, int level) { struct lm3639_device *dev; dev = (struct lm3639_device *)i2c_get_clientdata(client); if (level > MAX_BRIGHTNESS_LM3639) level = MAX_BRIGHTNESS_LM3639; else if (level < 0) level = 0; cur_main_lcd_level = level; dev->bl_dev->props.brightness = cur_main_lcd_level; store_level_used = 1; mutex_lock(&main_lm3639_dev->bl_mutex); if (level != 0) { lm3639_write_reg(client, 0x05, level); } else { lm3639_write_reg(client, 0x00, 0x00); } mutex_unlock(&main_lm3639_dev->bl_mutex); }
void lm3639_led_enable(void){ int gpio = main_lm3639_dev->bl_gpio; pr_err(">> %s: START\n", __func__); mutex_lock(&main_lm3639_dev->bl_mutex); if (gpio_get_value(gpio) != 1) { gpio_direction_output(gpio, 1); if (backlight_status == POWER_OFF) {/* */ lm3639_write_reg(main_lm3639_dev->client, 0x05, 0x00); } mdelay(10); pr_err("%s: ON!\n", __func__); } backlight_status |= FLASH_ON; mutex_unlock(&main_lm3639_dev->bl_mutex); pr_err("<< %s: END\n", __func__); }
void lm3639_led_enable(void){ int gpio = main_lm3639_dev->bl_gpio; pr_err(">> %s: START\n", __func__); mutex_lock(&main_lm3639_dev->bl_mutex); if (gpio_get_value(gpio) != 1) { gpio_direction_output(gpio, 1); if (backlight_status == POWER_OFF) {/* LGE_CHANGE, [email protected], If display turn off, set backlight brightness 0x00*/ lm3639_write_reg(main_lm3639_dev->client, 0x05, 0x00); } mdelay(10); pr_err("%s: ON!\n", __func__); } backlight_status |= FLASH_ON; mutex_unlock(&main_lm3639_dev->bl_mutex); pr_err("<< %s: END\n", __func__); }
void lm3639_backlight_on(int level) { if ((backlight_status != BL_ON) && (backlight_status != BOTH_ON)){ if(!init_complete) lm3639_hw_reset(); bl_ctrl = 0; lm3639_read_reg(main_lm3639_dev->client, 0x0A, &bl_ctrl); bl_ctrl |= 0x11; lm3639_write_reg(main_lm3639_dev->client, 0x0A, bl_ctrl); pr_info("%s: ON!\n", __func__); } mdelay(1); lm3639_set_main_current_level(main_lm3639_dev->client, level); backlight_status |= BL_ON; return; }