Skip to content

Commit

Permalink
Merge tag 'leds-next-6.6' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/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
  ...
  • Loading branch information
Linus Torvalds committed Sep 4, 2023
2 parents d872306 + baca986 commit 2be6bc4
Show file tree
Hide file tree
Showing 54 changed files with 880 additions and 176 deletions.
9 changes: 9 additions & 0 deletions Documentation/ABI/testing/sysfs-class-led
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ Description:
brightness. Reading this file when no hw brightness change
event has happened will return an ENODATA error.

What: /sys/class/leds/<led>/color
Date: June 2023
KernelVersion: 6.5
Description:
Color of the LED.

This is a read-only file. Reading this file returns the color
of the LED as a string (e.g: "red", "green", "multicolor").

What: /sys/class/leds/<led>/trigger
Date: March 2006
KernelVersion: 2.6.17
Expand Down
15 changes: 13 additions & 2 deletions Documentation/devicetree/bindings/leds/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ properties:
- enum:
# LED will act as a back-light, controlled by the framebuffer system
- backlight
# LED will turn on (but for leds-gpio see "default-state" property in
# Documentation/devicetree/bindings/leds/leds-gpio.yaml)
# LED will turn on (see also "default-state" property)
- default-on
# LED "double" flashes at a load average based rate
- heartbeat
Expand Down Expand Up @@ -158,6 +157,18 @@ properties:
For flash LED controllers with configurable current this property is
mandatory for the LEDs in the non-flash modes (e.g. torch or indicator).

max-brightness:
description:
Normally, the maximum brightness is determined by the hardware, and this
property is not required. This property is used to set a software limit.
It could happen that an LED is made so bright that it gets damaged or
causes damage due to restrictions in a specific system, such as mounting
conditions.
Note that this flag is mainly used for PWM-LEDs, where it is not possible
to map brightness to current. Drivers for other controllers should use
led-max-microamp.
$ref: /schemas/types.yaml#definitions/uint32

panic-indicator:
description:
This property specifies that the LED should be used, if at all possible,
Expand Down
55 changes: 0 additions & 55 deletions Documentation/devicetree/bindings/leds/leds-an30259a.txt

This file was deleted.

13 changes: 13 additions & 0 deletions Documentation/devicetree/bindings/leds/leds-aw2013.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,20 @@ properties:
reg:
maxItems: 1

interrupts:
maxItems: 1
description: Open-drain, low active interrupt pin "INTN".
Used to report completion of operations (power up, LED breath effects).

vcc-supply:
description: Regulator providing power to the "VCC" pin.

vio-supply:
description: Regulator providing power for pull-up of the I/O lines.
"VIO1" in the typical application circuit example of the datasheet.
Note that this regulator does not directly connect to AW2013, but is
needed for the correct operation of the interrupt and I2C lines.

"#address-cells":
const: 1

Expand Down Expand Up @@ -52,6 +63,7 @@ additionalProperties: false
examples:
- |
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/leds/common.h>
i2c {
Expand All @@ -61,6 +73,7 @@ examples:
led-controller@45 {
compatible = "awinic,aw2013";
reg = <0x45>;
interrupts = <42 IRQ_TYPE_LEVEL_LOW>;
#address-cells = <1>;
#size-cells = <0>;
Expand Down
64 changes: 64 additions & 0 deletions Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/leds/leds-group-multicolor.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Multi-color LED built with monochromatic LEDs

maintainers:
- Jean-Jacques Hiblot <jjhiblot@traphandler.com>

description: |
This driver combines several monochromatic LEDs into one multi-color
LED using the multicolor LED class.
properties:
compatible:
const: leds-group-multicolor

leds:
description:
An aray of monochromatic leds
$ref: /schemas/types.yaml#/definitions/phandle-array

required:
- leds

allOf:
- $ref: leds-class-multicolor.yaml#

unevaluatedProperties: false

examples:
- |
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
monochromatic-leds {
compatible = "gpio-leds";
led0: led-0 {
gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>;
color = <LED_COLOR_ID_RED>;
};
led1: led-1 {
gpios = <&mcu_pio 1 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
};
led2: led-2 {
gpios = <&mcu_pio 2 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_BLUE>;
};
};
multi-led {
compatible = "leds-group-multicolor";
color = <LED_COLOR_ID_RGB>;
function = LED_FUNCTION_INDICATOR;
leds = <&led0>, <&led1>, <&led2>;
};
...
4 changes: 4 additions & 0 deletions Documentation/devicetree/bindings/leds/nxp,pca953x.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ properties:

gpio-controller: true

gpio-line-names:
minItems: 1
maxItems: 16

'#gpio-cells':
const: 2

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

title: NXP PCA995x LED controllers

maintainers:
- Isai Gaspar <isaiezequiel.gaspar@nxp.com>
- Marek Vasut <marex@denx.de>

description:
The NXP PCA9952/PCA9955B are programmable LED controllers connected via I2C
that can drive 16 separate lines. Each of them can be individually switched
on and off, and brightness can be controlled via individual PWM.

Datasheets are available at
https://www.nxp.com/docs/en/data-sheet/PCA9952_PCA9955.pdf
https://www.nxp.com/docs/en/data-sheet/PCA9955B.pdf

properties:
compatible:
enum:
- nxp,pca9952
- nxp,pca9955b

reg:
maxItems: 1

"#address-cells":
const: 1

"#size-cells":
const: 0

patternProperties:
"^led@[0-9a-f]+$":
type: object
$ref: common.yaml#
unevaluatedProperties: false

properties:
reg:
minimum: 0
maximum: 15

required:
- reg

additionalProperties: false

examples:
- |
#include <dt-bindings/leds/common.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
led-controller@1 {
compatible = "nxp,pca9955b";
reg = <0x01>;
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0x0>;
color = <LED_COLOR_ID_RED>;
function = LED_FUNCTION_POWER;
};
led@2 {
reg = <0x2>;
color = <LED_COLOR_ID_WHITE>;
function = LED_FUNCTION_STATUS;
};
};
};
...
84 changes: 84 additions & 0 deletions Documentation/devicetree/bindings/leds/panasonic,an30259a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/leds/panasonic,an30259a.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Panasonic AN30259A 3-channel LED controller

maintainers:
- Iskren Chernev <me@iskren.info>

description:
The AN30259A is a LED controller capable of driving three LEDs independently.
It supports constant current output and sloping current output modes. The chip
is connected over I2C.

properties:
compatible:
const: panasonic,an30259a

reg:
maxItems: 1

interrupts:
maxItems: 1

"#address-cells":
const: 1

"#size-cells":
const: 0

patternProperties:
"^led@[1-3]$":
$ref: common.yaml#
unevaluatedProperties: false

properties:
reg:
enum: [ 1, 2, 3 ]

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

additionalProperties: false

examples:
- |
#include <dt-bindings/leds/common.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
led-controller@30 {
compatible = "panasonic,an30259a";
reg = <0x30>;
#address-cells = <1>;
#size-cells = <0>;
led@1 {
reg = <1>;
linux,default-trigger = "heartbeat";
function = LED_FUNCTION_INDICATOR;
color = <LED_COLOR_ID_RED>;
};
led@2 {
reg = <2>;
function = LED_FUNCTION_INDICATOR;
color = <LED_COLOR_ID_GREEN>;
};
led@3 {
reg = <3>;
function = LED_FUNCTION_INDICATOR;
color = <LED_COLOR_ID_BLUE>;
};
};
};
...
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ properties:
description: GPIO pin to enable/disable the device.

patternProperties:
"^led@[0-6]$":
"^led@[0-5]$":
type: object
$ref: common.yaml#
unevaluatedProperties: false

properties:
reg:
minimum: 0
maximum: 6
maximum: 5

required:
- reg
Expand Down
Loading

0 comments on commit 2be6bc4

Please sign in to comment.