cancel
Showing results for 
Search instead for 
Did you mean: 

Standby current to high, rails keep enabled

allard.potma
Associate II

I'm trying to enter standby (DDR off or on) on my custom board, containing a STM32MP151 and a STPMIC1B.

 

This is my STPMIC/suspend entry in the device tree of OPTEE:

 

&i2c4 {
	compatible = "st,stm32mp15-i2c-non-secure";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c4_pins_z_mx>;
	//pinctrl-1 = <&i2c4_sleep_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	clock-frequency = <400000>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;

	pmic: stpmic@33 {
		compatible = "st,stpmic1";
		reg = <0x33>;
		interrupts-extended = <&gpioa 0 IRQ_TYPE_EDGE_FALLING>;
		interrupt-controller;
		#interrupt-cells = <2>;
		status = "okay";

		regulators {
			compatible = "st,stpmic1-regulators";
			buck1-supply = <&vin>;
			buck2-supply = <&vin>;
			buck3-supply = <&vin>;
			ldo3-supply = <&vdd>;
			ldo2-supply = <&vin>;
			ldo4-supply = <&bst_out>;
			boost-supply = <&vin>;
			vref_ddr-supply = <&vdd_ddr>;

			vddcore: buck1 {
				regulator-name = "vddcore";
				regulator-min-microvolt = <1200000>;
				regulator-max-microvolt = <1200000>;
				regulator-always-on;
				regulator-initial-mode = <0>;
				regulator-over-current-protection;
			};

			vdd_ddr: buck2 {
				regulator-name = "vdd_ddr";
				regulator-min-microvolt = <1200000>;
				regulator-max-microvolt = <1200000>;
				regulator-always-on;
				regulator-initial-mode = <0>;
				regulator-over-current-protection;
			};

			vdd: buck3 {
				regulator-name = "vdd";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-always-on;
				st,mask-reset;
				regulator-initial-mode = <0>;
				regulator-over-current-protection;
			};
			
			vdd_ddr_1v8: ldo3 {
				regulator-name = "vdd_ddr_1v8";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-always-on;
				regulator-over-current-protection;
			};

			vdd_emmc: ldo2 {
				regulator-name = "vdd_emmc";
				regulator-min-microvolt = <2900000>;
				regulator-max-microvolt = <2900000>;
				regulator-always-on;
				regulator-over-current-protection;
				interrupts = <IT_CURLIM_LDO2 0>;
			};
			
			bst_out: boost {
				regulator-name = "bst_out";
				interrupts = <IT_OCP_BOOST 0>;
			};
			
			vdd_usb: ldo4 {
				regulator-name = "vdd_usb";
				interrupts = <IT_CURLIM_LDO4 0>;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
			};

			vref_ddr: vref_ddr {
				regulator-name = "vref_ddr";
				regulator-always-on;
			};
		};

		onkey {
			compatible = "st,stpmic1-onkey";
			interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 0>;
			interrupt-names = "onkey-falling", "onkey-rising";
			power-off-time-sec = <10>;
			status = "enabled";
		};

		watchdog {
			compatible = "st,stpmic1-wdt";
			status = "disabled";
		};
	};
};

&pwr_regulators{
	status = "okay";

	/* USER CODE BEGIN pwr_regulators */
	system_suspend_supported_soc_modes = <
		STM32_PM_CSLEEP_RUN
		STM32_PM_CSTOP_ALLOW_LP_STOP
		STM32_PM_CSTOP_ALLOW_STANDBY_DDR_SR
	>;
	system_off_soc_mode = <STM32_PM_CSTOP_ALLOW_STANDBY_DDR_OFF>;
	vdd-supply = <&vdd>;
	vdd_3v3_usbfs-supply = <&vdd_usb>;
	/* USER CODE END pwr_regulators */
};

&vddcore {
	lp-stop {
		regulator-on-in-suspend;
	};
	standby-ddr-sr {
		regulator-off-in-suspend;
	};
	standby-ddr-off {
		regulator-off-in-suspend;
	};
};

&vdd_ddr {
	lp-stop {
		regulator-on-in-suspend;
	};
	standby-ddr-sr {
		regulator-on-in-suspend;
	};
	standby-ddr-off {
		regulator-off-in-suspend;
	};
};

&vdd {
	lp-stop {
		regulator-on-in-suspend;
	};
	standby-ddr-sr {
		regulator-on-in-suspend;
	};
	standby-ddr-off {
		regulator-off-in-suspend;
	};
};

&vdd_ddr_1v8 {
	lp-stop {
		regulator-on-in-suspend;
	};
	standby-ddr-sr {
		regulator-on-in-suspend;
	};
	standby-ddr-off {
		regulator-off-in-suspend;
	};
};

&vdd_emmc {
	lp-stop {
		regulator-on-in-suspend;
	};
	standby-ddr-sr {
		regulator-off-in-suspend;
	};
	standby-ddr-off {
		regulator-off-in-suspend;
	};
};

&bst_out {
	lp-stop {
		regulator-off-in-suspend;
	};
	standby-ddr-sr {
		regulator-off-in-suspend;
	};
	standby-ddr-off {
		regulator-off-in-suspend;
	};
};

&vdd_usb {
	lp-stop {
		regulator-off-in-suspend;
	};
	standby-ddr-sr {
		regulator-off-in-suspend;
	};
	standby-ddr-off {
		regulator-off-in-suspend;
	};
};

&vref_ddr {
	lp-stop {
		regulator-on-in-suspend;
	};
	standby-ddr-sr {
		regulator-on-in-suspend;
	};
	standby-ddr-off {
		regulator-off-in-suspend;
	};
};

 

 When I run

echo mem > /sys/power/state

 I get the following message:

 

[   47.699035] PM: suspend entry (deep)
[   47.797158] Filesystems sync: 0.095 seconds
[   47.807093] Freezing user space processes
[   47.812012] Freezing user space processes completed (elapsed 0.002 seconds)
[   47.817707] OOM killer disabled.
[   47.820762] Freezing remaining freezable tasks
[   47.827030] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[   47.833040] printk: Suspending console(s) (use no_console_suspend to debug)

 

After this i am not able to wake, and the power supply rails are not at the expected levels:

VDDCORE is at 1.2V

VDD_DDR is at 0V

VDD is at ~300mV

VDD_DDR_1V8 is at 0V

VDD_EMMC is at 2.9V

VDD_USB is at 3.3V

Questions:

- How to debug this? Why could some rails still be enabled?

- Is only the device tree of optee important for standby?

- Do I have to disable peripherals explicitly in optee device tree when they are enabled in kernel?

3 REPLIES 3
PatrickF
ST Employee

Hi,

some useful links (sorry if you already got it)
https://wiki.st.com/stm32mpu/wiki/Power_overview

STM32MP15x lines using low-power modes - AN5109.pdf

I'm not SW expert, but I guess all Device Tree should be aligned (or at least should not contain contradictory information).

Regards

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
allard.potma
Associate II

I've read those wiki entries. When I enable 'trace and debug' I get the following log:

 

root@uptime:~# echo mem > /sys/power/state
[  813.975319] PM: suspend entry (deep)
[  813.989732] Filesystems sync: 0.012 seconds
F/TC:0   __clk_enable:1174 Clock 68 has been enabled
F/TC:0   __clk_disable:1187 Clock 68 has been disabled
[  814.016977] Freezing user space processes
[  814.023351] Freezing user space processes completed (elapsed 0.003 seconds)
[  814.029120] OOM killer disabled.
[  814.032077] Freezing remaining freezable tasks
[  814.038682] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
F/TC:? 0 pta_scmi_ocall:178 Posting MSG message on channel 0u
F/TC:? 0 plat_scmi_clock_set_state:471 SCMI clock 8 disable
[  814.176733] dwc2 49000000.usb-otg: suspending usb gadget configfs-gadget.g1
D/TC:0   pwr_scv_handler:56 PWR service: clear 0x1000000 at offset 0xc
F/TC:0   pwr_scv_handler:82 clr off c=1000000 => e0000000
F/TC:? 0 pta_scmi_ocall:178 Posting MSG message on channel 0u
F/TC:? 0 plat_scmi_clock_set_state:465 SCMI clock 13 enable
F/TC:0 0 __clk_enable:1174 Clock 140 has been enabled
D/TC:0   pwr_scv_handler:56 PWR service: set 0x1 at offset 0x28
F/TC:0   pwr_scv_handler:77 set off 28=1 => 1
F/TC:? 0 pta_scmi_ocall:178 Posting MSG message on channel 0u
F/TC:? 0 plat_scmi_clock_set_state:471 SCMI clock 13 disable
F/TC:0 0 __clk_disable:1187 Clock 140 has been disabled
F/TC:? 0 pta_scmi_ocall:178 Posting MSG message on channel 0u
F/TC:? 0 plat_scmi_clock_set_state:465 SCMI clock 8 enable
F/TC:? 0 pta_scmi_ocall:178 Posting MSG message on channel 0u
F/TC:? 0 plat_scmi_clock_set_state:471 SCMI clock 8 disable
[  814.264928] stm32-dma 48000000.dma-controller: Suspend is prevented by Chan 0
[  814.270618] stm32-dma 48000000.dma-controller: PM: dpm_run_callback(): platform_pm_suspend+0x0/0x48 returns -16
[  814.280710] stm32-dma 48000000.dma-controller: PM: failed to suspend: error -16
[  814.288042] PM: Some devices failed to suspend, or early wake event detected
D/TC:0   pwr_scv_handler:56 PWR service: set 0x1 at offset 0x28
F/TC:0   pwr_scv_handler:77 set off 28=1 => 1
F/TC:? 0 pta_scmi_ocall:178 Posting MSG message on channel 0u
F/TC:? 0 plat_scmi_clock_set_state:465 SCMI clock 8 enable
F/TC:? 0 pta_scmi_ocall:178 Posting MSG message on channel 0u
F/TC:? 0 plat_scmi_clock_set_state:465 SCMI clock 13 enable
F/TC:0 0 __clk_enable:1174 Clock 140 has been enabled
D/TC:0   pwr_scv_handler:56 PWR service: set 0x1 at offset 0x20
F/TC:0   pwr_scv_handler:77 set off 20=1 => 100
D/TC:0   pwr_scv_handler:56 PWR service: set 0x1000000 at offset 0xc
F/TC:0   pwr_scv_handler:77 set off c=1000000 => e1000000
[  814.484889] dwc2 49000000.usb-otg: resuming usb gadget configfs-gadget.g1
F/TC:? 0 pta_scmi_ocall:178 Posting MSG message on channel 0u
[  814.655228] stm32-rproc 10000000.m4: wdg irq registered
[  814.659418] OOM killer enabled.
F/TC:? 0 pta_scmi_ocall:178 Posting MSG message on channel 0u
[  814.662177] Restarting tasks ... done.
[  814.688804] random: crng reseeded on system resumption
F/TC:? 0 plat_scmi_clock_set_state:471 SCMI clock 13 disable
F/TC:0 0 __clk_disable:1187 Clock 140 has been disabled
sh: write error: Device or resource busy[  814.735200] PM: suspend exit

Somehow DMA is blocking the suspend.

allard.potma
Associate II

I changed the device tree slightly:

 

&pwr_regulators{
	status = "okay";

	/* USER CODE BEGIN pwr_regulators */
	system_suspend_supported_soc_modes = <
		STM32_PM_CSLEEP_RUN
		STM32_PM_CSTOP_ALLOW_LP_STOP
		STM32_PM_CSTOP_ALLOW_LPLV_STOP
		STM32_PM_CSTOP_ALLOW_LPLV_STOP2
		STM32_PM_CSTOP_ALLOW_STANDBY_DDR_SR
	>;
	//system_off_soc_mode = <STM32_PM_CSTOP_ALLOW_STANDBY_DDR_OFF>;
	system_off_soc_mode = <STM32_PM_SHUTDOWN>;
	vdd-supply = <&vdd>;
	vdd_3v3_usbfs-supply = <&vdd_usb>;
	/* USER CODE END pwr_regulators */
};

 

Now the current drops to ~77uA when using 'shutdown -h now', and to ~1.2mA when using 'echo mem > /sys/power/state'. I looks like the echo mem method suspends to RAM, what I need. Unfortunately the method only works once, when I do another 'echo mem' after waking up from the previous one, the messages are there, but the current stays high, and after a couple of seconds the IWDG resets the processor.

If I enable the PM debugging, I get the DMA message again and the suspend is cancelled.