Commit 08df80a3 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull LED updates from Lee Jones:
 "New Drivers:
   - Add support for Allwinner A100 RGB LED controller
   - Add support for Maxim 5970 Dual Hot-swap controller

  New Device Support:
   - Add support for AW20108 to Awinic LED driver

  New Functionality:
   - Extend support for Net speeds to include; 2.5G, 5G and 10G
   - Allow tx/rx and cts/dsr/dcd/rng TTY LEDS to be turned on and off
     via sysfs if required
   - Add support for hardware control in AW200xx

  Fix-ups:
   - Use safer methods for string handling
   - Improve error handling; return proper error values, simplify,
     avoid duplicates, etc
   - Replace Mutex use with the Completion mechanism
   - Fix include lists; alphabetise, remove unused, explicitly add used
   - Use generic platform device properties
   - Use/convert to new/better APIs/helpers/MACROs instead of
     hand-rolling implementations
   - Device Tree binding adaptions/conversions/creation
   - Continue work to remove superfluous platform .remove() call-backs
   - Remove superfluous/defunct code
   - Trivial; whitespace, unused variables, spelling, clean-ups, etc
   - Avoid unnecessary duplicate locks

  Bug Fixes:
   - Repair Kconfig based dependency lists
   - Ensure unused dynamically allocated data is freed after use
   - Fix support for brightness control
   - Add missing sufficient delays during reset to ensure correct
     operation
   - Avoid division-by-zero issues"

* tag 'leds-next-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (45 commits)
  leds: trigger: netdev: Add core support for hw not supporting fallback to LED sw control
  leds: trigger: panic: Don't register panic notifier if creating the trigger failed
  leds: sun50i-a100: Convert to be agnostic to property provider
  leds: max5970: Add missing headers
  leds: max5970: Make use of dev_err_probe()
  leds: max5970: Make use of device properties
  leds: max5970: Remove unused variable
  leds: rgb: Drop obsolete dependency on COMPILE_TEST
  leds: sun50i-a100: Avoid division-by-zero warning
  leds: trigger: Remove unused function led_trigger_rename_static()
  leds: qcom-lpg: Introduce a wrapper for getting driver data from a pwm chip
  leds: gpio: Add kernel log if devm_fwnode_gpiod_get() fails
  dt-bindings: leds: qcom,spmi-flash-led: Fix example node name
  dt-bindings: leds: aw200xx: Fix led pattern and add reg constraints
  dt-bindings: leds: awinic,aw200xx: Add AW20108 device
  leds: aw200xx: Add support for aw20108 device
  leds: aw200xx: Improve autodim calculation method
  leds: aw200xx: Enable disable_locking flag in regmap config
  leds: aw200xx: Add delay after software reset
  dt-bindings: leds: aw200xx: Remove property "awinic,display-rows"
  ...
parents 2385018a 4289e434
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -114,6 +114,45 @@ Description:
		speed of 1000Mbps of the named network device.
		Setting this value also immediately changes the LED state.

What:		/sys/class/leds/<led>/link_2500
Date:		Nov 2023
KernelVersion:	6.8
Contact:	linux-leds@vger.kernel.org
Description:
		Signal the link speed state of 2500Mbps of the named network device.

		If set to 0 (default), the LED's normal state is off.

		If set to 1, the LED's normal state reflects the link state
		speed of 2500Mbps of the named network device.
		Setting this value also immediately changes the LED state.

What:		/sys/class/leds/<led>/link_5000
Date:		Nov 2023
KernelVersion:	6.8
Contact:	linux-leds@vger.kernel.org
Description:
		Signal the link speed state of 5000Mbps of the named network device.

		If set to 0 (default), the LED's normal state is off.

		If set to 1, the LED's normal state reflects the link state
		speed of 5000Mbps of the named network device.
		Setting this value also immediately changes the LED state.

What:		/sys/class/leds/<led>/link_10000
Date:		Nov 2023
KernelVersion:	6.8
Contact:	linux-leds@vger.kernel.org
Description:
		Signal the link speed state of 10000Mbps of the named network device.

		If set to 0 (default), the LED's normal state is off.

		If set to 1, the LED's normal state reflects the link state
		speed of 10000Mbps of the named network device.
		Setting this value also immediately changes the LED state.

What:		/sys/class/leds/<led>/half_duplex
Date:		Jun 2023
KernelVersion:	6.5
+56 −0
Original line number Diff line number Diff line
@@ -4,3 +4,59 @@ KernelVersion: 5.10
Contact:	linux-leds@vger.kernel.org
Description:
		Specifies the tty device name of the triggering tty

What:		/sys/class/leds/<led>/rx
Date:		February 2024
KernelVersion:	6.8
Description:
		Signal reception (rx) of data on the named tty device.
		If set to 0, the LED will not blink on reception.
		If set to 1 (default), the LED will blink on reception.

What:		/sys/class/leds/<led>/tx
Date:		February 2024
KernelVersion:	6.8
Description:
		Signal transmission (tx) of data on the named tty device.
		If set to 0, the LED will not blink on transmission.
		If set to 1 (default), the LED will blink on transmission.

What:		/sys/class/leds/<led>/cts
Date:		February 2024
KernelVersion:	6.8
Description:
		CTS = Clear To Send
		DCE is ready to accept data from the DTE.
		If the line state is detected, the LED is switched on.
		If set to 0 (default), the LED will not evaluate CTS.
		If set to 1, the LED will evaluate CTS.

What:		/sys/class/leds/<led>/dsr
Date:		February 2024
KernelVersion:	6.8
Description:
		DSR = Data Set Ready
		DCE is ready to receive and send data.
		If the line state is detected, the LED is switched on.
		If set to 0 (default), the LED will not evaluate DSR.
		If set to 1, the LED will evaluate DSR.

What:		/sys/class/leds/<led>/dcd
Date:		February 2024
KernelVersion:	6.8
Description:
		DCD = Data Carrier Detect
		DTE is receiving a carrier from the DCE.
		If the line state is detected, the LED is switched on.
		If set to 0 (default), the LED will not evaluate CAR (DCD).
		If set to 1, the LED will evaluate CAR (DCD).

What:		/sys/class/leds/<led>/rng
Date:		February 2024
KernelVersion:	6.8
Description:
		RNG = Ring Indicator
		DCE has detected an incoming ring signal on the telephone
		line. If the line state is detected, the LED is switched on.
		If set to 0 (default), the LED will not evaluate RNG.
		If set to 1, the LED will evaluate RNG.
+137 −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/allwinner,sun50i-a100-ledc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Allwinner A100 LED Controller

maintainers:
  - Samuel Holland <samuel@sholland.org>

description:
  The LED controller found in Allwinner sunxi SoCs uses a one-wire serial
  interface to drive up to 1024 RGB LEDs.

properties:
  compatible:
    oneOf:
      - const: allwinner,sun50i-a100-ledc
      - items:
          - enum:
              - allwinner,sun20i-d1-ledc
              - allwinner,sun50i-r329-ledc
          - const: allwinner,sun50i-a100-ledc

  reg:
    maxItems: 1

  "#address-cells":
    const: 1

  "#size-cells":
    const: 0

  interrupts:
    maxItems: 1

  clocks:
    items:
      - description: Bus clock
      - description: Module clock

  clock-names:
    items:
      - const: bus
      - const: mod

  resets:
    maxItems: 1

  dmas:
    maxItems: 1
    description: TX DMA channel

  dma-names:
    const: tx

  allwinner,pixel-format:
    description: Pixel format (subpixel transmission order), default is "grb"
    enum:
      - bgr
      - brg
      - gbr
      - grb
      - rbg
      - rgb

  allwinner,t0h-ns:
    default: 336
    description: Length of high pulse when transmitting a "0" bit

  allwinner,t0l-ns:
    default: 840
    description: Length of low pulse when transmitting a "0" bit

  allwinner,t1h-ns:
    default: 882
    description: Length of high pulse when transmitting a "1" bit

  allwinner,t1l-ns:
    default: 294
    description: Length of low pulse when transmitting a "1" bit

  allwinner,treset-ns:
    default: 300000
    description: Minimum delay between transmission frames

patternProperties:
  "^multi-led@[0-9a-f]+$":
    type: object
    $ref: leds-class-multicolor.yaml#
    unevaluatedProperties: false
    properties:
      reg:
        minimum: 0
        maximum: 1023
        description: Index of the LED in the series (must be contiguous)

    required:
      - reg

required:
  - compatible
  - reg
  - interrupts
  - clocks
  - clock-names
  - resets

additionalProperties: false

examples:
  - |
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/leds/common.h>

    ledc: led-controller@2008000 {
      compatible = "allwinner,sun20i-d1-ledc",
                   "allwinner,sun50i-a100-ledc";
      reg = <0x2008000 0x400>;
      interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
      clocks = <&ccu 12>, <&ccu 34>;
      clock-names = "bus", "mod";
      resets = <&ccu 12>;
      dmas = <&dma 42>;
      dma-names = "tx";
      #address-cells = <1>;
      #size-cells = <0>;

      multi-led@0 {
        reg = <0x0>;
        color = <LED_COLOR_ID_RGB>;
        function = LED_FUNCTION_INDICATOR;
      };
    };

...
+71 −24
Original line number Diff line number Diff line
@@ -10,15 +10,19 @@ maintainers:
  - Martin Kurbanov <mmkurbanov@sberdevices.ru>

description: |
  This controller is present on AW20036/AW20054/AW20072.
  It is a 3x12/6x9/6x12 matrix LED programmed via
  an I2C interface, up to 36/54/72 LEDs or 12/18/24 RGBs,
  3 pattern controllers for auto breathing or group dimming control.
  It is a matrix LED driver programmed via an I2C interface. Devices have
  a set of individually controlled leds and support 3 pattern controllers
  for auto breathing or group dimming control. Supported devices:
    - AW20036 (3x12) 36 LEDs
    - AW20054 (6x9)  54 LEDs
    - AW20072 (6x12) 72 LEDs
    - AW20108 (9x12) 108 LEDs

  For more product information please see the link below:
  aw20036 - https://www.awinic.com/en/productDetail/AW20036QNR#tech-docs
  aw20054 - https://www.awinic.com/en/productDetail/AW20054QNR#tech-docs
  aw20072 - https://www.awinic.com/en/productDetail/AW20072QNR#tech-docs
  aw20108 - https://www.awinic.com/en/productDetail/AW20108QNR#tech-docs

properties:
  compatible:
@@ -26,6 +30,7 @@ properties:
      - awinic,aw20036
      - awinic,aw20054
      - awinic,aw20072
      - awinic,aw20108

  reg:
    maxItems: 1
@@ -36,13 +41,11 @@ properties:
  "#size-cells":
    const: 0

  awinic,display-rows:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Leds matrix size
  enable-gpios:
    maxItems: 1

patternProperties:
  "^led@[0-9a-f]$":
  "^led@[0-9a-f]+$":
    type: object
    $ref: common.yaml#
    unevaluatedProperties: false
@@ -60,16 +63,11 @@ patternProperties:
          since the chip has a single global setting.
          The maximum output current of each LED is calculated by the
          following formula:
            IMAXled = 160000 * (592 / 600.5) * (1 / display-rows)
            IMAXled = 160000 * (592 / 600.5) * (1 / max-current-switch-number)
          And the minimum output current formula:
            IMINled = 3300 * (592 / 600.5) * (1 / display-rows)

required:
  - compatible
  - reg
  - "#address-cells"
  - "#size-cells"
  - awinic,display-rows
            IMINled = 3300 * (592 / 600.5) * (1 / max-current-switch-number)
          where max-current-switch-number is determinated by led configuration
          and depends on how leds are physically connected to the led driver.

allOf:
  - if:
@@ -78,18 +76,67 @@ allOf:
          contains:
            const: awinic,aw20036
    then:
      patternProperties:
        "^led@[0-9a-f]+$":
          properties:
            reg:
              items:
                minimum: 0
                maximum: 36

  - if:
      properties:
        compatible:
          contains:
            const: awinic,aw20054
    then:
      patternProperties:
        "^led@[0-9a-f]+$":
          properties:
            reg:
              items:
                minimum: 0
                maximum: 54

  - if:
      properties:
        compatible:
          contains:
            const: awinic,aw20072
    then:
      patternProperties:
        "^led@[0-9a-f]+$":
          properties:
        awinic,display-rows:
          enum: [1, 2, 3]
    else:
            reg:
              items:
                minimum: 0
                maximum: 72

  - if:
      properties:
        awinic,display-rows:
          enum: [1, 2, 3, 4, 5, 6, 7]
        compatible:
          contains:
            const: awinic,aw20108
    then:
      patternProperties:
        "^led@[0-9a-f]+$":
          properties:
            reg:
              items:
                minimum: 0
                maximum: 108

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

additionalProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/leds/common.h>

    i2c {
@@ -101,7 +148,7 @@ examples:
            reg = <0x3a>;
            #address-cells = <1>;
            #size-cells = <0>;
            awinic,display-rows = <3>;
            enable-gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;

            led@0 {
                reg = <0x0>;
+1 −1
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ properties:
      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
    $ref: /schemas/types.yaml#/definitions/uint32

  panic-indicator:
    description:
Loading