• Marek Behún's avatar
    leds: turris-omnia: Support HW controlled mode via private trigger · cbd6954f
    Marek Behún authored
    Add support for enabling MCU controlled mode of the Turris Omnia LEDs
    via a LED private trigger called "omnia-mcu". Recall that private LED
    triggers will only be listed in the sysfs trigger file for LEDs that
    support them (currently there is no user of this mechanism).
    
    When in MCU controlled mode, the user can still set LED color, but the
    blinking is done by MCU, which does different things for different LEDs:
    - WAN LED is blinked according to the LED[0] pin of the WAN PHY
    - LAN LEDs are blinked according to the LED[0] output of the
      corresponding port of the LAN switch
    - PCIe LEDs are blinked according to the logical OR of the MiniPCIe port
      LED pins
    
    In the future I want to make the netdev trigger to transparently offload
    the blinking to the HW if user sets compatible settings for the netdev
    trigger (for LEDs associated with network devices).
    There was some work on this already, and hopefully we will be able to
    complete it sometime, but for now there are still multiple blockers for
    this, and even if there weren't, we still would not be able to configure
    HW controlled mode for the LEDs associated with MiniPCIe ports.
    
    In the meantime let's support HW controlled mode via the private LED
    trigger mechanism. If, in the future, we manage to complete the netdev
    trigger offloading, we can still keep this private trigger for backwards
    compatibility, if needed.
    
    We also set "omnia-mcu" to cdev->default_trigger, so that the MCU keeps
    control until the user first wants to take over it. If a different
    default trigger is specified in device-tree via the
    'linux,default-trigger' property, LED class will overwrite
    cdev->default_trigger, and so the DT property will be respected.
    Signed-off-by: default avatarMarek Behún <kabel@kernel.org>
    Link: https://lore.kernel.org/r/20230918161104.20860-4-kabel@kernel.orgSigned-off-by: default avatarLee Jones <lee@kernel.org>
    cbd6954f
Kconfig 27.5 KB