Verdin iMX8MM: Behavior of CTRL_WAKE1_MICO# when active high

Hello,

I’m using a Verdin iMX8MM Q 2GB WB IT on a custom carrier board und want to wake up the SOM by CTRL_WAKE1_MICO# after going to suspend by software command.

On the eval board and with a default image it works like expected:

  • When the SOM is running and I set the CTRL_WAKE1_MICO# low, nothing happens
  • When the SOM is suspended by software command I can it wake up by setting the CTRL_WAKE1_MICO# low

Unfortunately we made a mistake with our carrier board and made the wake button active high with a external 20k pulldown.

So I tried to solve this by changing the device tree and make the wake up pin active high:

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

	wakeup {
		debounce-interval = <10>;
		/* Verdin CTRL_WAKE1_MICO# (SODIMM 252) */
		gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>;
		label = "Wake-Up";
		linux,code = <KEY_WAKEUP>;
		wakeup-source;
	};
};

This seems fine. When the SOM is suspended by software command I can it wake up by setting the CTRL_WAKE1_MICO# high.

But the CTRL_WAKE1_MICO# has a weird behavior:

  • When the SOM is running and I set the CTRL_WAKE1_MICO# high shortly, the SOM goes to suspend without any software command.
  • When the SOM is running and I set and hold the CTRL_WAKE1_MICO# high, the SOM goes to suspend. And it wakes up again when I release CTRL_WAKE1_MICO#.

What I am doing wrong?

Best regards,
Markus

Ok, I found the error.

I routed the signal of the button additionally to GPIO_7 (SODIMM_220) to get access to it in my software.

In my devicetree I added this as a key with KEY_SLEEP, because the software shall suspend the SOM, when the button is pressed shortly:

	gpio-keys {
		sleep {
			label = "Sleep";
			/* Verdin GPIO_7 (SODIMM 220) */
			gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
			linux,code = <KEY_SLEEP>;
			debounce-interval = <10>;
		};
	};

and that is wrong.

When I remove this from the device tree, the CTRL_WAKE1_MICO behave as expected. I didn’t expected that the OS will recognize the KEY_SLEEP and put the SOM to sleep.

Best regards,
Markus