static int ea8061_early_set_power(struct lcd_device *ld, int power) { struct ea8061 *lcd = lcd_get_data(ld); struct mipi_dsim_master_ops *ops = lcd_to_master_ops(lcd); int ret = 0; if (power != FB_BLANK_UNBLANK && power != FB_BLANK_POWERDOWN && power != FB_BLANK_NORMAL) { dev_err(lcd->dev, "power value should be 0, 1 or 4.\n"); return -EINVAL; } if (lcd->power == power) { dev_err(lcd->dev, "power mode is same as previous one.\n"); return -EINVAL; } if (ops->set_early_blank_mode) { /* LCD power off */ if ((POWER_IS_OFF(power) && POWER_IS_ON(lcd->power)) || (POWER_IS_ON(lcd->power) && POWER_IS_NRM(power))) { ret = ops->set_early_blank_mode(lcd_to_master(lcd), power); if (!ret && lcd->power != power) lcd->power = power; } } return ret; }
static int corgi_lcd_set_power(struct lcd_device *ld, int power) { struct corgi_lcd *lcd = dev_get_drvdata(&ld->dev); if (POWER_IS_ON(power) && !POWER_IS_ON(lcd->power)) corgi_lcd_power_on(lcd); if (!POWER_IS_ON(power) && POWER_IS_ON(lcd->power)) corgi_lcd_power_off(lcd); lcd->power = power; return 0; }
static int auo_a043fl01v2_set_power(struct lcd_device *lcd, int power) { struct auo_a043fl01v2_data *dev= lcd_get_data(lcd); if (POWER_IS_ON(power) && !POWER_IS_ON(dev->lcd_power)) auo_a043fl01v2_on(dev); if (!POWER_IS_ON(power) && POWER_IS_ON(dev->lcd_power)) auo_a043fl01v2_off(dev); dev->lcd_power = power; return 0; }
static int ea8061_power(struct lcd_info *lcd, int power) { int ret = 0; if (POWER_IS_ON(power) && !POWER_IS_ON(lcd->power)) ret = ea8061_power_on(lcd); else if (!POWER_IS_ON(power) && POWER_IS_ON(lcd->power)) ret = ea8061_power_off(lcd); if (!ret) lcd->power = power; return ret; }
static int ili922x_lcd_power(struct ili922x *lcd, int power) { int ret = 0; if (POWER_IS_ON(power) && !POWER_IS_ON(lcd->power)) ret = ili922x_poweron(lcd->spi); else if (!POWER_IS_ON(power) && POWER_IS_ON(lcd->power)) ret = ili922x_poweroff(lcd->spi); if (!ret) lcd->power = power; return ret; }
static int hx8357_set_power(struct lcd_device *lcdev, int power) { struct hx8357_data *lcd = lcd_get_data(lcdev); int ret = 0; if (POWER_IS_ON(power) && !POWER_IS_ON(lcd->state)) ret = hx8357_exit_standby(lcdev); else if (!POWER_IS_ON(power) && POWER_IS_ON(lcd->state)) ret = hx8357_enter_standby(lcdev); if (ret == 0) lcd->state = power; else dev_warn(&lcdev->dev, "failed to set power mode %d\n", power); return ret; }
static int ili9320_power(struct ili9320 *lcd, int power) { int ret = 0; dev_dbg(lcd->dev, "power %d => %d\n", lcd->power, power); if (POWER_IS_ON(power) && !POWER_IS_ON(lcd->power)) ret = ili9320_power_on(lcd); else if (!POWER_IS_ON(power) && POWER_IS_ON(lcd->power)) ret = ili9320_power_off(lcd); if (ret == 0) lcd->power = power; else dev_warn(lcd->dev, "failed to set power mode %d\n", power); return ret; }
static int ws2401_power(struct ws2401_lcd *lcd, int power) { int ret = 0; dev_dbg(lcd->dev, "%s(): old=%d (%s), new=%d (%s)\n", __func__, lcd->power, POWER_IS_ON(lcd->power) ? "on" : "off", power, POWER_IS_ON(power) ? "on" : "off" ); if (POWER_IS_ON(power) && !POWER_IS_ON(lcd->power)) ret = ws2401_power_on(lcd); else if (!POWER_IS_ON(power) && POWER_IS_ON(lcd->power)) ret = ws2401_power_off(lcd); if (!ret) lcd->power = power; return ret; }
static int ws2401_set_brightness(struct backlight_device *bd) { int ret = 0, brightness = bd->props.brightness; struct ws2401_lcd *lcd = bl_get_data(bd); dev_dbg(&bd->dev, "lcd set brightness called with %d\n", brightness); if (brightness < MIN_SUPP_BRIGHTNESS || brightness > bd->props.max_brightness) { dev_err(&bd->dev, "lcd brightness should be %d to %d.\n", MIN_SUPP_BRIGHTNESS, bd->props.max_brightness); return -EINVAL; } mutex_lock(&lcd->lock); if (brightness) { brightness = brightness / (MAX_REQ_BRIGHTNESS/MAX_SUPP_BRIGHTNESS); if (brightness >= MAX_SUPP_BRIGHTNESS) brightness = MAX_SUPP_BRIGHTNESS - 1; if (!lcd->pd->no_bl_ctrl) { if (POWER_IS_ON(lcd->power)) { ret = ws2401_update_brightness(lcd->mdd, brightness); if (ret) { dev_err(&bd->dev, "lcd brightness setting failed.\n"); return -EIO; } } } } lcd->current_brightness = brightness; mutex_unlock(&lcd->lock); return ret; }