Skip to content
Tomas Hlavacek edited this page Jun 27, 2016 · 2 revisions

Omnia LED driver

Driver architecture

There is an ARM Cortex-M0 MCU. The MCU drives common PWM signal for all LEDs (global brightness settings) and RGB signals for 3x STP16CPC26PTR LED drivers connected in SPI daisy-chain.

The MCU has the I2C command interface that is connected to the main CPU. The MCU has two slave adresses: 0x2a and 0x2b. The first should be used by userspace utilities that are not related to LEDs. The second address should be used by the LED kernel driver.

The kernel LED driver implements standard LED driver kernel interface. It can be manually configured through the /sys interface.

Moreover there are additional files in the /sys filesystem that allow setting of non-standard features: Global brightness, color of the LEDs (all LEDs are RGB) and autonomous operation

Kernel LED driver sysfs interface

LED names

LED 0 = user2
LED 1 = user1
LED 2 = pci3
LED 3 = pci2
LED 4 = pci1
LED 5 = wan
LED 6 = lan4
LED 7 = lan3
LED 8 = lan2
LED 9 = lan1
LED 10 = lan0
LED 11 = power
LED 12 = all

The names corresponds to the symbols on the prototype aluminium enclosure.

Sysfs interface

The sysfs interface is accessible in the following path for each LED: /sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/i2c-1/1-002b/leds/omnia-led:<name>/

The available files are:

  • autonomous - Read/write bool (1 or 0). autonomous=1 -> the kernel LED interface commands are ignored and the MCU blinks autonomously according to default LED mapping; autonomous=0 -> kernel LED driver drives the LED.
  • color - Read/write tuple of three bytes representing R G and B color fill in decimal format.
  • brightness - Standard LED interface to get/set the brightness manually.
  • trigger - Standard LED interface to get/set the kernel trigger.

In addition to that we have the global brightness (or global brightness limit) which is value from 0 to 100 (roughly in %, but it is the PWM ratio and the brightness seems to be non-linear). The global brightness get/set file is /sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/i2c-1/1-002b/global_brightness.

Examples

Set user1 LED to kernel driver mode

echo 0 > /sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/i2c-1/1-002b/leds/omnia-led:user1/autonomous

Set color of user1 LED to green

echo "0 255 0" > /sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/i2c-1/1-002b/leds/omnia-led:user1/color

Set a mmc0 trigger to user1 LED

echo mmc0 > /sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/i2c-1/1-002b/leds/omnia-led:user1/trigger