devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] dt-bindings: leds: Add TI TLC5928 LED
       [not found] <20250326153535.158137-1-corentin.guillevic@smile.fr>
@ 2025-03-26 15:35 ` Corentin Guillevic
  2025-03-31 14:45   ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: Corentin Guillevic @ 2025-03-26 15:35 UTC (permalink / raw)
  To: Pavel Machek, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Corentin Guillevic
  Cc: linux-leds, devicetree, linux-kernel

Document Texas Instruments TLC5928 LED driver devicetree bindings.

Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
---
 .../bindings/leds/leds-tlc5928.yaml           | 212 ++++++++++++++++++
 1 file changed, 212 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-tlc5928.yaml

diff --git a/Documentation/devicetree/bindings/leds/leds-tlc5928.yaml b/Documentation/devicetree/bindings/leds/leds-tlc5928.yaml
new file mode 100644
index 000000000000..0d857c9b1feb
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-tlc5928.yaml
@@ -0,0 +1,212 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-tlc5928.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LED driver for TLC5928 from Texas Instruments.
+
+maintainers:
+  - Corentin Guillevic <corentin.guillevic@smile.fr>
+
+description: |
+  The TLC5928 is a LED controller handling up to 16 LEDs. It can
+  control LED on/off using a SPI-compatible interface, and has an
+  on/off control data shift register (blank) and data latch.
+
+  This driver also supports the daisy-chaining of several TLC5928
+  chips, as illustrated by the diagram below (with two controllers):
+
+  +--------------+           +--------------+
+  |          SCLK|-----+---->|SCLK     BLANK|--
+  |              |     |     |              |
+  |  SPI     MOSI|-----|---->|MOSI  TLC5928 |
+  | Master       |     |     |        (1)   |
+  |          MISO|<--+ |  +--|MISO          |
+  |              |   | |  |  |              |
+  |      CS/LATCH|-+-|-|--|->|LATCH         |
+  +--------------+ | | |  |  +--------------+
+                   | | |  |  +--------------+
+                   | | +--|->|SCLK     BLANK|--
+                   | |    |  |              |
+                   | |    +->|MOSI  TLC5928 |
+                   | |       |        (2)   |
+                   | +-------|MISO          |
+                   |         |              |
+                   +-------->|LATCH         |
+                             +--------------+
+
+  For more product information please see the link below:
+  https://www.ti.com/product/TLC5928/part-details/TLC5928PWPR
+
+properties:
+  compatible:
+    const: ti,tlc5928
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  reg:
+    maxItems: 1
+    description:
+      SPI slave address
+
+  enable-gpios:
+    description: |
+      Array of GPIO specifiers, referring to the GPIO pins to enable/disable
+      each device (active high to disable). In the daisy chain case, each
+      GPIO has to be in the same sequence than the devices.
+
+  latch-gpio:
+    maxItems: 1
+    description: Latch GPIO (SPI chip select)
+
+patternProperties:
+  "^spi-chip@[0-9]$":
+    type: object
+    unevaluatedProperties: false
+    description: Properties for a TLC5928 controller.
+
+    properties:
+      '#address-cells':
+        const: 1
+
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+
+      "^led@[0-9a-f]+$":
+        type: object
+        $ref: common.yaml#
+        unevaluatedProperties: false
+        description:
+          Properties for a single LED.
+
+        properties:
+          reg:
+            description: Index of the LED.
+            minimum: 0
+            maximum: 15
+
+        required:
+          - reg
+
+    required:
+      - "#address-cells"
+      - "#size-cells"
+
+required:
+  - compatible
+  - reg
+  - latch-gpio
+
+unevaluatedProperties: false
+
+examples:
+  # Single controller
+  - |
+	#include <dt-bindings/leds/common.h>
+
+	tlc5928@0 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "ti,tlc5928";
+		reg = <0x0>;
+
+		enable-gpios = <&gpiof 10 GPIO_ACTIVE_HIGH>;
+		latch-gpio = <&gpiof 3 GPIO_ACTIVE_HIGH>;
+
+		spi-chip@0 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			led@0 {
+				label = "tlc5928:led0";
+				led = <LED_COLOR_ID_WHITE>;
+				reg = <0x0>;
+			};
+
+			led@1 {
+				label = "tlc5928:led1";
+				led = <LED_COLOR_ID_RED>;
+				reg = <0x1>;
+			};
+
+			led@f {
+				label = "tlc5928:led15";
+				led = <LED_COLOR_ID_GREEN>;
+				reg = <0xf>;
+			};
+		};
+	};
+
+  # Two controllers, in daisy chain
+  - |
+	#include <dt-bindings/leds/common.h>
+
+	tlc5928@0 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "ti,tlc5928";
+		reg = <0x0>;
+
+		enable-gpios = <&gpiof 10 GPIO_ACTIVE_HIGH>, /* OUT_EN_1 */
+			<&gpiof 9 GPIO_ACTIVE_HIGH>; /* OUT_EN_2 */
+		latch-gpio = <&gpiof 3 GPIO_ACTIVE_HIGH>;
+
+		spi-chip@0 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			led@0 {
+				label = "tlc5928:0:led0";
+				led = <LED_COLOR_ID_WHITE>;
+				reg = <0x0>;
+			};
+
+			led@1 {
+				label = "tlc5928:0:led1";
+				led = <LED_COLOR_ID_RED>;
+				reg = <0x1>;
+			};
+
+			led@f {
+				label = "tlc5928:0:led15";
+				led = <LED_COLOR_ID_GREEN>;
+				reg = <0xf>;
+			};
+		};
+
+		spi-chip@1 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			led@0 {
+				label = "tlc5928:1:led0";
+				led = <LED_COLOR_ID_BLUE>;
+				reg = <0x0>;
+			};
+
+			led@1 {
+				label = "tlc5928:1:led1";
+				led = <LED_COLOR_ID_AMBER>;
+				reg = <0x1>;
+			};
+
+			led@2 {
+				label = "tlc5928:1:led2";
+				led = <LED_COLOR_ID_VIOLET>;
+				reg = <0x2>;
+			};
+
+			led@f {
+				label = "tlc5928:1:led15";
+				led = <LED_COLOR_ID_YELLOW>;
+				reg = <0xf>;
+			};
+		};
+	};
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] dt-bindings: leds: Add TI TLC5928 LED
  2025-03-26 15:35 ` [PATCH 2/2] dt-bindings: leds: Add TI TLC5928 LED Corentin Guillevic
@ 2025-03-31 14:45   ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2025-03-31 14:45 UTC (permalink / raw)
  To: Corentin Guillevic
  Cc: Pavel Machek, Lee Jones, Krzysztof Kozlowski, Conor Dooley,
	linux-leds, devicetree, linux-kernel

On Wed, Mar 26, 2025 at 04:35:33PM +0100, Corentin Guillevic wrote:
> Document Texas Instruments TLC5928 LED driver devicetree bindings.
> 
> Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
> ---
>  .../bindings/leds/leds-tlc5928.yaml           | 212 ++++++++++++++++++
>  1 file changed, 212 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/leds/leds-tlc5928.yaml
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-tlc5928.yaml b/Documentation/devicetree/bindings/leds/leds-tlc5928.yaml
> new file mode 100644
> index 000000000000..0d857c9b1feb
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/leds-tlc5928.yaml
> @@ -0,0 +1,212 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/leds/leds-tlc5928.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: LED driver for TLC5928 from Texas Instruments.
> +
> +maintainers:
> +  - Corentin Guillevic <corentin.guillevic@smile.fr>
> +
> +description: |
> +  The TLC5928 is a LED controller handling up to 16 LEDs. It can
> +  control LED on/off using a SPI-compatible interface, and has an
> +  on/off control data shift register (blank) and data latch.
> +
> +  This driver also supports the daisy-chaining of several TLC5928
> +  chips, as illustrated by the diagram below (with two controllers):
> +
> +  +--------------+           +--------------+
> +  |          SCLK|-----+---->|SCLK     BLANK|--
> +  |              |     |     |              |
> +  |  SPI     MOSI|-----|---->|MOSI  TLC5928 |
> +  | Master       |     |     |        (1)   |
> +  |          MISO|<--+ |  +--|MISO          |
> +  |              |   | |  |  |              |
> +  |      CS/LATCH|-+-|-|--|->|LATCH         |
> +  +--------------+ | | |  |  +--------------+
> +                   | | |  |  +--------------+
> +                   | | +--|->|SCLK     BLANK|--
> +                   | |    |  |              |
> +                   | |    +->|MOSI  TLC5928 |
> +                   | |       |        (2)   |
> +                   | +-------|MISO          |
> +                   |         |              |
> +                   +-------->|LATCH         |
> +                             +--------------+
> +
> +  For more product information please see the link below:
> +  https://www.ti.com/product/TLC5928/part-details/TLC5928PWPR
> +
> +properties:
> +  compatible:
> +    const: ti,tlc5928
> +
> +  "#address-cells":
> +    const: 1
> +
> +  "#size-cells":
> +    const: 0
> +
> +  reg:
> +    maxItems: 1
> +    description:
> +      SPI slave address
> +
> +  enable-gpios:
> +    description: |

Don't need '|' if no formatting.

> +      Array of GPIO specifiers, referring to the GPIO pins to enable/disable
> +      each device (active high to disable). In the daisy chain case, each
> +      GPIO has to be in the same sequence than the devices.
> +
> +  latch-gpio:

latch-gpios

-gpio is deprecated.

> +    maxItems: 1
> +    description: Latch GPIO (SPI chip select)
> +
> +patternProperties:
> +  "^spi-chip@[0-9]$":
> +    type: object
> +    unevaluatedProperties: false
> +    description: Properties for a TLC5928 controller.

I don't think this level is needed. Just encode the chip instance into 
the LED address. Either 1 cell splitting the bits or 2 cells with chip 
instance in 1st cell and LED# in the 2nd cell.

> +
> +    properties:
> +      '#address-cells':
> +        const: 1
> +
> +      '#size-cells':
> +        const: 0
> +
> +    patternProperties:
> +
> +      "^led@[0-9a-f]+$":

Don't need the '+' as the max is 'f'. That will change with the above 
though. You'll want something like '^led@[0-9a-f]+,[0-9a-f]$' with the 
chip and led numbers split.

> +        type: object
> +        $ref: common.yaml#
> +        unevaluatedProperties: false
> +        description:
> +          Properties for a single LED.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-31 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250326153535.158137-1-corentin.guillevic@smile.fr>
2025-03-26 15:35 ` [PATCH 2/2] dt-bindings: leds: Add TI TLC5928 LED Corentin Guillevic
2025-03-31 14:45   ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).