Skip to content

Commit 2be6bc4

Browse files
committed
Merge tag 'leds-next-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
Pull LED updates from Lee Jones: "Core Frameworks: - Add new framework to support Group Multi-Color (GMC) LEDs - Offer an 'optional' API for non-essential LEDs - Support obtaining 'max brightness' values from Device Tree - Provide new led_classdev member 'color' (settable via DT and SYFS) - Stop TTY Trigger from using the old LED_ON constraints - Statically allocate leds_class New Drivers: - Add support for NXP PCA995x I2C Constant Current LED Driver New Device Support: - Add support for Siemens Simatic IPC BX-21 to Simatic IPC Fix-ups: - Some dependency / Kconfig tweaking - Move final probe() functions back over from .probe_new() - Simplify obtaining resources (memory, device data) using unified API helpers - Bunch of Device Tree additions, conversions and adaptions - Fix trivial styling issues; comments - Ensure correct includes are present and remove some that are not required - Omit the use of redundant casts and if relevant replace with better ones - Use purpose-built APIs for various actions; sysfs_emit(), module_led_trigger() - Remove a bunch of superfluous locking Bug Fixes: - Ensure error codes are correctly propagated back up the call chain - Fix incorrect error values from being returned (missing '-') - Ensure get'ed resources are put'ed to prevent leaks - Use correct class when exporting module resources - Fixing rounding (or lack there of) issues - Fix 'always false' LED_COLOR_ID_MULTI BUG() check" * tag 'leds-next-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (40 commits) leds: aw2013: Enable pull-up supply for interrupt and I2C dt-bindings: leds: Document pull-up supply for interrupt and I2C dt-bindings: leds: aw2013: Document interrupt leds: uleds: Use module_misc_device macro to simplify the code leds: trigger: netdev: Use module_led_trigger macro to simplify the code dt-bindings: leds: Fix reference to definition of default-state leds: turris-omnia: Drop unnecessary mutex locking leds: turris-omnia: Use sysfs_emit() instead of sprintf() leds: Make leds_class a static const structure leds: Remove redundant of_match_ptr() dt-bindings: leds: Add gpio-line-names to PCA9532 GPIO leds: trigger: tty: Do not use LED_ON/OFF constants, use led_blink_set_oneshot instead dt-bindings: leds: rohm,bd71828: Drop select:false leds: Fix BUG_ON check for LED_COLOR_ID_MULTI that is always false leds: multicolor: Use rounded division when calculating color components leds: rgb: Add a multicolor LED driver to group monochromatic LEDs dt-bindings: leds: Add binding for a multicolor group of LEDs leds: class: Store the color index in struct led_classdev leds: Provide devm_of_led_get_optional() leds: pca995x: Fix MODULE_DEVICE_TABLE for OF ...
2 parents d872306 + baca986 commit 2be6bc4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+880
-176
lines changed

Documentation/ABI/testing/sysfs-class-led

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ Description:
5959
brightness. Reading this file when no hw brightness change
6060
event has happened will return an ENODATA error.
6161

62+
What: /sys/class/leds/<led>/color
63+
Date: June 2023
64+
KernelVersion: 6.5
65+
Description:
66+
Color of the LED.
67+
68+
This is a read-only file. Reading this file returns the color
69+
of the LED as a string (e.g: "red", "green", "multicolor").
70+
6271
What: /sys/class/leds/<led>/trigger
6372
Date: March 2006
6473
KernelVersion: 2.6.17

Documentation/devicetree/bindings/leds/common.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ properties:
8383
- enum:
8484
# LED will act as a back-light, controlled by the framebuffer system
8585
- backlight
86-
# LED will turn on (but for leds-gpio see "default-state" property in
87-
# Documentation/devicetree/bindings/leds/leds-gpio.yaml)
86+
# LED will turn on (see also "default-state" property)
8887
- default-on
8988
# LED "double" flashes at a load average based rate
9089
- heartbeat
@@ -158,6 +157,18 @@ properties:
158157
For flash LED controllers with configurable current this property is
159158
mandatory for the LEDs in the non-flash modes (e.g. torch or indicator).
160159

160+
max-brightness:
161+
description:
162+
Normally, the maximum brightness is determined by the hardware, and this
163+
property is not required. This property is used to set a software limit.
164+
It could happen that an LED is made so bright that it gets damaged or
165+
causes damage due to restrictions in a specific system, such as mounting
166+
conditions.
167+
Note that this flag is mainly used for PWM-LEDs, where it is not possible
168+
to map brightness to current. Drivers for other controllers should use
169+
led-max-microamp.
170+
$ref: /schemas/types.yaml#definitions/uint32
171+
161172
panic-indicator:
162173
description:
163174
This property specifies that the LED should be used, if at all possible,

Documentation/devicetree/bindings/leds/leds-an30259a.txt

Lines changed: 0 additions & 55 deletions
This file was deleted.

Documentation/devicetree/bindings/leds/leds-aw2013.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,20 @@ properties:
2020
reg:
2121
maxItems: 1
2222

23+
interrupts:
24+
maxItems: 1
25+
description: Open-drain, low active interrupt pin "INTN".
26+
Used to report completion of operations (power up, LED breath effects).
27+
2328
vcc-supply:
2429
description: Regulator providing power to the "VCC" pin.
2530

31+
vio-supply:
32+
description: Regulator providing power for pull-up of the I/O lines.
33+
"VIO1" in the typical application circuit example of the datasheet.
34+
Note that this regulator does not directly connect to AW2013, but is
35+
needed for the correct operation of the interrupt and I2C lines.
36+
2637
"#address-cells":
2738
const: 1
2839

@@ -52,6 +63,7 @@ additionalProperties: false
5263
examples:
5364
- |
5465
#include <dt-bindings/gpio/gpio.h>
66+
#include <dt-bindings/interrupt-controller/irq.h>
5567
#include <dt-bindings/leds/common.h>
5668
5769
i2c {
@@ -61,6 +73,7 @@ examples:
6173
led-controller@45 {
6274
compatible = "awinic,aw2013";
6375
reg = <0x45>;
76+
interrupts = <42 IRQ_TYPE_LEVEL_LOW>;
6477
#address-cells = <1>;
6578
#size-cells = <0>;
6679
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/leds/leds-group-multicolor.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Multi-color LED built with monochromatic LEDs
8+
9+
maintainers:
10+
- Jean-Jacques Hiblot <[email protected]>
11+
12+
description: |
13+
This driver combines several monochromatic LEDs into one multi-color
14+
LED using the multicolor LED class.
15+
16+
properties:
17+
compatible:
18+
const: leds-group-multicolor
19+
20+
leds:
21+
description:
22+
An aray of monochromatic leds
23+
$ref: /schemas/types.yaml#/definitions/phandle-array
24+
25+
required:
26+
- leds
27+
28+
allOf:
29+
- $ref: leds-class-multicolor.yaml#
30+
31+
unevaluatedProperties: false
32+
33+
examples:
34+
- |
35+
#include <dt-bindings/gpio/gpio.h>
36+
#include <dt-bindings/leds/common.h>
37+
38+
monochromatic-leds {
39+
compatible = "gpio-leds";
40+
41+
led0: led-0 {
42+
gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>;
43+
color = <LED_COLOR_ID_RED>;
44+
};
45+
46+
led1: led-1 {
47+
gpios = <&mcu_pio 1 GPIO_ACTIVE_HIGH>;
48+
color = <LED_COLOR_ID_GREEN>;
49+
};
50+
51+
led2: led-2 {
52+
gpios = <&mcu_pio 2 GPIO_ACTIVE_HIGH>;
53+
color = <LED_COLOR_ID_BLUE>;
54+
};
55+
};
56+
57+
multi-led {
58+
compatible = "leds-group-multicolor";
59+
color = <LED_COLOR_ID_RGB>;
60+
function = LED_FUNCTION_INDICATOR;
61+
leds = <&led0>, <&led1>, <&led2>;
62+
};
63+
64+
...

Documentation/devicetree/bindings/leds/nxp,pca953x.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ properties:
2929

3030
gpio-controller: true
3131

32+
gpio-line-names:
33+
minItems: 1
34+
maxItems: 16
35+
3236
'#gpio-cells':
3337
const: 2
3438

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/leds/nxp,pca995x.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: NXP PCA995x LED controllers
8+
9+
maintainers:
10+
- Isai Gaspar <[email protected]>
11+
- Marek Vasut <[email protected]>
12+
13+
description:
14+
The NXP PCA9952/PCA9955B are programmable LED controllers connected via I2C
15+
that can drive 16 separate lines. Each of them can be individually switched
16+
on and off, and brightness can be controlled via individual PWM.
17+
18+
Datasheets are available at
19+
https://www.nxp.com/docs/en/data-sheet/PCA9952_PCA9955.pdf
20+
https://www.nxp.com/docs/en/data-sheet/PCA9955B.pdf
21+
22+
properties:
23+
compatible:
24+
enum:
25+
- nxp,pca9952
26+
- nxp,pca9955b
27+
28+
reg:
29+
maxItems: 1
30+
31+
"#address-cells":
32+
const: 1
33+
34+
"#size-cells":
35+
const: 0
36+
37+
patternProperties:
38+
"^led@[0-9a-f]+$":
39+
type: object
40+
$ref: common.yaml#
41+
unevaluatedProperties: false
42+
43+
properties:
44+
reg:
45+
minimum: 0
46+
maximum: 15
47+
48+
required:
49+
- reg
50+
51+
additionalProperties: false
52+
53+
examples:
54+
- |
55+
#include <dt-bindings/leds/common.h>
56+
57+
i2c {
58+
#address-cells = <1>;
59+
#size-cells = <0>;
60+
61+
led-controller@1 {
62+
compatible = "nxp,pca9955b";
63+
reg = <0x01>;
64+
#address-cells = <1>;
65+
#size-cells = <0>;
66+
67+
led@0 {
68+
reg = <0x0>;
69+
color = <LED_COLOR_ID_RED>;
70+
function = LED_FUNCTION_POWER;
71+
};
72+
73+
led@2 {
74+
reg = <0x2>;
75+
color = <LED_COLOR_ID_WHITE>;
76+
function = LED_FUNCTION_STATUS;
77+
};
78+
};
79+
};
80+
81+
...
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/leds/panasonic,an30259a.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Panasonic AN30259A 3-channel LED controller
8+
9+
maintainers:
10+
- Iskren Chernev <[email protected]>
11+
12+
description:
13+
The AN30259A is a LED controller capable of driving three LEDs independently.
14+
It supports constant current output and sloping current output modes. The chip
15+
is connected over I2C.
16+
17+
properties:
18+
compatible:
19+
const: panasonic,an30259a
20+
21+
reg:
22+
maxItems: 1
23+
24+
interrupts:
25+
maxItems: 1
26+
27+
"#address-cells":
28+
const: 1
29+
30+
"#size-cells":
31+
const: 0
32+
33+
patternProperties:
34+
"^led@[1-3]$":
35+
$ref: common.yaml#
36+
unevaluatedProperties: false
37+
38+
properties:
39+
reg:
40+
enum: [ 1, 2, 3 ]
41+
42+
required:
43+
- compatible
44+
- reg
45+
- "#address-cells"
46+
- "#size-cells"
47+
48+
additionalProperties: false
49+
50+
examples:
51+
- |
52+
#include <dt-bindings/leds/common.h>
53+
54+
i2c {
55+
#address-cells = <1>;
56+
#size-cells = <0>;
57+
58+
led-controller@30 {
59+
compatible = "panasonic,an30259a";
60+
reg = <0x30>;
61+
#address-cells = <1>;
62+
#size-cells = <0>;
63+
64+
led@1 {
65+
reg = <1>;
66+
linux,default-trigger = "heartbeat";
67+
function = LED_FUNCTION_INDICATOR;
68+
color = <LED_COLOR_ID_RED>;
69+
};
70+
71+
led@2 {
72+
reg = <2>;
73+
function = LED_FUNCTION_INDICATOR;
74+
color = <LED_COLOR_ID_GREEN>;
75+
};
76+
77+
led@3 {
78+
reg = <3>;
79+
function = LED_FUNCTION_INDICATOR;
80+
color = <LED_COLOR_ID_BLUE>;
81+
};
82+
};
83+
};
84+
...

Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ properties:
3535
description: GPIO pin to enable/disable the device.
3636

3737
patternProperties:
38-
"^led@[0-6]$":
38+
"^led@[0-5]$":
3939
type: object
4040
$ref: common.yaml#
4141
unevaluatedProperties: false
4242

4343
properties:
4444
reg:
4545
minimum: 0
46-
maximum: 6
46+
maximum: 5
4747

4848
required:
4949
- reg

0 commit comments

Comments
 (0)