Or Continue to Thread: [Kernel] (ver 041) Mako KK 4.4…
Find Your Device:
10th April 2013, 07:21 PM   |  #9754  
faux123's Avatar
OP Senior Member
Flag West Los Angeles
Thanks Meter: 34,296
8,511 posts
Join Date:Joined: Dec 2010
Donate to Me
SOC Sleep States demystified! (Corrected for incorrect information thanks for G+ comments!)

Often times users using many apps like CPU Spy will say post how much time their phone spent in "sleep" and thinking that "sleep" has only 1 state, unfortunately, it is WRONG. For many modern CPUs there are several C-States (sleep states), and the term "sleep" does NOT correctly describe them all.

Just like in real life, there are several stages of "sleep", the shallowest sleep is C0 State. As in real life, C0 state is very easy to wake up from with almost NO latency at all (real life will be like grogginess, so C0 is just like when you first doze off but any little distraction will instantly wake you up). The deeper the sleep, the harder it is to wake up from. It takes longer for CPU to re-initialize itself to a waking state (just like real life where once you enter REM sleep, it's very hard to wake up from it).

For most processors, C3 is the Deepest sleep state. C3 state is ALMOST like turning it off using the absolutely minimum power.

C0 - Shallowest sleep (dozing off) with instant wake up
C1 - slightly deeper sleep with slight latency when waking up
C2 - deeper sleep with longer latency when waking up
C3 - really deep sleep (like REM sleep in real life) with longest latency when waking up

My pyramid (Sensation 4G) kernel has Intellidemand Governor 2.0 (Grand daddy of the Mako's Intellidemand governor) where I disabled ALL hotplugging when screen is on (ie, both cores stays ON the WHOLE TIME) but I enabled C2 state for both processors, so even though at first you think it may draw more battery than hotplugging (turning off the core when not using), many of my users have experienced better battery life than with hotplugging (Hotplugging is VERY expensive, the act of turning cores on/off drains battery as well).

On Nexus 4 (Mako), for some reason, Qualcomm has decided to only allow for C0 state (the shallowest sleep) while idling and so the "sleep" isn't really that deep. With my FauxClock app + my kernel, I give you all the "deeper" sleep states so when idling, you phone can experience deeper sleep. There's a hardware bug for Krait processors where the secondary cores, 1~3, cannot achieve deeper sleep state independently, so hotplugging is still necessary to save power for cores 1~3 but for core 0 (and core 0 is the master CPU and it's NEVER hotplugged) being able to go into deeper sleep state will help to conserve more power.

FauxClock is designed with forward compatibility. With the newer Qualcomm Krait 600/800 series, they have fixed a few of the hardware bugs from the Krait processors, and so for those newer SOCs, you can go into deeper sleep with all cores like the like older 8x60 SOCs.
Last edited by faux123; 10th April 2013 at 09:16 PM.
The Following 79 Users Say Thank You to faux123 For This Useful Post: [ View ]