R/G/B/X LEDs using stock Ubuntu 24.04

Hi all,
I'm trying to figure out how to enable control of the additional LEDs next to the ethernet port on the UP4000.
I'm trying to not install any specific UP board kernel to make this happen - as these will likely be deployed and required to be supported by us for 5-8 years - likely beyond the timeframe of supported software released by UP....
Is there a way to enable certain GPIOs directly to allow this to work?
I notice at the moment, I can see:
# ls -l /sys/class/leds total 0 lrwxrwxrwx 1 root root 0 May 8 06:20 enp2s0-0::lan -> ../../devices/pci0000:00/0000:00:13.1/0000:02:00.0/net/enp2s0/enp2s0-0::lan lrwxrwxrwx 1 root root 0 May 8 06:20 enp2s0-1::lan -> ../../devices/pci0000:00/0000:00:13.1/0000:02:00.0/net/enp2s0/enp2s0-1::lan lrwxrwxrwx 1 root root 0 May 8 06:20 enp2s0-2::lan -> ../../devices/pci0000:00/0000:00:13.1/0000:02:00.0/net/enp2s0/enp2s0-2::lan
... and it does look like at least some of the GPIO control is available with the stock Ubuntu 24.04 kernel:
# ls -l /sys/class/gpio/ total 0 --w------- 1 root root 4096 May 9 06:21 export lrwxrwxrwx 1 root root 0 May 8 06:20 gpiochip512 -> ../../devices/platform/INT3452:00/gpio/gpiochip512 lrwxrwxrwx 1 root root 0 May 8 06:20 gpiochip590 -> ../../devices/platform/INT3452:01/gpio/gpiochip590 lrwxrwxrwx 1 root root 0 May 8 06:20 gpiochip667 -> ../../devices/platform/INT3452:02/gpio/gpiochip667 lrwxrwxrwx 1 root root 0 May 8 06:20 gpiochip714 -> ../../devices/platform/INT3452:03/gpio/gpiochip714 --w------- 1 root root 4096 May 9 06:21 unexport
Right now, I'm only looking to get basic ON / OFF support working - but it would likely be good to register them as normal LEDs to allow some of the effects to work...
Answers
-
Hi @SteveInAU
Please install the Pinctrl, and refer to the link.
https://github.com/up-division/pinctrl-upboardhttps://github.com/up-board/up-community/wiki/How-to-use-the-peripherals-on-40-Pin-Header
Best Regards,
Harry Chiu -
Hi @SteveInAU
The Pinctrl driver can only control Y/R/G leds.
If you want to control the blue led, can control it via GPIO, number is 585.Best Regards,
Harry Chiu -
Hello Harry Chiu,
The directions at https://github.com/up-division/pinctrl-upboard are no longer correct.
The Pinctrl driver does not allow access to the leds. If we follow:
https://github.com/up-board/up-community/wiki/How-to-use-the-peripherals-on-40-Pin-Header$ ls -l /sys/class/leds
clearly shows that a 'upboard' folder was not created and thus not possible to perform:
$ echo 1 > /sys/class/leds/upboard:green:/brightnessAlso, exporting 585 and changing the value does nothing.
Furthermore, exporting GPIOs only seems to work with Rpi GPIO numbering. For example, with respect to physical pin 19:
$ echo 422 > /sys/class/gpio/export <=== Fails
$ echo 10 > /sys/class/gpio/export <=== WorksMy UP4000 build uses: Ubuntu 24.04, 6.11.0-28-generic, dkms installed, and Pinctrl driver installed
-
After installing pinctrl, will gpiochip0 appear under /sys/class/gpio/??
Best Regards,
Harry Chiu