Commit d59b92f9 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'backlight-for-linus-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight

Pull backlight updates from Lee Jones:
 "Changes to existing drivers:

   - supply MODULE_DEVICE_TABLE() to ensure probing
   - constify struct; da9052_bl
   - enable compile test; lcd_l4f00242t03, lcd_lms283fg05, backlight_gpio
   - suspend/resume bugfix; lp855x_bl
   - devm_gpiod_get_optional() API fixup; pwm_bl
   - error handling fixup; backlight"

* tag 'backlight-for-linus-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight:
  backlight: Change the return type of backlight_update_status() to int
  backlight: pwm_bl: Simplify usage of devm_gpiod_get_optional
  backlight: lp855x: Don't clear level on suspend/blank
  backlight: Allow compile test of GPIO consumers if !GPIOLIB
  video: backlight: da9052: Constify platform_device_id
  gpio-backlight: Discover driver during boot time
parents e0456717 cca0ba2d
...@@ -36,14 +36,16 @@ config LCD_CORGI ...@@ -36,14 +36,16 @@ config LCD_CORGI
config LCD_L4F00242T03 config LCD_L4F00242T03
tristate "Epson L4F00242T03 LCD" tristate "Epson L4F00242T03 LCD"
depends on SPI_MASTER && GPIOLIB depends on SPI_MASTER
depends on GPIOLIB || COMPILE_TEST
help help
SPI driver for Epson L4F00242T03. This provides basic support SPI driver for Epson L4F00242T03. This provides basic support
for init and powering the LCD up/down through a sysfs interface. for init and powering the LCD up/down through a sysfs interface.
config LCD_LMS283GF05 config LCD_LMS283GF05
tristate "Samsung LMS283GF05 LCD" tristate "Samsung LMS283GF05 LCD"
depends on SPI_MASTER && GPIOLIB depends on SPI_MASTER
depends on GPIOLIB || COMPILE_TEST
help help
SPI driver for Samsung LMS283GF05. This provides basic support SPI driver for Samsung LMS283GF05. This provides basic support
for powering the LCD up/down through a sysfs interface. for powering the LCD up/down through a sysfs interface.
...@@ -434,7 +436,7 @@ config BACKLIGHT_AS3711 ...@@ -434,7 +436,7 @@ config BACKLIGHT_AS3711
config BACKLIGHT_GPIO config BACKLIGHT_GPIO
tristate "Generic GPIO based Backlight Driver" tristate "Generic GPIO based Backlight Driver"
depends on GPIOLIB depends on GPIOLIB || COMPILE_TEST
help help
If you have a LCD backlight adjustable by GPIO, say Y to enable If you have a LCD backlight adjustable by GPIO, say Y to enable
this driver. this driver.
......
...@@ -152,7 +152,7 @@ static int da9052_backlight_remove(struct platform_device *pdev) ...@@ -152,7 +152,7 @@ static int da9052_backlight_remove(struct platform_device *pdev)
return 0; return 0;
} }
static struct platform_device_id da9052_wled_ids[] = { static const struct platform_device_id da9052_wled_ids[] = {
{ {
.name = "da9052-wled1", .name = "da9052-wled1",
.driver_data = DA9052_TYPE_WLED1, .driver_data = DA9052_TYPE_WLED1,
......
...@@ -146,6 +146,8 @@ static struct of_device_id gpio_backlight_of_match[] = { ...@@ -146,6 +146,8 @@ static struct of_device_id gpio_backlight_of_match[] = {
{ .compatible = "gpio-backlight" }, { .compatible = "gpio-backlight" },
{ /* sentinel */ } { /* sentinel */ }
}; };
MODULE_DEVICE_TABLE(of, gpio_backlight_of_match);
#endif #endif
static struct platform_driver gpio_backlight_driver = { static struct platform_driver gpio_backlight_driver = {
......
...@@ -257,21 +257,15 @@ static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br) ...@@ -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) static int lp855x_bl_update_status(struct backlight_device *bl)
{ {
struct lp855x *lp = bl_get_data(bl); struct lp855x *lp = bl_get_data(bl);
int brightness = bl->props.brightness;
if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
bl->props.brightness = 0; brightness = 0;
if (lp->mode == PWM_BASED) { if (lp->mode == PWM_BASED)
int br = bl->props.brightness; lp855x_pwm_ctrl(lp, brightness, bl->props.max_brightness);
int max_br = bl->props.max_brightness; else if (lp->mode == REGISTER_BASED)
lp855x_write_byte(lp, lp->cfg->reg_brightness, (u8)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);
}
return 0; return 0;
} }
......
...@@ -241,7 +241,8 @@ static int pwm_backlight_probe(struct platform_device *pdev) ...@@ -241,7 +241,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
pb->dev = &pdev->dev; pb->dev = &pdev->dev;
pb->enabled = false; 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)) { if (IS_ERR(pb->enable_gpio)) {
ret = PTR_ERR(pb->enable_gpio); ret = PTR_ERR(pb->enable_gpio);
goto err_alloc; goto err_alloc;
...@@ -263,9 +264,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) ...@@ -263,9 +264,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
pb->enable_gpio = gpio_to_desc(data->enable_gpio); 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"); pb->power_supply = devm_regulator_get(&pdev->dev, "power");
if (IS_ERR(pb->power_supply)) { if (IS_ERR(pb->power_supply)) {
ret = PTR_ERR(pb->power_supply); ret = PTR_ERR(pb->power_supply);
......
...@@ -117,12 +117,16 @@ struct backlight_device { ...@@ -117,12 +117,16 @@ struct backlight_device {
int use_count; 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); mutex_lock(&bd->update_lock);
if (bd->ops && bd->ops->update_status) if (bd->ops && bd->ops->update_status)
bd->ops->update_status(bd); ret = bd->ops->update_status(bd);
mutex_unlock(&bd->update_lock); mutex_unlock(&bd->update_lock);
return ret;
} }
extern struct backlight_device *backlight_device_register(const char *name, extern struct backlight_device *backlight_device_register(const char *name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment