Skip to content

Rewrite GPIO LED trigger to use trigger-sources

Linus Walleij linux-devicetree linux-gpio linux-leds 2 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected] change-id 20230911-gpio-led-trigger-dt-922bbe21fa22

Versions newest first

  1. v2 Latest3 patches 3 repliesApplied
  2. v12 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- Add a quirk to gpiolib-of to allow to read out trigger-sources as
any regular GPIO.
- Fix a use-after-free bug found by Dan Carpenter.
- Tested on hardware.
- Link to v1: https://lore.kernel.org/r/[email protected]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/3gpiolib: of: Allow "trigger-sources" to reference a GPIOdrivers/gpio/gpiolib-of.c+28 -02 replies
2/3dt-bindings: leds: Mention GPIO triggersDocumentation/devicetree/bindings/leds/common.yaml+2 -00 replies
3/3leds: triggers: gpio: Rewrite to use trigger-sourcesdrivers/leds/trigger/Kconfig drivers/leds/trigger/ledtrig-gpio.c+41 -1010 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchConor Dooley
1/3
2/3A-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/3] Rewrite GPIO LED trigger to use trigger-sources

This rewrites the platform-data GPIO LED trigger to instead use fwnode trigger-sources to describe the LED used.

This will work out-of-the-box with e.g. device tree.

Tested with real hardware by modifying a device tree adding trigger-sources to a LED and trigger-source-cells to a gpio chip, setting the trigger to a pushbutton. It works like a charm, once the trigger is set to "gpio".

Adding trigger-sources to GPIO chips in a simple way requires this patch to be merged to the generic dtschema:
https://lore.kernel.org/linux-devicetree/[email protected]/

---
Changes in v2:
- Add a quirk to gpiolib-of to allow to read out trigger-sources as
any regular GPIO.
- Fix a use-after-free bug found by Dan Carpenter.
- Tested on hardware.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Linus Walleij (3):
gpiolib: of: Allow "trigger-sources" to reference a GPIO
dt-bindings: leds: Mention GPIO triggers
leds: triggers: gpio: Rewrite to use trigger-sources

 Documentation/devicetree/bindings/leds/common.yaml |   2 +
 drivers/gpio/gpiolib-of.c                          |  28 +++++
 drivers/leds/trigger/Kconfig                       |   5 +-
 drivers/leds/trigger/ledtrig-gpio.c                | 137 ++++++---------------
 4 files changed, 71 insertions(+), 101 deletions(-)

---
base-commit: 8eb1c4d9b44873d30efc1846148944534f4a017d
change-id: 20230911-gpio-led-trigger-dt-922bbe21fa22

Best regards,

Signature · 1 line
Linus Walleij <[email protected]>