1# Copyright (c) 2019, Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4description: |
5  Worldsemi WS2812 LED strip, GPIO binding
6
7  Driver bindings for bit-banging a WS2812 or compatible LED strip.
8
9  The CPU driver uses inline assembly, and isn't available for all
10  boards. The timing is automatically derived from the CPU clock frequency,
11  or can be provided by setting the delay-txx properties in the device
12  tree, or can be manually provided by the Kconfig settings DELAY_Txx.
13
14  The four delays provided (calculated based on the clock frequency,
15  provided by a dts, or Kconfig file) determine the delays as depicted
16  below. The exact timings of the LED strip data line might vary on the
17  type of LEDs used, consult the data-sheet for the precise timings.
18
19  0 code
20     +-------+                 +---
21     |       |                 |
22     |  T0H  |       T0L       |
23     |       |                 |
24  ---+       +-----------------+
25
26  1 code
27     +---------------+         +---
28     |               |         |
29     |      T1H      |   T1L   |
30     |               |         |
31  ---+               +---------+
32
33
34  Example dts file:
35  / {
36        cpus {
37            cpu@0 {
38                clock-frequency = <64000000>;
39            };
40        };
41
42        rgb_led: ws2812 {
43            compatible = "worldsemi,ws2812-gpio";
44            chain-length = <1>;
45            color-mapping = <LED_COLOR_ID_GREEN
46                             LED_COLOR_ID_RED
47                             LED_COLOR_ID_BLUE>;
48            gpios = <&gpio0 16 0>;
49        };
50  };
51
52  Example dts file:
53  / {
54        chosen {
55            zephyr,led-strip = &rgb_led;
56        };
57
58        rgb_led: ws2812 {
59            compatible = "worldsemi,ws2812-gpio";
60            chain-length = <1>;
61            color-mapping = <LED_COLOR_ID_GREEN
62                             LED_COLOR_ID_RED
63                             LED_COLOR_ID_BLUE>;
64            reset-delay = <50>;
65            gpios = <&gpio0 16 0>;
66            delay-t1h = <48>;
67            delay-t1l = <32>;
68            delay-t0h = <16>;
69            delay-t0l = <32>;
70        };
71  };
72
73compatible: "worldsemi,ws2812-gpio"
74
75include: [base.yaml, ws2812-gpio.yaml]
76
77properties:
78  delay-t1h:
79    type: int
80    description: |
81      Number of NOP assembly operations to create a delay for a 1 bit, high
82      voltage period (default 700 nsec)
83
84  delay-t1l:
85    type: int
86    description: |
87      Number of NOP assembly operations to create a delay for a 1 bit, low
88      voltage period (default 600 nsec)
89
90  delay-t0h:
91    type: int
92    description: |
93      Number of NOP assembly operations to create a delay for a 0 bit, high
94      voltage period (default 350 nsec)
95
96  delay-t0l:
97    type: int
98    description: |
99      Number of NOP assembly operations to create a delay for a 0 bit, low
100      voltage period (default 800 nsec)
101