From cb13f20965339570792a0c2446159ba30c7f5bdb Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Sat, 9 Jun 2018 17:48:59 +0000 Subject: [PATCH 1/1] Initial import --- .gitignore | 2 ++ Makefile | 16 +++++++++++ README | 26 +++++++++++++++++ bbb-gpio-keypad-00A0.dts | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 README create mode 100644 bbb-gpio-keypad-00A0.dts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0361461 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.dtbo +*.dts.tmp diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fa051fa --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +PART_NUMBER = bbb-gpio-keypad +VERSION = 00A0 + +INCLUDE_PATH = /home/debian/bb.org-overlays/include + +compile: $(PART_NUMBER)-$(VERSION).dtbo + +install: compile + cp $(PART_NUMBER)-$(VERSION).dtbo /lib/firmware + +clean: + rm -f *.dtbo *.dts.tmp *~ + +%.dtbo: %.dts + cpp -nostdinc -undef -D__DTS__ -I$(INCLUDE_PATH) -x assembler-with-cpp -o $<.tmp $< + dtc -Wno-unit_address_vs_reg -O dtb -o $@ -b 0 -@ $<.tmp diff --git a/README b/README new file mode 100644 index 0000000..ea42e59 --- /dev/null +++ b/README @@ -0,0 +1,26 @@ +Simple devicetree definition for a gpio keypad for connected to a BeagleBone +Black and using the gpio-keys driver. + +The keypad is connected this way: + + P8_07 -> KEY_TOP + P8_08 -> KEY_LEFT + P8_09 -> KEY_RIGHT + P8_10 -> KEY_BOTTOM + +The .dts file depends on definitions from bb.org-overlays, to download it +execute the following commands: + + $ cd ~ + $ git clone https://github.com/beagleboard/bb.org-overlays.git + +To compile and install the devicetree overlay execute the following commands: + + $ make && sudo make install + +And add an entry with the DT overlay to /boot/uEnv.txt, for example: + + uboot_overlay_addr1=/lib/firmware/bbb-gpio-keypad-00A0.dtbo + + +Copyright (C) 2018 Antonio Ospite diff --git a/bbb-gpio-keypad-00A0.dts b/bbb-gpio-keypad-00A0.dts new file mode 100644 index 0000000..d290093 --- /dev/null +++ b/bbb-gpio-keypad-00A0.dts @@ -0,0 +1,72 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/ { + compatible = "ti,beaglebone", "ti,beaglebone-black"; + + /* identification */ + part-number = "gpio-keypad-ao2"; + version = "00A0"; + + // resources this cape uses + exclusive-use = + "P8.07", + "P8.08", + "P8.09", + "P8.10"; + + fragment@0 { + target = <&am33xx_pinmux>; + __overlay__ { + 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) + >; + }; + }; + }; + + fragment@1 { + target-path = "/"; + __overlay__ { + gpio_keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&keypad_pins>; + + up { + label = "GPIO Key UP"; + linux,code = <103>; + gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; + debounce_interval = <50>; + }; + left { + label = "GPIO Key LEFT"; + linux,code = <105>; + gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; + debounce_interval = <50>; + }; + right { + label = "GPIO Key RIGHT"; + linux,code = <106>; + gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; + debounce_interval = <50>; + }; + down { + label = "GPIO Key DOWN"; + linux,code = <108>; + gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; + debounce_interval = <50>; + }; + }; + }; + }; +}; + -- 2.1.4