Commit 2be6bc48 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
  ...
parents d8723062 baca986e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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
+13 −2
Original line number Diff line number Diff line
@@ -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
@@ -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,
+0 −55
Original line number Diff line number Diff line
* Panasonic AN30259A 3-channel LED driver

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.

Required properties:
	- compatible: Must be "panasonic,an30259a".
	- reg: I2C slave address.
	- #address-cells: Must be 1.
	- #size-cells: Must be 0.

Each LED is represented as a sub-node of the panasonic,an30259a node.

Required sub-node properties:
	- reg: Pin that the LED is connected to. Must be 1, 2, or 3.

Optional sub-node properties:
	- function :
		see Documentation/devicetree/bindings/leds/common.txt
	- color :
		see Documentation/devicetree/bindings/leds/common.txt
	- label :
		see Documentation/devicetree/bindings/leds/common.txt (deprecated)
	- linux,default-trigger :
		see Documentation/devicetree/bindings/leds/common.txt

Example:

#include <dt-bindings/leds/common.h>

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>;
	};
};
+13 −0
Original line number Diff line number Diff line
@@ -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

@@ -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 {
@@ -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>;

+64 −0
Original line number Diff line number Diff line
# 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>;
    };

...
Loading