98a2fb29352071195bd103f0bc43016a4991f4a6
[experiments/bbb-gpio-keypad.git] / bbb-gpio-keypad-00A0.dts
1 /*
2  * bbb-gpio-keypad - simple navigation keypad for the BeagleBone Black
3  *
4  * Copyright (C) 2018  Antonio Ospite <ao2@ao2.it>
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 /dts-v1/;
21 /plugin/;
22
23 #include <dt-bindings/board/am335x-bbw-bbb-base.h>
24 #include <dt-bindings/gpio/gpio.h>
25 #include <dt-bindings/pinctrl/am33xx.h>
26
27 / {
28     compatible = "ti,beaglebone", "ti,beaglebone-black";
29
30     // Identification.
31     part-number = "bbb-gpio-keypad";
32     version = "00A0";
33
34     // Resources this cape uses, see also https://ao2.it/137
35     exclusive-use =
36       "P8.07",
37       "P8.08",
38       "P8.09",
39       "P8.10",
40       "P8.26",
41       "P9.15";
42
43     fragment@0 {
44         target = <&am33xx_pinmux>;
45         __overlay__ {
46             keypad_pins: pinmux_gpio_pins{
47                 pinctrl-single,pins = <
48                     BONE_P8_07 (PIN_INPUT_PULLUP | MUX_MODE7)
49                     BONE_P8_08 (PIN_INPUT_PULLUP | MUX_MODE7)
50                     BONE_P8_09 (PIN_INPUT_PULLUP | MUX_MODE7)
51                     BONE_P8_10 (PIN_INPUT_PULLUP | MUX_MODE7)
52                     BONE_P8_26 (PIN_INPUT_PULLUP | MUX_MODE7)
53                     BONE_P9_15 (PIN_INPUT_PULLUP | MUX_MODE7)
54                 >;
55             };
56         };
57     };
58
59     fragment@1 {
60         target-path = "/";
61         __overlay__ {
62             gpio_keys {
63                 compatible = "gpio-keys";
64                 autorepeat;
65                 pinctrl-names = "default";
66                 pinctrl-0 = <&keypad_pins>;
67
68                 up {
69                     label = "GPIO Key UP";
70                     linux,code = <103>;
71                     gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
72                     debounce_interval = <50>;
73                 };
74                 left {
75                     label = "GPIO Key LEFT";
76                     linux,code = <105>;
77                     gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
78                     debounce_interval = <50>;
79                 };
80                 right {
81                     label = "GPIO Key RIGHT";
82                     linux,code = <106>;
83                     gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
84                     debounce_interval = <50>;
85                 };
86                 down {
87                     label = "GPIO Key DOWN";
88                     linux,code = <108>;
89                     gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
90                     debounce_interval = <50>;
91                 };
92                 enter {
93                     label = "GPIO Key ENTER";
94                     linux,code = <28>;
95                     gpios = <&gpio1 29 GPIO_ACTIVE_LOW>;
96                     debounce_interval = <50>;
97                 };
98                 esc {
99                     label = "GPIO Key ESC";
100                     linux,code = <1>;
101                     gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
102                     debounce_interval = <50>;
103                 };
104             };
105         };
106     };
107 };
108