Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+22 -22
+5 -3
drivers/video/backlight/Kconfig
··· 36 36 37 37 config LCD_L4F00242T03 38 38 tristate "Epson L4F00242T03 LCD" 39 - depends on SPI_MASTER && GPIOLIB 39 + depends on SPI_MASTER 40 + depends on GPIOLIB || COMPILE_TEST 40 41 help 41 42 SPI driver for Epson L4F00242T03. This provides basic support 42 43 for init and powering the LCD up/down through a sysfs interface. 43 44 44 45 config LCD_LMS283GF05 45 46 tristate "Samsung LMS283GF05 LCD" 46 - depends on SPI_MASTER && GPIOLIB 47 + depends on SPI_MASTER 48 + depends on GPIOLIB || COMPILE_TEST 47 49 help 48 50 SPI driver for Samsung LMS283GF05. This provides basic support 49 51 for powering the LCD up/down through a sysfs interface. ··· 436 434 437 435 config BACKLIGHT_GPIO 438 436 tristate "Generic GPIO based Backlight Driver" 439 - depends on GPIOLIB 437 + depends on GPIOLIB || COMPILE_TEST 440 438 help 441 439 If you have a LCD backlight adjustable by GPIO, say Y to enable 442 440 this driver.
+1 -1
drivers/video/backlight/da9052_bl.c
··· 152 152 return 0; 153 153 } 154 154 155 - static struct platform_device_id da9052_wled_ids[] = { 155 + static const struct platform_device_id da9052_wled_ids[] = { 156 156 { 157 157 .name = "da9052-wled1", 158 158 .driver_data = DA9052_TYPE_WLED1,
+2
drivers/video/backlight/gpio_backlight.c
··· 146 146 { .compatible = "gpio-backlight" }, 147 147 { /* sentinel */ } 148 148 }; 149 + 150 + MODULE_DEVICE_TABLE(of, gpio_backlight_of_match); 149 151 #endif 150 152 151 153 static struct platform_driver gpio_backlight_driver = {
+6 -12
drivers/video/backlight/lp855x_bl.c
··· 257 257 static int lp855x_bl_update_status(struct backlight_device *bl) 258 258 { 259 259 struct lp855x *lp = bl_get_data(bl); 260 + int brightness = bl->props.brightness; 260 261 261 262 if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) 262 - bl->props.brightness = 0; 263 + brightness = 0; 263 264 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); 275 269 276 270 return 0; 277 271 }
+2 -4
drivers/video/backlight/pwm_bl.c
··· 241 241 pb->dev = &pdev->dev; 242 242 pb->enabled = false; 243 243 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); 245 246 if (IS_ERR(pb->enable_gpio)) { 246 247 ret = PTR_ERR(pb->enable_gpio); 247 248 goto err_alloc; ··· 263 262 264 263 pb->enable_gpio = gpio_to_desc(data->enable_gpio); 265 264 } 266 - 267 - if (pb->enable_gpio) 268 - gpiod_direction_output(pb->enable_gpio, 1); 269 265 270 266 pb->power_supply = devm_regulator_get(&pdev->dev, "power"); 271 267 if (IS_ERR(pb->power_supply)) {
+6 -2
include/linux/backlight.h
··· 117 117 int use_count; 118 118 }; 119 119 120 - static inline void backlight_update_status(struct backlight_device *bd) 120 + static inline int backlight_update_status(struct backlight_device *bd) 121 121 { 122 + int ret = -ENOENT; 123 + 122 124 mutex_lock(&bd->update_lock); 123 125 if (bd->ops && bd->ops->update_status) 124 - bd->ops->update_status(bd); 126 + ret = bd->ops->update_status(bd); 125 127 mutex_unlock(&bd->update_lock); 128 + 129 + return ret; 126 130 } 127 131 128 132 extern struct backlight_device *backlight_device_register(const char *name,