2021-03-08 05:00 AM
Hello. I am working on standby/wakeup using gpio pin in stm32mp1 custom board. Going to sleep works well using gpio-keys but I can't wakeup. What bothers me most is that interrupt responsible for waking up does not set "waleup" attribute although it is defined in DTS as wakeup-source. I am not sure whether I correctly understand the concept behind exti_pwr and pwr_irq nodes so if there is anyone who can help me with a proper setup I would appreciate your help. Please find enclosed DTS.
gpio_keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
autorepeat;
input-name = "gpio-keys";
button@1 {
label = "Suspend";
linux,code = <205>;
gpios = <&gpioi 6 GPIO_ACTIVE_LOW>;
};
button@2 {
label = "Wakeup";
linux,code = <143>;
interrupts-extended = <&exti_pwr 55 IRQ_TYPE_EDGE_RISING>;
wakeup-source;
};
};
};
&pwr_irq {
wakeup-gpios = <&gpioi 6 GPIO_ACTIVE_HIGH>;
};
2021-03-08 08:48 AM
Hi,
PI6 has no WKUP capabilities.
If you really go in SoC Standby (i.e. VDDCORE shutdown), you must use to wakeup one of the 6 available WKUP pins (e.g. PA0/WKUP1 is used on our DK2/EV1 board).
See Reference Manual
See also:
https://wiki.st.com/stm32mpu/wiki/Interrupt_overview
https://wiki.st.com/stm32mpu/wiki/PWR_internal_peripheral
Regards.
2021-03-08 11:03 AM
2021-03-08 10:58 PM
So what you're saying is that only PA0, PA2, PC13, PI8, PI11 and PC1 have wakeup capabilities because that's what I see in DTS ?
2021-03-08 11:40 PM
Wakeup capabilities are shown in Reference Manual (PWR section, e.g. in RM0436 Rev.5, Table 33. "System Low-power mode summary", or "PWR exiting from Standby mode" sub-section).
WKUP pins locations are shown on Datasheet, 6x are present on 18x18 and 12x12 packages, 4x in 16x16 and 10x10 packages.
I confirm, it is PI8 and PI11 (on some packages), plus PC13, PA0, PA2, PC1.
They are present in STM32CubeMX, PWR category.
2021-03-10 03:35 AM
Thank for you support. I have one more question regarding standby. We would like to set certain IO pins with pull-ups or pull-downs during standby but it looks like vddcore is switched off during standby. It looks like in deep standby this is normal but I am wondering how could I go into other LP mode like Sleep so that vddcore is on and gpio pin values will be retained.
2021-03-10 06:21 AM
Yes, whenever VDDCORE if OFF (STANDBY), all IOs are hi-z (except some IOs related to VSW domain like those for RTC, TAMP).
For your case, if you want to avoid external resistors, you could use LPLV-Stop (VDDCORE only reduced, larger power than STANDBY, but GPIO settings and interrupt capabilities are kept).
Se https://wiki.st.com/stm32mpu/wiki/How_to_define_your_low-power_strategy
Regards.
2021-03-10 06:25 AM
I'm trying to find whether this is somehow configurable within the Linux kernel but as for now I didn't find anything. Do you know this off the top of your head ?
2021-03-10 07:01 AM
I'm not specialist of this, maybe read https://wiki.st.com/stm32mpu/wiki/Power_overview or AN5109.pdf
2021-03-11 10:29 PM
Thanks again. This Power overview pge guided me to the solution. It looks like kernel relies on settings made by TF-A and TF-a sets the deepest mode it has defined in DTS under
system_suspend_supported_modes = <
STM32_PM_CSLEEP_RUN
STM32_PM_CSTOP_ALLOW_STOP
STM32_PM_CSTOP_ALLOW_LP_STOP
STM32_PM_CSTOP_ALLOW_LPLV_STOP
STM32_PM_CSTOP_ALLOW_STANDBY_DDR_SR
>;
So what is needed is to define the deepest mode of your choice for the kernel to go.