Commit e4a7b2dc authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull LED updates from Pavel Machek:
 "Okay, so... this one is interesting. RGB LEDs are very common, and we
  need to have some kind of support for them. Multicolor is for
  arbitrary set of LEDs in one package, RGB is for LEDs that can produce
  full range of colors. We do not have real multicolor LED that is not
  RGB in the pipeline, so that one is disabled for now.

  You can expect this saga to continue with next pull requests"

* tag 'leds-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds: (37 commits)
  MAINTAINERS: Remove myself as LED subsystem maintainer
  leds: disallow /sys/class/leds/*:multi:* for now
  leds: add RGB color option, as that is different from multicolor.
  Make LEDS_LP55XX_COMMON depend on I2C to fix build errors:
  Documentation: ABI: leds-turris-omnia: document sysfs attribute
  leds: initial support for Turris Omnia LEDs
  dt-bindings: leds: add cznic,turris-omnia-leds binding
  leds: pattern trigger -- check pattern for validity
  leds: Replace HTTP links with HTTPS ones
  leds: trigger: add support for LED-private device triggers
  leds: lp5521: Add multicolor framework multicolor brightness support
  leds: lp5523: Update the lp5523 code to add multicolor brightness function
  leds: lp55xx: Add multicolor framework support to lp55xx
  leds: lp55xx: Convert LED class registration to devm_*
  dt-bindings: leds: Convert leds-lp55xx to yaml
  leds: multicolor: Introduce a multicolor class definition
  leds: Add multicolor ID to the color ID list
  dt: bindings: Add multicolor class dt bindings documention
  leds: lp5523: Fix various formatting issues in the code
  leds: lp55xx: Fix file permissions to use DEVICE_ATTR macros
  ...
parents fffe3ae0 bba37471
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
What:		/sys/class/leds/<led>/device/brightness
Date:		July 2020
KernelVersion:	5.9
Contact:	Marek Behún <marek.behun@nic.cz>
Description:	(RW) On the front panel of the Turris Omnia router there is also
		a button which can be used to control the intensity of all the
		LEDs at once, so that if they are too bright, user can dim them.

		The microcontroller cycles between 8 levels of this global
		brightness (from 100% to 0%), but this setting can have any
		integer value between 0 and 100. It is therefore convenient to be
		able to change this setting from software.

		Format: %i
+35 −0
Original line number Diff line number Diff line
What:		/sys/class/leds/<led>/brightness
Date:		March 2020
KernelVersion:	5.9
Contact:	Dan Murphy <dmurphy@ti.com>
Description:	read/write
		Writing to this file will update all LEDs within the group to a
		calculated percentage of what each color LED intensity is set
		to. The percentage is calculated for each grouped LED via the
		equation below:

		led_brightness = brightness * multi_intensity/max_brightness

		For additional details please refer to
		Documentation/leds/leds-class-multicolor.rst.

		The value of the LED is from 0 to
		/sys/class/leds/<led>/max_brightness.

What:		/sys/class/leds/<led>/multi_index
Date:		March 2020
KernelVersion:	5.9
Contact:	Dan Murphy <dmurphy@ti.com>
Description:	read
		The multi_index array, when read, will output the LED colors
		as an array of strings as they are indexed in the
		multi_intensity file.

What:		/sys/class/leds/<led>/multi_intensity
Date:		March 2020
KernelVersion:	5.9
Contact:	Dan Murphy <dmurphy@ti.com>
Description:	read/write
		This file contains array of integers. Order of components is
		described by the multi_index array. The maximum intensity should
		not exceed /sys/class/leds/<led>/max_brightness.
+90 −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/cznic,turris-omnia-leds.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: CZ.NIC's Turris Omnia LEDs driver

maintainers:
  - Marek Behún <marek.behun@nic.cz>

description:
  This module adds support for the RGB LEDs found on the front panel of the
  Turris Omnia router. There are 12 RGB LEDs that are controlled by a
  microcontroller that communicates via the I2C bus. Each LED is described
  as a subnode of this I2C device.

properties:
  compatible:
    const: cznic,turris-omnia-leds

  reg:
    description: I2C slave address of the microcontroller.
    maxItems: 1

  "#address-cells":
    const: 1

  "#size-cells":
    const: 0

patternProperties:
  "^multi-led[0-9a-f]$":
    type: object
    allOf:
      - $ref: leds-class-multicolor.yaml#
    description:
      This node represents one of the RGB LED devices on Turris Omnia.
      No subnodes need to be added for subchannels since this controller only
      supports RGB LEDs.

    properties:
      reg:
        minimum: 0
        maximum: 11
        description:
          This property identifies one of the LEDs on the front panel of the
          Turris Omnia router.

    required:
      - reg

additionalProperties: false

examples:
  - |

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

    i2c0 {
        #address-cells = <1>;
        #size-cells = <0>;

        led-controller@2b {
            compatible = "cznic,turris-omnia-leds";
            reg = <0x2b>;
            #address-cells = <1>;
            #size-cells = <0>;

            multi-led@0 {
                /*
                 * No subnodes are needed, this controller only supports RGB
                 * LEDs.
                 */
                reg = <0>;
                color = <LED_COLOR_ID_MULTI>;
                function = LED_FUNCTION_POWER;
                linux,default-trigger = "heartbeat";
            };

            multi-led@a {
                reg = <0xa>;
                color = <LED_COLOR_ID_MULTI>;
                function = LED_FUNCTION_INDICATOR;
                function-enumerator = <1>;
            };
        };
    };

...
+37 −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-class-multicolor.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Common properties for the multicolor LED class.

maintainers:
  - Dan Murphy <dmurphy@ti.com>

description: |
  Bindings for multi color LEDs show how to describe current outputs of
  either integrated multi-color LED elements (like RGB, RGBW, RGBWA-UV
  etc.) or standalone LEDs, to achieve logically grouped multi-color LED
  modules. This is achieved by adding multi-led nodes layer to the
  monochrome LED bindings.
  The nodes and properties defined in this document are unique to the multicolor
  LED class.  Common LED nodes and properties are inherited from the common.txt
  within this documentation directory.

patternProperties:
  "^multi-led@([0-9a-f])$":
    type: object
    description: Represents the LEDs that are to be grouped.
    properties:
      color:
        const: 8  # LED_COLOR_ID_MULTI
        description: |
          For multicolor LED support this property should be defined as
          LED_COLOR_ID_MULTI which can be found in include/linux/leds/common.h.

    $ref: "common.yaml#"

    required:
      - color
...
+1 −1
Original line number Diff line number Diff line
@@ -102,4 +102,4 @@ led-controller@38 {
};

For more product information please see the links below:
http://www.ti.com/product/LM3532
https://www.ti.com/product/LM3532
Loading