patches/openwrt/kernel: Update Turris Omnia 5.15 patches (LEDs + MCU)
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 --wakeupoption, for exampleoromnia-mcutool --wakeup '+10 hours'omnia-mcutool --wakeup '2023-10-19 08:00'
With upgraded MCU firmware the updated LED driver now supports:
- enabling/disabling LED gamma correction with
or
echo 1 >/sys/bus/i2c/devices/1-002b/gamma_correctionThe 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,echo 0 >/sys/bus/i2c/devices/1-002b/gamma_correction - the LED panel global brightness file
/sys/bus/i2c/devices/1-002b/brightnesscan now be polled for changes using theepoll()system call. It will emit aMODIFYevent when the user changes the brightness by pressing the front button. This will be used inrainbow-ng'sbutton-syncdaemon. Currently thebutton-sync.shscript 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-keysdriver). This is done by executingTo configure the default option (pressing front button dimms the front LEDs panel), executeecho cpu >/sys/bus/i2c/devices/1-002a/front_button_modeecho 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:
Now to disable USB port power
cd /sys/class/gpio echo 456 >export cd '/sys/class/gpio/gpio456.Front USB3 port power'and to enable it backecho 0 >valueecho 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