From 43999aefd1a39615c1325532ae4a7437e2fbe72c Mon Sep 17 00:00:00 2001 From: Scaria Kochidanadu Date: Mon, 20 Jul 2026 17:22:45 +0530 Subject: [PATCH 1/2] feat(Release_Specific_Workarounds): Add the new low power mode Reword the documentation to be generic for changing the selected low power mode in ATF. Add information about the new low power mode DSS plus Deepsleep and how it can be selected. Signed-off-by: Scaria Kochidanadu --- .../linux/Release_Specific_Workarounds.rst | 63 +++++++++++-------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/source/devices/AM62LX/linux/Release_Specific_Workarounds.rst b/source/devices/AM62LX/linux/Release_Specific_Workarounds.rst index ce8711c4c..8c8822f1a 100644 --- a/source/devices/AM62LX/linux/Release_Specific_Workarounds.rst +++ b/source/devices/AM62LX/linux/Release_Specific_Workarounds.rst @@ -7,37 +7,50 @@ System Suspend Mode Workarounds ARM Trusted Firmware changes **************************** -This patch updates the system suspend mode for the AM62L platform. After making the following changes, -re-build the ARM Trusted Firmware and then re-package it in the :file:`tispl.bin` file to ensure -the changes take effect. To learn more about TF-A and how to rebuild it, see :ref:`foundational-components-atf`. -For rebuilding U-Boot and generating the new :file:`tispl.bin` follow :ref:`Build-U-Boot-label`. +The AM62L platform supports multiple low power modes. ARM Trusted Firmware (TF-A) sets the +active mode through the ``mode`` variable in the :func:`am62l_pwr_domain_suspend` +function. The following table lists all available modes: + ++--------------+---------------------------+----------------------------------------------+ +| Mode Value | Low Power Mode | Description | ++==============+===========================+==============================================+ +| 0 | DeepSleep | Default mode. Low latency, higher power | ++--------------+---------------------------+----------------------------------------------+ +| 6 | RTC + I/O + DDR | Lowest power with DDR retention | ++--------------+---------------------------+----------------------------------------------+ +| 8 | DSS plus DeepSleep | DeepSleep with Display Subsystem powered | ++--------------+---------------------------+----------------------------------------------+ + +To change the low power mode, modify the ``mode`` value in the TF-A source code as shown below. +After making the changes, re-build the TF-A and then re-package it in the +:file:`tispl.bin` file to ensure the changes take effect. To learn more about TF-A and how to +rebuild it, see :ref:`foundational-components-atf`. For rebuilding U-Boot and generating the new +:file:`tispl.bin` follow :ref:`Build-U-Boot-label`. .. code-block:: diff - diff --git a/plat/ti/k3/common/am62l_psci.c b/plat/ti/k3/common/am62l_psci.c - index 3df4986e5..945da5908 100644 - --- a/plat/ti/k3/common/am62l_psci.c - +++ b/plat/ti/k3/common/am62l_psci.c - @@ -317,6 +317,7 @@ static void am62l_pwr_domain_suspend(const psci_power_state_t *target_state) - * mode=6 for RTC only + DDR and mode=0 for deepsleep - */ - uint32_t mode = am62l_lpm_state; - + mode = 6; - + diff --git a/plat/ti/k3low/common/am62l_psci.c b/plat/ti/k3low/common/am62l_psci.c + index 6bb9a4298..d8da7e6a9 100644 + --- a/plat/ti/k3low/common/am62l_psci.c + +++ b/plat/ti/k3low/common/am62l_psci.c + @@ -233,7 +233,7 @@ static int am62l_validate_power_state(unsigned int power_state, + static void am62l_pwr_domain_suspend(const psci_power_state_t *target_state) + { + uint32_t core, proc_id; + - uint32_t mode = 0; + + uint32_t mode = 6; core = plat_my_core_pos(); - proc_id = PLAT_PROC_START_ID + core; + uint64_t context_save_addr = TIFS_LPM_SAVE_CTX; -This modifies :file:`plat/ti/k3/common/am62l_psci.c`, which is the new Power -State Coordination Interface (PSCI) driver for AM62L in Arm Trusted Firmware. -The :func:`am62l_pwr_domain_suspend` function will change the default system -suspend mode from Deep Sleep to RTC Only + DDR. +This modifies :file:`plat/ti/k3/common/am62l_psci.c`, the PSCI driver for AM62L in +Arm Trusted Firmware. The example above changes the default suspend mode from DeepSleep +(mode 0) to RTC + I/O + DDR (mode 6). Replace the ``mode`` value with any value from the +table above to select a different low power mode. -The default mode of 0 is the Deep Sleep state. Deep Sleep provides the lowest -latency wake-up but also uses more power. The updated default mode of 6 is -the RTC only + DDR state. In contrast, RTC only + DDR offers a lower power -consumption profile, but at the cost of higher wake-up latency. +.. note:: -This change is a temporary solution. A more robust solution is under development to pass a suspend parameter from the kernel -by leveraging the s2idle mechanism. + This is a workaround required for selecting the low power mode when using [deep] in the /sys/power/suspend interface. + A more robust solution to select the suspend mode at runtime from the kernel is via the s2idle mechanism, without requiring + a firmware rebuild. See :ref:`pm_s2idle_psci` for details. Once :file:`tispl.bin` is rebuilt and packaged, continue with entering LPM as described in :ref:`lpm_modes`. From ad354d7028461b0faea1332db4e41780407ab85d Mon Sep 17 00:00:00 2001 From: Scaria Kochidanadu Date: Mon, 20 Jul 2026 17:22:57 +0530 Subject: [PATCH 2/2] feat(pm_am62lx_low_power_modes): Introduce s2idle method for LPM Add the documentation for using s2idle method for selecting and entering Low power modes. Enhancing the documentation by distinguishing between the power-off and suspend-to-ram LPMs available. Signed-off-by: Scaria Kochidanadu --- .../pm_am62lx_low_power_modes.rst | 81 ++++++++++++++++--- 1 file changed, 71 insertions(+), 10 deletions(-) diff --git a/source/linux/Foundational_Components/Power_Management/pm_am62lx_low_power_modes.rst b/source/linux/Foundational_Components/Power_Management/pm_am62lx_low_power_modes.rst index f155e07ec..47e9891a6 100644 --- a/source/linux/Foundational_Components/Power_Management/pm_am62lx_low_power_modes.rst +++ b/source/linux/Foundational_Components/Power_Management/pm_am62lx_low_power_modes.rst @@ -19,8 +19,27 @@ to highest power consumption): #. RTC Only Plus DDR #. Deep Sleep +These modes fall into two distinct categories based on whether DDR context is retained: + +- **Power Off**: The system enters a complete poweroff state. DDR context is lost and upon wakeup, + the system executes a full hardware restart. + +- **Suspend to RAM**: The system suspends with DDR RAM context retained and the state is + restored on resume, resulting in significantly lower wakeup latency. + +| **Power Off Mode** +| - RTC Only + +| **Suspend to RAM Mode** +| - RTC + I/O + DDR +| - Deep Sleep +| - DSS plus DeepSleep + +Power Off Mode +************** + RTC Only -******** +======== RTC Only mode is the deepest low power mode that allows the system to enter a complete poweroff state with ultra-low power consumption while maintaining system time and wakeup capability. @@ -80,17 +99,41 @@ During resume from RTC Only mode, the system goes through a normal Linux boot pr detects that the RTC is already programmed and skips the full initialization, performing only minimal cleanup to preserve the system time. -RTC Only Plus DDR -***************** +Suspend to RAM Mode +******************* + +Selecting the Suspend to RAM Entry Mechanism +============================================ + +When entering suspend to RAM via ``echo mem > /sys/power/state``, the kernel selects the +low power mode to enter based on the value of ``/sys/power/mem_sleep``: + +- ``deep`` — uses the system suspend path; selected by default. + Always enters the hardcoded mode selected in the firmware during build time, + which is **DeepSleep** mode by default. +- ``s2idle`` — uses the Suspend-to-Idle path via PSCI, which allows the platform firmware (TF-A) to select the deepest available mode. + Allows mode selection in runtime. Mode selected is determined by latency and system configuration. + +To check or change the current default at runtime: + +.. code-block:: console + + root@am62lxx-evm:~# cat /sys/power/mem_sleep + s2idle [deep] + + root@am62lxx-evm:~# echo s2idle > /sys/power/mem_sleep + + +For full details on the s2idle path, PSCI integration, and mode selection at runtime, refer to :ref:`pm_s2idle_psci`. .. note:: - Please go through the s2idle docs to understand how to select between multiple low power modes. - The steps and overall architecture/ sequence diagrams are documented in :ref:`pm_s2idle_psci`. - The default mode via s2idle is RTC Only Plus DDR, since it's the deepest. + If the [deep] path is selected in `/sys/power/mem_sleep`, the low power mode + selection requires special steps to enter. The steps are documented in :ref:`am62l_suspend_workarounds`. + The default mode is **DeepSleep** mode. - If regular [mem] interface is selected in `/sys/power/mem_sleep`, the RTC Only + DDR low power mode - requires special steps to enter. The steps are documented in :ref:`am62l_suspend_workarounds`. +RTC + I/O + DDR +================= RTC Only + DDR mode is the deepest low power mode that allows the system to enter a state of lowest power consumption while still retaining the DDR RAM context. @@ -108,6 +151,13 @@ sources. root@am62lxx-evm:~# echo disabled > /sys/devices/platform/bus@f0000/f900000.dwc3-usb/power/wakeup root@am62lxx-evm:~# echo disabled > /sys/devices/platform/bus@f0000/f910000.dwc3-usb/power/wakeup +.. note:: + + Without the disabling USB as a wakeup source, upon resume the USB driver will crash and the system will not resume, + while using the [deep] path. + + For the [s2idle] path, if USB0 or USB1 is enabled as a wakeup source the system will enter DeepSleep instead of RTC + I/O + DDR. + Now the SoC can be suspended using the following command. .. code-block:: console @@ -132,7 +182,7 @@ Now the SoC can be suspended using the following command. [ 222.445468] PM: suspend exit DeepSleep -********* +========= DeepSleep AKA Suspend-to-RAM is a low-power mode that allows the SoC to retain its state in RAM while the processor is turned off. @@ -144,7 +194,16 @@ Since the power to Always-On power domains are ON throughout DeepSleep, power to key modules such as GPIO and others is maintained to allow wakeup events to exit out of this mode. -In order to enter DeepSleep, +DeepSleep is the default mode entered using the [deep] path in `/sys/power/mem_sleep`. + +To enter DeepSleep mode using the [s2idle] path, set the cpu latency constraint between that of DeepSleep(350ms) and RTC + I/O + DDR(900ms) mode. +Refer :ref:`setting-cpu-wakeup-latency` to see how to set the CPU wakeup latency constraint. + +Use the following command to set the constraint to 500ms, which will allow the system to enter DeepSleep mode. + + .. code-block:: bash + + exec 4<>/dev/cpu_wakeup_latency; echo 0x7a120 >&4 .. code-block:: console @@ -172,6 +231,8 @@ In order to enter DeepSleep, [ 88.649913] PM: suspend exit root@am62lxx-evm:~# +Execute the above commands in a subshell to avoid accidentally keeping the file descriptor open indefinitely. + Memory Usage ************