Hi Igor,
Thanks for your reply. I was able to modify the patch to be suitable for my setup. In my case, I'm using the following pins for the buttons:
MX6SL_PAD_SD1_CLK__KPP_COL_0,
MX6SL_PAD_SD1_CMD__KPP_ROW_0,
MX6SL_PAD_SD1_DAT1__KPP_ROW_1,
MX6SL_PAD_SD1_DAT3__KPP_ROW_2,
MX6SL_PAD_SD1_DAT5__KPP_ROW_3,
I modified my common to match the patch you linked to. My patch is therefore:
--- a/arch/arm/mach-mx6/board-mx6sl_common.h
+++ b/arch/arm/mach-mx6/board-mx6sl_common.h
@@ -484,14 +484,14 @@ static iomux_v3_cfg_t suspend_enter_pads[] = {
/* PWM pads */
MX6SL_PAD_PWM1__GPIO_3_23,
/* SD pads. */
- MX6SL_PAD_SD1_CLK__GPIO_5_15,
- MX6SL_PAD_SD1_CMD__GPIO_5_14,
+// MX6SL_PAD_SD1_CLK__GPIO_5_15, XXXjaya disable to allow resume
+// MX6SL_PAD_SD1_CMD__GPIO_5_14, XXXjaya disable to allow resume
MX6SL_PAD_SD1_DAT0__GPIO_5_11,
- MX6SL_PAD_SD1_DAT1__GPIO_5_8,
+// MX6SL_PAD_SD1_DAT1__GPIO_5_8, XXXjaya disable to allow resume
MX6SL_PAD_SD1_DAT2__GPIO_5_13,
- MX6SL_PAD_SD1_DAT3__GPIO_5_6,
+// MX6SL_PAD_SD1_DAT3__GPIO_5_6, XXXjaya disable to allow resume
MX6SL_PAD_SD1_DAT4__GPIO_5_12,
- MX6SL_PAD_SD1_DAT5__GPIO_5_9,
+// MX6SL_PAD_SD1_DAT5__GPIO_5_9, XXXjaya disable to allow resume
MX6SL_PAD_SD1_DAT6__GPIO_5_7,
MX6SL_PAD_SD1_DAT7__GPIO_5_10,
Unfortunately, with this change I still can't get resume from buttons to work. However, there is a change because now after the button press, and then resuming using console, I see the interrupt count for imx-keypad has increased.
# cat /sys/devices/platform/imx-keypad/input/input0/uevent
PRODUCT=19/0/0/0
NAME="imx-keypad"
PROP=0
EV=100013
KEY=2 0 0 0 0 0 0 40000000 0 0 18000000 0
MSC=10
MODALIAS=input:b0019v0000p0000e0000-e0,1,4,14,k9E,161,ram4,lsfw
# echo mem > /sys/power/state
PM: Syncing filesystems ... done.
PM: Preparing system for mem sleep
Freezing user space processes ... (elapsed 0.01 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.
PM: Entering mem sleep
Suspending console(s) (use no_console_suspend to debug)
so now I press button and it doesn't wakeup. But I use serial console resume and then check interrupt count.
wl1271: down
udc suspend begins
USB Gadget suspend ends
add wake up source irq 58
add wake up source irq 51
PM: suspend of devices complete after 9.865 msecs
PM: late suspend of devices complete after 0.500 msecs
PM: early resume of devices complete after 0.343 msecs
remove wake up source irq 51
remove wake up source irq 58
ddrMode=0, lvdsModeCe=0, lvdsMode=0, prev EPDC_TCE_CTRL 0x10, new val 0x40002
after write EPDC_TCE_CTRL 0x40002
USB Gadget resume begins
fsl_udc_resume, Wait for wakeup thread finishes
dr_controller_run: udc enter low power mode
USB Gadget resume ends
wl1271: firmware booted (Rev 6.1.5.50.69)
PM: resume of devices complete after 590.333 msecs
PM: Finishing wakeup.
Restarting tasks ... done.
# cat /proc/interrupts
CPU0
34: 0 GIC sdma
51: 0 GIC snvs_rtc
55: 22881 GIC mmc0
56: 15351 GIC mmc1
58: 1027 GIC IMX-uart
63: 0 GIC spi_imx
68: 274 GIC imx-i2c
69: 0 GIC imx-i2c
75: 0 GIC usb_wakeup, fsl-usb2-udc
87: 1533 GIC i.MX Timer Tick
112: 0 GIC imx2-wdt
114: 2 GIC imx-keypad
121: 0 GIC dvfs
129: 4 GIC fb_dma
130: 1 GIC pxp-irq
391: 192 GPIO wl1271
Err: 0
It looks like the problem is that there is still some configuration step that's missing. I noticed once the resume occurs, it says:
USB Gadget suspend ends
add wake up source irq 58
add wake up source irq 51
So it looks like the imx-uart is registered as a wake up source (irq 58) and that's why it works. But I can't see irq 141 registered as a wakeup source. So what's missing is registering a wakeup source. I'm now looking for where that needs to be done.
I checked that wakeup is enabled for keypad in sysfs:
# echo enabled > /sys/devices/platform/imx-keypad/power/wakeup
# cat /sys/devices/platform/imx-keypad/power/wakeup
enabled
Still looking for where wakeup source is configured.
Thanks!