Somewhere between 4.12 and 4.13 the s2idle doesn't work anymore on the Surface Pro 3. After some bisecting I found 3 patches that seem to be at fault: ACPI / sleep: EC-based wakeup from suspend-to-idle on recent systems -> 0f1a83833a0ba93d6986d9e30c8fe35d7d45c17c ACPI / PM: Ignore spurious SCI wakeups from suspend-to-idle -> 33e4f80ee69b5168badf37edbfed796eb48434b9 ACPI / PM: Clean up device wakeup enable/disable code -> 235d81a630ca2d39818da96f0c14bc960ffbaeb5 It doesn't seem to be just one patch, I've tried combinations of the 3, but only with all three reverted s2idle suspend and resume starts working again.
I tried both the DE(KDE) suspend functionality but also: echo memory > /sys/power/state and the behaviour is the same: display goes dark, system is not responding - the power button which previously wakes up the system doesn't work anymore. It needs a hard reset from this point The home button has a slight vibration when device is fully running, in this state the vibration doesn't happen at all so I suppose it went through some sleep stages. For reference I tried with iommu=off booting because of another bug that made the rounds but that never helped. The problem seems to be in the 3 patches I mentioned in my top email
When I try pm_test(platform,devices,freezer) with almost any value the system goes to sleep/resumes fine.
Please attach: 1. dmesg output after a fresh boot (please use 4.15-rc7 for that if possible) 2. The output of dmidecode 3. The output of acpidump from the affected machine. Please test if rtcwake wakes up the system from sleep both in the working and non-working cases.
For the collection of dmesg output in 1. above, please boot the kernel with dyndbg="file sleep.c +p" (as per file:///scratch/rafael/work/build/hornet/Documentation/output/admin-guide/dynamic-debug-howto.html).
Sorry, passed a local link above, should be https://www.kernel.org/doc/html/latest/admin-guide/dynamic-debug-howto.html
Created attachment 273477 [details] dmesg dmesg with dyndebug for sleep.c enabled(incl rtc wake)
Created attachment 273479 [details] dmidecode
Created attachment 273481 [details] acpidump
acpidump, dmidecode and dmesg for kernel(including rtcwake sleep/resume) included. Everything is running kernel 4.15-rc7. rtcwak -m freeze -s 20 works perfectly fine
Sorry dmesg doesn't include the sleep sequence but I can't see anything new there.
Created attachment 273487 [details] Patch to test OK, let's try a long shot. Please check if this patch makes the power button wakeup from s2idle work.
Same thing, system doesn't wake up after applying the patch
Created attachment 273495 [details] Patch to test v2 Obviously, it won't work without initializing wakeup. Please try this one.
Doesn't seem to wakeup the device either.
I should note that the lid event doesn't seem to be working either anymore. Before the patches I mentioned in the report the lid would be able to wake up the device as well but not anymore.
The lid thing may not be directly related to the power button, though. What does happen when you press the power button in the working state (ie. while the machine is not suspended)? It should generate input events, so does it do that?
Created attachment 273503 [details] Debug patch OK, so we need to dig deeper. Please apply this patch (it will print all Surface Pro 3 button events to the kernel log in addition to what the previous patch did). Then, boot the kernel, enable dynamic debug in sleep.c and device_pm.c (from the kernel command line or via debugfs) and run echo 1 > /sys/power/pm_debug_messages Next, press the power button for a couple of times, trigger a system suspend with rtcwake (use a reasonably long sleep time), press the power button for a couple of times while suspended and when it resumes, collect the dmesg output and attach it here.
Created attachment 273505 [details] dmesg with debug enabled Outside suspend the Power button works fine. From the logs I gather the events are queued and delivered after the rtc alarm. I used 30s for rtcwake
Created attachment 273507 [details] Debug patch v2 Actually, please apply this patch instead of the one from the previous comment and do what I asked for in that comment. I sort of already know what was going to happen with the previous patch.
(In reply to Valentin Manea from comment #18) > Created attachment 273505 [details] > dmesg with debug enabled Thanks! > Outside suspend the Power button works fine. OK > From the logs I gather the events are queued and delivered after the rtc > alarm. Yes, they are, but that's too late. :-) Please run the same test with the patch from comment #19 applied.
Created attachment 273509 [details] logs with new patch Now it works correctly, resumes on first power button press.
OK What about the lid?
The lid seems to be working as well.
OK Two patches seem to be needed, one for sleep.c and one for the Surface3 Pro button driver. Let me prepare and post them.
Patches posted: https://patchwork.kernel.org/patch/10155053/ https://patchwork.kernel.org/patch/10155047/ Please test them and let me know if they work for you (they are just pieces of the big debug patch you tested before, so they together should work unless I messed up something).
They seem to work fine, no problems anymore.
OK, thanks!