Free up the pins from the pinmux helper
[experiments/bbb-gpio-keypad.git] / bbb-gpio-keypad-00A0.dts
index d290093..fb06c45 100644 (file)
@@ -1,3 +1,22 @@
+/*
+ * bbb-gpio-keypad - simple navigation keypad for the BeagleBone Black
+ *
+ * Copyright (C) 2018  Antonio Ospite <ao2@ao2.it>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
 /dts-v1/;
 /plugin/;
 
 / {
     compatible = "ti,beaglebone", "ti,beaglebone-black";
 
-    /* identification */
-    part-number = "gpio-keypad-ao2";
+    // Identification.
+    part-number = "bbb-gpio-keypad";
     version = "00A0";
 
-    // resources this cape uses
+    // Resources this cape uses, see also https://ao2.it/137
     exclusive-use =
-      "P8.07",
-      "P8.08",
-      "P8.09",
-      "P8.10";
+        "P8.07",
+        "P8.08",
+        "P8.09",
+        "P8.10",
+        "P8.26",
+        "P9.15";
 
+    // Free up the pins from the pinmux helper
     fragment@0 {
+        target = <&ocp>;
+        __overlay__ {
+            P8_07_pinmux { status = "disabled"; };
+            P8_08_pinmux { status = "disabled"; };
+            P8_09_pinmux { status = "disabled"; };
+            P8_10_pinmux { status = "disabled"; };
+            P8_26_pinmux { status = "disabled"; };
+            P9_15_pinmux { status = "disabled"; };
+        };
+    };
+
+    fragment@1 {
         target = <&am33xx_pinmux>;
         __overlay__ {
-            keypad_pins: pinmux_gpio_pins{
+            keypad_pins: pinmux_gpio_pins {
                 pinctrl-single,pins = <
-                   BONE_P8_07 (PIN_INPUT_PULLUP | MUX_MODE7)
-                   BONE_P8_08 (PIN_INPUT_PULLUP | MUX_MODE7)
-                   BONE_P8_09 (PIN_INPUT_PULLUP | MUX_MODE7)
-                   BONE_P8_10 (PIN_INPUT_PULLUP | MUX_MODE7)
+                    BONE_P8_07 (PIN_INPUT_PULLUP | MUX_MODE7)
+                    BONE_P8_08 (PIN_INPUT_PULLUP | MUX_MODE7)
+                    BONE_P8_09 (PIN_INPUT_PULLUP | MUX_MODE7)
+                    BONE_P8_10 (PIN_INPUT_PULLUP | MUX_MODE7)
+                    BONE_P8_26 (PIN_INPUT_PULLUP | MUX_MODE7)
+                    BONE_P9_15 (PIN_INPUT_PULLUP | MUX_MODE7)
                 >;
             };
         };
     };
 
-    fragment@1 {
+    fragment@2 {
         target-path = "/";
         __overlay__ {
             gpio_keys {
                 compatible = "gpio-keys";
+                autorepeat;
                 pinctrl-names = "default";
                 pinctrl-0 = <&keypad_pins>;
 
                     gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
                     debounce_interval = <50>;
                 };
+                enter {
+                    label = "GPIO Key ENTER";
+                    linux,code = <28>;
+                    gpios = <&gpio1 29 GPIO_ACTIVE_LOW>;
+                    debounce_interval = <50>;
+                };
+                esc {
+                    label = "GPIO Key ESC";
+                    linux,code = <1>;
+                    gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
+                    debounce_interval = <50>;
+                };
             };
         };
     };
 };
-