reorder pins to be one below another on one side of connector
[linux-gpio-pinout] / device-tree / gpio-3-buttons.dts
1 /dts-v1/;
2 /plugin/;
3
4 / {
5         compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
6
7         /*
8          * This fragment is needed only for the internal pull-up activation,
9          * external pull-up resistor is highly recommended if using long wires
10          */
11
12         fragment@0 {
13                 target = <&pio>;
14                 __overlay__ {
15                         gpio_button_0: gpio_button_0 {
16                                 pins = "PG3","PG1","PG5";
17                                 function = "gpio_in";
18                                 bias-pull-up;
19                         };
20                 };
21         };
22
23         fragment@1 {
24                 target-path = "/";
25                 __overlay__ {
26                         gpio-3-buttons {
27                                 /*
28                                  * Use "gpio-keys" for EINT capable pins, "gpio-keys-polled" for other pins
29                                  * add "poll-interval" property if using "gpio-keys-polled"
30                                  */
31 /*
32                                 compatible = "gpio-keys";
33 */
34                                 compatible = "gpio-keys-polled";
35                                 poll-interval = <100>;
36                                 autorepeat;
37
38                                 pinctrl-names = "default";
39                                 pinctrl-0 = <&gpio_button_0>;
40
41                                 up {
42                                         label = "button-up";
43                                         linux,code = <103>; /* KEY_UP, see include/uapi/linux/input-event-codes.h */
44                                         gpios = <&pio 6 3 1>; /* PG3 GPIO_ACTIVE_LOW */
45                                 };
46
47                                 down {
48                                         label = "button-down";
49                                         linux,code = <108>; /* KEY_DOWN, see include/uapi/linux/input-event-codes.h */
50                                         gpios = <&pio 6 1 1>; /* PG1 GPIO_ACTIVE_LOW */
51                                 };
52
53                                 enter {
54                                         label = "button-enter";
55                                         linux,code = <28>; /* KEY_DOWN, see include/uapi/linux/input-event-codes.h */
56                                         gpios = <&pio 6 5 1>; /* PG5 GPIO_ACTIVE_LOW */
57                                 };
58                         };
59                 };
60         };
61 };