* [PATCH 1/4] devicetree: bindings: Update gpio-keys-polled with support for abs/rel axis
@ 2015-09-09 9:11 Hans de Goede
2015-09-09 9:11 ` [PATCH 2/4] devicetree: bindings: Add header file with evdev type and abs/rel code defines Hans de Goede
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Hans de Goede @ 2015-09-09 9:11 UTC (permalink / raw
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
The devicetree binding for gpio-keys-polled already allows specifying
what type of events (key / rel / abs) a button generates when pressed.
But for rel / abs axis we also need to specify which value this specific
gpio represents.
One usecase is digital joysticks / direction-pads which are hooked up to
gpio, in this case we've left and right buttons which we want to map to
EV_ABS, ABS_X and we want generate events for left with a value of -1 and
for right with a value of +1 (and similar for up / down and ABS_Y).
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
Documentation/devicetree/bindings/input/gpio-keys-polled.txt | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/input/gpio-keys-polled.txt b/Documentation/devicetree/bindings/input/gpio-keys-polled.txt
index 313abef..ab4b09b 100644
--- a/Documentation/devicetree/bindings/input/gpio-keys-polled.txt
+++ b/Documentation/devicetree/bindings/input/gpio-keys-polled.txt
@@ -13,11 +13,16 @@ Subnode properties:
- gpios: OF device-tree gpio specification.
- label: Descriptive name of the key.
- - linux,code: Keycode to emit.
+ - linux,code: Key / Axis code to emit.
Optional subnode-properties:
- linux,input-type: Specify event type this button/key generates.
If not specified defaults to <1> == EV_KEY.
+ - linux,input-value: If linux,input-type is EV_ABS or EV_REL then this
+ value is send for events this button generates when pressed.
+ EV_ABS axis will generate an event with a value of 0 when all
+ buttons with linux,input-type == EV_ABS and linux,code == axis
+ are released.
- debounce-interval: Debouncing interval time in milliseconds.
If not specified defaults to 5.
- gpio-key,wakeup: Boolean, button can wake-up the system.
--
2.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/4] devicetree: bindings: Add header file with evdev type and abs/rel code defines
2015-09-09 9:11 [PATCH 1/4] devicetree: bindings: Update gpio-keys-polled with support for abs/rel axis Hans de Goede
@ 2015-09-09 9:11 ` Hans de Goede
[not found] ` <1441789886-5868-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-09-09 9:11 ` [PATCH 4/4] ARM: dts: sun4i: inet9f-rev03: Add support for game buttons / joysticks Hans de Goede
[not found] ` <1441789886-5868-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2 siblings, 1 reply; 12+ messages in thread
From: Hans de Goede @ 2015-09-09 9:11 UTC (permalink / raw
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input, linux-arm-kernel, devicetree,
linux-sunxi, Hans de Goede
This header provides evdev constants for linux,code, and linux,input-*
properties.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
include/dt-bindings/input/evdev.h | 76 +++++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
create mode 100644 include/dt-bindings/input/evdev.h
diff --git a/include/dt-bindings/input/evdev.h b/include/dt-bindings/input/evdev.h
new file mode 100644
index 0000000..c1f7e0d
--- /dev/null
+++ b/include/dt-bindings/input/evdev.h
@@ -0,0 +1,76 @@
+/*
+ * This header provides evdev constants for linux,code, and linux,input-*
+ * properties.
+ */
+
+#ifndef _DT_BINDINGS_INPUT_LINUX_H
+#define _DT_BINDINGS_INPUT_LINUX_H
+
+/*
+ * Event types
+ */
+
+#define EV_SYN 0x00
+#define EV_KEY 0x01
+#define EV_REL 0x02
+#define EV_ABS 0x03
+#define EV_MSC 0x04
+#define EV_SW 0x05
+#define EV_LED 0x11
+#define EV_SND 0x12
+#define EV_REP 0x14
+#define EV_FF 0x15
+#define EV_PWR 0x16
+#define EV_FF_STATUS 0x17
+#define EV_MAX 0x1f
+
+/*
+ * Relative axes
+ */
+
+#define REL_X 0x00
+#define REL_Y 0x01
+#define REL_Z 0x02
+#define REL_RX 0x03
+#define REL_RY 0x04
+#define REL_RZ 0x05
+#define REL_HWHEEL 0x06
+#define REL_DIAL 0x07
+#define REL_WHEEL 0x08
+#define REL_MISC 0x09
+#define REL_MAX 0x0f
+
+/*
+ * Absolute axes
+ */
+
+#define ABS_X 0x00
+#define ABS_Y 0x01
+#define ABS_Z 0x02
+#define ABS_RX 0x03
+#define ABS_RY 0x04
+#define ABS_RZ 0x05
+#define ABS_THROTTLE 0x06
+#define ABS_RUDDER 0x07
+#define ABS_WHEEL 0x08
+#define ABS_GAS 0x09
+#define ABS_BRAKE 0x0a
+#define ABS_HAT0X 0x10
+#define ABS_HAT0Y 0x11
+#define ABS_HAT1X 0x12
+#define ABS_HAT1Y 0x13
+#define ABS_HAT2X 0x14
+#define ABS_HAT2Y 0x15
+#define ABS_HAT3X 0x16
+#define ABS_HAT3Y 0x17
+#define ABS_PRESSURE 0x18
+#define ABS_DISTANCE 0x19
+#define ABS_TILT_X 0x1a
+#define ABS_TILT_Y 0x1b
+#define ABS_TOOL_WIDTH 0x1c
+
+#define ABS_VOLUME 0x20
+
+#define ABS_MISC 0x28
+
+#endif /* _DT_BINDINGS_INPUT_LINUX_H */
--
2.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/4] input: gpio_keys_polled: input_sync once after polling all the buttons
[not found] ` <1441789886-5868-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-09-09 9:11 ` Hans de Goede
2015-09-10 17:45 ` [PATCH 1/4] devicetree: bindings: Update gpio-keys-polled with support for abs/rel axis Rob Herring
1 sibling, 0 replies; 12+ messages in thread
From: Hans de Goede @ 2015-09-09 9:11 UTC (permalink / raw
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
There is no need to do a separate input_sync per changed button. Instead
do the input_sync once after polling all the buttons.
This is a preparation patch for adding support for EV_ABS / EV_REL events.
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
drivers/input/keyboard/gpio_keys_polled.c | 88 +++++++++++++++++++++++++++----
1 file changed, 79 insertions(+), 9 deletions(-)
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index 097d721..0a80e6f 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -40,10 +40,36 @@ struct gpio_keys_polled_dev {
struct input_polled_dev *poll_dev;
struct device *dev;
const struct gpio_keys_platform_data *pdata;
+ unsigned long rel_axis_seen[BITS_TO_LONGS(REL_CNT)];
+ unsigned long abs_axis_seen[BITS_TO_LONGS(ABS_CNT)];
struct gpio_keys_button_data data[0];
};
-static void gpio_keys_polled_check_state(struct input_dev *input,
+static void gpio_keys_button_event(struct input_polled_dev *dev,
+ struct gpio_keys_button *button,
+ int state)
+{
+ struct gpio_keys_polled_dev *bdev = dev->private;
+ struct input_dev *input = dev->input;
+ unsigned int type = button->type ?: EV_KEY;
+
+ if (type == EV_REL) {
+ if (state) {
+ input_event(input, type, button->code, button->value);
+ __set_bit(button->code, bdev->rel_axis_seen);
+ }
+ } else if (type == EV_ABS) {
+ if (state) {
+ input_event(input, type, button->code, button->value);
+ __set_bit(button->code, bdev->abs_axis_seen);
+ }
+ } else {
+ input_event(input, type, button->code, state);
+ input_sync(input);
+ }
+}
+
+static void gpio_keys_polled_check_state(struct input_polled_dev *dev,
struct gpio_keys_button *button,
struct gpio_keys_button_data *bdata)
{
@@ -54,11 +80,9 @@ static void gpio_keys_polled_check_state(struct input_dev *input,
else
state = !!gpiod_get_value(button->gpiod);
- if (state != bdata->last_state) {
- unsigned int type = button->type ?: EV_KEY;
+ gpio_keys_button_event(dev, button, state);
- input_event(input, type, button->code, state);
- input_sync(input);
+ if (state != bdata->last_state) {
bdata->count = 0;
bdata->last_state = state;
}
@@ -71,15 +95,33 @@ static void gpio_keys_polled_poll(struct input_polled_dev *dev)
struct input_dev *input = dev->input;
int i;
+ memset(bdev->rel_axis_seen, 0, sizeof(bdev->rel_axis_seen));
+ memset(bdev->abs_axis_seen, 0, sizeof(bdev->abs_axis_seen));
+
for (i = 0; i < pdata->nbuttons; i++) {
struct gpio_keys_button_data *bdata = &bdev->data[i];
- if (bdata->count < bdata->threshold)
+ if (bdata->count < bdata->threshold) {
bdata->count++;
- else
- gpio_keys_polled_check_state(input, &pdata->buttons[i],
+ gpio_keys_button_event(dev, &pdata->buttons[i],
+ bdata->last_state);
+ } else {
+ gpio_keys_polled_check_state(dev, &pdata->buttons[i],
bdata);
+ }
+ }
+
+ for_each_set_bit(i, input->relbit, REL_CNT) {
+ if (!test_bit(i, bdev->rel_axis_seen))
+ input_event(input, EV_REL, i, 0);
+ }
+
+ for_each_set_bit(i, input->absbit, ABS_CNT) {
+ if (!test_bit(i, bdev->abs_axis_seen))
+ input_event(input, EV_ABS, i, 0);
}
+
+ input_sync(input);
}
static void gpio_keys_polled_open(struct input_polled_dev *dev)
@@ -152,6 +194,10 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct
&button->type))
button->type = EV_KEY;
+ if (fwnode_property_read_u32(child, "linux,input-value",
+ (u32 *)&button->value))
+ button->value = 1;
+
button->wakeup = fwnode_property_present(child, "gpio-key,wakeup");
if (fwnode_property_read_u32(child, "debounce-interval",
@@ -165,6 +211,25 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct
return pdata;
}
+static void gpio_keys_polled_set_abs_params(struct input_dev *input,
+ const struct gpio_keys_platform_data *pdata, unsigned int code)
+{
+ int i, min = 0, max = 0;
+
+ for (i = 0; i < pdata->nbuttons; i++) {
+ struct gpio_keys_button *button = &pdata->buttons[i];
+
+ if (button->type != EV_ABS || button->code != code)
+ continue;
+
+ if (button->value < min)
+ min = button->value;
+ if (button->value > max)
+ max = button->value;
+ }
+ input_set_abs_params(input, code, min, max, 0, 0);
+}
+
static const struct of_device_id gpio_keys_polled_of_match[] = {
{ .compatible = "gpio-keys-polled", },
{ },
@@ -271,6 +336,9 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
pdata->poll_interval);
input_set_capability(input, type, button->code);
+ if (type == EV_ABS)
+ gpio_keys_polled_set_abs_params(input, pdata,
+ button->code);
}
bdev->poll_dev = poll_dev;
@@ -287,9 +355,11 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
/* report initial state of the buttons */
for (i = 0; i < pdata->nbuttons; i++)
- gpio_keys_polled_check_state(input, &pdata->buttons[i],
+ gpio_keys_polled_check_state(poll_dev, &pdata->buttons[i],
&bdev->data[i]);
+ input_sync(input);
+
return 0;
}
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/4] ARM: dts: sun4i: inet9f-rev03: Add support for game buttons / joysticks
2015-09-09 9:11 [PATCH 1/4] devicetree: bindings: Update gpio-keys-polled with support for abs/rel axis Hans de Goede
2015-09-09 9:11 ` [PATCH 2/4] devicetree: bindings: Add header file with evdev type and abs/rel code defines Hans de Goede
@ 2015-09-09 9:11 ` Hans de Goede
[not found] ` <1441789886-5868-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2 siblings, 0 replies; 12+ messages in thread
From: Hans de Goede @ 2015-09-09 9:11 UTC (permalink / raw
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input, linux-arm-kernel, devicetree,
linux-sunxi, Hans de Goede
The inet9f-rev03 tablet has multiple fire-buttons / direction controls,
add support for these using the same axis mapping as ps2 compatible game
controllers with the same stick / button layout use.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
arch/arm/boot/dts/sun4i-a10-inet9f-rev03.dts | 165 +++++++++++++++++++++++++++
1 file changed, 165 insertions(+)
diff --git a/arch/arm/boot/dts/sun4i-a10-inet9f-rev03.dts b/arch/arm/boot/dts/sun4i-a10-inet9f-rev03.dts
index 932e397..84c63f3 100644
--- a/arch/arm/boot/dts/sun4i-a10-inet9f-rev03.dts
+++ b/arch/arm/boot/dts/sun4i-a10-inet9f-rev03.dts
@@ -44,6 +44,7 @@
#include "sun4i-a10.dtsi"
#include "sunxi-common-regulators.dtsi"
#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/evdev.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/pinctrl/sun4i-a10.h>
@@ -59,6 +60,159 @@
chosen {
stdout-path = "serial0:115200n8";
};
+
+ gpio_keys {
+ compatible = "gpio-keys-polled";
+ pinctrl-names = "default";
+ pinctrl-0 = <&key_pins_inet9f>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ poll-interval = <20>;
+
+ button@0 {
+ label = "Left Joystick Left";
+ linux,code = <ABS_X>;
+ linux,input-type = <EV_ABS>;
+ linux,input-value = <0xffffffff>; /* -1 */
+ gpios = <&pio 0 6 GPIO_ACTIVE_LOW>; /* PA6 */
+ };
+
+ button@1 {
+ label = "Left Joystick Right";
+ linux,code = <ABS_X>;
+ linux,input-type = <EV_ABS>;
+ linux,input-value = <1>;
+ gpios = <&pio 0 5 GPIO_ACTIVE_LOW>; /* PA5 */
+ };
+
+ button@2 {
+ label = "Left Joystick Up";
+ linux,code = <ABS_Y>;
+ linux,input-type = <EV_ABS>;
+ linux,input-value = <0xffffffff>; /* -1 */
+ gpios = <&pio 0 8 GPIO_ACTIVE_LOW>; /* PA8 */
+ };
+
+ button@3 {
+ label = "Left Joystick Down";
+ linux,code = <ABS_Y>;
+ linux,input-type = <EV_ABS>;
+ linux,input-value = <1>;
+ gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */
+ };
+
+ button@4 {
+ label = "Right Joystick Left";
+ linux,code = <ABS_Z>;
+ linux,input-type = <EV_ABS>;
+ linux,input-value = <0xffffffff>; /* -1 */
+ gpios = <&pio 0 1 GPIO_ACTIVE_LOW>; /* PA1 */
+ };
+
+ button@5 {
+ label = "Right Joystick Right";
+ linux,code = <ABS_Z>;
+ linux,input-type = <EV_ABS>;
+ linux,input-value = <1>;
+ gpios = <&pio 0 0 GPIO_ACTIVE_LOW>; /* PA0 */
+ };
+
+ button@6 {
+ label = "Right Joystick Up";
+ linux,code = <ABS_RZ>;
+ linux,input-type = <EV_ABS>;
+ linux,input-value = <0xffffffff>; /* -1 */
+ gpios = <&pio 0 3 GPIO_ACTIVE_LOW>; /* PA3 */
+ };
+
+ button@7 {
+ label = "Right Joystick Down";
+ linux,code = <ABS_RZ>;
+ linux,input-type = <EV_ABS>;
+ linux,input-value = <1>;
+ gpios = <&pio 0 4 GPIO_ACTIVE_LOW>; /* PA4 */
+ };
+
+ button@8 {
+ label = "DPad Left";
+ linux,code = <ABS_HAT0X>;
+ linux,input-type = <EV_ABS>;
+ linux,input-value = <0xffffffff>; /* -1 */
+ gpios = <&pio 7 23 GPIO_ACTIVE_LOW>; /* PH23 */
+ };
+
+ button@9 {
+ label = "DPad Right";
+ linux,code = <ABS_HAT0X>;
+ linux,input-type = <EV_ABS>;
+ linux,input-value = <1>;
+ gpios = <&pio 7 24 GPIO_ACTIVE_LOW>; /* PH24 */
+ };
+
+ button@10 {
+ label = "DPad Up";
+ linux,code = <ABS_HAT0Y>;
+ linux,input-type = <EV_ABS>;
+ linux,input-value = <0xffffffff>; /* -1 */
+ gpios = <&pio 7 25 GPIO_ACTIVE_LOW>; /* PH25 */
+ };
+
+ button@11 {
+ label = "DPad Down";
+ linux,code = <ABS_HAT0Y>;
+ linux,input-type = <EV_ABS>;
+ linux,input-value = <1>;
+ gpios = <&pio 7 26 GPIO_ACTIVE_LOW>; /* PH26 */
+ };
+
+ button@12 {
+ label = "Button X";
+ linux,code = <BTN_X>;
+ gpios = <&pio 0 16 GPIO_ACTIVE_LOW>; /* PA16 */
+ };
+
+ button@13 {
+ label = "Button Y";
+ linux,code = <BTN_Y>;
+ gpios = <&pio 0 14 GPIO_ACTIVE_LOW>; /* PA14 */
+ };
+
+ button@14 {
+ label = "Button A";
+ linux,code = <BTN_A>;
+ gpios = <&pio 0 17 GPIO_ACTIVE_LOW>; /* PA17 */
+ };
+
+ button@15 {
+ label = "Button B";
+ linux,code = <BTN_B>;
+ gpios = <&pio 0 15 GPIO_ACTIVE_LOW>; /* PA15 */
+ };
+
+ button@16 {
+ label = "Select Button";
+ linux,code = <BTN_SELECT>;
+ gpios = <&pio 0 11 GPIO_ACTIVE_LOW>; /* PA11 */
+ };
+
+ button@17 {
+ label = "Start Button";
+ linux,code = <BTN_START>;
+ gpios = <&pio 0 12 GPIO_ACTIVE_LOW>; /* PA12 */
+ };
+
+ button@18 {
+ label = "Top Left Button";
+ linux,code = <BTN_TL>;
+ gpios = <&pio 7 22 GPIO_ACTIVE_LOW>; /* PH22 */
+ };
+
+ button@19 {
+ label = "Top Right Button";
+ linux,code = <BTN_TR>;
+ gpios = <&pio 0 13 GPIO_ACTIVE_LOW>; /* PA13 */
+ };
+ };
};
&cpu0 {
@@ -167,6 +321,17 @@
};
&pio {
+ key_pins_inet9f: key_pins@0 {
+ allwinner,pins = "PA0", "PA1", "PA3", "PA4",
+ "PA5", "PA6", "PA8", "PA9",
+ "PA11", "PA12", "PA13",
+ "PA14", "PA15", "PA16", "PA17",
+ "PH22", "PH23", "PH24", "PH25", "PH26";
+ allwinner,function = "gpio_in";
+ allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+ allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+ };
+
usb0_id_detect_pin: usb0_id_detect_pin@0 {
allwinner,pins = "PH4";
allwinner,function = "gpio_in";
--
2.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] devicetree: bindings: Add header file with evdev type and abs/rel code defines
[not found] ` <1441789886-5868-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-09-10 17:25 ` Rob Herring
2015-09-10 18:34 ` Dmitry Torokhov
0 siblings, 1 reply; 12+ messages in thread
From: Rob Herring @ 2015-09-10 17:25 UTC (permalink / raw
To: Hans de Goede, Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
On 09/09/2015 04:11 AM, Hans de Goede wrote:
> This header provides evdev constants for linux,code, and linux,input-*
> properties.
>
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> include/dt-bindings/input/evdev.h | 76 +++++++++++++++++++++++++++++++++++++++
This looks fine, but please just add to input/input.h.
Rob
> 1 file changed, 76 insertions(+)
> create mode 100644 include/dt-bindings/input/evdev.h
>
> diff --git a/include/dt-bindings/input/evdev.h b/include/dt-bindings/input/evdev.h
> new file mode 100644
> index 0000000..c1f7e0d
> --- /dev/null
> +++ b/include/dt-bindings/input/evdev.h
> @@ -0,0 +1,76 @@
> +/*
> + * This header provides evdev constants for linux,code, and linux,input-*
> + * properties.
> + */
> +
> +#ifndef _DT_BINDINGS_INPUT_LINUX_H
> +#define _DT_BINDINGS_INPUT_LINUX_H
> +
> +/*
> + * Event types
> + */
> +
> +#define EV_SYN 0x00
> +#define EV_KEY 0x01
> +#define EV_REL 0x02
> +#define EV_ABS 0x03
> +#define EV_MSC 0x04
> +#define EV_SW 0x05
> +#define EV_LED 0x11
> +#define EV_SND 0x12
> +#define EV_REP 0x14
> +#define EV_FF 0x15
> +#define EV_PWR 0x16
> +#define EV_FF_STATUS 0x17
> +#define EV_MAX 0x1f
> +
> +/*
> + * Relative axes
> + */
> +
> +#define REL_X 0x00
> +#define REL_Y 0x01
> +#define REL_Z 0x02
> +#define REL_RX 0x03
> +#define REL_RY 0x04
> +#define REL_RZ 0x05
> +#define REL_HWHEEL 0x06
> +#define REL_DIAL 0x07
> +#define REL_WHEEL 0x08
> +#define REL_MISC 0x09
> +#define REL_MAX 0x0f
> +
> +/*
> + * Absolute axes
> + */
> +
> +#define ABS_X 0x00
> +#define ABS_Y 0x01
> +#define ABS_Z 0x02
> +#define ABS_RX 0x03
> +#define ABS_RY 0x04
> +#define ABS_RZ 0x05
> +#define ABS_THROTTLE 0x06
> +#define ABS_RUDDER 0x07
> +#define ABS_WHEEL 0x08
> +#define ABS_GAS 0x09
> +#define ABS_BRAKE 0x0a
> +#define ABS_HAT0X 0x10
> +#define ABS_HAT0Y 0x11
> +#define ABS_HAT1X 0x12
> +#define ABS_HAT1Y 0x13
> +#define ABS_HAT2X 0x14
> +#define ABS_HAT2Y 0x15
> +#define ABS_HAT3X 0x16
> +#define ABS_HAT3Y 0x17
> +#define ABS_PRESSURE 0x18
> +#define ABS_DISTANCE 0x19
> +#define ABS_TILT_X 0x1a
> +#define ABS_TILT_Y 0x1b
> +#define ABS_TOOL_WIDTH 0x1c
> +
> +#define ABS_VOLUME 0x20
> +
> +#define ABS_MISC 0x28
> +
> +#endif /* _DT_BINDINGS_INPUT_LINUX_H */
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/4] devicetree: bindings: Update gpio-keys-polled with support for abs/rel axis
[not found] ` <1441789886-5868-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-09-09 9:11 ` [PATCH 3/4] input: gpio_keys_polled: input_sync once after polling all the buttons Hans de Goede
@ 2015-09-10 17:45 ` Rob Herring
1 sibling, 0 replies; 12+ messages in thread
From: Rob Herring @ 2015-09-10 17:45 UTC (permalink / raw
To: Hans de Goede, Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
On 09/09/2015 04:11 AM, Hans de Goede wrote:
> The devicetree binding for gpio-keys-polled already allows specifying
> what type of events (key / rel / abs) a button generates when pressed.
>
> But for rel / abs axis we also need to specify which value this specific
> gpio represents.
>
> One usecase is digital joysticks / direction-pads which are hooked up to
> gpio, in this case we've left and right buttons which we want to map to
> EV_ABS, ABS_X and we want generate events for left with a value of -1 and
> for right with a value of +1 (and similar for up / down and ABS_Y).
One minor comment, otherwise:
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> Documentation/devicetree/bindings/input/gpio-keys-polled.txt | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/input/gpio-keys-polled.txt b/Documentation/devicetree/bindings/input/gpio-keys-polled.txt
> index 313abef..ab4b09b 100644
> --- a/Documentation/devicetree/bindings/input/gpio-keys-polled.txt
> +++ b/Documentation/devicetree/bindings/input/gpio-keys-polled.txt
> @@ -13,11 +13,16 @@ Subnode properties:
>
> - gpios: OF device-tree gpio specification.
> - label: Descriptive name of the key.
> - - linux,code: Keycode to emit.
> + - linux,code: Key / Axis code to emit.
>
> Optional subnode-properties:
> - linux,input-type: Specify event type this button/key generates.
> If not specified defaults to <1> == EV_KEY.
> + - linux,input-value: If linux,input-type is EV_ABS or EV_REL then this
> + value is send for events this button generates when pressed.
s/send/sent/
> + EV_ABS axis will generate an event with a value of 0 when all
> + buttons with linux,input-type == EV_ABS and linux,code == axis
> + are released.
> - debounce-interval: Debouncing interval time in milliseconds.
> If not specified defaults to 5.
> - gpio-key,wakeup: Boolean, button can wake-up the system.
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] devicetree: bindings: Add header file with evdev type and abs/rel code defines
2015-09-10 17:25 ` Rob Herring
@ 2015-09-10 18:34 ` Dmitry Torokhov
[not found] ` <CAKdAkRRFcn5+SXNfU4J+v4tcFyA1mZR1hMhT2y3QJeQJ1tTDYQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Torokhov @ 2015-09-10 18:34 UTC (permalink / raw
To: Rob Herring
Cc: Hans de Goede, Maxime Ripard, linux-input@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, devicetree, linux-sunxi
On Thu, Sep 10, 2015 at 10:25 AM, Rob Herring <robh@kernel.org> wrote:
> On 09/09/2015 04:11 AM, Hans de Goede wrote:
>> This header provides evdev constants for linux,code, and linux,input-*
>> properties.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> include/dt-bindings/input/evdev.h | 76 +++++++++++++++++++++++++++++++++++++++
>
> This looks fine, but please just add to input/input.h.
>
> Rob
>
>> 1 file changed, 76 insertions(+)
>> create mode 100644 include/dt-bindings/input/evdev.h
>>
>> diff --git a/include/dt-bindings/input/evdev.h b/include/dt-bindings/input/evdev.h
>> new file mode 100644
>> index 0000000..c1f7e0d
>> --- /dev/null
>> +++ b/include/dt-bindings/input/evdev.h
>> @@ -0,0 +1,76 @@
>> +/*
>> + * This header provides evdev constants for linux,code, and linux,input-*
>> + * properties.
>> + */
>> +
>> +#ifndef _DT_BINDINGS_INPUT_LINUX_H
>> +#define _DT_BINDINGS_INPUT_LINUX_H
>> +
>> +/*
>> + * Event types
>> + */
>> +
>> +#define EV_SYN 0x00
>> +#define EV_KEY 0x01
>> +#define EV_REL 0x02
>> +#define EV_ABS 0x03
>> +#define EV_MSC 0x04
>> +#define EV_SW 0x05
>> +#define EV_LED 0x11
>> +#define EV_SND 0x12
>> +#define EV_REP 0x14
>> +#define EV_FF 0x15
>> +#define EV_PWR 0x16
>> +#define EV_FF_STATUS 0x17
>> +#define EV_MAX 0x1f
>> +
>> +/*
>> + * Relative axes
>> + */
>> +
>> +#define REL_X 0x00
>> +#define REL_Y 0x01
>> +#define REL_Z 0x02
>> +#define REL_RX 0x03
>> +#define REL_RY 0x04
>> +#define REL_RZ 0x05
>> +#define REL_HWHEEL 0x06
>> +#define REL_DIAL 0x07
>> +#define REL_WHEEL 0x08
>> +#define REL_MISC 0x09
>> +#define REL_MAX 0x0f
>> +
>> +/*
>> + * Absolute axes
>> + */
>> +
>> +#define ABS_X 0x00
>> +#define ABS_Y 0x01
>> +#define ABS_Z 0x02
>> +#define ABS_RX 0x03
>> +#define ABS_RY 0x04
>> +#define ABS_RZ 0x05
>> +#define ABS_THROTTLE 0x06
>> +#define ABS_RUDDER 0x07
>> +#define ABS_WHEEL 0x08
>> +#define ABS_GAS 0x09
>> +#define ABS_BRAKE 0x0a
>> +#define ABS_HAT0X 0x10
>> +#define ABS_HAT0Y 0x11
>> +#define ABS_HAT1X 0x12
>> +#define ABS_HAT1Y 0x13
>> +#define ABS_HAT2X 0x14
>> +#define ABS_HAT2Y 0x15
>> +#define ABS_HAT3X 0x16
>> +#define ABS_HAT3Y 0x17
>> +#define ABS_PRESSURE 0x18
>> +#define ABS_DISTANCE 0x19
>> +#define ABS_TILT_X 0x1a
>> +#define ABS_TILT_Y 0x1b
>> +#define ABS_TOOL_WIDTH 0x1c
>> +
>> +#define ABS_VOLUME 0x20
>> +
>> +#define ABS_MISC 0x28
>> +
>> +#endif /* _DT_BINDINGS_INPUT_LINUX_H */
>>
>
Actually I'd rather we removed include/dt-bindings/input/input.h and
instead used the header file from uapi. As it is now we already
duplicating definitions and the copy in dt-bindings is missing several
key codes. Until we split DT bindings form the kernel code I'd rather
have definitions in one place.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] devicetree: bindings: Add header file with evdev type and abs/rel code defines
[not found] ` <CAKdAkRRFcn5+SXNfU4J+v4tcFyA1mZR1hMhT2y3QJeQJ1tTDYQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-09-10 18:40 ` Hans de Goede
[not found] ` <55F1CE8B.5050302-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 12+ messages in thread
From: Hans de Goede @ 2015-09-10 18:40 UTC (permalink / raw
To: Dmitry Torokhov, Rob Herring
Cc: Maxime Ripard,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
devicetree, linux-sunxi
Hi,
On 10-09-15 20:34, Dmitry Torokhov wrote:
> On Thu, Sep 10, 2015 at 10:25 AM, Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>> On 09/09/2015 04:11 AM, Hans de Goede wrote:
>>> This header provides evdev constants for linux,code, and linux,input-*
>>> properties.
>>>
>>> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>> ---
>>> include/dt-bindings/input/evdev.h | 76 +++++++++++++++++++++++++++++++++++++++
>>
>> This looks fine, but please just add to input/input.h.
>>
>> Rob
>>
>>> 1 file changed, 76 insertions(+)
>>> create mode 100644 include/dt-bindings/input/evdev.h
>>>
>>> diff --git a/include/dt-bindings/input/evdev.h b/include/dt-bindings/input/evdev.h
>>> new file mode 100644
>>> index 0000000..c1f7e0d
>>> --- /dev/null
>>> +++ b/include/dt-bindings/input/evdev.h
>>> @@ -0,0 +1,76 @@
>>> +/*
>>> + * This header provides evdev constants for linux,code, and linux,input-*
>>> + * properties.
>>> + */
>>> +
>>> +#ifndef _DT_BINDINGS_INPUT_LINUX_H
>>> +#define _DT_BINDINGS_INPUT_LINUX_H
>>> +
>>> +/*
>>> + * Event types
>>> + */
>>> +
>>> +#define EV_SYN 0x00
>>> +#define EV_KEY 0x01
>>> +#define EV_REL 0x02
>>> +#define EV_ABS 0x03
>>> +#define EV_MSC 0x04
>>> +#define EV_SW 0x05
>>> +#define EV_LED 0x11
>>> +#define EV_SND 0x12
>>> +#define EV_REP 0x14
>>> +#define EV_FF 0x15
>>> +#define EV_PWR 0x16
>>> +#define EV_FF_STATUS 0x17
>>> +#define EV_MAX 0x1f
>>> +
>>> +/*
>>> + * Relative axes
>>> + */
>>> +
>>> +#define REL_X 0x00
>>> +#define REL_Y 0x01
>>> +#define REL_Z 0x02
>>> +#define REL_RX 0x03
>>> +#define REL_RY 0x04
>>> +#define REL_RZ 0x05
>>> +#define REL_HWHEEL 0x06
>>> +#define REL_DIAL 0x07
>>> +#define REL_WHEEL 0x08
>>> +#define REL_MISC 0x09
>>> +#define REL_MAX 0x0f
>>> +
>>> +/*
>>> + * Absolute axes
>>> + */
>>> +
>>> +#define ABS_X 0x00
>>> +#define ABS_Y 0x01
>>> +#define ABS_Z 0x02
>>> +#define ABS_RX 0x03
>>> +#define ABS_RY 0x04
>>> +#define ABS_RZ 0x05
>>> +#define ABS_THROTTLE 0x06
>>> +#define ABS_RUDDER 0x07
>>> +#define ABS_WHEEL 0x08
>>> +#define ABS_GAS 0x09
>>> +#define ABS_BRAKE 0x0a
>>> +#define ABS_HAT0X 0x10
>>> +#define ABS_HAT0Y 0x11
>>> +#define ABS_HAT1X 0x12
>>> +#define ABS_HAT1Y 0x13
>>> +#define ABS_HAT2X 0x14
>>> +#define ABS_HAT2Y 0x15
>>> +#define ABS_HAT3X 0x16
>>> +#define ABS_HAT3Y 0x17
>>> +#define ABS_PRESSURE 0x18
>>> +#define ABS_DISTANCE 0x19
>>> +#define ABS_TILT_X 0x1a
>>> +#define ABS_TILT_Y 0x1b
>>> +#define ABS_TOOL_WIDTH 0x1c
>>> +
>>> +#define ABS_VOLUME 0x20
>>> +
>>> +#define ABS_MISC 0x28
>>> +
>>> +#endif /* _DT_BINDINGS_INPUT_LINUX_H */
>>>
>>
>
> Actually I'd rather we removed include/dt-bindings/input/input.h and
> instead used the header file from uapi. As it is now we already
> duplicating definitions and the copy in dt-bindings is missing several
> key codes. Until we split DT bindings form the kernel code I'd rather
> have definitions in one place.
AFAIK we cannot do that as the uapi header also contains things like:
struct input_event {
struct timeval time;
__u16 type;
__u16 code;
__s32 value;
};
Which is not valid device tree syntax.
If you want this we need to split the uapi headers in one with only
defines and one with all the rest.
Regards,
Hans
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] devicetree: bindings: Add header file with evdev type and abs/rel code defines
[not found] ` <55F1CE8B.5050302-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-09-10 18:42 ` Dmitry Torokhov
2015-09-10 18:50 ` Hans de Goede
0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Torokhov @ 2015-09-10 18:42 UTC (permalink / raw
To: Hans de Goede
Cc: Rob Herring, Maxime Ripard,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
devicetree, linux-sunxi
On Thu, Sep 10, 2015 at 11:40 AM, Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> Hi,
>
>
> On 10-09-15 20:34, Dmitry Torokhov wrote:
>>
>> On Thu, Sep 10, 2015 at 10:25 AM, Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>>>
>>> On 09/09/2015 04:11 AM, Hans de Goede wrote:
>>>>
>>>> This header provides evdev constants for linux,code, and linux,input-*
>>>> properties.
>>>>
>>>> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>>> ---
>>>> include/dt-bindings/input/evdev.h | 76
>>>> +++++++++++++++++++++++++++++++++++++++
>>>
>>>
>>> This looks fine, but please just add to input/input.h.
>>>
>>> Rob
>>>
>>>> 1 file changed, 76 insertions(+)
>>>> create mode 100644 include/dt-bindings/input/evdev.h
>>>>
>>>> diff --git a/include/dt-bindings/input/evdev.h
>>>> b/include/dt-bindings/input/evdev.h
>>>> new file mode 100644
>>>> index 0000000..c1f7e0d
>>>> --- /dev/null
>>>> +++ b/include/dt-bindings/input/evdev.h
>>>> @@ -0,0 +1,76 @@
>>>> +/*
>>>> + * This header provides evdev constants for linux,code, and
>>>> linux,input-*
>>>> + * properties.
>>>> + */
>>>> +
>>>> +#ifndef _DT_BINDINGS_INPUT_LINUX_H
>>>> +#define _DT_BINDINGS_INPUT_LINUX_H
>>>> +
>>>> +/*
>>>> + * Event types
>>>> + */
>>>> +
>>>> +#define EV_SYN 0x00
>>>> +#define EV_KEY 0x01
>>>> +#define EV_REL 0x02
>>>> +#define EV_ABS 0x03
>>>> +#define EV_MSC 0x04
>>>> +#define EV_SW 0x05
>>>> +#define EV_LED 0x11
>>>> +#define EV_SND 0x12
>>>> +#define EV_REP 0x14
>>>> +#define EV_FF 0x15
>>>> +#define EV_PWR 0x16
>>>> +#define EV_FF_STATUS 0x17
>>>> +#define EV_MAX 0x1f
>>>> +
>>>> +/*
>>>> + * Relative axes
>>>> + */
>>>> +
>>>> +#define REL_X 0x00
>>>> +#define REL_Y 0x01
>>>> +#define REL_Z 0x02
>>>> +#define REL_RX 0x03
>>>> +#define REL_RY 0x04
>>>> +#define REL_RZ 0x05
>>>> +#define REL_HWHEEL 0x06
>>>> +#define REL_DIAL 0x07
>>>> +#define REL_WHEEL 0x08
>>>> +#define REL_MISC 0x09
>>>> +#define REL_MAX 0x0f
>>>> +
>>>> +/*
>>>> + * Absolute axes
>>>> + */
>>>> +
>>>> +#define ABS_X 0x00
>>>> +#define ABS_Y 0x01
>>>> +#define ABS_Z 0x02
>>>> +#define ABS_RX 0x03
>>>> +#define ABS_RY 0x04
>>>> +#define ABS_RZ 0x05
>>>> +#define ABS_THROTTLE 0x06
>>>> +#define ABS_RUDDER 0x07
>>>> +#define ABS_WHEEL 0x08
>>>> +#define ABS_GAS 0x09
>>>> +#define ABS_BRAKE 0x0a
>>>> +#define ABS_HAT0X 0x10
>>>> +#define ABS_HAT0Y 0x11
>>>> +#define ABS_HAT1X 0x12
>>>> +#define ABS_HAT1Y 0x13
>>>> +#define ABS_HAT2X 0x14
>>>> +#define ABS_HAT2Y 0x15
>>>> +#define ABS_HAT3X 0x16
>>>> +#define ABS_HAT3Y 0x17
>>>> +#define ABS_PRESSURE 0x18
>>>> +#define ABS_DISTANCE 0x19
>>>> +#define ABS_TILT_X 0x1a
>>>> +#define ABS_TILT_Y 0x1b
>>>> +#define ABS_TOOL_WIDTH 0x1c
>>>> +
>>>> +#define ABS_VOLUME 0x20
>>>> +
>>>> +#define ABS_MISC 0x28
>>>> +
>>>> +#endif /* _DT_BINDINGS_INPUT_LINUX_H */
>>>>
>>>
>>
>> Actually I'd rather we removed include/dt-bindings/input/input.h and
>> instead used the header file from uapi. As it is now we already
>> duplicating definitions and the copy in dt-bindings is missing several
>> key codes. Until we split DT bindings form the kernel code I'd rather
>> have definitions in one place.
>
>
> AFAIK we cannot do that as the uapi header also contains things like:
>
> struct input_event {
> struct timeval time;
> __u16 type;
> __u16 code;
> __s32 value;
> };
>
> Which is not valid device tree syntax.
>
> If you want this we need to split the uapi headers in one with only
> defines and one with all the rest.
That would be fine by me. event-codes.h?
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] devicetree: bindings: Add header file with evdev type and abs/rel code defines
2015-09-10 18:42 ` Dmitry Torokhov
@ 2015-09-10 18:50 ` Hans de Goede
2015-09-10 22:48 ` Rob Herring
0 siblings, 1 reply; 12+ messages in thread
From: Hans de Goede @ 2015-09-10 18:50 UTC (permalink / raw
To: Dmitry Torokhov
Cc: Rob Herring, Maxime Ripard, linux-input@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, devicetree, linux-sunxi
Hi,
On 10-09-15 20:42, Dmitry Torokhov wrote:
> On Thu, Sep 10, 2015 at 11:40 AM, Hans de Goede <hdegoede@redhat.com> wrote:
>> Hi,
>>
>>
>> On 10-09-15 20:34, Dmitry Torokhov wrote:
>>>
>>> On Thu, Sep 10, 2015 at 10:25 AM, Rob Herring <robh@kernel.org> wrote:
>>>>
>>>> On 09/09/2015 04:11 AM, Hans de Goede wrote:
>>>>>
>>>>> This header provides evdev constants for linux,code, and linux,input-*
>>>>> properties.
>>>>>
>>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>>>> ---
>>>>> include/dt-bindings/input/evdev.h | 76
>>>>> +++++++++++++++++++++++++++++++++++++++
>>>>
>>>>
>>>> This looks fine, but please just add to input/input.h.
>>>>
>>>> Rob
>>>>
>>>>> 1 file changed, 76 insertions(+)
>>>>> create mode 100644 include/dt-bindings/input/evdev.h
>>>>>
>>>>> diff --git a/include/dt-bindings/input/evdev.h
>>>>> b/include/dt-bindings/input/evdev.h
>>>>> new file mode 100644
>>>>> index 0000000..c1f7e0d
>>>>> --- /dev/null
>>>>> +++ b/include/dt-bindings/input/evdev.h
>>>>> @@ -0,0 +1,76 @@
>>>>> +/*
>>>>> + * This header provides evdev constants for linux,code, and
>>>>> linux,input-*
>>>>> + * properties.
>>>>> + */
>>>>> +
>>>>> +#ifndef _DT_BINDINGS_INPUT_LINUX_H
>>>>> +#define _DT_BINDINGS_INPUT_LINUX_H
>>>>> +
>>>>> +/*
>>>>> + * Event types
>>>>> + */
>>>>> +
>>>>> +#define EV_SYN 0x00
>>>>> +#define EV_KEY 0x01
>>>>> +#define EV_REL 0x02
>>>>> +#define EV_ABS 0x03
>>>>> +#define EV_MSC 0x04
>>>>> +#define EV_SW 0x05
>>>>> +#define EV_LED 0x11
>>>>> +#define EV_SND 0x12
>>>>> +#define EV_REP 0x14
>>>>> +#define EV_FF 0x15
>>>>> +#define EV_PWR 0x16
>>>>> +#define EV_FF_STATUS 0x17
>>>>> +#define EV_MAX 0x1f
>>>>> +
>>>>> +/*
>>>>> + * Relative axes
>>>>> + */
>>>>> +
>>>>> +#define REL_X 0x00
>>>>> +#define REL_Y 0x01
>>>>> +#define REL_Z 0x02
>>>>> +#define REL_RX 0x03
>>>>> +#define REL_RY 0x04
>>>>> +#define REL_RZ 0x05
>>>>> +#define REL_HWHEEL 0x06
>>>>> +#define REL_DIAL 0x07
>>>>> +#define REL_WHEEL 0x08
>>>>> +#define REL_MISC 0x09
>>>>> +#define REL_MAX 0x0f
>>>>> +
>>>>> +/*
>>>>> + * Absolute axes
>>>>> + */
>>>>> +
>>>>> +#define ABS_X 0x00
>>>>> +#define ABS_Y 0x01
>>>>> +#define ABS_Z 0x02
>>>>> +#define ABS_RX 0x03
>>>>> +#define ABS_RY 0x04
>>>>> +#define ABS_RZ 0x05
>>>>> +#define ABS_THROTTLE 0x06
>>>>> +#define ABS_RUDDER 0x07
>>>>> +#define ABS_WHEEL 0x08
>>>>> +#define ABS_GAS 0x09
>>>>> +#define ABS_BRAKE 0x0a
>>>>> +#define ABS_HAT0X 0x10
>>>>> +#define ABS_HAT0Y 0x11
>>>>> +#define ABS_HAT1X 0x12
>>>>> +#define ABS_HAT1Y 0x13
>>>>> +#define ABS_HAT2X 0x14
>>>>> +#define ABS_HAT2Y 0x15
>>>>> +#define ABS_HAT3X 0x16
>>>>> +#define ABS_HAT3Y 0x17
>>>>> +#define ABS_PRESSURE 0x18
>>>>> +#define ABS_DISTANCE 0x19
>>>>> +#define ABS_TILT_X 0x1a
>>>>> +#define ABS_TILT_Y 0x1b
>>>>> +#define ABS_TOOL_WIDTH 0x1c
>>>>> +
>>>>> +#define ABS_VOLUME 0x20
>>>>> +
>>>>> +#define ABS_MISC 0x28
>>>>> +
>>>>> +#endif /* _DT_BINDINGS_INPUT_LINUX_H */
>>>>>
>>>>
>>>
>>> Actually I'd rather we removed include/dt-bindings/input/input.h and
>>> instead used the header file from uapi. As it is now we already
>>> duplicating definitions and the copy in dt-bindings is missing several
>>> key codes. Until we split DT bindings form the kernel code I'd rather
>>> have definitions in one place.
>>
>>
>> AFAIK we cannot do that as the uapi header also contains things like:
>>
>> struct input_event {
>> struct timeval time;
>> __u16 type;
>> __u16 code;
>> __s32 value;
>> };
>>
>> Which is not valid device tree syntax.
>>
>> If you want this we need to split the uapi headers in one with only
>> defines and one with all the rest.
>
> That would be fine by me. event-codes.h?
Since this will live in the generic include/linux namespace (for userspace)
maybe input-event-codes ?
Rob are you ok with including uapi headers from dts files if those uapi
headers are guaranteed to have only #define-s in them?
I currently have a bit too much on my plate. So if someone else can take
care of this (assuming Rob acks it) that would be great.
Regards,
Hans
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] devicetree: bindings: Add header file with evdev type and abs/rel code defines
2015-09-10 18:50 ` Hans de Goede
@ 2015-09-10 22:48 ` Rob Herring
[not found] ` <55F208BA.5030507-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 12+ messages in thread
From: Rob Herring @ 2015-09-10 22:48 UTC (permalink / raw
To: Hans de Goede, Ian Campbell
Cc: Maxime Ripard, linux-input@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, devicetree, linux-sunxi
+Ian
On 09/10/2015 01:50 PM, Hans de Goede wrote:
> Hi,
>
> On 10-09-15 20:42, Dmitry Torokhov wrote:
>> On Thu, Sep 10, 2015 at 11:40 AM, Hans de Goede <hdegoede@redhat.com>
>> wrote:
>>> Hi,
>>>
>>>
>>> On 10-09-15 20:34, Dmitry Torokhov wrote:
>>>>
>>>> On Thu, Sep 10, 2015 at 10:25 AM, Rob Herring <robh@kernel.org> wrote:
>>>>>
>>>>> On 09/09/2015 04:11 AM, Hans de Goede wrote:
>>>>>>
>>>>>> This header provides evdev constants for linux,code, and
>>>>>> linux,input-*
>>>>>> properties.
>>>>>>
>>>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>>>>> ---
>>>>>> include/dt-bindings/input/evdev.h | 76
>>>>>> +++++++++++++++++++++++++++++++++++++++
>>>>>
>>>>>
>>>>> This looks fine, but please just add to input/input.h.
[...]
>>>> Actually I'd rather we removed include/dt-bindings/input/input.h and
>>>> instead used the header file from uapi. As it is now we already
>>>> duplicating definitions and the copy in dt-bindings is missing several
>>>> key codes. Until we split DT bindings form the kernel code I'd rather
>>>> have definitions in one place.
We do already have split binding tree. It is generated from the kernel
tree ATM. Adding Ian for any comments.
>>> AFAIK we cannot do that as the uapi header also contains things like:
>>>
>>> struct input_event {
>>> struct timeval time;
>>> __u16 type;
>>> __u16 code;
>>> __s32 value;
>>> };
>>>
>>> Which is not valid device tree syntax.
>>>
>>> If you want this we need to split the uapi headers in one with only
>>> defines and one with all the rest.
>>
>> That would be fine by me. event-codes.h?
>
> Since this will live in the generic include/linux namespace (for userspace)
> maybe input-event-codes ?
>
> Rob are you ok with including uapi headers from dts files if those uapi
> headers are guaranteed to have only #define-s in them?
No. If you can do it as a symlink or some limited way, I'd be fine with
that. I don't want to see wholesale addition of uapi headers though.
Rob
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] devicetree: bindings: Add header file with evdev type and abs/rel code defines
[not found] ` <55F208BA.5030507-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2015-09-12 18:04 ` Dmitry Torokhov
0 siblings, 0 replies; 12+ messages in thread
From: Dmitry Torokhov @ 2015-09-12 18:04 UTC (permalink / raw
To: Rob Herring
Cc: Hans de Goede, Ian Campbell, Maxime Ripard,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
devicetree, linux-sunxi
On Thu, Sep 10, 2015 at 3:48 PM, Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> +Ian
>
> On 09/10/2015 01:50 PM, Hans de Goede wrote:
>> Hi,
>>
>> On 10-09-15 20:42, Dmitry Torokhov wrote:
>>> On Thu, Sep 10, 2015 at 11:40 AM, Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>> wrote:
>>>> Hi,
>>>>
>>>>
>>>> On 10-09-15 20:34, Dmitry Torokhov wrote:
>>>>>
>>>>> On Thu, Sep 10, 2015 at 10:25 AM, Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>>>>>>
>>>>>> On 09/09/2015 04:11 AM, Hans de Goede wrote:
>>>>>>>
>>>>>>> This header provides evdev constants for linux,code, and
>>>>>>> linux,input-*
>>>>>>> properties.
>>>>>>>
>>>>>>> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>>>>>> ---
>>>>>>> include/dt-bindings/input/evdev.h | 76
>>>>>>> +++++++++++++++++++++++++++++++++++++++
>>>>>>
>>>>>>
>>>>>> This looks fine, but please just add to input/input.h.
>
> [...]
>
>>>>> Actually I'd rather we removed include/dt-bindings/input/input.h and
>>>>> instead used the header file from uapi. As it is now we already
>>>>> duplicating definitions and the copy in dt-bindings is missing several
>>>>> key codes. Until we split DT bindings form the kernel code I'd rather
>>>>> have definitions in one place.
>
> We do already have split binding tree. It is generated from the kernel
> tree ATM.
But the data in the kernel is the "source of truth" for now since the
other tree is simply generated.
> Adding Ian for any comments.
>
>>>> AFAIK we cannot do that as the uapi header also contains things like:
>>>>
>>>> struct input_event {
>>>> struct timeval time;
>>>> __u16 type;
>>>> __u16 code;
>>>> __s32 value;
>>>> };
>>>>
>>>> Which is not valid device tree syntax.
>>>>
>>>> If you want this we need to split the uapi headers in one with only
>>>> defines and one with all the rest.
>>>
>>> That would be fine by me. event-codes.h?
>>
>> Since this will live in the generic include/linux namespace (for userspace)
>> maybe input-event-codes ?
>>
>> Rob are you ok with including uapi headers from dts files if those uapi
>> headers are guaranteed to have only #define-s in them?
>
> No. If you can do it as a symlink or some limited way, I'd be fine with
> that. I don't want to see wholesale addition of uapi headers though.
Umm, not sure if I like symlink, it makes hard to see what includes
what. The individual DTSes will continue including
dt-bindings/input/input.h and only input.h will include uapi header
(so use of uapi is internal detail). Would that still be a problem?
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-09-12 18:04 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-09 9:11 [PATCH 1/4] devicetree: bindings: Update gpio-keys-polled with support for abs/rel axis Hans de Goede
2015-09-09 9:11 ` [PATCH 2/4] devicetree: bindings: Add header file with evdev type and abs/rel code defines Hans de Goede
[not found] ` <1441789886-5868-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-09-10 17:25 ` Rob Herring
2015-09-10 18:34 ` Dmitry Torokhov
[not found] ` <CAKdAkRRFcn5+SXNfU4J+v4tcFyA1mZR1hMhT2y3QJeQJ1tTDYQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-10 18:40 ` Hans de Goede
[not found] ` <55F1CE8B.5050302-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-09-10 18:42 ` Dmitry Torokhov
2015-09-10 18:50 ` Hans de Goede
2015-09-10 22:48 ` Rob Herring
[not found] ` <55F208BA.5030507-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-09-12 18:04 ` Dmitry Torokhov
2015-09-09 9:11 ` [PATCH 4/4] ARM: dts: sun4i: inet9f-rev03: Add support for game buttons / joysticks Hans de Goede
[not found] ` <1441789886-5868-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-09-09 9:11 ` [PATCH 3/4] input: gpio_keys_polled: input_sync once after polling all the buttons Hans de Goede
2015-09-10 17:45 ` [PATCH 1/4] devicetree: bindings: Update gpio-keys-polled with support for abs/rel axis Rob Herring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).