xref: /openbmc/linux/Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt (revision 597473720f4dc69749542bfcfed4a927a43d935e)
1*1dd70937SKrzysztof Kozlowski* Pattern format for LED pattern trigger
2*1dd70937SKrzysztof Kozlowski
3*1dd70937SKrzysztof KozlowskiThe pattern is given by a series of tuples, of brightness and duration (ms).
4*1dd70937SKrzysztof KozlowskiThe LED is expected to traverse the series and each brightness value for the
5*1dd70937SKrzysztof Kozlowskispecified duration. Duration of 0 means brightness should immediately change to
6*1dd70937SKrzysztof Kozlowskinew value, and writing malformed pattern deactivates any active one.
7*1dd70937SKrzysztof Kozlowski
8*1dd70937SKrzysztof Kozlowski1. For gradual dimming, the dimming interval now is set as 50 milliseconds. So
9*1dd70937SKrzysztof Kozlowskithe tuple with duration less than dimming interval (50ms) is treated as a step
10*1dd70937SKrzysztof Kozlowskichange of brightness, i.e. the subsequent brightness will be applied without
11*1dd70937SKrzysztof Kozlowskiadding intervening dimming intervals.
12*1dd70937SKrzysztof Kozlowski
13*1dd70937SKrzysztof KozlowskiThe gradual dimming format of the software pattern values should be:
14*1dd70937SKrzysztof Kozlowski"brightness_1 duration_1 brightness_2 duration_2 brightness_3 duration_3 ...".
15*1dd70937SKrzysztof KozlowskiFor example (using sysfs interface):
16*1dd70937SKrzysztof Kozlowski
17*1dd70937SKrzysztof Kozlowskiecho 0 1000 255 2000 > pattern
18*1dd70937SKrzysztof Kozlowski
19*1dd70937SKrzysztof KozlowskiIt will make the LED go gradually from zero-intensity to max (255) intensity in
20*1dd70937SKrzysztof Kozlowski1000 milliseconds, then back to zero intensity in 2000 milliseconds:
21*1dd70937SKrzysztof Kozlowski
22*1dd70937SKrzysztof KozlowskiLED brightness
23*1dd70937SKrzysztof Kozlowski    ^
24*1dd70937SKrzysztof Kozlowski255-|       / \            / \            /
25*1dd70937SKrzysztof Kozlowski    |      /    \         /    \         /
26*1dd70937SKrzysztof Kozlowski    |     /       \      /       \      /
27*1dd70937SKrzysztof Kozlowski    |    /          \   /          \   /
28*1dd70937SKrzysztof Kozlowski  0-|   /             \/             \/
29*1dd70937SKrzysztof Kozlowski    +---0----1----2----3----4----5----6------------> time (s)
30*1dd70937SKrzysztof Kozlowski
31*1dd70937SKrzysztof Kozlowski2. To make the LED go instantly from one brightness value to another, we should
32*1dd70937SKrzysztof Kozlowskiuse zero-time lengths (the brightness must be same as the previous tuple's). So
33*1dd70937SKrzysztof Kozlowskithe format should be: "brightness_1 duration_1 brightness_1 0 brightness_2
34*1dd70937SKrzysztof Kozlowskiduration_2 brightness_2 0 ...".
35*1dd70937SKrzysztof KozlowskiFor example (using sysfs interface):
36*1dd70937SKrzysztof Kozlowski
37*1dd70937SKrzysztof Kozlowskiecho 0 1000 0 0 255 2000 255 0 > pattern
38*1dd70937SKrzysztof Kozlowski
39*1dd70937SKrzysztof KozlowskiIt will make the LED stay off for one second, then stay at max brightness for
40*1dd70937SKrzysztof Kozlowskitwo seconds:
41*1dd70937SKrzysztof Kozlowski
42*1dd70937SKrzysztof KozlowskiLED brightness
43*1dd70937SKrzysztof Kozlowski    ^
44*1dd70937SKrzysztof Kozlowski255-|        +---------+    +---------+
45*1dd70937SKrzysztof Kozlowski    |        |         |    |         |
46*1dd70937SKrzysztof Kozlowski    |        |         |    |         |
47*1dd70937SKrzysztof Kozlowski    |        |         |    |         |
48*1dd70937SKrzysztof Kozlowski  0-|   -----+         +----+         +----
49*1dd70937SKrzysztof Kozlowski    +---0----1----2----3----4----5----6------------> time (s)
50