diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 2d9923a60076e3809d83a8435779ef5795d2590e..0505b796d743250e9e314b5a34747ff05033574e 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig @@ -36,14 +36,16 @@ config LCD_CORGI config LCD_L4F00242T03 tristate "Epson L4F00242T03 LCD" - depends on SPI_MASTER && GPIOLIB + depends on SPI_MASTER + depends on GPIOLIB || COMPILE_TEST help SPI driver for Epson L4F00242T03. This provides basic support for init and powering the LCD up/down through a sysfs interface. config LCD_LMS283GF05 tristate "Samsung LMS283GF05 LCD" - depends on SPI_MASTER && GPIOLIB + depends on SPI_MASTER + depends on GPIOLIB || COMPILE_TEST help SPI driver for Samsung LMS283GF05. This provides basic support for powering the LCD up/down through a sysfs interface. @@ -434,7 +436,7 @@ config BACKLIGHT_AS3711 config BACKLIGHT_GPIO tristate "Generic GPIO based Backlight Driver" - depends on GPIOLIB + depends on GPIOLIB || COMPILE_TEST help If you have a LCD backlight adjustable by GPIO, say Y to enable this driver. diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c index b1943e7735a12881130dc3d94b4266a992fc4230..fd2be417aa64d5a247756a7ebacdf6c3472fc012 100644 --- a/drivers/video/backlight/da9052_bl.c +++ b/drivers/video/backlight/da9052_bl.c @@ -152,7 +152,7 @@ static int da9052_backlight_remove(struct platform_device *pdev) return 0; } -static struct platform_device_id da9052_wled_ids[] = { +static const struct platform_device_id da9052_wled_ids[] = { { .name = "da9052-wled1", .driver_data = DA9052_TYPE_WLED1, diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 439feb2389a8cc3d70a45d7a2a3eac431d4f8db9..5fbbc2ebdf937cbbdb1d84e52128543a30125f3c 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -146,6 +146,8 @@ static struct of_device_id gpio_backlight_of_match[] = { { .compatible = "gpio-backlight" }, { /* sentinel */ } }; + +MODULE_DEVICE_TABLE(of, gpio_backlight_of_match); #endif static struct platform_driver gpio_backlight_driver = { diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c index a26d3bb2565071d6897a70a6ef42de56614a2c71..88116b493f3ba9d3177c22866df061d7fd449ef7 100644 --- a/drivers/video/backlight/lp855x_bl.c +++ b/drivers/video/backlight/lp855x_bl.c @@ -257,21 +257,15 @@ static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br) static int lp855x_bl_update_status(struct backlight_device *bl) { struct lp855x *lp = bl_get_data(bl); + int brightness = bl->props.brightness; if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) - bl->props.brightness = 0; + brightness = 0; - if (lp->mode == PWM_BASED) { - int br = bl->props.brightness; - int max_br = bl->props.max_brightness; - - lp855x_pwm_ctrl(lp, br, max_br); - - } else if (lp->mode == REGISTER_BASED) { - u8 val = bl->props.brightness; - - lp855x_write_byte(lp, lp->cfg->reg_brightness, val); - } + if (lp->mode == PWM_BASED) + lp855x_pwm_ctrl(lp, brightness, bl->props.max_brightness); + else if (lp->mode == REGISTER_BASED) + lp855x_write_byte(lp, lp->cfg->reg_brightness, (u8)brightness); return 0; } diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 6897f1c1bc732efe36632895fcedc577b7292a33..eff379b234ccfef7ce0a6abc96e4b9d8e3c6125a 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -241,7 +241,8 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->dev = &pdev->dev; pb->enabled = false; - pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable"); + pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable", + GPIOD_OUT_HIGH); if (IS_ERR(pb->enable_gpio)) { ret = PTR_ERR(pb->enable_gpio); goto err_alloc; @@ -263,9 +264,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->enable_gpio = gpio_to_desc(data->enable_gpio); } - if (pb->enable_gpio) - gpiod_direction_output(pb->enable_gpio, 1); - pb->power_supply = devm_regulator_get(&pdev->dev, "power"); if (IS_ERR(pb->power_supply)) { ret = PTR_ERR(pb->power_supply); diff --git a/include/linux/backlight.h b/include/linux/backlight.h index adb14a8616df53e681031e895ff37e783ca287f7..1e7a69adbe6f6992fa955e1c907d0820a224d177 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -117,12 +117,16 @@ struct backlight_device { int use_count; }; -static inline void backlight_update_status(struct backlight_device *bd) +static inline int backlight_update_status(struct backlight_device *bd) { + int ret = -ENOENT; + mutex_lock(&bd->update_lock); if (bd->ops && bd->ops->update_status) - bd->ops->update_status(bd); + ret = bd->ops->update_status(bd); mutex_unlock(&bd->update_lock); + + return ret; } extern struct backlight_device *backlight_device_register(const char *name,