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

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

Pull backlight changes from Lee Jones:
Changes to existing drivers:
- remove get brightness implementations in via-pmu-backlight
samsung-q10 aat2870_bl ams369fg06 bd6107 gpio_backlight ld9040
lp855x_bl lp8788_bl lv5207lp pandora_bl pwm_bl s6e63m0 tps65217_bl
aty128fb atyfb_base radeon_backlight s6e8ax0 nv_backlight
riva/fbdev
- improve error handling in jornada720_lcd
- make use of new 'get optional' GPIO command in pwm_bl
- fix sparse warning in ipaq_micro_bl

New drivers/supported devices:
- new driver for iPAQ"

* tag 'backlight-for-linus-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight:
backlight: ipaq_micro: Fix sparse non static symbol warning
backlight: Add driver for iPAQ micro backlight
backlight: pwm-backlight: Use devm_gpiod_get_optional()
backlight: jornada720: Minimise code duplication and handle errors better
backlight: Show brightness even if get_brightness is not implemented
backlight: Remove trivial get_brightness implementations

+116 -143
-6
drivers/macintosh/via-pmu-backlight.c
··· 110 110 } 111 111 112 112 113 - static int pmu_backlight_get_brightness(struct backlight_device *bd) 114 - { 115 - return bd->props.brightness; 116 - } 117 - 118 113 static const struct backlight_ops pmu_backlight_data = { 119 - .get_brightness = pmu_backlight_get_brightness, 120 114 .update_status = pmu_backlight_update_status, 121 115 122 116 };
-6
drivers/platform/x86/samsung-q10.c
··· 46 46 return 0; 47 47 } 48 48 49 - static int samsungq10_bl_get_intensity(struct backlight_device *bd) 50 - { 51 - return bd->props.brightness; 52 - } 53 - 54 49 static const struct backlight_ops samsungq10_bl_ops = { 55 - .get_brightness = samsungq10_bl_get_intensity, 56 50 .update_status = samsungq10_bl_set_intensity, 57 51 }; 58 52
+9
drivers/video/backlight/Kconfig
··· 207 207 known as the Corgi backlight driver. If you have a Sharp Zaurus 208 208 SL-C7xx, SL-Cxx00 or SL-6000x say y. 209 209 210 + config BACKLIGHT_IPAQ_MICRO 211 + tristate "iPAQ microcontroller backlight driver" 212 + depends on MFD_IPAQ_MICRO 213 + default y 214 + help 215 + Say y to enable the backlight driver for Compaq iPAQ handheld 216 + computers. Say yes if you have one of the h3100/h3600/h3700 217 + machines. 218 + 210 219 config BACKLIGHT_LM3533 211 220 tristate "Backlight Driver for LM3533" 212 221 depends on BACKLIGHT_CLASS_DEVICE
+1
drivers/video/backlight/Makefile
··· 36 36 obj-$(CONFIG_BACKLIGHT_GPIO) += gpio_backlight.o 37 37 obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o 38 38 obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o 39 + obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o 39 40 obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o 40 41 obj-$(CONFIG_BACKLIGHT_LM3630A) += lm3630a_bl.o 41 42 obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o
-6
drivers/video/backlight/aat2870_bl.c
··· 67 67 return aat2870->write(aat2870, AAT2870_BL_CH_EN, 0x0); 68 68 } 69 69 70 - static int aat2870_bl_get_brightness(struct backlight_device *bd) 71 - { 72 - return bd->props.brightness; 73 - } 74 - 75 70 static int aat2870_bl_update_status(struct backlight_device *bd) 76 71 { 77 72 struct aat2870_bl_driver_data *aat2870_bl = bl_get_data(bd); ··· 115 120 116 121 static const struct backlight_ops aat2870_bl_ops = { 117 122 .options = BL_CORE_SUSPENDRESUME, 118 - .get_brightness = aat2870_bl_get_brightness, 119 123 .update_status = aat2870_bl_update_status, 120 124 .check_fb = aat2870_bl_check_fb, 121 125 };
-6
drivers/video/backlight/ams369fg06.c
··· 410 410 return ams369fg06_power(lcd, power); 411 411 } 412 412 413 - static int ams369fg06_get_brightness(struct backlight_device *bd) 414 - { 415 - return bd->props.brightness; 416 - } 417 - 418 413 static int ams369fg06_set_brightness(struct backlight_device *bd) 419 414 { 420 415 int ret = 0; ··· 438 443 }; 439 444 440 445 static const struct backlight_ops ams369fg06_backlight_ops = { 441 - .get_brightness = ams369fg06_get_brightness, 442 446 .update_status = ams369fg06_set_brightness, 443 447 }; 444 448
+2
drivers/video/backlight/backlight.c
··· 223 223 mutex_lock(&bd->ops_lock); 224 224 if (bd->ops && bd->ops->get_brightness) 225 225 rc = sprintf(buf, "%d\n", bd->ops->get_brightness(bd)); 226 + else 227 + rc = sprintf(buf, "%d\n", bd->props.brightness); 226 228 mutex_unlock(&bd->ops_lock); 227 229 228 230 return rc;
-6
drivers/video/backlight/bd6107.c
··· 105 105 return 0; 106 106 } 107 107 108 - static int bd6107_backlight_get_brightness(struct backlight_device *backlight) 109 - { 110 - return backlight->props.brightness; 111 - } 112 - 113 108 static int bd6107_backlight_check_fb(struct backlight_device *backlight, 114 109 struct fb_info *info) 115 110 { ··· 116 121 static const struct backlight_ops bd6107_backlight_ops = { 117 122 .options = BL_CORE_SUSPENDRESUME, 118 123 .update_status = bd6107_backlight_update_status, 119 - .get_brightness = bd6107_backlight_get_brightness, 120 124 .check_fb = bd6107_backlight_check_fb, 121 125 }; 122 126
-6
drivers/video/backlight/gpio_backlight.c
··· 44 44 return 0; 45 45 } 46 46 47 - static int gpio_backlight_get_brightness(struct backlight_device *bl) 48 - { 49 - return bl->props.brightness; 50 - } 51 - 52 47 static int gpio_backlight_check_fb(struct backlight_device *bl, 53 48 struct fb_info *info) 54 49 { ··· 55 60 static const struct backlight_ops gpio_backlight_ops = { 56 61 .options = BL_CORE_SUSPENDRESUME, 57 62 .update_status = gpio_backlight_update_status, 58 - .get_brightness = gpio_backlight_get_brightness, 59 63 .check_fb = gpio_backlight_check_fb, 60 64 }; 61 65
+83
drivers/video/backlight/ipaq_micro_bl.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify 3 + * it under the terms of the GNU General Public License version 2 as 4 + * published by the Free Software Foundation. 5 + * 6 + * iPAQ microcontroller backlight support 7 + * Author : Linus Walleij <linus.walleij@linaro.org> 8 + */ 9 + 10 + #include <linux/backlight.h> 11 + #include <linux/err.h> 12 + #include <linux/fb.h> 13 + #include <linux/init.h> 14 + #include <linux/mfd/ipaq-micro.h> 15 + #include <linux/module.h> 16 + #include <linux/platform_device.h> 17 + 18 + static int micro_bl_update_status(struct backlight_device *bd) 19 + { 20 + struct ipaq_micro *micro = dev_get_drvdata(&bd->dev); 21 + int intensity = bd->props.brightness; 22 + struct ipaq_micro_msg msg = { 23 + .id = MSG_BACKLIGHT, 24 + .tx_len = 3, 25 + }; 26 + 27 + if (bd->props.power != FB_BLANK_UNBLANK) 28 + intensity = 0; 29 + if (bd->props.state & (BL_CORE_FBBLANK | BL_CORE_SUSPENDED)) 30 + intensity = 0; 31 + 32 + /* 33 + * Message format: 34 + * Byte 0: backlight instance (usually 1) 35 + * Byte 1: on/off 36 + * Byte 2: intensity, 0-255 37 + */ 38 + msg.tx_data[0] = 0x01; 39 + msg.tx_data[1] = intensity > 0 ? 1 : 0; 40 + msg.tx_data[2] = intensity; 41 + return ipaq_micro_tx_msg_sync(micro, &msg); 42 + } 43 + 44 + static const struct backlight_ops micro_bl_ops = { 45 + .options = BL_CORE_SUSPENDRESUME, 46 + .update_status = micro_bl_update_status, 47 + }; 48 + 49 + static struct backlight_properties micro_bl_props = { 50 + .type = BACKLIGHT_RAW, 51 + .max_brightness = 255, 52 + .power = FB_BLANK_UNBLANK, 53 + .brightness = 64, 54 + }; 55 + 56 + static int micro_backlight_probe(struct platform_device *pdev) 57 + { 58 + struct backlight_device *bd; 59 + struct ipaq_micro *micro = dev_get_drvdata(pdev->dev.parent); 60 + 61 + bd = devm_backlight_device_register(&pdev->dev, "ipaq-micro-backlight", 62 + &pdev->dev, micro, &micro_bl_ops, 63 + &micro_bl_props); 64 + if (IS_ERR(bd)) 65 + return PTR_ERR(bd); 66 + 67 + platform_set_drvdata(pdev, bd); 68 + backlight_update_status(bd); 69 + 70 + return 0; 71 + } 72 + 73 + static struct platform_driver micro_backlight_device_driver = { 74 + .driver = { 75 + .name = "ipaq-micro-backlight", 76 + }, 77 + .probe = micro_backlight_probe, 78 + }; 79 + module_platform_driver(micro_backlight_device_driver); 80 + 81 + MODULE_LICENSE("GPL v2"); 82 + MODULE_DESCRIPTION("driver for iPAQ Atmel micro backlight"); 83 + MODULE_ALIAS("platform:ipaq-micro-backlight");
+19 -18
drivers/video/backlight/jornada720_lcd.c
··· 43 43 44 44 jornada_ssp_start(); 45 45 46 - if (jornada_ssp_byte(GETCONTRAST) != TXDUMMY) { 47 - dev_err(&ld->dev, "get contrast failed\n"); 48 - jornada_ssp_end(); 49 - return -ETIMEDOUT; 50 - } else { 46 + if (jornada_ssp_byte(GETCONTRAST) == TXDUMMY) { 51 47 ret = jornada_ssp_byte(TXDUMMY); 52 - jornada_ssp_end(); 53 - return ret; 48 + goto success; 54 49 } 50 + 51 + dev_err(&ld->dev, "failed to set contrast\n"); 52 + ret = -ETIMEDOUT; 53 + 54 + success: 55 + jornada_ssp_end(); 56 + return ret; 55 57 } 56 58 57 59 static int jornada_lcd_set_contrast(struct lcd_device *ld, int value) 58 60 { 59 - int ret; 61 + int ret = 0; 60 62 61 63 jornada_ssp_start(); 62 64 63 65 /* start by sending our set contrast cmd to mcu */ 64 - ret = jornada_ssp_byte(SETCONTRAST); 65 - 66 - /* push the new value */ 67 - if (jornada_ssp_byte(value) != TXDUMMY) { 68 - dev_err(&ld->dev, "set contrast failed\n"); 69 - jornada_ssp_end(); 70 - return -ETIMEDOUT; 66 + if (jornada_ssp_byte(SETCONTRAST) == TXDUMMY) { 67 + /* if successful push the new value */ 68 + if (jornada_ssp_byte(value) == TXDUMMY) 69 + goto success; 71 70 } 72 71 73 - /* if we get here we can assume everything went well */ 74 - jornada_ssp_end(); 72 + dev_err(&ld->dev, "failed to set contrast\n"); 73 + ret = -ETIMEDOUT; 75 74 76 - return 0; 75 + success: 76 + jornada_ssp_end(); 77 + return ret; 77 78 } 78 79 79 80 static int jornada_lcd_set_power(struct lcd_device *ld, int power)
-6
drivers/video/backlight/ld9040.c
··· 642 642 return lcd->power; 643 643 } 644 644 645 - static int ld9040_get_brightness(struct backlight_device *bd) 646 - { 647 - return bd->props.brightness; 648 - } 649 - 650 645 static int ld9040_set_brightness(struct backlight_device *bd) 651 646 { 652 647 int ret = 0, brightness = bd->props.brightness; ··· 669 674 }; 670 675 671 676 static const struct backlight_ops ld9040_backlight_ops = { 672 - .get_brightness = ld9040_get_brightness, 673 677 .update_status = ld9040_set_brightness, 674 678 }; 675 679
-6
drivers/video/backlight/lp855x_bl.c
··· 274 274 return 0; 275 275 } 276 276 277 - static int lp855x_bl_get_brightness(struct backlight_device *bl) 278 - { 279 - return bl->props.brightness; 280 - } 281 - 282 277 static const struct backlight_ops lp855x_bl_ops = { 283 278 .options = BL_CORE_SUSPENDRESUME, 284 279 .update_status = lp855x_bl_update_status, 285 - .get_brightness = lp855x_bl_get_brightness, 286 280 }; 287 281 288 282 static int lp855x_backlight_register(struct lp855x *lp)
-6
drivers/video/backlight/lp8788_bl.c
··· 176 176 return 0; 177 177 } 178 178 179 - static int lp8788_bl_get_brightness(struct backlight_device *bl_dev) 180 - { 181 - return bl_dev->props.brightness; 182 - } 183 - 184 179 static const struct backlight_ops lp8788_bl_ops = { 185 180 .options = BL_CORE_SUSPENDRESUME, 186 181 .update_status = lp8788_bl_update_status, 187 - .get_brightness = lp8788_bl_get_brightness, 188 182 }; 189 183 190 184 static int lp8788_backlight_register(struct lp8788_bl *bl)
-6
drivers/video/backlight/lv5207lp.c
··· 70 70 return 0; 71 71 } 72 72 73 - static int lv5207lp_backlight_get_brightness(struct backlight_device *backlight) 74 - { 75 - return backlight->props.brightness; 76 - } 77 - 78 73 static int lv5207lp_backlight_check_fb(struct backlight_device *backlight, 79 74 struct fb_info *info) 80 75 { ··· 81 86 static const struct backlight_ops lv5207lp_backlight_ops = { 82 87 .options = BL_CORE_SUSPENDRESUME, 83 88 .update_status = lv5207lp_backlight_update_status, 84 - .get_brightness = lv5207lp_backlight_get_brightness, 85 89 .check_fb = lv5207lp_backlight_check_fb, 86 90 }; 87 91
-6
drivers/video/backlight/pandora_bl.c
··· 100 100 return 0; 101 101 } 102 102 103 - static int pandora_backlight_get_brightness(struct backlight_device *bl) 104 - { 105 - return bl->props.brightness; 106 - } 107 - 108 103 static const struct backlight_ops pandora_backlight_ops = { 109 104 .options = BL_CORE_SUSPENDRESUME, 110 105 .update_status = pandora_backlight_update_status, 111 - .get_brightness = pandora_backlight_get_brightness, 112 106 }; 113 107 114 108 static int pandora_backlight_probe(struct platform_device *pdev)
+2 -11
drivers/video/backlight/pwm_bl.c
··· 115 115 return 0; 116 116 } 117 117 118 - static int pwm_backlight_get_brightness(struct backlight_device *bl) 119 - { 120 - return bl->props.brightness; 121 - } 122 - 123 118 static int pwm_backlight_check_fb(struct backlight_device *bl, 124 119 struct fb_info *info) 125 120 { ··· 125 130 126 131 static const struct backlight_ops pwm_backlight_ops = { 127 132 .update_status = pwm_backlight_update_status, 128 - .get_brightness = pwm_backlight_get_brightness, 129 133 .check_fb = pwm_backlight_check_fb, 130 134 }; 131 135 ··· 239 245 pb->dev = &pdev->dev; 240 246 pb->enabled = false; 241 247 242 - pb->enable_gpio = devm_gpiod_get(&pdev->dev, "enable"); 248 + pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable"); 243 249 if (IS_ERR(pb->enable_gpio)) { 244 250 ret = PTR_ERR(pb->enable_gpio); 245 - if (ret == -ENOENT) 246 - pb->enable_gpio = NULL; 247 - else 248 - goto err_alloc; 251 + goto err_alloc; 249 252 } 250 253 251 254 /*
-6
drivers/video/backlight/s6e63m0.c
··· 597 597 return lcd->power; 598 598 } 599 599 600 - static int s6e63m0_get_brightness(struct backlight_device *bd) 601 - { 602 - return bd->props.brightness; 603 - } 604 - 605 600 static int s6e63m0_set_brightness(struct backlight_device *bd) 606 601 { 607 602 int ret = 0, brightness = bd->props.brightness; ··· 624 629 }; 625 630 626 631 static const struct backlight_ops s6e63m0_backlight_ops = { 627 - .get_brightness = s6e63m0_get_brightness, 628 632 .update_status = s6e63m0_set_brightness, 629 633 }; 630 634
-6
drivers/video/backlight/tps65217_bl.c
··· 109 109 return rc; 110 110 } 111 111 112 - static int tps65217_bl_get_brightness(struct backlight_device *bl) 113 - { 114 - return bl->props.brightness; 115 - } 116 - 117 112 static const struct backlight_ops tps65217_bl_ops = { 118 113 .options = BL_CORE_SUSPENDRESUME, 119 114 .update_status = tps65217_bl_update_status, 120 - .get_brightness = tps65217_bl_get_brightness 121 115 }; 122 116 123 117 static int tps65217_bl_hw_init(struct tps65217_bl *tps65217_bl,
-6
drivers/video/fbdev/aty/aty128fb.c
··· 1802 1802 return 0; 1803 1803 } 1804 1804 1805 - static int aty128_bl_get_brightness(struct backlight_device *bd) 1806 - { 1807 - return bd->props.brightness; 1808 - } 1809 - 1810 1805 static const struct backlight_ops aty128_bl_data = { 1811 - .get_brightness = aty128_bl_get_brightness, 1812 1806 .update_status = aty128_bl_update_status, 1813 1807 }; 1814 1808
-6
drivers/video/fbdev/aty/atyfb_base.c
··· 2211 2211 return 0; 2212 2212 } 2213 2213 2214 - static int aty_bl_get_brightness(struct backlight_device *bd) 2215 - { 2216 - return bd->props.brightness; 2217 - } 2218 - 2219 2214 static const struct backlight_ops aty_bl_data = { 2220 - .get_brightness = aty_bl_get_brightness, 2221 2215 .update_status = aty_bl_update_status, 2222 2216 }; 2223 2217
-6
drivers/video/fbdev/aty/radeon_backlight.c
··· 123 123 return 0; 124 124 } 125 125 126 - static int radeon_bl_get_brightness(struct backlight_device *bd) 127 - { 128 - return bd->props.brightness; 129 - } 130 - 131 126 static const struct backlight_ops radeon_bl_data = { 132 - .get_brightness = radeon_bl_get_brightness, 133 127 .update_status = radeon_bl_update_status, 134 128 }; 135 129
-6
drivers/video/fbdev/exynos/s6e8ax0.c
··· 704 704 return lcd->power; 705 705 } 706 706 707 - static int s6e8ax0_get_brightness(struct backlight_device *bd) 708 - { 709 - return bd->props.brightness; 710 - } 711 - 712 707 static int s6e8ax0_set_brightness(struct backlight_device *bd) 713 708 { 714 709 int ret = 0, brightness = bd->props.brightness; ··· 731 736 }; 732 737 733 738 static const struct backlight_ops s6e8ax0_backlight_ops = { 734 - .get_brightness = s6e8ax0_get_brightness, 735 739 .update_status = s6e8ax0_set_brightness, 736 740 }; 737 741
-6
drivers/video/fbdev/nvidia/nv_backlight.c
··· 82 82 return 0; 83 83 } 84 84 85 - static int nvidia_bl_get_brightness(struct backlight_device *bd) 86 - { 87 - return bd->props.brightness; 88 - } 89 - 90 85 static const struct backlight_ops nvidia_bl_ops = { 91 - .get_brightness = nvidia_bl_get_brightness, 92 86 .update_status = nvidia_bl_update_status, 93 87 }; 94 88
-6
drivers/video/fbdev/riva/fbdev.c
··· 326 326 return 0; 327 327 } 328 328 329 - static int riva_bl_get_brightness(struct backlight_device *bd) 330 - { 331 - return bd->props.brightness; 332 - } 333 - 334 329 static const struct backlight_ops riva_bl_ops = { 335 - .get_brightness = riva_bl_get_brightness, 336 330 .update_status = riva_bl_update_status, 337 331 }; 338 332