1. Purpose[edit source]
This article describes the configuration of the PWR wake-up pins for a usage in Linux, based on OP-TEE driver.
The PWR Wake-up pins are used to wake-up from Standby from an external device.
This article does not describe how to configure a wake-up pin to use it internally in OP-TEE.
This article is applicable only if the PWR peripherals is assigned only to OP-TEE, for all STM32 Arm® Cortex® MPUs except STM32MP15x lines .
For STM32MP15x lines , the PWR Wake-up is handled in pwr_irq irqchip driver.
2. Overview[edit source]
- Button: one external device plugged to a wake-up pin. Could also be a PMIC.
- PWR: PWR internal peripheral
- OP-TEE PWR IRQ driver: driver in charge of PWR peripheral that provides access to the wake-up pin via an interrupts interface.
- OP-TEE PWR IRQ user driver: PWR IRQ consumer used to enable one wake-up pin and forward events as notifications to the non-secure world.
- OP-TEE notification: stack in charge of communication with the non secure world.
- Linux Linaro optee driver: stack in charge of communication with secure world. Transform OP-TEE notifications to interrupts.
- GPIO keys: Linux driver using a wake-up pin handled by OP-TEE. Could be any driver able to handle Linux interrupts.
3. Wake-up pin configuration[edit source]
3.1. OP-TEE configuration[edit source]
Wake-up pins are configured in OP-TEE via device-tree. A pwr-irq-user can be instantiated to handle the desired wake-up pin and send a OP-TEE notification to Linux in case of event.
3.2. Linux configuration[edit source]
Linux does not handle wake-up pin, but it can handle an OP-TEE notification as an interrupt. This is configured via device-tree.
4. Example with wake-up pin 2[edit source]
In the example below, the wake-up pin number 2 is configured by OP-TEE, forwarded as notification number 4 to Linux, and used by "gpio-keys" driver in Linux to generate a key-press.
OP-TEE device tree:
wakeup_button: wakeup-button { compatible = "st,stm32mp1,pwr-irq-user"; st,wakeup-pin-number = <2>; st,notif-it-id = <4>; status = "okay"; };
Linux device tree:
wake_up { compatible = "gpio-keys"; status = "okay"; button { label = "wake-up"; linux,code = <KEY_WAKEUP>; interrupts-extended = <&optee 4>; status = "okay"; }; };
5. Source code location[edit source]
The source files are located inside the OP-TEE.
- OP-TEE PWR IRQ driver:
- core/arch/arm/plat-stm32mp1/drivers/stm32mp1_pwr_irq.c for STM32MP13x lines
- core/arch/arm/plat-stm32mp2/drivers/stm32mp25_pwr_irq.c for STM32MP25x lines
6. References[edit source]