xref: /freebsd-src/sys/contrib/device-tree/Bindings/leds/leds-trigger-pattern.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel Vadot* Pattern format for LED pattern trigger
2*c66ec88fSEmmanuel Vadot
3*c66ec88fSEmmanuel VadotThe pattern is given by a series of tuples, of brightness and duration (ms).
4*c66ec88fSEmmanuel VadotThe LED is expected to traverse the series and each brightness value for the
5*c66ec88fSEmmanuel Vadotspecified duration. Duration of 0 means brightness should immediately change to
6*c66ec88fSEmmanuel Vadotnew value, and writing malformed pattern deactivates any active one.
7*c66ec88fSEmmanuel Vadot
8*c66ec88fSEmmanuel Vadot1. For gradual dimming, the dimming interval now is set as 50 milliseconds. So
9*c66ec88fSEmmanuel Vadotthe tuple with duration less than dimming interval (50ms) is treated as a step
10*c66ec88fSEmmanuel Vadotchange of brightness, i.e. the subsequent brightness will be applied without
11*c66ec88fSEmmanuel Vadotadding intervening dimming intervals.
12*c66ec88fSEmmanuel Vadot
13*c66ec88fSEmmanuel VadotThe gradual dimming format of the software pattern values should be:
14*c66ec88fSEmmanuel Vadot"brightness_1 duration_1 brightness_2 duration_2 brightness_3 duration_3 ...".
15*c66ec88fSEmmanuel VadotFor example (using sysfs interface):
16*c66ec88fSEmmanuel Vadot
17*c66ec88fSEmmanuel Vadotecho 0 1000 255 2000 > pattern
18*c66ec88fSEmmanuel Vadot
19*c66ec88fSEmmanuel VadotIt will make the LED go gradually from zero-intensity to max (255) intensity in
20*c66ec88fSEmmanuel Vadot1000 milliseconds, then back to zero intensity in 2000 milliseconds:
21*c66ec88fSEmmanuel Vadot
22*c66ec88fSEmmanuel VadotLED brightness
23*c66ec88fSEmmanuel Vadot    ^
24*c66ec88fSEmmanuel Vadot255-|       / \            / \            /
25*c66ec88fSEmmanuel Vadot    |      /    \         /    \         /
26*c66ec88fSEmmanuel Vadot    |     /       \      /       \      /
27*c66ec88fSEmmanuel Vadot    |    /          \   /          \   /
28*c66ec88fSEmmanuel Vadot  0-|   /             \/             \/
29*c66ec88fSEmmanuel Vadot    +---0----1----2----3----4----5----6------------> time (s)
30*c66ec88fSEmmanuel Vadot
31*c66ec88fSEmmanuel Vadot2. To make the LED go instantly from one brightness value to another, we should
32*c66ec88fSEmmanuel Vadotuse zero-time lengths (the brightness must be same as the previous tuple's). So
33*c66ec88fSEmmanuel Vadotthe format should be: "brightness_1 duration_1 brightness_1 0 brightness_2
34*c66ec88fSEmmanuel Vadotduration_2 brightness_2 0 ...".
35*c66ec88fSEmmanuel VadotFor example (using sysfs interface):
36*c66ec88fSEmmanuel Vadot
37*c66ec88fSEmmanuel Vadotecho 0 1000 0 0 255 2000 255 0 > pattern
38*c66ec88fSEmmanuel Vadot
39*c66ec88fSEmmanuel VadotIt will make the LED stay off for one second, then stay at max brightness for
40*c66ec88fSEmmanuel Vadottwo seconds:
41*c66ec88fSEmmanuel Vadot
42*c66ec88fSEmmanuel VadotLED brightness
43*c66ec88fSEmmanuel Vadot    ^
44*c66ec88fSEmmanuel Vadot255-|        +---------+    +---------+
45*c66ec88fSEmmanuel Vadot    |        |         |    |         |
46*c66ec88fSEmmanuel Vadot    |        |         |    |         |
47*c66ec88fSEmmanuel Vadot    |        |         |    |         |
48*c66ec88fSEmmanuel Vadot  0-|   -----+         +----+         +----
49*c66ec88fSEmmanuel Vadot    +---0----1----2----3----4----5----6------------> time (s)
50