]> git.itanic.dy.fi Git - linux-stable/commit
leds: triggers: gpio: Rewrite to use trigger-sources
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 26 Sep 2023 21:48:13 +0000 (23:48 +0200)
committerLee Jones <lee@kernel.org>
Wed, 1 Nov 2023 11:28:58 +0000 (11:28 +0000)
commit4a11dbf04f31c71eb458c062129e95b7aa308464
tree38e82c600838e2d32ac66e259cfab6c27f4f1ff6
parentf9be4d5bb62ab41723db04d7b3abed2ad6c34825
leds: triggers: gpio: Rewrite to use trigger-sources

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: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230926-gpio-led-trigger-dt-v2-3-e06e458b788e@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/trigger/Kconfig
drivers/leds/trigger/ledtrig-gpio.c