Skip to content

Commit

Permalink
Merge branch 'for-leds-next' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/git/lee/leds.git
  • Loading branch information
sfrothwell committed Mar 7, 2025
2 parents 69b25d8 + 7a33504 commit 516810d
Show file tree
Hide file tree
Showing 9 changed files with 383 additions and 170 deletions.
4 changes: 4 additions & 0 deletions Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ properties:
- enum:
- qcom,pm8550-pwm
- const: qcom,pm8350c-pwm
- items:
- enum:
- qcom,pm8937-pwm
- const: qcom,pm8916-pwm

"#pwm-cells":
const: 2
Expand Down
40 changes: 0 additions & 40 deletions Documentation/devicetree/bindings/leds/leds-tlc591xx.txt

This file was deleted.

90 changes: 90 additions & 0 deletions Documentation/devicetree/bindings/leds/ti,tlc59116.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/leds/ti,tlc59116.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: LEDs connected to tlc59116 or tlc59108

maintainers:
- Andrew Lunn <[email protected]>

properties:
compatible:
enum:
- ti,tlc59108
- ti,tlc59116

reg:
maxItems: 1

"#address-cells":
const: 1

"#size-cells":
const: 0

patternProperties:
"^led@[0-9a-f]$":
type: object
$ref: common.yaml#
properties:
reg:
items:
minimum: 0
maximum: 15

unevaluatedProperties: false

required:
- compatible
- reg
- "#address-cells"
- "#size-cells"

allOf:
- if:
properties:
compatible:
contains:
const: ti,tlc59108
then:
patternProperties:
"^led@[0-9a-f]$":
properties:
reg:
items:
maximum: 7

additionalProperties: false

examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
led-controller@68 {
compatible = "ti,tlc59116";
reg = <0x68>;
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0x0>;
label = "wrt1900ac:amber:wan";
};
led@2 {
reg = <0x2>;
label = "wrt1900ac:white:2g";
};
led@9 {
reg = <0x9>;
label = "wrt1900ac:green:alive";
linux,default-trigger = "heartbeat";
};
};
};
22 changes: 18 additions & 4 deletions drivers/leds/led-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,19 @@ static void set_brightness_delayed(struct work_struct *ws)
* before this work item runs once. To make sure this works properly
* handle LED_SET_BRIGHTNESS_OFF first.
*/
if (test_and_clear_bit(LED_SET_BRIGHTNESS_OFF, &led_cdev->work_flags))
if (test_and_clear_bit(LED_SET_BRIGHTNESS_OFF, &led_cdev->work_flags)) {
set_brightness_delayed_set_brightness(led_cdev, LED_OFF);
/*
* The consecutives led_set_brightness(LED_OFF),
* led_set_brightness(LED_FULL) could have been executed out of
* order (LED_FULL first), if the work_flags has been set
* between LED_SET_BRIGHTNESS_OFF and LED_SET_BRIGHTNESS of this
* work. To avoid ending with the LED turned off, turn the LED
* on again.
*/
if (led_cdev->delayed_set_value != LED_OFF)
set_bit(LED_SET_BRIGHTNESS, &led_cdev->work_flags);
}

if (test_and_clear_bit(LED_SET_BRIGHTNESS, &led_cdev->work_flags))
set_brightness_delayed_set_brightness(led_cdev, led_cdev->delayed_set_value);
Expand Down Expand Up @@ -331,10 +342,13 @@ void led_set_brightness_nopm(struct led_classdev *led_cdev, unsigned int value)
* change is done immediately afterwards (before the work runs),
* it uses a separate work_flag.
*/
if (value) {
led_cdev->delayed_set_value = value;
led_cdev->delayed_set_value = value;
/* Ensure delayed_set_value is seen before work_flags modification */
smp_mb__before_atomic();

if (value)
set_bit(LED_SET_BRIGHTNESS, &led_cdev->work_flags);
} else {
else {
clear_bit(LED_SET_BRIGHTNESS, &led_cdev->work_flags);
clear_bit(LED_SET_BLINK, &led_cdev->work_flags);
set_bit(LED_SET_BRIGHTNESS_OFF, &led_cdev->work_flags);
Expand Down
2 changes: 0 additions & 2 deletions drivers/leds/leds-lp8860.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ static const struct regmap_config lp8860_regmap_config = {
.max_register = LP8860_EEPROM_UNLOCK,
.reg_defaults = lp8860_reg_defs,
.num_reg_defaults = ARRAY_SIZE(lp8860_reg_defs),
.cache_type = REGCACHE_NONE,
};

static const struct reg_default lp8860_eeprom_defs[] = {
Expand Down Expand Up @@ -369,7 +368,6 @@ static const struct regmap_config lp8860_eeprom_regmap_config = {
.max_register = LP8860_EEPROM_REG_24,
.reg_defaults = lp8860_eeprom_defs,
.num_reg_defaults = ARRAY_SIZE(lp8860_eeprom_defs),
.cache_type = REGCACHE_NONE,
};

static int lp8860_probe(struct i2c_client *client)
Expand Down
Loading

0 comments on commit 516810d

Please sign in to comment.