Using Ultra Low Power mode 1 (ULP1) on SAMA5D2


Introduction

In products like the SAMA5D2 the Ultra Low Power mode 1 is available to gain even more power when the system is suspended. While the Ultra Low Power mode 0 (ULP0) maintains some clocks for peripherals to be able to wake up the system, in ULP1 peripheral clocks are off and some selected wake-up sources can re-start the system quickly. For instance, here are the possible wake-up sources on SAMA5D2:

  • WKUP0 pin (level transition, configurable debouncing)
  • WKUP1 Secumod wake up signal
  • WKUP2 pin to WKUP9 pin (shared with PIOBU0 to PIOBU7)
  • RTC alarm
  • USB Resume from Suspend mode
  • SDMMC card detect
  • RXLP event
  • ACC event
  • Any SleepWalking event coming from TWI, FLEXCOMx, SPI, ADC

Info In Linux we manage only some of these wake-up sources.

For detailed description of these modes, please refer to the product datasheet: Electrical Characteristics chapter and "Power Consumption" entry. Particularly, the "Low-power Mode Summary Table" table is very handy.

The startup procedure when the SoC is in ULP1 is described in the product datasheet in the Power Management Controller chapter in the "Fast Startup from Ultra Low-Power (ULP) Mode 1" entry.

On product which implement this ULP1 mode, this feature is used during the common suspend/resume cycles of an embedded Linux system, as described below.

Commands to enter the sleep state

Enter the ULP1 mode

# echo mem > /sys/power/state

You can use the WAKE UP button to wake up from the ULP1 mode.

Enter the Standby mode

# echo standby > /sys/power/state

You can use the PB_USER button to wake from the standby mode.

RTC alarm to wake from the sleep mode.

rtcwake -m mem -s 5

rtcwake -m standby -s 5

Switching back to the ULP0 mode

If you want to use the ULP0 mode for SAMA5D2, please do the following changes.

diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 953aad4..1a16145 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -628,7 +628,7 @@ void __init at91sam9x5_pm_init(void)
        at91_pm_init();
 
        if (readl(pmc + AT91_PMC_VERSION) >= SAMA5D2_PMC_VERSION)
-               at91_pm_data.ulp_mode = ULP1_MODE;
+               at91_pm_data.ulp_mode = ULP0_MODE;
 
        at91_pmc_fast_startup_init();
 }

Configuration the PB_USER button to wake up from the ULP0 mode.

         gpio_keys {
                 compatible = "gpio-keys";
 
                 pinctrl-names = "default";
                 pinctrl-0 = <&pinctrl_key_gpio_default>;
 
                 bp1 {
                         label = "PB_USER";
                         gpios = <&pioA 41 GPIO_ACTIVE_LOW>;
                         linux,code = <0x104>;
                         gpio-key,wakeup;
                 };
         };

Pointing hand The ULP0 mode can not be woken up by the WAKE UP button. It can be woken up by the PB_USER button and rtc alarm event.

WebFaqBaseForm
Boards Sama5d2-icp, Sama5d27WLSom1EK, Sama5d27Som1EK, Sama5d2PtcEK, Sama5d2Xplained
Components Kernel, linux-4.1-at91, linux-4.4-at91
Summary Using Ultra Low Power mode 1 (ULP1)
r6 - 21 Jan 2020 - 15:49:32 - CristianBirsan
 
Linux & Open Source for AT91 Microchip Microprocessors

Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.

Microchip and others, are registered trademarks or trademarks of Microchip Technology Inc. and its subsidiaries. This site is powered by the TWiki collaboration platform

Arm® and others are registered trademarks or trademarks of Arm Limited (or its affiliates). Other terms and product names may be trademarks of others.

Ideas, requests, contributions ? Connect to LinksToCommunities page.

Syndicate this siteRSS ATOM