Using Ultra Low Power mode 1 (ULP1) on SAMA5D2
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
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.
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
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;
};
};
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.