-
Notifications
You must be signed in to change notification settings - Fork 5
Omnia LED driver
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
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.
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
.
echo 0 > /sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/i2c-1/1-002b/leds/omnia-led:user1/autonomous
echo "0 255 0" > /sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/i2c-1/1-002b/leds/omnia-led:user1/color
echo mmc0 > /sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/i2c-1/1-002b/leds/omnia-led:user1/trigger