2

UPDATE : I changed the keyboard layout file (gpio-keys.kl) to the following:

key 115   POWER     WAKE
key 114   POWER     WAKE

As seen, I now registered the volume buttons as POWER keys in Android and it wakes up the system. However, I wish to have any generic gpio-key wake up the system. The fact that changing the key layout file as above works tells me that perhaps the issue is on the Android side and not the Linux kernel side. Not sure. Perhaps there are files in Android (policy files, etc.) where I can provide a wake capability to the gpio-key of choice, much the same way as the POWER key has this wake capability.

Please let me know your thoughts.

ORIGINAL : As for some background, my hardware is a Samsung Galaxy S2-i777, which runs on an Exynos4210 SoC (ARM-based processor). OS is LineageOS 14.1. I'm trying to wake up my system from sleep using a gpio-keys interrupt but I have been unsuccessful.

I've configured gpio-keys in my board file (no device tree as old kernel version). A snippet of where I defined my gpio-keys is below:

struct gpio_keys_button u1_buttons[] = {
{
    .code = KEY_VOLUMEUP,
    .gpio = GPIO_VOL_UP,
    .active_low = 1,
    .type = EV_KEY,
    .wakeup = 1,
    .isr_hook = sec_debug_check_crash_key,
    .debounce_interval = 10,
},  
};

I omitted registered platform section, etc. but can show if necessary. As seen above, I set the boolean property wakeup to 1 to enable my gpio GPIO_VOL_UP to act as a wakeup source. Also as seen, it is my volume buttons that I want to use as my gpio-keys. I also modified my key layout file (gpio-keys.kl) as seen below:

key 115   VOLUME_UP       WAKE
key 114   VOLUME_DOWN     WAKE

When I check my local terminal in LineageOS, I see that my gpio-keys are defined as wakeup_sources and wakeup is enabled. I also see that my volume buttons are generating interrupts (cat /proc/interrupts).

When my system goes to sleep, the volume buttons (gpio-keys) do not wake up my system. Only thing that wakes up my system is the power button (which appears to be a gpio-key as well).

What do you think the issue might be? What are the general steps necessary to waking up the system using gpio-keys interrupts? Even if it is not specific to my hardware, perhaps a general layout of these steps or certain considerations will help me since I might be missing something. Thanks!

JoeG
  • 33
  • 1
  • 7

1 Answers1

1

First, I would suggest to check the console for any log messages when the Volume button is pressed in the suspend state.

Second, I would like to suggest you to probe the the HW lines to check whether an interrupt is actually generated whenever you press the Volume button when the system is in deep sleep state.

If the interrupts aren't generated, then the HW section might be disabled in the low-power mode and you wouldn't be able to wakeup the system.

San
  • 71
  • 1
  • 5