• Linus Walleij's avatar
    leds: triggers: gpio: Rewrite to use trigger-sources · 4a11dbf0
    Linus Walleij authored
    By providing a GPIO line as "trigger-sources" in the FWNODE
    (such as from the device tree) and combining with the
    GPIO trigger, we can support a GPIO LED trigger in a natural
    way from the hardware description instead of using the
    custom sysfs and deprecated global GPIO numberspace.
    
    Example:
    
    gpio: gpio@0 {
        compatible "my-gpio";
        gpio-controller;
        #gpio-cells = <2>;
        interrupt-controller;
        #interrupt-cells = <2>;
        #trigger-source-cells = <2>;
    };
    
    leds {
        compatible = "gpio-leds";
        led-my-gpio {
            label = "device:blue:myled";
            gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
            default-state = "off";
            linux,default-trigger = "gpio";
            trigger-sources = <&gpio 1 GPIO_ACTIVE_HIGH>;
        };
    };
    
    Make this the norm, unmark the driver as broken.
    
    Delete the sysfs handling of GPIOs.
    
    Since GPIO descriptors inherently can describe inversion,
    the inversion handling can just be deleted.
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Link: https://lore.kernel.org/r/20230926-gpio-led-trigger-dt-v2-3-e06e458b788e@linaro.orgSigned-off-by: default avatarLee Jones <lee@kernel.org>
    4a11dbf0
Kconfig 4.44 KB