1. Purpose
This article describes the configuration of the PWR wake-up pins for a usage in Linux.
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 OPTEE.
2. Overview
- Button: one external device plugged to a wake-up pin. Could also be a PMIC.
- PWR: PWR internal peripheral
- OPTEE PWR IRQ driver: driver in charge of PWR peripheral that provides access to the wake-up pin via an interrupts interface.
- OPTEE PWR IRQ user driver: PWR IRQ consumer used to enable one wake-up pin and forward events as notifications to the non-secure world.
- OPTEE notification: stack in charge of communication with the non secure world.
- Linux Linaro optee driver: stack in charge of communication with secure world. Transform OPTEE notifications to interrupts.
- GPIO keys: Linux driver using a wake-up pin handled by OPTEE. Could be any driver able to handle Linux interrupts.
3. Wake-up pin configuration
3.1. OPTEE configuration
Wake-up pins are configured in OPTEE via device-tree. A pwr-irq-user can be instantiated to handle the desired wake-up pin and send a OPTEE notification to Linux in case of event.
3.2. Linux configuration
Linux does not handle wake-up pin, but it can handle an OPTEE notification as an interrupt. This is configured via device-tree.
4. Example with wake-up pin 2
In the example below, the wake-up pin number 2 is configured by OPTEE, forwarded as notification number 4 to Linux, and used by "gpio-keys" driver in Linux to generate a key-press.
OPTEE 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. References