DESK-MX9-L/Deployment/Power Manager

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes
2024-07-01 First public version



Power Manager[edit | edit source]

This page outlines operational details for accessing the different consumption modes provided for the i.MX93 SoC, as described by NXP in AN14022 and AN13917. An explanation and measurement of consumption in some real use cases is proposed here.

For convenience, the description below is divided into the two groups as per NXP nomenclature: run mode and low-power mode.

Run mode[edit | edit source]

As described in AN14022, NXP i.MX93 SoC features a basic support for voltage and frequency dynamic scaling. As such, its Linux BSP does not provide the well-known CPUFreq subsystem. Instead, it provides an alternative, NXP-specific implementation, which is based on the lpm driver. Please note that selection and configuration of the run modes may require modifying the Device Tree (DT) too as explained in the following sections.

In regard to run mode, NXP defines four operating modes:

  • Over drive
  • Nominal drive
  • Low drive
  • Low drive with SWFFC

By default, not all of them are available in DESK-MX9-L. Over drive and Nominal drive are selectable only. This choice is due to the fact that Low drive and Low drive with SWFFC entails to change the clock frequency of some buses too. A conservative approach was preferred, leaving it up to the developer to modify the DT as shown below in case the other two modes need to be used as well.

Mode VDD SOC A55 Max Frequency DRAM Max Frequency Notes
Over drive (OD Mode, default) 0.9 V 1700 MHz 1866 MHz (3733 MTS) (1)
Nominal drive (ND Mode) 0.85 V 1400 MHz 1400 MHz (2800 MTS)
Low drive (LD Mode) 0.8 V 933 MHz 933 MHz (1866 MTS) (2)
Low drive with SWFFC

(Software Fast Frequency Change)

(LD SWFFC Mode)

0.8 V 933 MHz 625 MTS (2)

Note:

  • (1): Over drive is the default operating mode
  • (2): To enable Low drive and Low drive with SWFFC modes, DT must be modified. See here for more details.

Selecting over drive/nominal mode[edit | edit source]

The driver/imx/soc/imx93_lpm.c driver uses imx-atf to manage the operating mode and can be controlled using a sysfs interface.

To select the Nominal drive mode, issue the following command:

root@desk-mx93-rev1:~# echo 1 > /sys/devices/platform/imx93-lpm/mode
[ 9557.112015] System switching to ND mode...
root@desk-mx93-rev1:~# cat /sys/devices/platform/imx93-lpm/mode
System is in ND mode with DDR 1866 MTS!
root@desk-mx93-rev1:~# mhz
1398 MHz, 0.7153 nanosec clock

To select the Over drive mode (which is enabled by default), execute the following command:

root@desk-mx93-rev1:~# echo 0 > /sys/devices/platform/imx93-lpm/mode
[ 9456.025419] System switching to OD mode...
root@desk-mx93-rev1:~# cat /sys/devices/platform/imx93-lpm/mode
System is in OD mode with DDR 3733 MTS!
root@desk-mx93-rev1:~# mhz
1690 MHz, 0.5917 nanosec clock

To have Nominal drive mode as default at power up, it is necessary to add the property no-od-mode on lpm node of the device tree. In other words, modify the DT as follows (specifically, the file arch/arm64/boot/dts/freescale/imx93-aura.dtsi):

&lpm {
	soc-supply = <&buck1>;
	status = "okay";
+	no-od-mode;
};

For the sake of completeness, other operating mode-related useful commands are listed.

To read the current mode:

root@desk-mx93-rev0:~# cat /sys/devices/platform/imx93-lpm/mode
System is in OD mode with DDR 3733 MTS!

To read the current cores' frequency clock:

root@desk-mx93-rev1:~# mhz
1690 MHz, 0.5917 nanosec clock

Enabling low drive mode[edit | edit source]

To enable the two Low drive modes, add the property ld-mode-enabled on lpm node of the device tree. Please modify the DT as follows (again, the file arch/arm64/boot/dts/freescale/imx93-aura.dtsi):

&lpm {
	soc-supply = <&buck1>;
	status = "okay";
+	ld-mode-enabled;
};


200px-Emblem-important.svg.png

If you want to add these modalities, verify if you need to change the clock rate for other peripherals as NXP shows in the DT of the official i.MX93 Evaluation Kit (EVK):arch/arm64/boot/dts/freescale/imx93-11x11-evk-ld.dts:

&lpm {
        ld-mode-enabled;
};

&flexspi1 {
	assigned-clocks = <&clk IMX93_CLK_FLEXSPI1>;
	assigned-clock-parents = <&clk IMX93_CLK_SYS_PLL_PFD1>;
	assigned-clock-rates = <266000000>;
};

&usdhc1 {
	assigned-clocks = <&clk IMX93_CLK_USDHC1>;
	assigned-clock-parents = <&clk IMX93_CLK_SYS_PLL_PFD1>;
	assigned-clock-rates = <266000000>;
};

&usdhc2 {
	assigned-clocks = <&clk IMX93_CLK_USDHC2>;
	assigned-clock-parents = <&clk IMX93_CLK_SYS_PLL_PFD1>;
	assigned-clock-rates = <266000000>;
};

&usdhc3 {
	assigned-clocks = <&clk IMX93_CLK_USDHC3>;
	assigned-clock-parents = <&clk IMX93_CLK_SYS_PLL_PFD1>;
	assigned-clock-rates = <266000000>;
};
Selecting low drive modes[edit | edit source]

Once the target has booted with the modified DT, you can select Low drive Mode by issuing the following command:

root@desk-mx93-rev1:~# echo 2 > /sys/devices/platform/imx93-lpm/mode
[ 9623.164150] System switching to LD/SWFFC mode...
root@desk-mx93-rev1:~# cat /sys/devices/platform/imx93-lpm/mode
System is in LD mode with DDR 1866 MTS!
root@desk-mx93-rev1:~# mhz
898 MHz, 1.1136 nanosec clock

To select the Low drive with SWFFC mode, execute the following command instead:

root@desk-mx93-rev1:~# echo 3 > /sys/devices/platform/imx93-lpm/mode
[ 9648.546368] System switching to LD/SWFFC mode...
root@desk-mx93-rev1:~# cat /sys/devices/platform/imx93-lpm/mode
System is in LD mode with DDR 625 MTS!
root@desk-mx93-rev1:~# mhz
898 MHz, 1.1136 nanosec clock

Low-power mode[edit | edit source]

In this mode all unnecessary power domains (MIX) can be off. The AONMIX and internal modules, such as OSC24M/PLL, are an exception in this mode. The Cortex CPU in AONMIX handles all the computing and data processing. Cortex-A55 is powered down and DRAM can be in self-refresh/retention mode. NXP provides three low-power modes:

Idle mode[edit | edit source]

In this mode the CPU can be put into a power-gated state, but with L3 data retained, DRAM, and bus clocks are reduced. Most of the internal logic is clock-gated, all the external power from PMIC remains the same and most IPs remain in their state: therefore, the interrupt response in this mode is quick compared to the Run mode.

In the following example, the RTC with a timeout of one minute is set as the wakeup source, then the system is placed in idle mode.

root@desk-mx93-rev1:~# sudo sh -c "echo `date '+%s' -d '+ 1 minutes'` > /sys/class/rtc/rtc0/wakealarm"
root@desk-mx93-rev1:~# echo freeze > /sys/power/state

Suspend mode[edit | edit source]

This mode is defined as the most power-saving mode since it shuts off all the clocks and all the unnecessary power supplies. Compared to idle, this mode takes a longer time to exit, but it also uses far less energy.

In the following example, the RTC with a timeout of one minute is set as the wakeup source, then the system is placed in suspend mode.

root@desk-mx93-rev1:~# sudo sh -c "echo `date '+%s' -d '+ 1 minutes'` > /sys/class/rtc/rtc0/wakealarm"
root@desk-mx93-rev1:~# echo mem > /sys/power/state

BBSM mode[edit | edit source]

This mode is also called RTC mode. In this mode only the power for the BBSM domain remains on to keep RTC and BBSM logic alive.

  • Switching to this mode requires shutting down the system:
    • via software with the shutdown command
    • via hardware by bringing the ONOFF line low. The system can detect the duration of the low ONOFF line assertion, being able to define different behaviors for short and long periods by modifiying the properties HandlePowerKey and HandlePowerKeyLongPress in the file /etc/systemd/logind.conf, respectively. To cause shutdown set a property to poweroff. For more details see https://www.freedesktop.org/software/systemd/man/latest/logind.conf.html.
  • To switch from this mode to run mode:
    • via hardware by assert the ONOFF line low for a few seconds
    • via software by defining an RTC event before shutdown, for example by setting a startup after two minutes: sudo sh -c "echo `date '+%s' -d '+ 2 minutes'` > /sys/class/rtc/rtc0/wakealarm"


References[edit | edit source]