How to wakeup apalis using GPIO?

Hello,

We are working on Apalis Ixora development platform running on Android 7.1.2.
We are able to suspend the system using:
echo mem > /sys/power/state

But we are facing problem in waking up the system. How to use MXM3 PIN 37 to wakeup the system ? How to change the state of this pin from software ? Please throw some light on this.
Ref: High performance, low power Embedded Computing Systems | Toradex Developer Center

Pin 37 should be set as wake-up source by default. Did you try to change it state externally?
For changing pin state please refer to this article - High performance, low power Embedded Computing Systems | Toradex Developer Center

Hi @alex.tx ,

Thanks for your reply.

  1. I understand that Pin 37 should be configured as wake-up source by default. What do you mean by ‘externally’ here? do you mean that “I should try wake-up with some hard key connected to that PIN 37?”

  2. I don’t see this pin (GPIO 4) under sysfs entry:

    toradex_apalis6q:/ # cat /sys/kernel/debug/gpio
    gpiochip0: GPIOs 0-31, parent: platform/209c000.gpio, 209c000.gpio:
    gpio-0 ( |usb_host_vbus ) out lo
    gpio-12 ( |? ) out lo
    gpio-14 ( |? ) out lo

    gpiochip1: GPIOs 32-63, parent: platform/20a0000.gpio, 20a0000.gpio:
    gpio-33 ( |? ) out lo
    gpio-34 ( |? ) out lo
    gpio-36 ( |ov5647_mipi_pwdn ) out lo

    gpiochip2: GPIOs 64-95, parent: platform/20a4000.gpio, 20a4000.gpio:
    gpio-77 ( |enable ) out hi
    gpio-86 ( |usb_otg_vbus ) out lo
    gpio-92 ( |usb_host_vbus_hub ) out hi

    gpiochip3: GPIOs 96-127, parent: platform/20a8000.gpio, 20a8000.gpio:
    gpio-116 ( |cd ) in hi

    gpiochip4: GPIOs 128-159, parent: platform/20ac000.gpio, 20ac000.gpio:

    gpiochip5: GPIOs 160-191, parent: platform/20b0000.gpio, 20b0000.gpio:
    gpio-175 ( |ov5647_mipi_led ) out lo

    gpiochip6: GPIOs 192-223, parent: platform/20b4000.gpio, 20b4000.gpio:

Is this correct ? Or what should have gone wrong here ?
I can see this pin configuration in my dts:

gpio-keys {
                compatible = "gpio-keys";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_gpio_keys>;

                wakeup {
                        label = "Wake-Up";
                        gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_WAKEUP>;
                        debounce-interval = <10>;
                        gpio-key,wakeup;
                };
        };

Please throw some light here.

  1. Do i need to configure direction of this pin explicitly ?

hi @amit251291

Sorry for the late reply.

I understand that Pin 37 should be configured as wake-up source by default. What do you mean by ‘externally’ here? do you mean that “I should try wake-up with some hard key connected to that PIN 37?”

Externally means that you have change the state of the pin by a signal which is not provided by the module. Anyway during suspend mode module (SOC) is inactive, so it cannot active itself, except you put a timer for suspend as explained here.

I don’t see this pin (GPIO 4) under sysfs entry

What is the SODIMM Pin you are looking for? Please note that not all the GPIOs are exported in Linux. Consult this page to get further Information about GPIOs in Linux?

Do i need to configure direction of this pin explicitly ?

No, keep it as GPIO, then it will an input and 0 state. You can control the direction in Linux.

Hi @jaski.tx

Thanks for you reply

What is the SODIMM Pin you are looking
for? Please note that not all the
GPIOs are exported in Linux. Consult
this page to get further Information
about GPIOs in Linux?.

I am looking for PIN 37 which is configured as wake-up pin. This PIN is GPIO1_IO4 as per apalis_imx6 datasheet. Please see below image. I am unable to see this PIN under /sys/kernel/debug/gpio which is shown here.

Hi,

The GPIO1_IO4 (Sodimm 37) would be gpio4. I tried the command with Bsp2.8b4 and I can see gpio4. Which Bsp version exactly are you using ( cat /etc/issue )? Have you done any changes in your device tree files? If yes, please share them ( git diff ).

Best regards, Jaski