mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 01:21:49 +00:00
There is a fundamental difference in host behavior w.r.t. S3 and S0ix. When the host enters S3, it asserts the SLP_S3# signal until it is woken back up. Thus, EC depends on the SLP_S3# signal state to decide when to notify listeners about CHIPSET_SUSPEND and CHIPSET_RESUME state. With S0ix, SLP_S0# signal is asserted whenever host enters S0ix. However, periodically (every 8 seconds), the host wakes up for some bookkeeping activities, but does not come out of the low power mode completely. This bookkeeping activity takes ~2-5 ms and the host goes back into S0ix state. Because of this periodic activity, SLP_S0# signal is de-asserted and asserted back every 8 seconds. Thus, if the power state machine depends solely on the SLP_S0# signal to notify CHIPSET_SUSPEND and CHIPSET_RESUME states, then all the listeners would be performing unnecessary actions every 8 seconds. This leads to a number of side-effects including: 1. Dual-role toggle being enabled and disabled every 8 seconds. 2. Power spikes in EC power consumption during S0ix every 8 seconds. In order to avoid the side-effects of periodic host activity in S0ix, this change adds a new flag s0ix_notify, which is set based on the notifications that are pending based on host sleep event. On receiving host sleep event for S0ix suspend, s0ix_notify will be set to S0IX_NOTIFY_SUSPEND. Next, whenever SLP_S0# is asserted, power_state machine notifies listeners of CHIPSET_SUSPEND and resets s0ix_notify flag to S0IX_NOTIFY_NONE. Thus, all future assertions of SLP_S0# do not result in the suspend notification. Similarly, on resume, power_state machine will not notify CHIPSET_RESUME on SLP_S0# deassertion. Instead the host sleep event for S0ix resume will set s0ix_notify flag to S0IX_NOTIFY_RESUME and wake chipset task. The power state machine in turn will notify listeners of the resume event and reset s0ix_notify flag. BUG=b:65356050,b:67750352 BRANCH=None TEST=Verified that the CHIPSET_SUSPEND/CHIPSET_RESUME notification happens only once during a system suspend/resume cycle. Periodic host wakes for book-keeping activities do not result in CHIPSET_SUSPEND/CHIPSET_RESUME notifications. Change-Id: Idf253b9393a0c25ff2eac63c60ddbcd3af954818 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/729478 Reviewed-by: Aaron Durbin <adurbin@chromium.org>