Skip to content

patches/openwrt/kernel: Update Turris Omnia 5.15 patches (LEDs + MCU)

Marek Behun requested to merge hotfix/led-updates-and-new-mcu-driver into hbk

Update Turris Omnia LED driver patches from upstream, and add pending patches to support Turris Omnia MCU.

This MCU driver adds the following abilities if the user has upgraded MCU firmware (see below as to how to do that):

  • the poweroff command now completely powers the device off (the power consumption goes to minimum). To power the router on, the user needs to press the front button,
  • the device can be configured to automatically power on from powered off state at a specific time by using the omnia-mcutool --wakeup option, for example
    omnia-mcutool --wakeup '+10 hours'
    or
    omnia-mcutool --wakeup '2023-10-19 08:00'

With upgraded MCU firmware the updated LED driver now supports:

  • enabling/disabling LED gamma correction with
    echo 1 >/sys/bus/i2c/devices/1-002b/gamma_correction
    or
    echo 0 >/sys/bus/i2c/devices/1-002b/gamma_correction
    The gamma correction table is calibrated for new Omnia boards (2020+), it may give weird colors for older boards. In the future we might add the ability to configure gamma correction table dynamically,
  • the LED panel global brightness file /sys/bus/i2c/devices/1-002b/brightness can now be polled for changes using the epoll() system call. It will emit a MODIFY event when the user changes the brightness by pressing the front button. This will be used in rainbow-ng's button-sync daemon. Currently the button-sync.sh script periodically reads the file every 2 seconds to determine if the user has changed the brightness.

The following features are supported by the MCU driver even without upgrading the MCU firmware:

  • the factory reset level can be read by
    cat /sys/bus/i2c/devices/1-002a/reset_selector
  • the front button can be configured to act as an input device (via the kmod-input-gpio-keys driver). This is done by executing
    echo cpu >/sys/bus/i2c/devices/1-002a/front_button_mode
    To configure the default option (pressing front button dimms the front LEDs panel), execute
    echo mcu >/sys/bus/i2c/devices/1-002a/front_button_mode
  • some of the MCU GPIOs are now available via /sys/class/gpio. For example we can now enable/disable power for USB ports via sysfs:
    cd /sys/class/gpio
    echo 456 >export
    cd '/sys/class/gpio/gpio456.Front USB3 port power'
    Now to disable USB port power
    echo 0 >value
    and to enable it back
    echo 1 >value

The user can upgrade the MCU firmware by executing

opkg update
opkg install omnia-mcutool
omnia-mcutool --upgrade
reboot
Edited by Marek Behun

Merge request reports