Commit 9f6ffd0d authored by Wadim Egorov's avatar Wadim Egorov Committed by Lee Jones
Browse files

dt-bindings: leds: Convert PCA9532 to dtschema



Convert the PCA9532 LED Dimmer to dtschema.
While at it, update the example to match recommended node names and
the link to the product datasheet. Also add GPIO properties since
the driver allows to use unused pins as GPIOs.

Signed-off-by: default avatarWadim Egorov <w.egorov@phytec.de>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: default avatarLee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230412140552.451527-1-w.egorov@phytec.de
parent 7fec6515
Loading
Loading
Loading
Loading
+0 −49
Original line number Diff line number Diff line
*NXP - pca9532 PWM LED Driver

The PCA9532 family is SMBus I/O expander optimized for dimming LEDs.
The PWM support 256 steps.

Required properties:
	- compatible:
		"nxp,pca9530"
		"nxp,pca9531"
		"nxp,pca9532"
		"nxp,pca9533"
	- reg -  I2C slave address

Each led is represented as a sub-node of the nxp,pca9530.

Optional sub-node properties:
	- label: see Documentation/devicetree/bindings/leds/common.txt
	- type: Output configuration, see dt-bindings/leds/leds-pca9532.h (default NONE)
	- linux,default-trigger: see Documentation/devicetree/bindings/leds/common.txt
	- default-state: see Documentation/devicetree/bindings/leds/common.txt
	  This property is only valid for sub-nodes of type <PCA9532_TYPE_LED>.

Example:
  #include <dt-bindings/leds/leds-pca9532.h>

  leds: pca9530@60 {
    compatible = "nxp,pca9530";
    reg = <0x60>;

    red-power {
      label = "pca:red:power";
      type = <PCA9532_TYPE_LED>;
    };
    green-power {
      label = "pca:green:power";
      type = <PCA9532_TYPE_LED>;
    };
    kernel-booting {
      type = <PCA9532_TYPE_LED>;
      default-state = "on";
    };
    sys-stat {
      type = <PCA9532_TYPE_LED>;
      default-state = "keep"; // don't touch, was set by U-Boot
    };
  };

For more product information please see the link below:
http://nxp.com/documents/data_sheet/PCA9532.pdf
+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/nxp,pca953x.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: NXP PCA9532 LED Dimmer

maintainers:
  - Riku Voipio <riku.voipio@iki.fi>

description: |
  The PCA9532 family is SMBus I/O expander optimized for dimming LEDs.
  The PWM support 256 steps.

  For more product information please see the link below:
    https://www.nxp.com/docs/en/data-sheet/PCA9532.pdf

properties:
  compatible:
    enum:
      - nxp,pca9530
      - nxp,pca9531
      - nxp,pca9532
      - nxp,pca9533

  reg:
    maxItems: 1

  gpio-controller: true

  '#gpio-cells':
    const: 2

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

    properties:
      type:
        description: |
          Output configuration, see include/dt-bindings/leds/leds-pca9532.h
        $ref: /schemas/types.yaml#/definitions/uint32
        default: 0
        minimum: 0
        maximum: 4

required:
  - compatible
  - reg

additionalProperties: false

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

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

        led-controller@62 {
            compatible = "nxp,pca9533";
            reg = <0x62>;

            led-1 {
                label = "pca:red:power";
                type = <PCA9532_TYPE_LED>;
            };

            led-2 {
                label = "pca:green:power";
                type = <PCA9532_TYPE_LED>;
            };

            led-3 {
                type = <PCA9532_TYPE_LED>;
                default-state = "on";
            };

            led-4 {
                type = <PCA9532_TYPE_LED>;
                default-state = "keep";
            };
        };
    };

...