Skip to content

Commit d59b92f

Browse files
committed
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
2 parents e045671 + cca0ba2 commit d59b92f

6 files changed

Lines changed: 22 additions & 22 deletions

File tree

‎drivers/video/backlight/Kconfig‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ config LCD_CORGI
3636

3737
config LCD_L4F00242T03
3838
tristate "Epson L4F00242T03 LCD"
39-
depends on SPI_MASTER && GPIOLIB
39+
depends on SPI_MASTER
40+
depends on GPIOLIB || COMPILE_TEST
4041
help
4142
SPI driver for Epson L4F00242T03. This provides basic support
4243
for init and powering the LCD up/down through a sysfs interface.
4344

4445
config LCD_LMS283GF05
4546
tristate "Samsung LMS283GF05 LCD"
46-
depends on SPI_MASTER && GPIOLIB
47+
depends on SPI_MASTER
48+
depends on GPIOLIB || COMPILE_TEST
4749
help
4850
SPI driver for Samsung LMS283GF05. This provides basic support
4951
for powering the LCD up/down through a sysfs interface.
@@ -434,7 +436,7 @@ config BACKLIGHT_AS3711
434436

435437
config BACKLIGHT_GPIO
436438
tristate "Generic GPIO based Backlight Driver"
437-
depends on GPIOLIB
439+
depends on GPIOLIB || COMPILE_TEST
438440
help
439441
If you have a LCD backlight adjustable by GPIO, say Y to enable
440442
this driver.

‎drivers/video/backlight/da9052_bl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static int da9052_backlight_remove(struct platform_device *pdev)
152152
return 0;
153153
}
154154

155-
static struct platform_device_id da9052_wled_ids[] = {
155+
static const struct platform_device_id da9052_wled_ids[] = {
156156
{
157157
.name = "da9052-wled1",
158158
.driver_data = DA9052_TYPE_WLED1,

‎drivers/video/backlight/gpio_backlight.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ static struct of_device_id gpio_backlight_of_match[] = {
146146
{ .compatible = "gpio-backlight" },
147147
{ /* sentinel */ }
148148
};
149+
150+
MODULE_DEVICE_TABLE(of, gpio_backlight_of_match);
149151
#endif
150152

151153
static struct platform_driver gpio_backlight_driver = {

‎drivers/video/backlight/lp855x_bl.c‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -257,21 +257,15 @@ static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br)
257257
static int lp855x_bl_update_status(struct backlight_device *bl)
258258
{
259259
struct lp855x *lp = bl_get_data(bl);
260+
int brightness = bl->props.brightness;
260261

261262
if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
262-
bl->props.brightness = 0;
263+
brightness = 0;
263264

264-
if (lp->mode == PWM_BASED) {
265-
int br = bl->props.brightness;
266-
int max_br = bl->props.max_brightness;
267-
268-
lp855x_pwm_ctrl(lp, br, max_br);
269-
270-
} else if (lp->mode == REGISTER_BASED) {
271-
u8 val = bl->props.brightness;
272-
273-
lp855x_write_byte(lp, lp->cfg->reg_brightness, val);
274-
}
265+
if (lp->mode == PWM_BASED)
266+
lp855x_pwm_ctrl(lp, brightness, bl->props.max_brightness);
267+
else if (lp->mode == REGISTER_BASED)
268+
lp855x_write_byte(lp, lp->cfg->reg_brightness, (u8)brightness);
275269

276270
return 0;
277271
}

‎drivers/video/backlight/pwm_bl.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
241241
pb->dev = &pdev->dev;
242242
pb->enabled = false;
243243

244-
pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable");
244+
pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
245+
GPIOD_OUT_HIGH);
245246
if (IS_ERR(pb->enable_gpio)) {
246247
ret = PTR_ERR(pb->enable_gpio);
247248
goto err_alloc;
@@ -263,9 +264,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
263264
pb->enable_gpio = gpio_to_desc(data->enable_gpio);
264265
}
265266

266-
if (pb->enable_gpio)
267-
gpiod_direction_output(pb->enable_gpio, 1);
268-
269267
pb->power_supply = devm_regulator_get(&pdev->dev, "power");
270268
if (IS_ERR(pb->power_supply)) {
271269
ret = PTR_ERR(pb->power_supply);

‎include/linux/backlight.h‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,16 @@ struct backlight_device {
117117
int use_count;
118118
};
119119

120-
static inline void backlight_update_status(struct backlight_device *bd)
120+
static inline int backlight_update_status(struct backlight_device *bd)
121121
{
122+
int ret = -ENOENT;
123+
122124
mutex_lock(&bd->update_lock);
123125
if (bd->ops && bd->ops->update_status)
124-
bd->ops->update_status(bd);
126+
ret = bd->ops->update_status(bd);
125127
mutex_unlock(&bd->update_lock);
128+
129+
return ret;
126130
}
127131

128132
extern struct backlight_device *backlight_device_register(const char *name,

0 commit comments

Comments
 (0)