Hi imx friends,
I'm using a 6sololite board with linux 3.0.35. I have been using the matrix keypad support and it is working fine. I am able to read the key input events in software with no problem. Thanks to everyone who helped make that work.
So now I'm trying to test suspend/resume. I have tested console based suspend/resume and this also works fine. The way I test that is:
# echo enabled > /sys/devices/platform/imx-uart.1/tty/ttymxc1/power/wakeup
# 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)
Then I hit any key on serial console and it resumes.
udc suspend begins
USB Gadget suspend ends
add wake up source irq 59
add wake up source irq 58
add wake up source irq 51
PM: suspend of devices complete after 2.264 msecs
PM: late suspend of devices complete after 0.490 msecs
PM: early resume of devices complete after 0.341 msecs
remove wake up source irq 51
remove wake up source irq 58
remove wake up source irq 59
USB Gadget resume begins
fsl_udc_resume, Wait for wakeup thread finishes
dr_controller_run: udc enter low power mode
USB Gadget resume ends
PM: resume of devices complete after 123.276 msecs
PM: Finishing wakeup.
Restarting tasks ... done.
Okay, so all of that looks good. Now what I would like to do is to do the same thing from the keypad button. On non-imx boards, I'm used to using the wakeup flag with matrix-keypad driver to make this work. But on mx6, there is no matrix-keypad support, only imx-keypad support. In my code, I tried:
static int mx6sl_evk_keymap[] = {
KEY(0, 0, KEY_POWER),
KEY(1, 0, KEY_BACK),
KEY(2, 0, KEY_F1),
KEY(3, 0, KEY_F2),
...
static const struct matrix_keymap_data mx6sl_evk_map_data __initconst = {
.keymap = mx6sl_evk_keymap,
.keymap_size = ARRAY_SIZE(mx6sl_evk_keymap),
};
imx6sl_add_imx_keypad(&mx6sl_evk_map_data);
Above ends up in:
drivers/input/keyboard/imx_keypad.c
which does:
device_init_wakeup(&pdev->dev, 1);
So we know that the imx_keypad driver is enabling wakeup. But this doesn't seem to work for me. I can see that interrupts from the buttons are working fine during normal activity. Eg:
cat /proc/interrupts
114: 4 GIC imx-keypad
121: 0 GIC dvfs
130: 0 GIC pxp-irq
Err: 0
root@imx6qsabresd:~# 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)
<-- Here, I press all the buttons many times and no wakeup is activated.
Is there some iomux or pad setting that I need to do to make the keypad support wakeup from suspend? I would appreciate any advice/suggestions.
Thanks!
Hi Jaya
please try patch provided on
How to use the kpp for imx6q+android4.3?
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
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!