Control On-board LEDs

So there’s still not a solution for this? :(( The green LED while power on is really bright and it could degrade with such brigthness I think and I want to have a better control over them so I can make them blink on wifi activity for example or storage I/O.

Why not using the gpio with an additional led+resistor?

My case has special like holes for those 3 LEDs and the green LED is too bright but yeah I will try to put a led with resistor.


I’m so sorry that I write in this old subject, but I need exactly the same - have possibility to turn on/off system LEDs. I try to setup automatic configuration for BPI-R2 and I want to use this system LEDs to inform about the setup process finished. I would use sound but I cant find any speaker on this board. I can’t use any additional LEDs and resistors to connect it to GPIO port :frowning: @linkerosa Are you will be able to show me how I can use this mentioned by you? In /sys/devices/platform/ I have only mediatek,dummy_codec/, mediatek,mt7623_audio/, mediatek,mt7623_dai/, mt8173-cpufreq/ regarded to mediatek.

the leds itself seems to be mapped here: /sys/class/leds/ as



but currently i have no idea, how to control them

mt6323 pmic has three leds , they can be found on bpi r2 board

you need to add them to dts and enable them in kconfig, as they’re done in upstream kernel

and how to use ?

on =>

echo 1 > /sys/class/leds/bpi-r2:isink:green/brightness

off =>

echo 0 > /sys/class/leds/bpi-r2:isink:green/brightness

blink =>

echo timer > /sys/class/leds/bpi-r2:isink:green/trigger

change blink frequency (on and off time in ms) =>

echo 100 > /sys/class/leds/bpi-r2:isink:green/delay_on

echo 100 > /sys/class/leds/bpi-r2:isink:green/delay_off

1 Like

thank you @linkerosa

works in my tests…red and blue simply going on with “echo 1”, green blinks in nearly 1s period (~500ms on and ~500ms off)

brightness sounds like a float-value, right? can it be dimmed?

delay-values are not existing in my system (4.14.34), tried to create => permission denied

btw. i had thought, that the leds are these next to gpio, but these are the leds near power-socket

OK, thanks all for exploration. Now, I have only this:

root@bpi-iot-ros-img:~# ls -l /sys/class/leds/
total 0
lrwxrwxrwx 1 root root 0 Apr 17 16:51 input4::capslock -> ../../devices/platform/1a1c0000.usb/usb1/1-1/1-1:1.0/0003:03F0:064A.0003/input/input4/input4::capslock
lrwxrwxrwx 1 root root 0 Apr 17 16:51 input4::numlock -> ../../devices/platform/1a1c0000.usb/usb1/1-1/1-1:1.0/0003:03F0:064A.0003/input/input4/input4::numlock
lrwxrwxrwx 1 root root 0 Apr 17 16:51 input4::scrolllock -> ../../devices/platform/1a1c0000.usb/usb1/1-1/1-1:1.0/0003:03F0:064A.0003/input/input4/input4::scrolllock

Because I use original kernel from Ubuntu image 1.2.1 (recompalied to have build in sata and raid support):

root@bpi-iot-ros-img:~# uname -a
Linux bpi-iot-ros-img 4.4.70-BPI-R2-Kernel

It is true?

/sys/class/leds/bpi-r2:isink:green/brightness can be 1 ~ 6

after you have to input echo timer > /sys/class/leds/bpi-r2:isink:green/trigger

and then the entires




can appear

can blinking disabled? i have echoed timer to trigger, now the delay_on and delay_off node are visible, but i see no difference when i change the values. if i enable these noedes first the green led flickers strange with different times

green is brighter that the other 2

@frank-w In which of your kernel version these system LEDs are supported?

as i wrote above…4.14.34…should be supported also in earlier 4.14.x

Thanks @frank-w and sorry, but I’m not catched this detail. Could you share the link for the sources of this kernel(s)?

blinking can be disabled by echo 0 > /sys/class/leds/bpi-r2:isink:green/brightness

frequency can changes, you can try

echo 100 > /sys/class/leds/bpi-r2:isink:green/delay_on

echo 100 > /sys/class/leds/bpi-r2:isink:green/delay_off


echo 1000 > /sys/class/leds/bpi-r2:isink:green/delay_on

echo 100 > /sys/class/leds/bpi-r2:isink:green/delay_off

and compare what diffrences between the two set of commands

It seems hardware characteristics. i have checked the hardware value written by the driver, it indeed to writing the same value to their leds registers but there’s brightness differences

:stuck_out_tongue: then the led is off :wink: i want a steady-on

with 100/1000 i see no difference…tried with 10/1000 …there is a difference

echo 1 > /sys/class/leds/bpi-r2:isink:green/brightness

it is steady on on my setup …

[11:45] root@bpi-r2:~# L=/sys/class/leds/bpi-r2\:isink
[12:05] root@bpi-r2:~# echo 0 > $L:green/brightness                 #goes off 
[12:05] root@bpi-r2:~# echo 1 > $L:green/brightness                 #starts blinking

weird. it is different with my test.

echo 0 (to cancel blinking), and then echo 1 , i can get a always steady on

how about the other two leds ?

driver should use the same programming to those leds

the other 2 (red/blue) go on (1) and off (0), no blinking

timing with delay-nodes ist strange anyway…hard to describe

i see no difference between red,blue and green:

btw. i have HW rev 1.1 (if it matters), running debian 8 on my test-system with kernel 4.14.34