TS-7970 LEDs

From embeddedTS Manuals
Revision as of 17:26, 17 January 2022 by Lionel (talk | contribs) (Links auto-updated for 2022 re-branding ( https://github.com/embeddedarm/linux-3.10.17-imx6/blob/master/Documentation/leds/ledtrig-transient.txt →‎ https://github.com/embeddedTS/linux-3.10.17-imx6/blob/master/Documentation/leds/ledtrig-transient.txt https://github.com/embeddedarm/linux-3.10.17-imx6/blob/master/Documentation/leds/ledtrig-oneshot.txt →‎ https://github.com/embeddedTS/linux-3.10.17-imx6/blob/master/Documentation/leds/ledtrig-oneshot.txt))

The kernel provides access to control the LEDs using the sysfs:

# Set Red led on
echo 1 > /sys/class/leds/red-led/brightness
# Set Red led off
echo 0 > /sys/class/leds/red-led/brightness

# Set Green led on
echo 1 > /sys/class/leds/green-led/brightness
# Set Green led off
echo 0 > /sys/class/leds/green-led/brightness

The kernel provides various triggers that can be useful for debugging purposes. The trigger for a given LED is in its directory:

echo "heartbeat" > /sys/class/leds/red-led/trigger
Trigger value LED toggles on
none Default, no action
mmc0 MicroSD card activity
mmc1 eMMC activity
mmc2 WIFI SDIO activity
timer 2hz blink
oneshot Blinks after delay. [1]
heartbeat Similar to timer, but varies the period based on system load
backlight Toggles on FB_BLANK
gpio Toggle based on a specified gpio. [2]
cpu0 Blink on CPU core 0 activity
cpu1 Blink on CPU core 1 activity
cpu2 Blink on CPU core 2 activity
cpu3 Blink on CPU core 3 activity
default-on Only turns on by default. Only useful for device tree.
transient Specify on/off with time to turn off. [3]
flash/torch Toggle on Camera activation. Not currently used.
  1. See the Kernel documentation for more details
  2. When this trigger is set, a "gpio" file appears in the same directory which can be used to specify what GPIO to follow when it blinks
  3. See the Kernel documentation for more details