How to configure PWR Wake-up pins

Applicable for STM32MP13x lines

1 Purpose[edit]

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 STM32MP13x lines More info.png.

For STM32MP15x lines More info.png, the PWR Wake-up is handled in EXTI_pwr irqchip driver.

2 Overview[edit]

Alternate text
Wake-up pins overview
  • 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]

3.1 OP-TEE configuration[edit]

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]

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]

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 References[edit]