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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'backlight-next-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight

Pull backlight updates from Lee Jones:
"New Functionality:
- Add lots of Device Tree bindings / support
- Turn off LED strings when display is blank
- Switch I2C drivers from .probe_new() to .probe()
- Remove superfluous NULL checks
- Only obtain PWM information once and do it in .probe()

Fix-ups:
- Ensure locks are obtained and held when required"

* tag 'backlight-next-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight:
backlight: led_bl: Take led_access lock when required
video: backlight: lp855x: Get PWM for PWM mode during probe
dt-bindings: backlight: lp855x: Convert to YAML and modernize
dt-bindings: backlight: pwm: Make power-supply not required
backlight: pwm_bl: Remove unneeded checks for valid GPIOs
backlight: Switch i2c drivers back to use .probe()
backlight: lm3630a: Turn off both led strings when display is blank
dt-bindings: leds: backlight: ktz8866: Add reg property and update example

+217 -124
+18 -9
Documentation/devicetree/bindings/leds/backlight/kinetic,ktz8866.yaml
··· 21 21 compatible: 22 22 const: kinetic,ktz8866 23 23 24 + reg: 25 + maxItems: 1 26 + 24 27 vddpos-supply: 25 28 description: positive boost supply regulator. 26 29 ··· 57 54 58 55 required: 59 56 - compatible 57 + - reg 60 58 - vddpos-supply 61 59 - vddneg-supply 62 60 - enable-gpios ··· 68 64 - | 69 65 #include <dt-bindings/gpio/gpio.h> 70 66 71 - backlight { 72 - compatible = "kinetic,ktz8866"; 67 + i2c { 68 + #address-cells = <1>; 69 + #size-cells = <0>; 73 70 74 - vddpos-supply = <&bl_vddpos_5p5>; 75 - vddneg-supply = <&bl_vddneg_5p5>; 76 - enable-gpios = <&tlmm 139 GPIO_ACTIVE_HIGH>; 77 - current-num-sinks = <5>; 78 - kinetic,current-ramp-delay-ms = <128>; 79 - kinetic,led-enable-ramp-delay-ms = <1>; 80 - kinetic,enable-lcd-bias; 71 + backlight@11 { 72 + compatible = "kinetic,ktz8866"; 73 + reg = <0x11>; 74 + vddpos-supply = <&bl_vddpos_5p5>; 75 + vddneg-supply = <&bl_vddneg_5p5>; 76 + enable-gpios = <&tlmm 139 GPIO_ACTIVE_HIGH>; 77 + current-num-sinks = <5>; 78 + kinetic,current-ramp-delay-ms = <128>; 79 + kinetic,led-enable-ramp-delay-ms = <1>; 80 + kinetic,enable-lcd-bias; 81 + }; 81 82 };
+149
Documentation/devicetree/bindings/leds/backlight/lp855x-backlight.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/leds/backlight/lp855x-backlight.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Texas Instruments LP855X backlight controllers 8 + 9 + maintainers: 10 + - Artur Weber <aweber.kernel@gmail.com> 11 + 12 + properties: 13 + compatible: 14 + enum: 15 + - ti,lp8550 16 + - ti,lp8551 17 + - ti,lp8552 18 + - ti,lp8553 19 + - ti,lp8555 20 + - ti,lp8556 21 + - ti,lp8557 22 + 23 + reg: 24 + maxItems: 1 25 + 26 + dev-ctrl: 27 + $ref: /schemas/types.yaml#/definitions/uint8 28 + description: 29 + Value of device control register. This is a device-specific value. 30 + 31 + bl-name: 32 + $ref: /schemas/types.yaml#/definitions/string 33 + description: Backlight device name. 34 + 35 + init-brt: 36 + $ref: /schemas/types.yaml#/definitions/uint8 37 + description: Initial value of backlight brightness. 38 + 39 + power-supply: 40 + description: Regulator which controls the 3V rail. 41 + 42 + enable-supply: 43 + description: Regulator which controls the EN/VDDIO input. 44 + 45 + pwms: 46 + maxItems: 1 47 + description: | 48 + PWM channel to use for controlling the backlight; setting this 49 + enables the PWM-based backlight control mode. 50 + 51 + pwm-names: true 52 + 53 + pwm-period: 54 + $ref: /schemas/types.yaml#/definitions/uint32 55 + description: 56 + PWM period value. Deprecated; set the period value in the pwms 57 + property instead. 58 + deprecated: true 59 + 60 + patternProperties: 61 + "^rom-[0-9a-f]{2}h$": 62 + type: object 63 + description: Nodes containing the values of configuration registers. 64 + additionalProperties: false 65 + properties: 66 + rom-addr: 67 + $ref: /schemas/types.yaml#/definitions/uint8 68 + description: Register address of ROM area to be updated. 69 + 70 + rom-val: 71 + $ref: /schemas/types.yaml#/definitions/uint8 72 + description: Value to write to the ROM register. 73 + 74 + required: 75 + - compatible 76 + - reg 77 + - dev-ctrl 78 + 79 + unevaluatedProperties: false 80 + 81 + examples: 82 + - | 83 + i2c { 84 + #address-cells = <1>; 85 + #size-cells = <0>; 86 + 87 + backlight@2c { 88 + compatible = "ti,lp8555"; 89 + reg = <0x2c>; 90 + 91 + dev-ctrl = /bits/ 8 <0x00>; 92 + 93 + pwms = <&pwm 0 10000>; 94 + pwm-names = "lp8555"; 95 + 96 + /* 4V OV, 4 output LED0 string enabled */ 97 + rom-14h { 98 + rom-addr = /bits/ 8 <0x14>; 99 + rom-val = /bits/ 8 <0xcf>; 100 + }; 101 + 102 + /* Heavy smoothing, 24ms ramp time step */ 103 + rom-15h { 104 + rom-addr = /bits/ 8 <0x15>; 105 + rom-val = /bits/ 8 <0xc7>; 106 + }; 107 + 108 + /* 4 output LED1 string enabled */ 109 + rom-19h { 110 + rom-addr = /bits/ 8 <0x19>; 111 + rom-val = /bits/ 8 <0x0f>; 112 + }; 113 + }; 114 + }; 115 + - | 116 + i2c { 117 + #address-cells = <1>; 118 + #size-cells = <0>; 119 + 120 + backlight@2c { 121 + compatible = "ti,lp8556"; 122 + reg = <0x2c>; 123 + 124 + bl-name = "lcd-bl"; 125 + dev-ctrl = /bits/ 8 <0x85>; 126 + init-brt = /bits/ 8 <0x10>; 127 + }; 128 + }; 129 + - | 130 + i2c { 131 + #address-cells = <1>; 132 + #size-cells = <0>; 133 + 134 + backlight@2c { 135 + compatible = "ti,lp8557"; 136 + reg = <0x2c>; 137 + enable-supply = <&backlight_vddio>; 138 + power-supply = <&backlight_vdd>; 139 + 140 + dev-ctrl = /bits/ 8 <0x41>; 141 + init-brt = /bits/ 8 <0x0a>; 142 + 143 + /* 4V OV, 4 output LED string enabled */ 144 + rom-14h { 145 + rom-addr = /bits/ 8 <0x14>; 146 + rom-val = /bits/ 8 <0xcf>; 147 + }; 148 + }; 149 + };
-72
Documentation/devicetree/bindings/leds/backlight/lp855x.txt
··· 1 - lp855x bindings 2 - 3 - Required properties: 4 - - compatible: "ti,lp8550", "ti,lp8551", "ti,lp8552", "ti,lp8553", 5 - "ti,lp8555", "ti,lp8556", "ti,lp8557" 6 - - reg: I2C slave address (u8) 7 - - dev-ctrl: Value of DEVICE CONTROL register (u8). It depends on the device. 8 - 9 - Optional properties: 10 - - bl-name: Backlight device name (string) 11 - - init-brt: Initial value of backlight brightness (u8) 12 - - pwm-period: PWM period value. Set only PWM input mode used (u32) 13 - - rom-addr: Register address of ROM area to be updated (u8) 14 - - rom-val: Register value to be updated (u8) 15 - - power-supply: Regulator which controls the 3V rail 16 - - enable-supply: Regulator which controls the EN/VDDIO input 17 - 18 - Example: 19 - 20 - /* LP8555 */ 21 - backlight@2c { 22 - compatible = "ti,lp8555"; 23 - reg = <0x2c>; 24 - 25 - dev-ctrl = /bits/ 8 <0x00>; 26 - pwm-period = <10000>; 27 - 28 - /* 4V OV, 4 output LED0 string enabled */ 29 - rom_14h { 30 - rom-addr = /bits/ 8 <0x14>; 31 - rom-val = /bits/ 8 <0xcf>; 32 - }; 33 - 34 - /* Heavy smoothing, 24ms ramp time step */ 35 - rom_15h { 36 - rom-addr = /bits/ 8 <0x15>; 37 - rom-val = /bits/ 8 <0xc7>; 38 - }; 39 - 40 - /* 4 output LED1 string enabled */ 41 - rom_19h { 42 - rom-addr = /bits/ 8 <0x19>; 43 - rom-val = /bits/ 8 <0x0f>; 44 - }; 45 - }; 46 - 47 - /* LP8556 */ 48 - backlight@2c { 49 - compatible = "ti,lp8556"; 50 - reg = <0x2c>; 51 - 52 - bl-name = "lcd-bl"; 53 - dev-ctrl = /bits/ 8 <0x85>; 54 - init-brt = /bits/ 8 <0x10>; 55 - }; 56 - 57 - /* LP8557 */ 58 - backlight@2c { 59 - compatible = "ti,lp8557"; 60 - reg = <0x2c>; 61 - enable-supply = <&backlight_vddio>; 62 - power-supply = <&backlight_vdd>; 63 - 64 - dev-ctrl = /bits/ 8 <0x41>; 65 - init-brt = /bits/ 8 <0x0a>; 66 - 67 - /* 4V OV, 4 output LED string enabled */ 68 - rom_14h { 69 - rom-addr = /bits/ 8 <0x14>; 70 - rom-val = /bits/ 8 <0xcf>; 71 - }; 72 - };
-1
Documentation/devicetree/bindings/leds/backlight/pwm-backlight.yaml
··· 68 68 required: 69 69 - compatible 70 70 - pwms 71 - - power-supply 72 71 73 72 additionalProperties: false 74 73
+2 -2
drivers/video/backlight/adp8860_bl.c
··· 803 803 .name = KBUILD_MODNAME, 804 804 .pm = &adp8860_i2c_pm_ops, 805 805 }, 806 - .probe_new = adp8860_probe, 807 - .remove = adp8860_remove, 806 + .probe = adp8860_probe, 807 + .remove = adp8860_remove, 808 808 .id_table = adp8860_id, 809 809 }; 810 810
+2 -2
drivers/video/backlight/adp8870_bl.c
··· 973 973 .name = KBUILD_MODNAME, 974 974 .pm = &adp8870_i2c_pm_ops, 975 975 }, 976 - .probe_new = adp8870_probe, 977 - .remove = adp8870_remove, 976 + .probe = adp8870_probe, 977 + .remove = adp8870_remove, 978 978 .id_table = adp8870_id, 979 979 }; 980 980
+1 -1
drivers/video/backlight/arcxcnn_bl.c
··· 392 392 .name = "arcxcnn_bl", 393 393 .of_match_table = arcxcnn_dt_ids, 394 394 }, 395 - .probe_new = arcxcnn_probe, 395 + .probe = arcxcnn_probe, 396 396 .remove = arcxcnn_remove, 397 397 .id_table = arcxcnn_ids, 398 398 };
+1 -1
drivers/video/backlight/bd6107.c
··· 192 192 .driver = { 193 193 .name = "bd6107", 194 194 }, 195 - .probe_new = bd6107_probe, 195 + .probe = bd6107_probe, 196 196 .remove = bd6107_remove, 197 197 .id_table = bd6107_ids, 198 198 };
+1 -1
drivers/video/backlight/ktz8866.c
··· 196 196 .name = "ktz8866", 197 197 .of_match_table = ktz8866_match_table, 198 198 }, 199 - .probe_new = ktz8866_probe, 199 + .probe = ktz8866_probe, 200 200 .remove = ktz8866_remove, 201 201 .id_table = ktz8866_ids, 202 202 };
+4 -1
drivers/video/backlight/led_bl.c
··· 209 209 return PTR_ERR(priv->bl_dev); 210 210 } 211 211 212 - for (i = 0; i < priv->nb_leds; i++) 212 + for (i = 0; i < priv->nb_leds; i++) { 213 + mutex_lock(&priv->leds[i]->led_access); 213 214 led_sysfs_disable(priv->leds[i]); 215 + mutex_unlock(&priv->leds[i]->led_access); 216 + } 214 217 215 218 backlight_update_status(priv->bl_dev); 216 219
+7 -3
drivers/video/backlight/lm3630a_bl.c
··· 202 202 usleep_range(1000, 2000); 203 203 /* minimum brightness is 0x04 */ 204 204 ret = lm3630a_write(pchip, REG_BRT_A, bl->props.brightness); 205 - if (bl->props.brightness < 0x4) 205 + 206 + if (backlight_is_blank(bl) || (backlight_get_brightness(bl) < 0x4)) 207 + /* turn the string off */ 206 208 ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDA_ENABLE, 0); 207 209 else 208 210 ret |= lm3630a_update(pchip, REG_CTRL, ··· 279 277 usleep_range(1000, 2000); 280 278 /* minimum brightness is 0x04 */ 281 279 ret = lm3630a_write(pchip, REG_BRT_B, bl->props.brightness); 282 - if (bl->props.brightness < 0x4) 280 + 281 + if (backlight_is_blank(bl) || (backlight_get_brightness(bl) < 0x4)) 282 + /* turn the string off */ 283 283 ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDB_ENABLE, 0); 284 284 else 285 285 ret |= lm3630a_update(pchip, REG_CTRL, ··· 620 616 .name = LM3630A_NAME, 621 617 .of_match_table = lm3630a_match_table, 622 618 }, 623 - .probe_new = lm3630a_probe, 619 + .probe = lm3630a_probe, 624 620 .remove = lm3630a_remove, 625 621 .id_table = lm3630a_id, 626 622 };
+1 -1
drivers/video/backlight/lm3639_bl.c
··· 411 411 .driver = { 412 412 .name = LM3639_NAME, 413 413 }, 414 - .probe_new = lm3639_probe, 414 + .probe = lm3639_probe, 415 415 .remove = lm3639_remove, 416 416 .id_table = lm3639_id, 417 417 };
+27 -23
drivers/video/backlight/lp855x_bl.c
··· 218 218 219 219 static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br) 220 220 { 221 - struct pwm_device *pwm; 222 221 struct pwm_state state; 223 222 224 - /* request pwm device with the consumer name */ 225 - if (!lp->pwm) { 226 - pwm = devm_pwm_get(lp->dev, lp->chipname); 227 - if (IS_ERR(pwm)) 228 - return; 223 + pwm_get_state(lp->pwm, &state); 229 224 230 - lp->pwm = pwm; 231 - 232 - pwm_init_state(lp->pwm, &state); 233 - } else { 234 - pwm_get_state(lp->pwm, &state); 235 - } 236 - 237 - state.period = lp->pdata->period_ns; 238 225 state.duty_cycle = div_u64(br * state.period, max_br); 239 226 state.enabled = state.duty_cycle; 240 227 ··· 326 339 of_property_read_string(node, "bl-name", &pdata->name); 327 340 of_property_read_u8(node, "dev-ctrl", &pdata->device_control); 328 341 of_property_read_u8(node, "init-brt", &pdata->initial_brightness); 342 + /* Deprecated, specify period in pwms property instead */ 329 343 of_property_read_u32(node, "pwm-period", &pdata->period_ns); 330 344 331 345 /* Fill ROM platform data if defined */ ··· 387 399 const struct i2c_device_id *id = i2c_client_get_device_id(cl); 388 400 const struct acpi_device_id *acpi_id = NULL; 389 401 struct device *dev = &cl->dev; 402 + struct pwm_state pwmstate; 390 403 struct lp855x *lp; 391 404 int ret; 392 405 ··· 446 457 } 447 458 } 448 459 449 - if (lp->pdata->period_ns > 0) 450 - lp->mode = PWM_BASED; 451 - else 452 - lp->mode = REGISTER_BASED; 453 - 454 460 lp->supply = devm_regulator_get(dev, "power"); 455 461 if (IS_ERR(lp->supply)) { 456 462 if (PTR_ERR(lp->supply) == -EPROBE_DEFER) ··· 456 472 lp->enable = devm_regulator_get_optional(dev, "enable"); 457 473 if (IS_ERR(lp->enable)) { 458 474 ret = PTR_ERR(lp->enable); 459 - if (ret == -ENODEV) { 475 + if (ret == -ENODEV) 460 476 lp->enable = NULL; 461 - } else { 477 + else 462 478 return dev_err_probe(dev, ret, "getting enable regulator\n"); 463 - } 479 + } 480 + 481 + lp->pwm = devm_pwm_get(lp->dev, lp->chipname); 482 + if (IS_ERR(lp->pwm)) { 483 + ret = PTR_ERR(lp->pwm); 484 + if (ret == -ENODEV || ret == -EINVAL) 485 + lp->pwm = NULL; 486 + else 487 + return dev_err_probe(dev, ret, "getting PWM\n"); 488 + 489 + lp->mode = REGISTER_BASED; 490 + dev_dbg(dev, "mode: register based\n"); 491 + } else { 492 + pwm_init_state(lp->pwm, &pwmstate); 493 + /* Legacy platform data compatibility */ 494 + if (lp->pdata->period_ns > 0) 495 + pwmstate.period = lp->pdata->period_ns; 496 + pwm_apply_state(lp->pwm, &pwmstate); 497 + 498 + lp->mode = PWM_BASED; 499 + dev_dbg(dev, "mode: PWM based\n"); 464 500 } 465 501 466 502 if (lp->supply) { ··· 591 587 .of_match_table = of_match_ptr(lp855x_dt_ids), 592 588 .acpi_match_table = ACPI_PTR(lp855x_acpi_match), 593 589 }, 594 - .probe_new = lp855x_probe, 590 + .probe = lp855x_probe, 595 591 .remove = lp855x_remove, 596 592 .id_table = lp855x_ids, 597 593 };
+1 -1
drivers/video/backlight/lv5207lp.c
··· 141 141 .driver = { 142 142 .name = "lv5207lp", 143 143 }, 144 - .probe_new = lv5207lp_probe, 144 + .probe = lv5207lp_probe, 145 145 .remove = lv5207lp_remove, 146 146 .id_table = lv5207lp_ids, 147 147 };
+3 -6
drivers/video/backlight/pwm_bl.c
··· 54 54 if (pb->post_pwm_on_delay) 55 55 msleep(pb->post_pwm_on_delay); 56 56 57 - if (pb->enable_gpio) 58 - gpiod_set_value_cansleep(pb->enable_gpio, 1); 57 + gpiod_set_value_cansleep(pb->enable_gpio, 1); 59 58 60 59 pb->enabled = true; 61 60 } ··· 64 65 if (!pb->enabled) 65 66 return; 66 67 67 - if (pb->enable_gpio) 68 - gpiod_set_value_cansleep(pb->enable_gpio, 0); 68 + gpiod_set_value_cansleep(pb->enable_gpio, 0); 69 69 70 70 if (pb->pwm_off_delay) 71 71 msleep(pb->pwm_off_delay); ··· 427 429 * Synchronize the enable_gpio with the observed state of the 428 430 * hardware. 429 431 */ 430 - if (pb->enable_gpio) 431 - gpiod_direction_output(pb->enable_gpio, active); 432 + gpiod_direction_output(pb->enable_gpio, active); 432 433 433 434 /* 434 435 * Do not change pb->enabled here! pb->enabled essentially