Skip to content

Commit c90f43d

Browse files
committed
[pwrmgr,doc] Add explanation of short WFI cases
A short WFI duration can lead to a pwr_cpu_i.core_sleeping input that is too small to be sampled. Add an explicit guide to poll for LOW_POWER_HINT dropping before checking WAKE_INFO, so the values in WAKE_INFO can be trusted. Signed-off-by: Alexander Williams <[email protected]>
1 parent bc3f321 commit c90f43d

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

hw/ip_templates/pwrmgr/doc/programmers_guide.md

+15
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ Assume first the system has the power states described [above](theory_of_operati
1919
7. Set and poll [`CFG_CDC_SYNC`](registers.md#cfg_cdc_sync) to ensure above settings propagate across clock domains.
2020
8. Execute wait-for-interrupt instruction on the processing host.
2121

22+
Note that entering low power mode requires that pwrmgr's `pwr_cpu_i.core_sleeping` input be at logic high long enough to be sampled.
23+
A wait-for-interrupt instruction does not guarantee entry into low power, since the CPU could immediately resume execution in some cases.
24+
2225
### Possible Exits
2326

2427
Once low power is initiated, the system may exit due to several reasons.
@@ -30,6 +33,18 @@ Once low power is initiated, the system may exit due to several reasons.
3033
In both fall through exit and aborted entry, the power manager does not actually enter low power.
3134
Instead the low power entry is interrupted and the system restored to active state.
3235

36+
In addition, a CPU's sleeping signal that is too short for the power manager to sample will not trigger even an attempt to go to low power.
37+
In such cases, there will be no bits set in [`WAKE_INFO`](registers.md#wake_info), and no side effects of pwrmgr entering low power mode will trigger.
38+
39+
To check the exit condition, software can follow these steps:
40+
1. Clear low power hint in [`CONTROL`](registers.md#control) and poll until it becomes cleared.
41+
<!-- As of this writing, the CONTROL REGWEN locks out writes to CONTROL once pwrmgr receives the trigger to enable low power mode.
42+
pwrmgr enables writes again upon exiting low power mode.
43+
For the case where low power isn't even *attempted* due to short WFI, CONTROL will not be locked, so the clear will succeed. -->
44+
- Until the hint clears, the values in [`WAKE_INFO`](registers.md#wake_info) may not reflect the true exit condition.
45+
2. Check [`WAKE_INFO`](registers.md#wake_info) to get the condition.
46+
- If no bits are set, then this was a fast fall through, where low power entry was not attempted.
47+
3348
## Programmer Sequence for Exiting Low Power
3449

3550
There are two separate cases for low power exit.

hw/top_earlgrey/ip_autogen/pwrmgr/doc/programmers_guide.md

+15
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ Assume first the system has the power states described [above](theory_of_operati
1919
7. Set and poll [`CFG_CDC_SYNC`](registers.md#cfg_cdc_sync) to ensure above settings propagate across clock domains.
2020
8. Execute wait-for-interrupt instruction on the processing host.
2121

22+
Note that entering low power mode requires that pwrmgr's `pwr_cpu_i.core_sleeping` input be at logic high long enough to be sampled.
23+
A wait-for-interrupt instruction does not guarantee entry into low power, since the CPU could immediately resume execution in some cases.
24+
2225
### Possible Exits
2326

2427
Once low power is initiated, the system may exit due to several reasons.
@@ -30,6 +33,18 @@ Once low power is initiated, the system may exit due to several reasons.
3033
In both fall through exit and aborted entry, the power manager does not actually enter low power.
3134
Instead the low power entry is interrupted and the system restored to active state.
3235

36+
In addition, a CPU's sleeping signal that is too short for the power manager to sample will not trigger even an attempt to go to low power.
37+
In such cases, there will be no bits set in [`WAKE_INFO`](registers.md#wake_info), and no side effects of pwrmgr entering low power mode will trigger.
38+
39+
To check the exit condition, software can follow these steps:
40+
1. Clear low power hint in [`CONTROL`](registers.md#control) and poll until it becomes cleared.
41+
<!-- As of this writing, the CONTROL REGWEN locks out writes to CONTROL once pwrmgr receives the trigger to enable low power mode.
42+
pwrmgr enables writes again upon exiting low power mode.
43+
For the case where low power isn't even *attempted* due to short WFI, CONTROL will not be locked, so the clear will succeed. -->
44+
- Until the hint clears, the values in [`WAKE_INFO`](registers.md#wake_info) may not reflect the true exit condition.
45+
2. Check [`WAKE_INFO`](registers.md#wake_info) to get the condition.
46+
- If no bits are set, then this was a fast fall through, where low power entry was not attempted.
47+
3348
## Programmer Sequence for Exiting Low Power
3449

3550
There are two separate cases for low power exit.

0 commit comments

Comments
 (0)