Hello,
I have a Beaglebone black on which I am running latest Debian image.
root@beaglebone:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="
https://www.debian.org/"
SUPPORT_URL="
https://www.debian.org/support"
BUG_REPORT_URL="
https://bugs.debian.org/"
root@beaglebone:~# uname -a
Linux beaglebone 4.4.91-ti-r133 #1 SMP Tue Oct 10 05:18:08 UTC 2017 armv7l GNU/Linux
I got the Linux source from here to modify the device trees.
https://github.com/beagleboard/linux.gitdiff --git a/arch/arm/boot/dts/am335x-boneblack-custom.dts b/arch/arm/boot/dts/am335x-boneblack-custom.dts
index 0c68a88..a85990d 100644
--- a/arch/arm/boot/dts/am335x-boneblack-custom.dts
+++ b/arch/arm/boot/dts/am335x-boneblack-custom.dts
@@ -10,10 +10,49 @@
#include "am33xx.dtsi"
#include "am335x-bone-common-no-capemgr.dtsi"
#include <dt-bindings/board/am335x-bbw-bbb-base.h>
+#include <dt-bindings/input/input.h>
/ {
model = "TI AM335x BeagleBone Black";
compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
+
+ gpio-keys {
+ compatible = "gpio-keys";
+ pinctrl-names = "default";
+ pinctrl-0 = <&wakeup_gpio_pins>;
+
+ power1 {
+ label = "CAN1_WakeB";
+ gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
+ linux,code = <KEY_WAKEUP>;
+ debounce-interval = <10>;
+ wakeup-source;
+ };
+
+ power2 {
+ label = "CAN1_WakeA";
+ gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
+ linux,code = <KEY_WAKEUP>;
+ debounce-interval = <10>;
+ wakeup-source;
+ };
+
+ power3 {
+ label = "CAN0_WakeB";
+ gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
+ linux,code = <KEY_WAKEUP>;
+ debounce-interval = <10>;
+ wakeup-source;
+ };
+
+ power4 {
+ label = "CAN0_WakeA";
+ gpios = <&gpio2 22 GPIO_ACTIVE_HIGH>;
+ linux,code = <KEY_WAKEUP>;
+ debounce-interval = <10>;
+ wakeup-source;
+ };
+ };
};
&ldo3_reg {
@@ -52,6 +91,15 @@
BONE_P9_17 (SLEWCTRL_SLOW | PIN_INPUT_PULLUP | MUX_MODE3)
>;
};
+
+ wakeup_gpio_pins: pinmux_wakeup {
+ pinctrl-single,pins = <
+ BONE_P8_07 (SLEWCTRL_SLOW | PIN_INPUT_PULLUP | MUX_MODE7)
+ BONE_P8_11 (SLEWCTRL_SLOW | PIN_INPUT_PULLUP | MUX_MODE7)
+ BONE_P8_15 (SLEWCTRL_SLOW | PIN_INPUT_PULLUP | MUX_MODE7)
+ BONE_P8_27 (SLEWCTRL_SLOW | PIN_INPUT_PULLUP | MUX_MODE7)
+ >;
+ };
};
After compiling copied it to /boot/dtbs/4.4.91-ti-r133 and added "dtb=am335x-boneblack-custom.dtb". Wake up events seem to be generated which I tested with "evtest" but after initiating suspend with "echo mem > /sys/power/state", wakeup does not happen on any activity on the pin.
root@beaglebone:~# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: tps65217_pwr_but
/dev/input/event1: gpio-keys
Select the device event number [0-1]: 1
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio-keys"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 143 (KEY_WAKEUP)
Properties:
Testing ... (interrupt to exit)
Event: time 1517912798.523455, type 1 (EV_KEY), code 143 (KEY_WAKEUP), value 0
Event: time 1517912798.523455, -------------- SYN_REPORT ------------
Event: time 1517912799.801348, type 1 (EV_KEY), code 143 (KEY_WAKEUP), value 1
Event: time 1517912799.801348, -------------- SYN_REPORT ------------
Event: time 1517912799.884218, type 1 (EV_KEY), code 143 (KEY_WAKEUP), value 0
Event: time 1517912799.884218, -------------- SYN_REPORT ------------
root@beaglebone:~# echo mem > /sys/power/state
[ 2109.821542] PM: Syncing filesystems ... done.
[ 2114.060031] Freezing user space processes ... (elapsed 0.001 seconds) done.
[ 2114.068922] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 2114.200500] PM: suspend of devices complete after 121.160 msecs
[ 2114.210744] PM: late suspend of devices complete after 4.001 msecs
[ 2114.221114] PM: noirq suspend of devices complete after 3.858 msecs
[ 2114.227715] Disabling non-boot CPUs ...
No wakeup here upon any activity on the wakeup pins.
Does anyone have an idea?
Thanks & Regards,
Sanchayan Maity.