This is so good news, finally! I have been waiting for this for almost two years now. What happened? This happened:
root@bones:~/bin# ./pms before sleep: AC online @ 0.00W | Cap-remain 26.88Wh | Voltage 4.183V | Remain 0h 0m S0IR Residency: 0us S0I1 Residency: 0us S0I2 Residency: 0us S0I3 Residency: 0us S0 Residency: 198783424us after sleep: AC online @ 0.00W | Cap-remain 26.88Wh | Voltage 4.183V | Remain 0h 0m S0IR Residency: 384us S0I1 Residency: 3936us S0I2 Residency: 96us S0I3 Residency: 28158592us S0 Residency: 201490592us
What you see here is the output of a small script I wrote which sends my Thinkpad Tablet 10 with Intel Baytrail Z3795 CPU to sleep. I am using a custom script because during the past months I experimented a lot to achieve as low as possible power mode and have it sleep and resume as reliable as possible too.
What you see above is the output of my battery tool plus the output of “cat /sys/kernel/debug/pmc_atom/sleep_state” before going to sleep and right after resume. For the past kernel version all S0I stats have been zero, meaning the CPU never entered these states when sleeping. This is pretty bad since these states are the states of minimum power consumption. Not reaching these states mean higher power drain during sleep – when the device is effectively doing nothing. This caused a pretty high power drain resulting in max. three days of standby, i.e. a fully charged battery would be flat within less than three days of standby. In average this translated to about 0.3W power consumption in standby.
Previously I had experiments where it reached S0i2 and this already reduced the power consumption to about ~0.1W meaning a little more than eight days of standby. Today I discovered that with kernel 4.15rc8 I can get it to go into S0i3 which will even further increase standby times! In S0i3, the deepest sleep state, the LPDDR RAM is finally sent into self refresh so that all CPU clocks can be stopped. This will greatly improve standby!
Update: With S0i3 power consumption goes down to about 0,086W. My battery still has almost 27Wh (from the original 33Wh), so my TPT10 will run flat after 313,95 hours or 13,08 days! This is an awesome improvement!
Here is a good overview and explanation of the Intel S0i<n> states:
On the negative side of things with kernel 4.15rc8 some things need to be tweaked and do not work at all anymore:
- All ACPI controlled GPIOs are now by default wakeup sources. I think this to be a bad idea since the TPT10 will now wakeup to lid switch, plugging or unplugging AC and some more. Especially the lid switch is problematic since at least with my ultrabook keyboard it is extremely unreliable and wakes up even when moving the folded deice.
- The IIO sensor hub driver has an issue, namely a parse error at boot:
hid-sensor-hub 0018:2047:0855.0002: item 0 1 0 8 parsing failed
hid-sensor-hub 0018:2047:0855.0002: parse failed
hid-sensor-hub: probe of 0018:2047:0855.0002 failed with error -22
So all IIO sensors are gone for now – no ambient light, no accel, no magnetometer anymore. Weird.
- The LID switch as a LID switch input event is gone. I have no idea why, it might be cause by another kernel thing, first the kernel says:
input: Lid Switch as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input0
ACPI: Lid Switch [LID0]
but some time later:
ACPI: button: The lid device is not compliant to SW_LID.
- There used to be a RFKILL switch for the built-in GPS which is gone too, I need to check the kernel config and source.
- It still happens that I get interrupt storm from acpi_irq IRQ#9 after resume. It mostly happens when the ultrabook keyboard is removed while the device is running. After that the IRQ#9 gets disabled and the S0i<n> is not reached anymore. I need to find a fix for this IR#9 getting disabled thing. Strangely during normal runtime this IRQ seems not to be used at all and also not during suspend / resume so I wonder why it prevents proper sleep after it got disabled? My current theory is that an ACPI event does not get handled properly then and that this causes further ACPI sleep requests not being processed.
But deep sleep is more important to me than the above 🙂 Still not working is battery EC readings since the method the TPT10 uses seems to be very far away from what the kernel implements here.
For getting sound to work properly you need to apply another patch so that the quirk gets applied correctly. This patch is already in the ASOC repository and will get merged into mainline. Between 4.14 and 4.15 the Alsa device name has changed so you need to upgrade your Alsa config. Pierre Louis Bossart has a Github repo with matching Alsa UCM files with which finally also automatic headphone detection is working and the digital microphones work as audio input! This is pretty awesome. Grab the UCM files here:
I have compiled and uploaded a kernel 4.15rc8 and rc9 Debian packages to my server:
Have fun, happy hacking, feedback welcome!