How to configure PWR Wake-up pins

Revision as of 13:18, 21 September 2022 by Registered User
Applicable for STM32MP13x lines

1. Purpose[edit source]

This article describes the configuration of the PWR wake-up pins.
The PWR Wake-up pins are used to wake-up from Standby from an external device.

2. Overview[edit source]

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 OP-TEE TZ: stack in charge of communication with secure world. Provides OP-TEE notifications as interrupts.
  • GPIO keys: OP-TEE interrupts client.

3. OP-TEE Wake-up pin 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 OPTEE notification to Linux in case of event.

4. Linux Wake-up pin usage[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.

5. 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";
               };
       };

6. References[edit source]