leds: trigger: Add new LED Input events trigger
v3 cover leds: trigger: Add new LED Input events trigger
Hi All,
While looking into a driver for the backlight for the 3 menu / home / back capacitive-touch buttons found on the bottom bezel of the Xiaomi Pad 2 tablet I decided rather then to write a custom driver just for this it would be better to solve this in a generic way which can be reused on other devices since having such capactive touch buttons on the bottom bezel is quite normal for somewhat older phones and tablets.
So here is a patch adding a new trigger which turns LEDs on when there is input (/dev/input/event*) activity and turns them back off again after there has been no activity for 5 seconds. This trigger can then be used to control the LEDs backlighting these kind of capactive touch buttons and it may also be useful to control keyboard backlighting in some cases.
Changes in v3:
- Rebase on v6.10-rc1
- Use kzalloc(sizeof(*handle), ...)
Changes in v2:
- Add MODULE_ALIAS() for module auto-loading
- Stop using the led-trigger.c private trigger->led_cdevs list
Regards,
Hans
Hans de Goede (1):
leds: trigger: Add new LED Input events trigger
drivers/leds/trigger/Kconfig | 16 ++ drivers/leds/trigger/Makefile | 1 + drivers/leds/trigger/ledtrig-input-events.c | 233 ++++++++++++++++++++ 3 files changed, 250 insertions(+) create mode 100644 drivers/leds/trigger/ledtrig-input-events.c
Signature · 1 line
2.45.1
PATCH v3 1/1 leds: trigger: Add new LED Input events trigger
Add a new trigger which turns LEDs on when there is input (/dev/input/event*) activity and turns them back off again after there has been no activity for 5 seconds.
This is primarily intended to control LED devices which are a backlight for capacitive touch-buttons, such as e.g. the menu / home / back buttons found on the bottom bezel of many somewhat older smartphones and tablets.
This can also be used to turn on the keyboard backlight LED on input events and turn the keyboard backlight off again when idle.
---
Changes in v3:
- Use kzalloc(sizeof(*handle), ...)
Changes in v2:
- Add MODULE_ALIAS() for module auto-loading
- Stop using the led-trigger.c private trigger->led_cdevs list
--- drivers/leds/trigger/Kconfig | 16 ++ drivers/leds/trigger/Makefile | 1 + drivers/leds/trigger/ledtrig-input-events.c | 233 ++++++++++++++++++++ 3 files changed, 250 insertions(+) create mode 100644 drivers/leds/trigger/ledtrig-input-events.c
drivers/leds/trigger/Kconfig +16 -0
@@ -145,4 +145,20 @@ config LEDS_TRIGGER_TTY When build as a module this driver will be called ledtrig-tty. +config LEDS_TRIGGER_INPUT_EVENTS + tristate "LED Input events trigger" + depends on INPUT + help + Turn LEDs on when there is input (/dev/input/event*) activity and turn + them back off again after there has been no activity for 5 seconds. + + This is primarily intended to control LEDs which are a backlight for + capacitive touch-buttons, such as e.g. the menu / home / back buttons + found on the bottom bezel of many older smartphones and tablets. + + This can also be used to turn on the keyboard backlight LED on + input events and turn the keyboard backlight off again when idle. + + When build as a module this driver will be called ledtrig-input-events. + endif # LEDS_TRIGGERS
drivers/leds/trigger/Makefile +1 -0
@@ -15,3 +15,4 @@ obj-$(CONFIG_LEDS_TRIGGER_PANIC) += ledtrig-panic.o obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o obj-$(CONFIG_LEDS_TRIGGER_PATTERN) += ledtrig-pattern.o obj-$(CONFIG_LEDS_TRIGGER_TTY) += ledtrig-tty.o +obj-$(CONFIG_LEDS_TRIGGER_INPUT_EVENTS) += ledtrig-input-events.o
drivers/leds/trigger/ledtrig-input-events.c new file +233 -0
233 lines not on this page · raw message
Signature · 1 line
2.45.1
Re: (subset) [PATCH v3 1/1] leds: trigger: Add new LED Input events trigger
Quoted 9 lines · Hans de Goede
Add a new trigger which turns LEDs on when there is input (
/dev/input/event*) activity and turns them back off again after there has been no activity for 5 seconds.This is primarily intended to control LED devices which are a backlight for capacitive touch-buttons, such as e.g. the menu / home / back buttons found on the bottom bezel of many somewhat older smartphones and tablets.
[...]
Applied, thanks!
[1/1] leds: trigger: Add new LED Input events trigger
commit: 005408af25d5550e1bd22a18bf371651969c17ee
--
Lee Jones [李琼斯]