diff options
author | Linus Torvalds | 2021-11-08 12:21:28 -0800 |
---|---|---|
committer | Linus Torvalds | 2021-11-08 12:21:28 -0800 |
commit | d2f38a3c6507b2520101f9a3807ed98f1bdc545a (patch) | |
tree | 1d597c31c4e9d8ec21d8556a3363dfeed4a0ce0d /drivers | |
parent | 3a9b0a46e1708b6b3c298f2cf22923cc5a2ca63f (diff) | |
parent | 3976e974df1fd3a718627b0c9bdfee1953baa0d5 (diff) |
Merge tag 'backlight-next-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones:
"Fix-ups:
- Standardise *_exit() and *_remove() return values in ili9320 and
vgg2432a4
Bug Fixes:
- Do not override maximum brightness
- Propagate errors from get_brightness()"
* tag 'backlight-next-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight:
video: backlight: ili9320: Make ili9320_remove() return void
backlight: Propagate errors from get_brightness()
video: backlight: Drop maximum brightness override for brightness zero
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/backlight/backlight.c | 28 | ||||
-rw-r--r-- | drivers/video/backlight/ili9320.c | 3 | ||||
-rw-r--r-- | drivers/video/backlight/ili9320.h | 2 | ||||
-rw-r--r-- | drivers/video/backlight/vgg2432a4.c | 4 |
4 files changed, 22 insertions, 15 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 537fe1b376ad..4ae6fae94ac2 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -292,10 +292,13 @@ static ssize_t actual_brightness_show(struct device *dev, struct backlight_device *bd = to_backlight_device(dev); mutex_lock(&bd->ops_lock); - if (bd->ops && bd->ops->get_brightness) - rc = sprintf(buf, "%d\n", bd->ops->get_brightness(bd)); - else + if (bd->ops && bd->ops->get_brightness) { + rc = bd->ops->get_brightness(bd); + if (rc >= 0) + rc = sprintf(buf, "%d\n", rc); + } else { rc = sprintf(buf, "%d\n", bd->props.brightness); + } mutex_unlock(&bd->ops_lock); return rc; @@ -381,9 +384,18 @@ ATTRIBUTE_GROUPS(bl_device); void backlight_force_update(struct backlight_device *bd, enum backlight_update_reason reason) { + int brightness; + mutex_lock(&bd->ops_lock); - if (bd->ops && bd->ops->get_brightness) - bd->props.brightness = bd->ops->get_brightness(bd); + if (bd->ops && bd->ops->get_brightness) { + brightness = bd->ops->get_brightness(bd); + if (brightness >= 0) + bd->props.brightness = brightness; + else + dev_err(&bd->dev, + "Could not update brightness from device: %pe\n", + ERR_PTR(brightness)); + } mutex_unlock(&bd->ops_lock); backlight_generate_event(bd, reason); } @@ -688,12 +700,6 @@ static struct backlight_device *of_find_backlight(struct device *dev) of_node_put(np); if (!bd) return ERR_PTR(-EPROBE_DEFER); - /* - * Note: gpio_backlight uses brightness as - * power state during probe - */ - if (!bd->props.brightness) - bd->props.brightness = bd->props.max_brightness; } } diff --git a/drivers/video/backlight/ili9320.c b/drivers/video/backlight/ili9320.c index 168ac79523d7..2acd2708f8ca 100644 --- a/drivers/video/backlight/ili9320.c +++ b/drivers/video/backlight/ili9320.c @@ -251,10 +251,9 @@ int ili9320_probe_spi(struct spi_device *spi, } EXPORT_SYMBOL_GPL(ili9320_probe_spi); -int ili9320_remove(struct ili9320 *ili) +void ili9320_remove(struct ili9320 *ili) { ili9320_power(ili, FB_BLANK_POWERDOWN); - return 0; } EXPORT_SYMBOL_GPL(ili9320_remove); diff --git a/drivers/video/backlight/ili9320.h b/drivers/video/backlight/ili9320.h index fc59e389d59a..8213cc6e9184 100644 --- a/drivers/video/backlight/ili9320.h +++ b/drivers/video/backlight/ili9320.h @@ -68,7 +68,7 @@ extern int ili9320_write_regs(struct ili9320 *ili, extern int ili9320_probe_spi(struct spi_device *spi, struct ili9320_client *cli); -extern int ili9320_remove(struct ili9320 *lcd); +extern void ili9320_remove(struct ili9320 *lcd); extern void ili9320_shutdown(struct ili9320 *lcd); /* PM */ diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c index 9bf277ca4ae9..3567b45f9ba9 100644 --- a/drivers/video/backlight/vgg2432a4.c +++ b/drivers/video/backlight/vgg2432a4.c @@ -235,7 +235,9 @@ static int vgg2432a4_probe(struct spi_device *spi) static int vgg2432a4_remove(struct spi_device *spi) { - return ili9320_remove(spi_get_drvdata(spi)); + ili9320_remove(spi_get_drvdata(spi)); + + return 0; } static void vgg2432a4_shutdown(struct spi_device *spi) |