linux/Documentation/ABI/testing/sysfs-class-led-trigger-pattern
Martin Kurbanov aa172ba739 leds: trigger: pattern: Add support for hrtimer
Currently, led pattern trigger uses timer_list to schedule brightness
changing. As we know from timer_list API [1], it's not accurate to
milliseconds and depends on HZ granularity.

Example:
"0 10 0 0 50 10 50 0 100 10 100 0 150 10 150 0 200 10 200 0 250 10 250 0",
we expect it to be 60ms long, but it can actually be up to ~120ms
(add ~10ms for each pattern when HZ == 100).

But sometimes, userspace needs time accurate led patterns to make sure
that pattern will be executed during expected time slot.
To achieve this goal the patch introduces optional hrtimer usage for
led trigger pattern, because hrtimer is microseconds accurate timer.

[1]: kernel/time/timer.c#L104

Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
Link: https://lore.kernel.org/r/20240416201847.357099-1-mmkurbanov@salutedevices.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-02 17:32:01 +01:00

51 lines
1.7 KiB
Plaintext

What: /sys/class/leds/<led>/pattern
Date: September 2018
KernelVersion: 4.20
Description:
Specify a software pattern for the LED, that supports altering
the brightness for the specified duration with one software
timer. It can do gradual dimming and step change of brightness.
The pattern is given by a series of tuples, of brightness and
duration (ms).
The exact format is described in:
Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt
What: /sys/class/leds/<led>/hr_pattern
Date: April 2024
Description:
Specify a software pattern for the LED, that supports altering
the brightness for the specified duration with one software
timer. It can do gradual dimming and step change of brightness.
Unlike the /sys/class/leds/<led>/pattern, this attribute runs
a pattern on high-resolution timer (hrtimer).
What: /sys/class/leds/<led>/hw_pattern
Date: September 2018
KernelVersion: 4.20
Description:
Specify a hardware pattern for the LED, for LED hardware that
supports autonomously controlling brightness over time, according
to some preprogrammed hardware patterns. It deactivates any active
software pattern.
Since different LED hardware can have different semantics of
hardware patterns, each driver is expected to provide its own
description for the hardware patterns in their documentation
file at Documentation/leds/.
What: /sys/class/leds/<led>/repeat
Date: September 2018
KernelVersion: 4.20
Description:
Specify a pattern repeat number. -1 means repeat indefinitely,
other negative numbers and number 0 are invalid.
This file will always return the originally written repeat
number.
It should be noticed that some leds, like EL15203000 may
only support indefinitely patterns, so they always store -1.