linux-surface icon indicating copy to clipboard operation
linux-surface copied to clipboard

[Surface Laptop 2] System does not wake from suspend upon opening the lid

Open dimensions4700 opened this issue 5 years ago • 31 comments

5.0.7-surface-linux-surface Mint 19.1

My SL2 works great on this kernel, but I have to press the power button to wake it up. Minor inconvenience, but still annoying

dimensions4700 avatar Apr 22 '19 16:04 dimensions4700

Can confirm for SB1 as well. That's the main reason I'm still on 4.19.

tmarkov avatar Apr 23 '19 07:04 tmarkov

Happening for me as well on 5.0.9-surface-linux-surface.

skywideopen avatar May 01 '19 05:05 skywideopen

I also experience this issue on 4.19.37. 4.19.34 works as expected.

Note that I do have a /sys/.../power/wakeup file corresponding to the LID, and it is enabled, but system doesn't really wakeup.

tmarkov avatar May 02 '19 15:05 tmarkov

Are you guys sure it's not #468 and #454..?

For me, everything works and it's just the screen that is black.

nkkollaw avatar May 12 '19 21:05 nkkollaw

I'm sure. To reiterate, everything's normal except I need to press the power button to wake up: just opening the lid is not enough. Completely different from those two issues.

tmarkov avatar May 12 '19 21:05 tmarkov

Sorry @tmarkov, I'm an idiot, though I was replying to another issue, I had many tabs open.

nkkollaw avatar May 12 '19 21:05 nkkollaw

Also happens on my SB2 with v5.0.9 and v5.1.2. Suspending on lid-close works fine, waking via power-button too. Looks like a regression in upstream?

qzed avatar May 16 '19 00:05 qzed

I've had a look at this and apparently the GPE (ACPI) interrupt responsible for the lid does not get set up as wake source. I'm not sure why it has been enabled as wake source in the past, but manually enabling it does the trick (via acpi_setup_gpe_for_wake and acpi_set_gpe_wake_mask).

The reason this apparently only affects Surface devices is that the GPE (_L17) is not specifically marked as a wake source for/connected to the lid device (LID0, usually that would be done via a _PRW method on that device). As far as I can tell this connection is not mandated by the ACPI spec, but Linux relies on it (as far as I can tell to avoid spontaneous wake-ups from random GPE events, which seem to occur on some devices).

Now we only need to find out how/where to best set up the GPE.

qzed avatar Jul 25 '19 15:07 qzed

Still looking at how to best implement this, but I noticed that the GPE numbers are different on the Laptops:

  • _L17 for Book 1, Book 2, Pro 4 and Pro 5.
  • _L57 for Laptop 1 and 2.

So we need to figure out how to detect those two cases.

I don't have any info on the Pro 6, would be nice if someone has an acpidump/DSDT for me.

qzed avatar Jul 25 '19 19:07 qzed

Should be fixed by #540 (8e6c7b8).

qzed avatar Jul 26 '19 03:07 qzed

@qzed My Surface Pro 2017 is identified by MSHW0081 but uses GPE 0x4F (not 0x17). Tested working after changing 0001-surface-acpi.patch.

xeiraex avatar Aug 11 '19 02:08 xeiraex

@qzed I just tried your release for 5.2.5, still not fixed for me, SB1.

tmarkov avatar Aug 13 '19 18:08 tmarkov

@xeiraex Thanks for reporting this! Unfortunately this means that the GPE numbers can not be determined by MSHW0081, so I'll have to look for another solution. This might take me a bit.

qzed avatar Aug 13 '19 20:08 qzed

@tmarkov That's interesting. According to the DSDT of the SB1, _L17 should be the GPE interrupt for the lid. There are some changes compared to the DSDT of the SB2, specifically there seem to be some additional checks on the SB1, not sure if they change anything.

Just to be sure: Can you check that the GPE interrupt is enabled?

cd /sys/firmware/acpi/interrupts
grep . *

gpe17 should be enabled/unmasked. Also the number should increase if you open and close the lid (even if disabled/unmasked, at least when closing). See also: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-acpi.

qzed avatar Aug 13 '19 20:08 qzed

  • SB1 on Linux 5.2.8 (EDIT: with surface-acpi.patch from your v5.2 branch)

Wake on LID open does not work for me, too. gpe17 is actually enabled/unmasked and the number increased. The system will suspend on LID close, but does not wakeup by LID open

$ cd /sys/firmware/acpi/interrupts
$ grep . * | grep gpe17
gpe17:       2  EN     enabled      unmasked

$ journalctl -b | grep -ie "Lid " -ie "suspend entry" -ie "suspend exit"
kernel: input: Lid Switch as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input0
kernel: ACPI: Lid Switch [LID0]
systemd-logind[647]: Watching system buttons on /dev/input/event0 (Lid Switch)
systemd-logind[647]: Lid closed.
kernel: PM: suspend entry (s2idle)
systemd-logind[647]: Lid opened.
kernel: PM: suspend exit

# LID switch is enabled
$ grep -H . /sys/bus/acpi/drivers/button/PNP0C0D:00/{path,power/wakeup}
/sys/bus/acpi/drivers/button/PNP0C0D:00/path:\_SB_.LID0
/sys/bus/acpi/drivers/button/PNP0C0D:00/power/wakeup:enabled

This commit was made to fix wakeup from LID or Keyboard on 5.2, but it seems that it didn't work for us.

EDIT: I enabled aml_debug_output (sudo su -c "echo 1 > /sys/module/acpi/parameters/aml_debug_output") to see power button state. (I woke up the system by power button):

$ journalctl -f | grep -ie "Lid " -ie "suspend entry" -ie "suspend exit" -ie "Power button"
systemd-logind[647]: Lid closed.
kernel: PM: suspend entry (s2idle)
kernel: ACPI Debug:  "Power button pressed"
kernel: ACPI Debug:  "Power button released"
systemd-logind[647]: Lid opened.
kernel: PM: suspend exit

Actually, I opened the Lid before pressing power button, but recognized Lid open after pressing power button.

EDIT2: Ah sorry, the Lid state is from systemd-logind. Maybe not useful information.

kitakar5525 avatar Aug 14 '19 13:08 kitakar5525

@kitakar5525

This commit was made to fix wakeup from LID or Keyboard on 5.2, but it seems that it didn't work for us.

Thanks for the link, that finally explains why it suddenly stopped working in the first place! Now why this commit doesn't fix our problem: Normally, the lid device is defined in ACPI like this:

Device (LID0) {
    Name (_HID, EisaId ("PNP0C0D") /* Lid Device */)  // _HID: Hardware ID
    Method (_LID, 0, NotSerialized)  // _LID: Lid Status
    {
        /* returns lid status */
    }
    Name(_PRW, Package(2){   // specify wake source
         0x17,               // GPE
         0x04}               // can wakeup from S4 state
     )
}
Scope (_GPE) {
    Method (_L17, 0, NotSerialized)  // _Lxx: Level-Triggered GPE, xx=0x00-0xFF
    {
        /* do some checking if lid state has actually changed */
        Notify(LID0, 0x80)       // notify lid device that its state has changed
    }
}

So normally, the GPE/wake source would be directly specified, telling the system to enable this GPE (in this case _L17/0x17) for wake from S4. Of course, the Surface devices don't do that... (_PRW is not there, still technically conforming to ACPI spec). So we have to manually tell the kernel to use them as wake sources.

As far as I can tell from

$ cd /sys/firmware/acpi/interrupts
$ grep . * | grep gpe17
gpe17:       2  EN     enabled      unmasked

it should be enabled... so no idea why it's still not working.

qzed avatar Aug 14 '19 21:08 qzed

You could try and set-up/enable other GPEs for wake (I think that should be possible from the command line if I'm not mistaken), maybe it needs a different one or multiple.

qzed avatar Aug 14 '19 21:08 qzed

I think if you enable ACPI/AML debug messages you should also see _L17 in the output. From the SB1 DSDT that I have:

Method (_L17, 0, NotSerialized)  // _Lxx: Level-Triggered GPE, xx=0x00-0xFF
{
    ADBG ("_L17")
    // ...
}

qzed avatar Aug 14 '19 21:08 qzed

@kitakar5525 Do you have CONFIG_SURFACE_ACPI_SID enabled? The patch wasn't working for me until I noticed the ifdef and enabled it.

xeiraex avatar Aug 15 '19 02:08 xeiraex

_PRW is not there

Yeah, it may be the reason why we cannot see LID device on /proc/acpi/wakeup (I was wondering why.)

https://github.com/torvalds/linux/blob/41de59634046b19cd53a1983594a95135c656997/drivers/acpi/scan.c#L877-L904

You could try and set-up/enable other GPEs for wake (I think that should be possible from the command line if I'm not mistaken), maybe it needs a different one or multiple.

I tried enabling all disabled GPEs, but it did not work.

Do you have CONFIG_SURFACE_ACPI_SID enabled?

Yes, enabled all Surface related configs:

$ zcat /proc/config.gz | grep -i surface
CONFIG_TOUCHSCREEN_SURFACE3_SPI=m
CONFIG_SURFACE3_WMI=m
CONFIG_SURFACE_BOOK2_DGPU_HPS=m
CONFIG_SURFACE_ACPI=m
CONFIG_SURFACE_ACPI_SSH=y
CONFIG_SURFACE_ACPI_SSH_DEBUG_DEVICE=y
CONFIG_SURFACE_ACPI_SAN=y
CONFIG_SURFACE_ACPI_VHF=y
CONFIG_SURFACE_ACPI_DTX=y
CONFIG_SURFACE_ACPI_SID=y
CONFIG_SURFACE_PRO3_BUTTON=m
CONFIG_SURFACE_3_BUTTON=m
CONFIG_SURFACE_3_POWER_OPREGION=m

On Linux 4.14.134-surface (4 updates behind latest 4.14.138), I can wake up on LID open, but latest 4.19.66-surface, 5.2.8-surface and distribution's 5.2.8, I cannot wake the system on LID open.

you should also see _L17 in the output

On 4.14.134, the aml debug output ACPI Debug: "_L17" appears twice according to LID close/open.

On 4.19.66 or newer, the aml debug output only appears once. I actually opened the LID before pressing power button, but the aml debug output appears after power button release.

logs

enable some debug output

### power state 
# drivers/pci/pci-acpi.c:667 [pci_acpi]acpi_pci_set_power_state =_ "power state changed by ACPI to %s\012"
sudo su -c 'echo "file drivers/pci/pci-acpi.c +p" > /sys/kernel/debug/dynamic_debug/control'
# drivers/pci/pci-driver.c:849 [pci_driver]pci_pm_suspend_noirq =_ "PCI PM: Suspend power state: %s\012"
sudo su -c 'echo "file drivers/pci/pci-driver.c +p" > /sys/kernel/debug/dynamic_debug/control'
sudo su -c 'echo "file drivers/acpi/sleep.c +p" > /sys/kernel/debug/dynamic_debug/control'
sudo su -c 'echo "file drivers/platform/x86/intel_pmc_core.c +p" > /sys/kernel/debug/dynamic_debug/control'

### keyboard autosuspend
sudo su -c 'echo "file drivers/hid/hid-multitouch.c +p" > /sys/kernel/debug/dynamic_debug/control'
sudo su -c 'echo "file drivers/hid/usbhid/* +p" > /sys/kernel/debug/dynamic_debug/control'

# aml debug output
sudo su -c "echo 1 > /sys/module/acpi/parameters/aml_debug_output"
wakeup from lid log on 4.14.134-surface

# going into suspend by systemctl suspend
# closed lid at 1044.102253
# opened lid at 1063.300967
kern :warn : [ 1008.251158] ACPI Debug: "Primary internal battery _BST called"
kern :warn : [ 1008.252554] ACPI Debug: "Primary internal battery charging"
kern :warn : [ 1008.261420] ACPI Debug: "Primary internal battery _BST called"
kern :warn : [ 1008.262726] ACPI Debug: "External battery charging"
user :warn : [ 1009.947315] pre-suspend state
user :warn : [ 1009.948966] low_power_idle_cpu_residency_us: usec
user :warn : [ 1009.950455] slp_s0_residency_usec: 0 usec
kern :info : [ 1009.950873] PM: suspend entry (s2idle)
kern :info : [ 1009.950875] PM: Syncing filesystems ... done.
kern :debug : [ 1009.958743] PM: Preparing system for sleep (s2idle)
kern :info : [ 1009.959344] Freezing user space processes ... (elapsed 0.001 seconds) done.
kern :info : [ 1009.961217] OOM killer disabled.
kern :info : [ 1009.961218] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
kern :debug : [ 1009.962279] PM: Suspending system (s2idle)
kern :warn : [ 1009.962281] Suspending console(s) (use no_console_suspend to debug)
kern :debug : [ 1009.962561] intel-lpss 0000:00:15.1: power state changed by ACPI to D0
kern :debug : [ 1010.082636] intel-lpss 0000:00:15.2: power state changed by ACPI to D0
kern :debug : [ 1010.202453] intel-lpss 0000:00:15.3: power state changed by ACPI to D0
kern :info : [ 1010.324729] mwifiex_pcie 0000:03:00.0: info: successfully disconnected from [BSSID]: reason code 3
kern :info : [ 1010.327777] mwifiex_pcie 0000:03:00.0: None of the WOWLAN triggers enabled
kern :debug : [ 1010.334209] usbhid 1-1.4:1.0: suspend
kern :debug : [ 1010.403954] snd_hda_intel 0000:00:1f.3: power state changed by ACPI to D0
kern :err : [ 1010.420108] ipts mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F: error in reading m2h msg
kern :info : [ 1010.420205] IPTS removed
kern :debug : [ 1010.553006] PM: suspend of devices complete after 230.509 msecs
kern :debug : [ 1010.582480] PM: late suspend of devices complete after 29.461 msecs
kern :debug : [ 1010.582628] ACPI: \_SB_.PEPD: _DSM function 3 evaluation successful
kern :warn : [ 1010.583203] ACPI Debug: "Enter Resiliency"
kern :debug : [ 1010.584890] ACPI: \_SB_.PEPD: _DSM function 5 evaluation successful
kern :debug : [ 1010.584896] PM: suspend-to-idle
kern :debug : [ 1010.612279] pcieport 0000:00:1d.0: power state changed by ACPI to D3hot
kern :debug : [ 1010.613745] intel-lpss 0000:00:15.3: power state changed by ACPI to D3cold
kern :debug : [ 1010.614856] intel-lpss 0000:00:15.1: power state changed by ACPI to D3cold
kern :debug : [ 1010.615222] intel-lpss 0000:00:15.2: power state changed by ACPI to D3cold
kern :debug : [ 1010.622746] mwifiex_pcie 0000:03:00.0: power state changed by ACPI to D3hot
kern :debug : [ 1010.623362] intel-lpss 0000:00:15.0: power state changed by ACPI to D3cold
kern :debug : [ 1010.623538] snd_hda_intel 0000:00:1f.3: power state changed by ACPI to D3hot
kern :debug : [ 1010.642311] xhci_hcd 0000:00:14.0: power state changed by ACPI to D3hot
kern :debug : [ 1010.732245] pcieport 0000:00:1d.3: power state changed by ACPI to D3hot
kern :debug : [ 1010.732401] PM: noirq suspend of devices complete after 147.383 msecs
kern :debug : [ 1043.753702] PM: Timekeeping suspended for 32.913 seconds
kern :debug : [ 1043.753886] ACPI: \_PR_.PR00: LPI: required min power state:D0 current power state:D0
kern :info : [ 1043.753889] ACPI: \_PR_.PR00: LPI: Device not power manageble
kern :debug : [ 1043.753892] ACPI: \_PR_.PR01: LPI: required min power state:D0 current power state:D0
kern :info : [ 1043.753894] ACPI: \_PR_.PR01: LPI: Device not power manageble
kern :debug : [ 1043.753896] ACPI: \_PR_.PR02: LPI: required min power state:D0 current power state:D0
kern :info : [ 1043.753898] ACPI: \_PR_.PR02: LPI: Device not power manageble
kern :debug : [ 1043.753900] ACPI: \_PR_.PR03: LPI: required min power state:D0 current power state:D0
kern :info : [ 1043.753902] ACPI: \_PR_.PR03: LPI: Device not power manageble
kern :debug : [ 1043.753905] ACPI: \_SB_.PCI0.GFX0: LPI: required min power state:D3hot current power state:D0
kern :info : [ 1043.753907] ACPI: \_SB_.PCI0.GFX0: LPI: Device not power manageble
kern :debug : [ 1043.753910] ACPI: \_SB_.PCI0.I2C0: LPI: required min power state:D3hot current power state:D3hot
kern :debug : [ 1043.753913] ACPI: \_SB_.PCI0.XHC_: LPI: required min power state:D3hot current power state:D3hot
kern :debug : [ 1043.753916] ACPI: \_SB_.PCI0.HDAS: LPI: required min power state:D3hot current power state:D3hot
kern :debug : [ 1043.753919] ACPI: \_SB_.PCI0.RP05: LPI: required min power state:D0 current power state:D0
kern :debug : [ 1043.753922] ACPI: \_SB_.PCI0.RP09.PXSX: LPI: required min power state:D0 current power state:D0
kern :debug : [ 1043.753925] ACPI: \_SB_.PCI0.RP12.PXSX: LPI: required min power state:D3hot current power state:D3hot
kern :debug : [ 1043.753928] ACPI: \_SB_.PCI0.ISP0: LPI: required min power state:D3hot current power state:D0
kern :info : [ 1043.753930] ACPI: \_SB_.PCI0.ISP0: LPI: Device not power manageble
kern :debug : [ 1043.753933] ACPI: \_SB_.PCI0.HECI: LPI: required min power state:D0 current power state:D0
kern :info : [ 1043.753934] ACPI: \_SB_.PCI0.HECI: LPI: Device not power manageble
kern :debug : [ 1043.754598] pcieport 0000:00:1c.0: power state changed by ACPI to D0
kern :debug : [ 1043.754608] pcieport 0000:00:1d.0: power state changed by ACPI to D0
kern :debug : [ 1043.755802] intel-lpss 0000:00:15.0: power state changed by ACPI to D0
kern :debug : [ 1043.755971] snd_hda_intel 0000:00:1f.3: power state changed by ACPI to D0
kern :debug : [ 1043.755994] intel-lpss 0000:00:15.1: power state changed by ACPI to D0
kern :debug : [ 1043.756164] intel-lpss 0000:00:15.2: power state changed by ACPI to D0
kern :debug : [ 1043.756264] intel-lpss 0000:00:15.3: power state changed by ACPI to D0
kern :debug : [ 1043.784070] xhci_hcd 0000:00:14.0: power state changed by ACPI to D0
kern :debug : [ 1043.784266] nvme 0000:02:00.0: power state changed by ACPI to D0
kern :debug : [ 1044.033380] pcieport 0000:00:1d.3: power state changed by ACPI to D0
kern :debug : [ 1044.063530] mwifiex_pcie 0000:03:00.0: power state changed by ACPI to D0
kern :info : [ 1044.093493] mwifiex_pcie 0000:03:00.0: Refused to change power state, currently in D3
kern :debug : [ 1044.102193] PM: noirq resume of devices complete after 348.274 msecs
kern :warn : [ 1044.102253] ACPI Debug: "_L17" # closed the LID
kern :debug : [ 1044.133402] snd_hda_intel 0000:00:1f.3: power state changed by ACPI to D3hot
kern :debug : [ 1044.143443] pcieport 0000:00:1d.0: power state changed by ACPI to D3hot
kern :debug : [ 1044.144069] intel-lpss 0000:00:15.3: power state changed by ACPI to D3cold
kern :debug : [ 1044.144355] intel-lpss 0000:00:15.0: power state changed by ACPI to D3cold
kern :debug : [ 1044.144905] intel-lpss 0000:00:15.1: power state changed by ACPI to D3cold
kern :debug : [ 1044.145115] intel-lpss 0000:00:15.2: power state changed by ACPI to D3cold
kern :debug : [ 1044.173434] xhci_hcd 0000:00:14.0: power state changed by ACPI to D3hot
kern :debug : [ 1044.223408] pcieport 0000:00:1d.3: power state changed by ACPI to D3hot
kern :debug : [ 1044.223552] PM: noirq suspend of devices complete after 120.789 msecs
kern :debug : [ 1062.952407] PM: Timekeeping suspended for 18.530 seconds
kern :debug : [ 1062.952590] ACPI: \_PR_.PR00: LPI: required min power state:D0 current power state:D0
kern :info : [ 1062.952594] ACPI: \_PR_.PR00: LPI: Device not power manageble
kern :debug : [ 1062.952597] ACPI: \_PR_.PR01: LPI: required min power state:D0 current power state:D0
kern :info : [ 1062.952598] ACPI: \_PR_.PR01: LPI: Device not power manageble
kern :debug : [ 1062.952601] ACPI: \_PR_.PR02: LPI: required min power state:D0 current power state:D0
kern :info : [ 1062.952603] ACPI: \_PR_.PR02: LPI: Device not power manageble
kern :debug : [ 1062.952605] ACPI: \_PR_.PR03: LPI: required min power state:D0 current power state:D0
kern :info : [ 1062.952607] ACPI: \_PR_.PR03: LPI: Device not power manageble
kern :debug : [ 1062.952610] ACPI: \_SB_.PCI0.GFX0: LPI: required min power state:D3hot current power state:D0
kern :info : [ 1062.952612] ACPI: \_SB_.PCI0.GFX0: LPI: Device not power manageble
kern :debug : [ 1062.952615] ACPI: \_SB_.PCI0.I2C0: LPI: required min power state:D3hot current power state:D3hot
kern :debug : [ 1062.952618] ACPI: \_SB_.PCI0.XHC_: LPI: required min power state:D3hot current power state:D3hot
kern :debug : [ 1062.952621] ACPI: \_SB_.PCI0.HDAS: LPI: required min power state:D3hot current power state:D3hot
kern :debug : [ 1062.952624] ACPI: \_SB_.PCI0.RP05: LPI: required min power state:D0 current power state:D0
kern :debug : [ 1062.952628] ACPI: \_SB_.PCI0.RP09.PXSX: LPI: required min power state:D0 current power state:D0
kern :debug : [ 1062.952631] ACPI: \_SB_.PCI0.RP12.PXSX: LPI: required min power state:D3hot current power state:D0
kern :info : [ 1062.952633] ACPI: \_SB_.PCI0.RP12.PXSX: LPI: Constraint not met; min power state:D3hot current power state:D0
kern :debug : [ 1062.952636] ACPI: \_SB_.PCI0.ISP0: LPI: required min power state:D3hot current power state:D0
kern :info : [ 1062.952638] ACPI: \_SB_.PCI0.ISP0: LPI: Device not power manageble
kern :debug : [ 1062.952640] ACPI: \_SB_.PCI0.HECI: LPI: required min power state:D0 current power state:D0
kern :info : [ 1062.952642] ACPI: \_SB_.PCI0.HECI: LPI: Device not power manageble
kern :debug : [ 1062.953305] pcieport 0000:00:1c.0: power state changed by ACPI to D0
kern :debug : [ 1062.953320] pcieport 0000:00:1d.0: power state changed by ACPI to D0
kern :debug : [ 1062.954678] intel-lpss 0000:00:15.0: power state changed by ACPI to D0
kern :debug : [ 1062.954976] snd_hda_intel 0000:00:1f.3: power state changed by ACPI to D0
kern :debug : [ 1062.954995] intel-lpss 0000:00:15.1: power state changed by ACPI to D0
kern :debug : [ 1062.955140] intel-lpss 0000:00:15.2: power state changed by ACPI to D0
kern :debug : [ 1062.955192] intel-lpss 0000:00:15.3: power state changed by ACPI to D0
kern :debug : [ 1062.982872] xhci_hcd 0000:00:14.0: power state changed by ACPI to D0
kern :debug : [ 1062.982879] nvme 0000:02:00.0: power state changed by ACPI to D0
kern :debug : [ 1063.232092] pcieport 0000:00:1d.3: power state changed by ACPI to D0
kern :debug : [ 1063.262211] mwifiex_pcie 0000:03:00.0: power state changed by ACPI to D0
kern :info : [ 1063.292206] mwifiex_pcie 0000:03:00.0: Refused to change power state, currently in D3
kern :debug : [ 1063.300907] PM: noirq resume of devices complete after 348.280 msecs
kern :warn : [ 1063.300967] ACPI Debug: "_L17" # opened the LID
kern :debug : [ 1063.301446] PM: resume from suspend-to-idle
kern :warn : [ 1063.301571] ACPI Debug: "Exit Resiliency"
kern :warn : [ 1063.301582] ACPI Debug: "Exit CS"
kern :debug : [ 1063.372422] ACPI: \_SB_.PEPD: _DSM function 6 evaluation successful
kern :debug : [ 1063.372455] ACPI: \_SB_.PEPD: _DSM function 4 evaluation successful
kern :warn : [ 1063.375616] ACPI Debug: "SAM wake up interrupt sent"
kern :debug : [ 1063.376454] PM: early resume of devices complete after 3.995 msecs
kern :warn : [ 1063.378278] ACPI Debug: "Primary internal battery is available"
kern :warn : [ 1063.378884] ACPI Debug: "Primary external battery is available"
kern :debug : [ 1063.382090] /dev/vmmon[0]: HostIFReadUptimeWork: detected settimeofday: fixed uptimeBase old 18445178239465563257 new 18445178239414119788 attempts 1
kern :info : [ 1063.390755] [drm] GuC submission enabled (firmware i915/skl_guc_ver6_1.bin [version 6.1])
kern :debug : [ 1063.451329] usbhid 1-1.4:1.0: resume status 0
kern :debug : [ 1063.451492] hid-multitouch 0003:045E:07CE.0003: Kicking head 5 tail 4
kern :debug : [ 1063.592483] PM: resume of devices complete after 216.034 msecs
kern :debug : [ 1063.593120] PM: Finishing wakeup.
kern :info : [ 1063.593122] OOM killer enabled.
kern :info : [ 1063.593124] Restarting tasks ... 
kern :info : [ 1063.602978] probing Intel Precise Touch & Stylus
kern :info : [ 1063.602984] IPTS using DMA_BIT_MASK(64)
kern :warn : [ 1063.612749] done.
kern :info : [ 1063.620550] input: ipts 1B96:005E SingleTouch as /devices/pci0000:00/0000:00:16.4/mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F/0044:1B96:005E.0008/input/input137
kern :info : [ 1063.621058] input: ipts 1B96:005E Pen as /devices/pci0000:00/0000:00:16.4/mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F/0044:1B96:005E.0008/input/input148
kern :info : [ 1063.621271] input: ipts 1B96:005E as /devices/pci0000:00/0000:00:16.4/mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F/0044:1B96:005E.0008/input/input149
kern :info : [ 1063.621450] input: ipts 1B96:005E Mouse as /devices/pci0000:00/0000:00:16.4/mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F/0044:1B96:005E.0008/input/input150
kern :info : [ 1063.621602] hid-multitouch 0044:1B96:005E.0008: input,hidraw0: <UNKNOWN> HID v16900.00 Mouse [ipts 1B96:005E] on heci3
kern :warn : [ 1063.632114] ACPI Debug: "ext bat temp returned"
kern :warn : [ 1063.633324] ACPI Debug: "Primary internal battery _BIX called"
kern :err : [ 1063.635473] ipts mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F: touch enabled 4
kern :debug : [ 1063.643139] intel-lpss 0000:00:15.1: power state changed by ACPI to D3cold
kern :warn : [ 1063.681291] ACPI Debug: "New battery trip point set"
kern :warn : [ 1063.684450] ACPI Debug: "Primary internal battery _BST called"
kern :warn : [ 1063.687049] ACPI Debug: "Primary internal battery charging"
kern :debug : [ 1063.692699] intel-lpss 0000:00:15.3: power state changed by ACPI to D3cold
kern :debug : [ 1063.692786] intel-lpss 0000:00:15.2: power state changed by ACPI to D3cold
kern :warn : [ 1063.694216] ACPI Debug: "External battery _BIX called"
kern :warn : [ 1063.737702] ACPI Debug: "New external battery trip point set"
kern :warn : [ 1063.740930] ACPI Debug: "Primary internal battery _BST called"
kern :warn : [ 1063.742390] ACPI Debug: "External battery charging"
kern :info : [ 1063.750212] PM: suspend exit
user :warn : [ 1063.754127] post-suspend state
user :warn : [ 1063.755777] low_power_idle_cpu_residency_us: usec
user :warn : [ 1063.757281] slp_s0_residency_usec: 0 usec
kern :info : [ 1063.796948] [drm] RC6 on
kern :notice: [ 1063.797167] userif-2: sent link down event.
kern :notice: [ 1063.797170] userif-2: sent link up event.
kern :info : [ 1064.054093] [drm] Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.
kern :debug : [ 1064.732106] snd_hda_intel 0000:00:1f.3: power state changed by ACPI to D3hot
kern :warn : [ 1070.067103] ACPI Debug: "Primary internal battery _BST called"
kern :warn : [ 1070.068413] ACPI Debug: "Primary internal battery charging"
kern :warn : [ 1070.077522] ACPI Debug: "Primary internal battery _BST called"
kern :warn : [ 1070.078789] ACPI Debug: "External battery charging"
trying to wakeup from lid log on 5.2.8-surface

# going into suspend by systemctl suspend
# closed lid at about 110
# opened lid at about 120
# pressed power button at 130.632030
# However, the `_L17` debug print appeared only once, after power button release
# same result on 4.19.66-surface and distribution's Linux 5.2.8
kern :warn : [ 100.954407] ACPI Debug: "Primary internal battery _BST called"
kern :warn : [ 100.956543] ACPI Debug: "Primary internal battery charging"
kern :warn : [ 100.972730] ACPI Debug: "Primary internal battery _BST called"
kern :warn : [ 100.974585] ACPI Debug: "External battery charging"
kern :info : [ 101.536027] DEBUG: ipts_send_sensor_quiesce_io_cmd called
kern :debug : [ 102.136259] snd_hda_intel 0000:00:1f.3: power state changed by ACPI to D3hot
kern :notice: [ 102.642104] audit: type=1130 audit(1565836665.694:74): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=tlp-sleep comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
user :warn : [ 102.654937] pre-suspend state
user :warn : [ 102.657417] low_power_idle_cpu_residency_us: 1134876 usec
user :warn : [ 102.659250] slp_s0_residency_usec: 0 usec
kern :info : [ 102.659848] PM: suspend entry (s2idle)
kern :info : [ 102.667198] Filesystems sync: 0.007 seconds
kern :debug : [ 102.667202] PM: Preparing system for sleep (s2idle)
kern :info : [ 102.668532] Freezing user space processes ... (elapsed 0.002 seconds) done.
kern :info : [ 102.670800] OOM killer disabled.
kern :info : [ 102.670801] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
kern :debug : [ 102.671971] PM: Suspending system (s2idle)
kern :info : [ 102.671973] printk: Suspending console(s) (use no_console_suspend to debug)
kern :debug : [ 102.776494] intel-lpss 0000:00:15.0: power state changed by ACPI to D0
kern :info : [ 102.778181] mwifiex_pcie 0000:03:00.0: info: successfully disconnected from [BSSID]: reason code 3
kern :info : [ 102.780785] mwifiex_pcie 0000:03:00.0: None of the WOWLAN triggers enabled
kern :debug : [ 102.781822] snd_hda_intel 0000:00:1f.3: power state changed by ACPI to D0
kern :debug : [ 102.785108] usbhid 1-1.4:1.0: suspend
kern :info : [ 102.793155] DEBUG: ipts_mei_cl_remove called
kern :info : [ 102.793156] DEBUG: ipts_stop called
kern :info : [ 102.793157] DEBUG: ipts_send_sensor_quiesce_io_cmd called
kern :err : [ 102.793160] ipts mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F: mei_cldev_send() error 0x4:-19
kern :info : [ 102.793160] DEBUG: ipts_send_sensor_clear_mem_window_cmd called
kern :err : [ 102.793161] ipts mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F: mei_cldev_send() error 0x7:-19
kern :err : [ 102.794943] ipts mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F: error in reading m2h msg
kern :info : [ 102.794949] IPTS removed
kern :info : [ 102.844379] DEBUG: Passed nvme_suspend 2897, (pm_suspend_via_firmware() || !ctrl->npss)==false 
kern :info : [ 102.844381] DEBUG: nvme_suspend(): using host managed power settings
kern :debug : [ 102.847544] intel-lpss 0000:00:15.3: power state changed by ACPI to D0
kern :debug : [ 102.848067] intel-lpss 0000:00:15.2: power state changed by ACPI to D0
kern :debug : [ 102.848404] intel-lpss 0000:00:15.1: power state changed by ACPI to D0
kern :debug : [ 102.946272] PM: suspend of devices complete after 170.213 msecs
kern :debug : [ 102.962476] PM: late suspend of devices complete after 16.194 msecs
kern :debug : [ 102.962651] ACPI: \_SB_.PEPD: _DSM function 3 evaluation successful
kern :warn : [ 102.963235] ACPI Debug: "Enter Resiliency"
kern :debug : [ 102.964833] ACPI: \_SB_.PEPD: _DSM function 5 evaluation successful
kern :debug : [ 102.964899] PM: suspend-to-idle
kern :debug : [ 102.968287] nvme 0000:02:00.0: PCI PM: Suspend power state: D0
kern :debug : [ 102.968292] nvme 0000:02:00.0: PCI PM: Skipped
kern :debug : [ 102.968534] pcieport 0000:00:1d.0: PCI PM: Suspend power state: D0
kern :debug : [ 102.968538] pcieport 0000:00:1d.0: PCI PM: Skipped
kern :debug : [ 102.968713] pcieport 0000:00:1c.0: PCI PM: Suspend power state: D0
kern :debug : [ 102.968717] pcieport 0000:00:1c.0: PCI PM: Skipped
kern :debug : [ 102.978874] mei_me 0000:00:16.4: PCI PM: Suspend power state: D3hot
kern :debug : [ 102.979205] snd_hda_intel 0000:00:1f.3: power state changed by ACPI to D3hot
kern :debug : [ 102.979233] snd_hda_intel 0000:00:1f.3: PCI PM: Suspend power state: D3hot
kern :debug : [ 102.979251] i915 0000:00:02.0: PCI PM: Suspend power state: D3hot
kern :debug : [ 102.982205] mei_me 0000:00:16.0: PCI PM: Suspend power state: D3hot
kern :debug : [ 102.982384] mwifiex_pcie 0000:03:00.0: power state changed by ACPI to D3hot
kern :debug : [ 102.982761] intel-lpss 0000:00:15.3: power state changed by ACPI to D3cold
kern :debug : [ 102.983074] mwifiex_pcie 0000:03:00.0: PCI PM: Suspend power state: D3hot
kern :debug : [ 102.983263] intel-lpss 0000:00:15.3: PCI PM: Suspend power state: D3hot
kern :debug : [ 102.985535] intel_pch_thermal 0000:00:14.2: PCI PM: Suspend power state: D3hot
kern :debug : [ 102.986727] intel-lpss 0000:00:15.0: power state changed by ACPI to D3cold
kern :debug : [ 102.987430] intel-lpss 0000:00:15.2: power state changed by ACPI to D3cold
kern :debug : [ 102.988887] intel-lpss 0000:00:15.1: power state changed by ACPI to D3cold
kern :debug : [ 102.988961] intel-lpss 0000:00:15.0: PCI PM: Suspend power state: D3hot
kern :debug : [ 102.989224] intel-lpss 0000:00:15.2: PCI PM: Suspend power state: D3hot
kern :debug : [ 102.989317] intel-lpss 0000:00:15.1: PCI PM: Suspend power state: D3hot
kern :debug : [ 103.002330] xhci_hcd 0000:00:14.0: power state changed by ACPI to D3hot
kern :debug : [ 103.002355] xhci_hcd 0000:00:14.0: PCI PM: Suspend power state: D3hot
kern :debug : [ 103.045632] pcieport 0000:00:1d.3: power state changed by ACPI to D3hot
kern :debug : [ 103.045831] pcieport 0000:00:1d.3: PCI PM: Suspend power state: D3hot
kern :debug : [ 103.045854] PM: noirq suspend of devices complete after 80.759 msecs
kern :debug : [ 130.625725] PM: Timekeeping suspended for 26.897 seconds
kern :debug : [ 130.625742] TSC deadline timer enabled
kern :debug : [ 130.625915] ACPI: \_PR_.PR00: LPI: required min power state:D0 current power state:D0
kern :info : [ 130.625919] ACPI: \_PR_.PR00: LPI: Device not power manageable
kern :debug : [ 130.625923] ACPI: \_PR_.PR01: LPI: required min power state:D0 current power state:D0
kern :info : [ 130.625925] ACPI: \_PR_.PR01: LPI: Device not power manageable
kern :debug : [ 130.625928] ACPI: \_PR_.PR02: LPI: required min power state:D0 current power state:D0
kern :info : [ 130.625931] ACPI: \_PR_.PR02: LPI: Device not power manageable
kern :debug : [ 130.625934] ACPI: \_PR_.PR03: LPI: required min power state:D0 current power state:D0
kern :info : [ 130.625936] ACPI: \_PR_.PR03: LPI: Device not power manageable
kern :debug : [ 130.625940] ACPI: \_SB_.PCI0.GFX0: LPI: required min power state:D3hot current power state:D0
kern :info : [ 130.625942] ACPI: \_SB_.PCI0.GFX0: LPI: Device not power manageable
kern :debug : [ 130.625946] ACPI: \_SB_.PCI0.I2C0: LPI: required min power state:D3hot current power state:D3hot
kern :debug : [ 130.625949] ACPI: \_SB_.PCI0.XHC_: LPI: required min power state:D3hot current power state:D3hot
kern :debug : [ 130.625953] ACPI: \_SB_.PCI0.HDAS: LPI: required min power state:D3hot current power state:D3hot
kern :debug : [ 130.625956] ACPI: \_SB_.PCI0.RP05: LPI: required min power state:D0 current power state:D0
kern :debug : [ 130.625961] ACPI: \_SB_.PCI0.RP09.PXSX: LPI: required min power state:D0 current power state:D3cold
kern :debug : [ 130.625965] ACPI: \_SB_.PCI0.RP12.PXSX: LPI: required min power state:D3hot current power state:D3hot
kern :debug : [ 130.625968] ACPI: \_SB_.PCI0.ISP0: LPI: required min power state:D3hot current power state:D0
kern :info : [ 130.625970] ACPI: \_SB_.PCI0.ISP0: LPI: Device not power manageable
kern :debug : [ 130.625974] ACPI: \_SB_.PCI0.HECI: LPI: required min power state:D0 current power state:D0
kern :info : [ 130.625976] ACPI: \_SB_.PCI0.HECI: LPI: Device not power manageable
kern :debug : [ 130.628195] intel-lpss 0000:00:15.0: power state changed by ACPI to D0
kern :debug : [ 130.628821] intel-lpss 0000:00:15.1: power state changed by ACPI to D0
kern :debug : [ 130.629240] intel-lpss 0000:00:15.2: power state changed by ACPI to D0
kern :debug : [ 130.629335] intel-lpss 0000:00:15.3: power state changed by ACPI to D0
kern :warn : [ 130.632030] ACPI Debug: "Power button pressed" # power button
kern :debug : [ 130.642456] xhci_hcd 0000:00:14.0: power state changed by ACPI to D0
kern :debug : [ 130.642736] snd_hda_intel 0000:00:1f.3: power state changed by ACPI to D0
kern :debug : [ 130.791977] pcieport 0000:00:1d.3: power state changed by ACPI to D0
kern :debug : [ 130.941896] mwifiex_pcie 0000:03:00.0: power state changed by ACPI to D0
kern :debug : [ 130.958723] PM: noirq resume of devices complete after 332.756 msecs
kern :warn : [ 130.965293] ACPI Debug: "Power button released" # power button
kern :debug : [ 130.965372] PM: resume from suspend-to-idle
kern :warn : [ 130.965938] ACPI Debug: "_L17"
kern :warn : [ 130.966066] ACPI Debug: "Exit Resiliency"
kern :warn : [ 130.966150] ACPI Debug: "Exit CS"
kern :debug : [ 131.025713] ACPI: \_SB_.PEPD: _DSM function 6 evaluation successful
kern :debug : [ 131.025820] ACPI: \_SB_.PEPD: _DSM function 4 evaluation successful
kern :warn : [ 131.027096] ACPI Debug: "SAM wake up interrupt sent"
kern :debug : [ 131.028797] PM: early resume of devices complete after 2.970 msecs
kern :alert : [ 131.029272] mwifiex_pcie: DEBUG: putting into D0...
kern :info : [ 131.029913] [drm] HuC: Loaded firmware i915/skl_huc_ver01_07_1398.bin (version 1.7)
kern :warn : [ 131.034594] ACPI Debug: "Primary internal battery is available"
kern :info : [ 131.035334] [drm] GuC: Loaded firmware i915/skl_guc_ver9_33.bin (version 9.33)
kern :info : [ 131.035695] i915 0000:00:02.0: GuC firmware version 9.33
kern :info : [ 131.035697] i915 0000:00:02.0: GuC submission enabled
kern :info : [ 131.035699] i915 0000:00:02.0: HuC enabled
kern :warn : [ 131.035730] ACPI Debug: "Primary external battery is available"
kern :warn : [ 131.035944] acpi device:44: Cannot transition to power state D0 for parent in D3hot
kern :info : [ 131.036757] DEBUG: Passed nvme_resume 2868 
kern :debug : [ 131.095622] usbhid 1-1.4:1.0: resume status 0
kern :debug : [ 131.095791] hid-multitouch 0003:045E:07CE.0003: Kicking head 3 tail 2
kern :debug : [ 131.121741] PM: resume of devices complete after 92.951 msecs
kern :debug : [ 131.122645] PM: Finishing wakeup.
kern :info : [ 131.122649] OOM killer enabled.
kern :info : [ 131.122651] Restarting tasks ... done.
kern :debug : [ 131.149136] intel-lpss 0000:00:15.3: power state changed by ACPI to D3cold
kern :debug : [ 131.149280] intel-lpss 0000:00:15.2: power state changed by ACPI to D3cold
kern :info : [ 131.149589] probing Intel Precise Touch & Stylus
kern :info : [ 131.149591] IPTS using DMA_BIT_MASK(64)
kern :info : [ 131.150631] DEBUG: ipts_start called
kern :debug : [ 131.151171] intel-lpss 0000:00:15.1: power state changed by ACPI to D3cold
kern :warn : [ 131.156647] ACPI Debug: "ext bat temp returned"
kern :warn : [ 131.158317] ACPI Debug: "Primary internal battery _BIX called"
kern :info : [ 131.161629] input: ipts 1B96:005E UNKNOWN as /devices/pci0000:00/0000:00:16.4/mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F/0044:1B96:005E.0004/input/input50
kern :info : [ 131.161807] input: ipts 1B96:005E as /devices/pci0000:00/0000:00:16.4/mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F/0044:1B96:005E.0004/input/input52
kern :info : [ 131.162999] input: ipts 1B96:005E Touchscreen as /devices/pci0000:00/0000:00:16.4/mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F/0044:1B96:005E.0004/input/input53
kern :info : [ 131.163351] input: ipts 1B96:005E Mouse as /devices/pci0000:00/0000:00:16.4/mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F/0044:1B96:005E.0004/input/input54
kern :info : [ 131.163494] input: ipts 1B96:005E UNKNOWN as /devices/pci0000:00/0000:00:16.4/mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F/0044:1B96:005E.0004/input/input57
kern :info : [ 131.163585] hid-multitouch 0044:1B96:005E.0004: input,hidraw0: <UNKNOWN> HID v16900.00 Mouse [ipts 1B96:005E] on heci3
kern :info : [ 131.163693] DEBUG: ipts_send_sensor_clear_mem_window_cmd called
kern :err : [ 131.184215] ipts mei::3e8d0870-271a-4208-8eb5-9acb9402ae04:0F: touch enabled 4
kern :warn : [ 131.227995] ACPI Debug: "New battery trip point set"
kern :warn : [ 131.232343] ACPI Debug: "Primary internal battery _BST called"
kern :warn : [ 131.234570] ACPI Debug: "Primary internal battery charging"
kern :warn : [ 131.244531] ACPI Debug: "External battery _BIX called"
kern :info : [ 131.281965] mwifiex_pcie 0000:03:00.0: event: unknown event id: 0x0
kern :warn : [ 131.313983] ACPI Debug: "New external battery trip point set"
kern :warn : [ 131.318289] ACPI Debug: "Primary internal battery _BST called"
kern :warn : [ 131.330798] ACPI Debug: "External battery charging"
kern :info : [ 131.343652] PM: suspend exit
user :warn : [ 131.348703] post-suspend state
user :warn : [ 131.350817] low_power_idle_cpu_residency_us: 28654824 usec
user :warn : [ 131.352404] slp_s0_residency_usec: 0 usec
kern :notice: [ 131.360935] audit: type=1131 audit(1565836693.730:75): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=usbguard-dbus comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
kern :notice: [ 131.361924] audit: type=1131 audit(1565836693.733:76): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=usbguard comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
kern :notice: [ 131.372947] audit: type=1130 audit(1565836693.740:77): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=usbguard comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
kern :notice: [ 131.378698] audit: type=1130 audit(1565836693.750:78): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-suspend comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
kern :notice: [ 131.378702] audit: type=1131 audit(1565836693.750:79): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-suspend comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
kern :notice: [ 131.379220] audit: type=1130 audit(1565836693.750:80): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=usbguard-dbus comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
kern :notice: [ 131.543017] audit: type=1130 audit(1565836693.913:81): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
kern :notice: [ 131.583627] audit: type=1131 audit(1565836693.953:82): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=tlp-sleep comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
kern :info : [ 131.622770] [drm] Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.
kern :notice: [ 131.673477] userif-2: sent link down event.
kern :notice: [ 131.673484] userif-2: sent link up event.
kern :debug : [ 132.318484] intel-lpss 0000:00:15.0: power state changed by ACPI to D3cold
kern :debug : [ 132.378537] snd_hda_intel 0000:00:1f.3: power state changed by ACPI to D3hot
kern :notice: [ 137.508582] userif-2: sent link down event.
kern :notice: [ 137.508589] userif-2: sent link up event.
kern :warn : [ 138.622679] ACPI Debug: "Primary internal battery _BST called"
kern :warn : [ 138.624824] ACPI Debug: "Primary internal battery charging"
kern :warn : [ 138.644422] ACPI Debug: "Primary internal battery _BST called"
kern :warn : [ 138.646861] ACPI Debug: "External battery charging"

kitakar5525 avatar Aug 15 '19 03:08 kitakar5525

Full output of grep . *

grep . * on /sys/firmware/acpi/interrupts

error:       0
ff_gbl_lock:       0  EN     enabled      unmasked
ff_pmtimer:       0         invalid      unmasked
ff_pwr_btn:       0         invalid      unmasked
ff_rt_clk:       0         disabled     unmasked
ff_slp_btn:       0         invalid      unmasked
gpe00:       0         invalid      unmasked
gpe01:       0         invalid      unmasked
gpe02:       0         invalid      unmasked
gpe03:       0         invalid      unmasked
gpe04:       0         invalid      unmasked
gpe05:       0         invalid      unmasked
gpe06:       0         invalid      unmasked
gpe07:       0         invalid      unmasked
gpe08:       0         invalid      unmasked
gpe09:       0         invalid      unmasked
gpe0A:       0         invalid      unmasked
gpe0B:       0         invalid      unmasked
gpe0C:       0         invalid      unmasked
gpe0D:       0         invalid      unmasked
gpe0E:       0         invalid      unmasked
gpe0F:       0  EN     enabled      unmasked
gpe10:       0         invalid      unmasked
gpe11:       0         invalid      unmasked
gpe12:       0         invalid      unmasked
gpe13:       0         invalid      unmasked
gpe14:       0         invalid      unmasked
gpe15:       0         invalid      unmasked
gpe16:       0         invalid      unmasked
gpe17:       2  EN     enabled      unmasked
gpe18:       0         invalid      unmasked
gpe19:       0         invalid      unmasked
gpe1A:       0         invalid      unmasked
gpe1B:       0         invalid      unmasked
gpe1C:       0         invalid      unmasked
gpe1D:       0         invalid      unmasked
gpe1E:       0         invalid      unmasked
gpe1F:       0         invalid      unmasked
gpe20:       0         invalid      unmasked
gpe21:       0         invalid      unmasked
gpe22:       0         invalid      unmasked
gpe23:       0         invalid      unmasked
gpe24:       0         invalid      unmasked
gpe25:       0         invalid      unmasked
gpe26:       0         invalid      unmasked
gpe27:       0         invalid      unmasked
gpe28:       0         invalid      unmasked
gpe29:       0         invalid      unmasked
gpe2A:       0         invalid      unmasked
gpe2B:       0         invalid      unmasked
gpe2C:       0         invalid      unmasked
gpe2D:       0         invalid      unmasked
gpe2E:       0         invalid      unmasked
gpe2F:       0         invalid      unmasked
gpe30:       0         invalid      unmasked
gpe31:       0         invalid      unmasked
gpe32:       0         invalid      unmasked
gpe33:       0         invalid      unmasked
gpe34:       0         invalid      unmasked
gpe35:       0         invalid      unmasked
gpe36:       0         invalid      unmasked
gpe37:       0         invalid      unmasked
gpe38:       0         invalid      unmasked
gpe39:       0         invalid      unmasked
gpe3A:       0         invalid      unmasked
gpe3B:       0         invalid      unmasked
gpe3C:       0         invalid      unmasked
gpe3D:       0         invalid      unmasked
gpe3E:       0         invalid      unmasked
gpe3F:       0         invalid      unmasked
gpe40:       0         invalid      unmasked
gpe41:       0         invalid      unmasked
gpe42:       0         invalid      unmasked
gpe43:       0         invalid      unmasked
gpe44:       0         invalid      unmasked
gpe45:       0         invalid      unmasked
gpe46:       0         invalid      unmasked
gpe47:       0         invalid      unmasked
gpe48:       0         invalid      unmasked
gpe49:       0         invalid      unmasked
gpe4A:       0         invalid      unmasked
gpe4B:       0         invalid      unmasked
gpe4C:       0         invalid      unmasked
gpe4D:       0         invalid      unmasked
gpe4E:       0         invalid      unmasked
gpe4F:       0         invalid      unmasked
gpe50:    6493  EN     enabled      unmasked
gpe51:       0         invalid      unmasked
gpe52:       0         invalid      unmasked
gpe53:       0         invalid      unmasked
gpe54:       0         invalid      unmasked
gpe55:       0         invalid      unmasked
gpe56:       0         invalid      unmasked
gpe57:       0         invalid      unmasked
gpe58:       0         invalid      unmasked
gpe59:       0         invalid      unmasked
gpe5A:       0         invalid      unmasked
gpe5B:       0         invalid      unmasked
gpe5C:       0         invalid      unmasked
gpe5D:       0         invalid      unmasked
gpe5E:       0         invalid      unmasked
gpe5F:       0         invalid      unmasked
gpe60:       0         invalid      unmasked
gpe61:       0  EN     enabled      unmasked
gpe62:       0  EN     enabled      unmasked
gpe63:       0         invalid      unmasked
gpe64:       0         invalid      unmasked
gpe65:       0         invalid      unmasked
gpe66:     256  EN     enabled      unmasked
gpe67:       0         invalid      unmasked
gpe68:       0  EN     enabled      unmasked
gpe69:       0         disabled     unmasked
gpe6A:       0         invalid      unmasked
gpe6B:       0         invalid      unmasked
gpe6C:       0         invalid      unmasked
gpe6D:       0  EN     enabled      unmasked
gpe6E:       0         invalid      unmasked
gpe6F:       0  EN     enabled      unmasked
gpe70:       0         invalid      unmasked
gpe71:       0         invalid      unmasked
gpe72:       0         invalid      unmasked
gpe73:       0         invalid      unmasked
gpe74:       0         invalid      unmasked
gpe75:       0         invalid      unmasked
gpe76:       0         invalid      unmasked
gpe77:       0         invalid      unmasked
gpe78:       0         invalid      unmasked
gpe79:       0         invalid      unmasked
gpe7A:       0         invalid      unmasked
gpe7B:       0         invalid      unmasked
gpe7C:       0         invalid      unmasked
gpe7D:       0         invalid      unmasked
gpe7E:       0         invalid      unmasked
gpe7F:       0         invalid      unmasked
gpe_all:    6751
sci:    6750
sci_not:      17

kitakar5525 avatar Aug 15 '19 05:08 kitakar5525

I feel enabling wakeup from Surface Keyboard (and thus XHC) is also needed to wakeup from lid

sudo su -c 'echo enabled > "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1.4/power/wakeup" # Surface Keyboard'
sudo su -c 'echo enabled > "/sys/devices/pci0000:00/0000:00:14.0/power/wakeup"' # XHC

What's the wakeup config of yours?

However, I'm not sure it actually really wakes up by lid open.

kitakar5525 avatar Aug 15 '19 07:08 kitakar5525

@kitakar5525

_PRW is not there

Yeah, it may be the reason why we cannot see LID device on /proc/acpi/wakeup (I was wondering why.)

Yes, that is exactly the reason :)

On 4.19.66 or newer, the aml debug output only appears once. I actually opened the LID before pressing power button, but the aml debug output appears after power button release.

Okay, so that means that the interrupt is not called when the device is suspended. Which would indicate that it's not set-up to wake the device (or somehow gets disabled before suspend).

However, I'm not sure it actually really wakes up by lid open.

What's the order in which the _L17 is called? can you see some difference to the 4.14 logs? That might give us a hint.

What's the wakeup config of yours?

XHC was enabled by default, the keyboard wasn't. I've disabled them all and I can still wake the device via the lid. As far as I can tell, these shouldn't be connected as GPEs should be independent system interrupts.

qzed avatar Aug 16 '19 12:08 qzed

However, I'm not sure it actually really wakes up by lid open.

According to sudo cat /sys/kernel/debug/wakeup_sources, it woke up by rather keyboard input.


Note:

kitakar5525 avatar Aug 18 '19 14:08 kitakar5525

Any surface_acpi output should be appeared on dmesg if surface_acpi is working? I see no output from dmesg -x | grep -i surface_acpi

The module is loaded:

$ lsmod | grep surface
surfacepro3_button     20480  0
surface_acpi           57344  0
hid                   143360  7 i2c_hid,usbhid,hid_multitouch,hid_sensor_hub,intel_ipts,hid_generic,surface_acpi

kitakar5525 avatar Aug 18 '19 14:08 kitakar5525

@kitakar5525

Any surface_acpi output should be appeared on dmesg if surface_acpi is working? I see no output from dmesg -x | grep -i surface_acpi

You'd have to enable debug output for that, and with regards to the GPEs I don't think there is any (IIRC the only messages are with regards to probing on other devices).

qzed avatar Aug 20 '19 13:08 qzed

There seems to be something we're missing here, as it's working with 4.14. Either that was not the only change inbetween, or I've set-up the GPE wrong, or we need another/multiple GPEs for this to work.

qzed avatar Aug 20 '19 13:08 qzed

I added some debug print

surface_acpi: add debug print for lid switch

From 1aaac5a33d98dae8cca213ddffca42c204545d58 Mon Sep 17 00:00:00 2001
From: kitakar5525 <[email protected]>
Date: Thu, 22 Aug 2019 17:08:45 +0900
Subject: [PATCH] surface_acpi: add debug print for lid switch

---
 drivers/platform/x86/surface_acpi.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/surface_acpi.c b/drivers/platform/x86/surface_acpi.c
index a17538905..04342fdd3 100644
--- a/drivers/platform/x86/surface_acpi.c
+++ b/drivers/platform/x86/surface_acpi.c
@@ -355,6 +355,7 @@ int surfacegen5_ec_consumer_register(struct device *consumer)
 
    ec = surfacegen5_ec_acquire_init();
    if (!ec) {
+       pr_alert("DEBUG: surfacegen5_ec_acquire_init failed!\n");
        return -ENXIO;
    }
 
@@ -3641,6 +3642,7 @@ static int sid_perf_mode_setup(struct platform_device *pdev, const struct si_dev
    // link to ec
    status = surfacegen5_ec_consumer_register(&pdev->dev);
    if (status) {
+       pr_alert("DEBUG: surfacegen5_ec_consumer_register failed!\n");
        return status == -ENXIO ? -EPROBE_DEFER : status;
    }
 
@@ -3683,6 +3685,8 @@ static int sid_lid_enable_wakeup(const struct si_device_info *info, bool enable)
    int action = enable ? ACPI_GPE_ENABLE : ACPI_GPE_DISABLE;
    int status;
 
+   pr_alert("DEBUG: sid_lid_enable_wakeup called\n");
+
    if (!info->lid_device)
        return 0;
 
@@ -3698,6 +3702,8 @@ static int sid_lid_device_setup(struct platform_device *pdev, const struct si_de
    acpi_handle lid_handle;
    int status;
 
+   pr_alert("DEBUG: sid_lid_device_setup called\n");
+
    if (!info->lid_device)
        return 0;
 
@@ -3742,18 +3748,26 @@ static int surfacegen5_acpi_sid_probe(struct platform_device *pdev)
    const struct si_device_info *info;
    int status;
 
+   pr_alert("DEBUG: surfacegen5_acpi_sid_probe called\n");
+
    info = acpi_device_get_match_data(&pdev->dev);
-   if (!info)
+   if (!info) {
+       pr_alert("DEBUG: acpi_device_get_match_data failed!\n");
        return -ENODEV;
+   }
    platform_set_drvdata(pdev, (void *)info);
 
    status = sid_perf_mode_setup(pdev, info);
-   if (status)
+   if (status) {
+       pr_alert("DEBUG: sid_perf_mode_setup failed!\n");
        goto err_perf_mode;
+   }
 
    status = sid_lid_device_setup(pdev, info);
-   if (status)
+   if (status) {
+       pr_alert("DEBUG: sid_lid_device_setup failed!\n");
        goto err_lid;
+   }
 
    return 0;
 
-- 
2.23.0

and I found out why the GPE was not setup for wakeup on SB1. Rather surfacegen5_ec_acquire_init will fail. Thus sid_perf_mode_setup will fail and sid_lid_device_setup will not get called.

DEBUG: surfacegen5_acpi_sid_probe called
DEBUG: surfacegen5_ec_acquire_init failed!
DEBUG: surfacegen5_ec_consumer_register failed!
DEBUG: sid_perf_mode_setup failed!

For now, I disabled the status check of sid_perf_mode_setup and wakeup on lid open is working.

surface_acpi: disable status check of sid_perf_mode_setup for now

From dcc8cbe6f5e1812d53fe8063820ea3f798faf7a4 Mon Sep 17 00:00:00 2001
From: kitakar5525 <[email protected]>
Date: Thu, 22 Aug 2019 17:48:29 +0900
Subject: [PATCH] surface_acpi: disable status check of sid_perf_mode_setup for
 now

---
 drivers/platform/x86/surface_acpi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/surface_acpi.c b/drivers/platform/x86/surface_acpi.c
index a17538905..b3e6d495b 100644
--- a/drivers/platform/x86/surface_acpi.c
+++ b/drivers/platform/x86/surface_acpi.c
@@ -3748,8 +3748,8 @@ static int surfacegen5_acpi_sid_probe(struct platform_device *pdev)
    platform_set_drvdata(pdev, (void *)info);
 
    status = sid_perf_mode_setup(pdev, info);
-   if (status)
-       goto err_perf_mode;
+   // if (status)
+   //  goto err_perf_mode;
 
    status = sid_lid_device_setup(pdev, info);
    if (status)
@@ -3759,7 +3759,7 @@ static int surfacegen5_acpi_sid_probe(struct platform_device *pdev)
 
 err_lid:
    sid_perf_mode_remove(pdev, info);
-err_perf_mode:
+// err_perf_mode:
    return status;
 }
 
-- 
2.23.0


kitakar5525 avatar Aug 22 '19 09:08 kitakar5525

It may not affect SP4 because has_perf_mode is false

https://github.com/jakeday/linux-surface/blob/8e6c7b85ca308fa8171eed44252baa8bb669fecc/patches/4.19/0001-surface-acpi.patch#L3994-L3997

kitakar5525 avatar Aug 22 '19 09:08 kitakar5525

@kitakar5525 Thanks for figuring that out! I messed that up, sorry. On the SB1 has_perf_mode should also be false (at least until we've figured SAM-over-I2C out), since it doesn't use SAM-over-SSH. Should be fixed with 2150816. Note that the problem reported by @xeiraex (https://github.com/jakeday/linux-surface/issues/473#issuecomment-520195556) still exists.

qzed avatar Aug 25 '19 19:08 qzed

The problem reported by @xeiraex (https://github.com/jakeday/linux-surface/issues/473#issuecomment-520195556) should now also be fixed in the upcoming kernel releases.

qzed avatar Sep 25 '19 22:09 qzed