LEDs on ALIX.3D3

LEDs on ALIX.3D3

LEDs on ALIX.3D3

As most of the ALIX boards, the ALIX.3D3 has 3 general purpose LEDs. There is kernel support for them, but there are problems when the board has a Award BUIS as the ALIX.3D3. After reading the datasheet of the AMD CS5536 Geode companion about initialisation and use of the general purpose pins I got it finally running!

There are 2 problems with Award BIOS. On the one hand it contains no parseable string referring to the board, so the auto detection of the board in driver doesn’t work and the initialisation of at least 1 LEDs is wrong. The first problem is easy to solve, by forcing the kernel to load the driver. For the second problem I wrote a small kernel patch (see Update at the end of the post): leds-alix2 kernel patch for 2.6.29

So how to get them running? First of all we need to patch the Linux kernel and then active support. Download the patch to your box and run

wget http://www.twam.info/wp-content/uploads/2009/05/led.patch -O /root/leds-alix2.patch
cd /usr/src/linux
patch -p1 < /root/leds-alix2.patch

Now run kernel configuration and select

Device Drivers  --->
   [*] LED Support  --->
      <*>   LED Class Support
            *** LED drivers ***
      <*>   LED Support for ALIX.2 and ALIX.3 series
            *** LED Triggers ***
      [*]   LED Trigger support
      <*>     LED Timer Trigger
      <*>     LED Heartbeat Trigger
      <*>     LED Default ON Trigger

compile the kernel and adjust the kernel boot line by adding leds-alix2.force=1 to force the kernel to load the driver. If you use GRUB append it to the kernel line in /boot/grub.menu.lst:

kernel /boot/vmlinuz root=/dev/sda2 lxfb.mode_option=1280x1024@60 leds-alix2.force=1

After rebooting, dmesg should show something like

[    2.819802] leds_alix2: forced to skip BIOS test, assume system has ALIX.2 style LEDs
[    2.833003] Registered led device: alix:1
[    2.845860] Registered led device: alix:2
[    2.858804] Registered led device: alix:3

and you should be able to able to switch on/off the LEDs for example by

echo 1 > /sys/class/leds/alix\:3/brightness
sleep 5
echo 0 > /sys/class/leds/alix\:3/brightness

LED 3 should lit up for 5 seconds. If it’s working it’s time to test some triggers. Try

echo heartbeat > /sys/class/leds/alix\:2/trigger

LED 2 should blink like:   pulse – short pause – pulse – long pause – pulse – short pause – …

Another trigger is timer:

echo timer  > /sys/class/leds/alix\:1/trigger
echo 1000 > /sys/class/leds/alix\:1/delay_on
echo 100 > /sys/class/leds/alix\:1/delay_on

should activate the LED for 1000ms and then switch it off for 100ms and start again. I enabled this 2 triggers and made a simple demo video:

Update: In kernel 2.6.31 the patch isn’t required anymore, as it was accepted in the mainline.

If you like this article, feel free to flattr it:

May08