[PATCH v2 3/3] Input: gpio-keys - add EV_REL event type support
From: Xiong Nandi
Date: Sun Mar 22 2026 - 07:37:46 EST
The polled path handles EV_REL but the interrupt path silently
ignores it. Widen the type check so EV_REL goes through the same
reporting and shared-counter logic as EV_ABS.
Signed-off-by: Xiong Nandi <xndchn@xxxxxxxxx>
---
drivers/input/keyboard/gpio_keys.c | 6 +++---
include/linux/gpio_keys.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 4cbfd5a273bd..652a6932c52f 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -375,7 +375,7 @@ static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
return;
}
- if (type == EV_ABS) {
+ if (type == EV_ABS || type == EV_REL) {
if (state && !bdata->axis_active) {
bdata->axis_active = true;
atomic_inc(bdata->axis_count);
@@ -960,13 +960,13 @@ static int gpio_keys_probe(struct platform_device *pdev)
fwnode_handle_put(child);
- /* Allocate shared axis counters for EV_ABS buttons */
+ /* Allocate shared axis counters for EV_ABS/EV_REL buttons */
for (i = 0; i < pdata->nbuttons; i++) {
struct gpio_button_data *bdata = &ddata->data[i];
unsigned int type = bdata->button->type ?: EV_KEY;
int j;
- if (type != EV_ABS)
+ if (type != EV_ABS && type != EV_REL)
continue;
/* Reuse counter from an earlier button with same (type, code) */
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index 80fa930b04c6..75a745a32fe1 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -13,13 +13,13 @@ struct device;
* @active_low: %true indicates that button is considered
* depressed when gpio is low
* @desc: label that will be attached to button's gpio
- * @type: input event type (%EV_KEY, %EV_SW, %EV_ABS)
+ * @type: input event type (%EV_KEY, %EV_SW, %EV_ABS, %EV_REL)
* @wakeup: configure the button as a wake-up source
* @wakeup_event_action: event action to trigger wakeup
* @debounce_interval: debounce ticks interval in msecs
* @can_disable: %true indicates that userspace is allowed to
* disable button via sysfs
- * @value: axis value for %EV_ABS
+ * @value: axis value for %EV_ABS/%EV_REL
* @irq: Irq number in case of interrupt keys
* @wakeirq: Optional dedicated wake-up interrupt
*/
--
2.25.1