Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92a47674 authored by Alexander Stein's avatar Alexander Stein Committed by Dmitry Torokhov
Browse files

Input: gpio_keys - add support for EV_ABS



With this patch you can setup a group of GPIOs representing a specific
position on an EV_ABS axis.

Signed-off-by: default avatarAlexander Stein <alexander.stein@informatik.tu-chemnitz.de>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent def179c2
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -324,7 +324,12 @@ static void gpio_keys_report_event(struct gpio_button_data *bdata)
	unsigned int type = button->type ?: EV_KEY;
	unsigned int type = button->type ?: EV_KEY;
	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;
	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;


	if (type == EV_ABS) {
		if (state)
			input_event(input, type, button->code, button->value);
	} else {
		input_event(input, type, button->code, !!state);
		input_event(input, type, button->code, !!state);
	}
	input_sync(input);
	input_sync(input);
}
}


@@ -363,7 +368,7 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
					 struct gpio_button_data *bdata,
					 struct gpio_button_data *bdata,
					 struct gpio_keys_button *button)
					 struct gpio_keys_button *button)
{
{
	char *desc = button->desc ? button->desc : "gpio_keys";
	const char *desc = button->desc ? button->desc : "gpio_keys";
	struct device *dev = &pdev->dev;
	struct device *dev = &pdev->dev;
	unsigned long irqflags;
	unsigned long irqflags;
	int irq, error;
	int irq, error;
+4 −3
Original line number Original line Diff line number Diff line
@@ -3,14 +3,15 @@


struct gpio_keys_button {
struct gpio_keys_button {
	/* Configuration parameters */
	/* Configuration parameters */
	int code;		/* input event code (KEY_*, SW_*) */
	unsigned int code;	/* input event code (KEY_*, SW_*) */
	int gpio;
	int gpio;
	int active_low;
	int active_low;
	char *desc;
	const char *desc;
	int type;		/* input event type (EV_KEY, EV_SW) */
	unsigned int type;	/* input event type (EV_KEY, EV_SW, EV_ABS) */
	int wakeup;		/* configure the button as a wake-up source */
	int wakeup;		/* configure the button as a wake-up source */
	int debounce_interval;	/* debounce ticks interval in msecs */
	int debounce_interval;	/* debounce ticks interval in msecs */
	bool can_disable;
	bool can_disable;
	int value;		/* axis value for EV_ABS */
};
};


struct gpio_keys_platform_data {
struct gpio_keys_platform_data {