Bug 203579

Summary: Can't wake from S0ix using LID/Keyboard (Regression starting 4.21 / 4.19.36)
Product: ACPI Reporter: Rajat Jain (rajatxjain)
Component: ECAssignee: acpi_ec
Status: RESOLVED CODE_FIX    
Severity: normal CC: mika.westerberg, rajatxjain, rjw, rui.zhang
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.21 Subsystem:
Regression: No Bisected commit-id:
Attachments: Proposed patch
dmesg log

Description Rajat Jain 2019-05-12 03:32:19 UTC
I'm a chromeos developer. The chromebooks use S0ix (i.e. s2idle) for suspend. 

I noticed that recently multiple systems couldn't wake from S0ix using LID/Keyboard, after I upgraded from 4.19.35 to 4.19.36.

I cannot wake my system up using keystrokes and using lid open. The power button wake still continues to work, but the keyboard and lid open wake does not work.

localhost /sys # cat /proc/acpi/wakeup
Device  S-state   Status   Sysfs node
LID0      S4    *enabled   platform:PNP0C0D:00
CREC      S5    *disabled  platform:GOOG0004:00
                *disabled  platform:cros-ec-dev.1.auto
                *disabled  platform:cros-ec-accel.0
                *disabled  platform:cros-ec-accel.1
                *disabled  platform:cros-ec-gyro.0
                *disabled  platform:cros-ec-ring.0
                *disabled  platform:cros-usbpd-charger.2.auto
                *disabled  platform:cros-usbpd-logger.3.auto
D015      S3    *enabled   i2c:i2c-ELAN0000:00
PENH      S3    *enabled   platform:PRP0001:00
XHCI      S3    *enabled   pci:0000:00:14.0
GLAN      S4    *disabled
WIFI      S3    *disabled  pci:0000:00:14.3
localhost /sys #

I bisected and the regression started with this commit:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f941d3e41da7f86bdb9dcc1977c2bcc6b89bfe47

If I revert the patch, things start to work OK.

I debugged and found that although PNP0C0D:00 is wake capable and should wakeup the system, its corresponding GPE is not being enabled. The particular GPE's gpe_register_info->enable_for_wake does not have any bits set when acpi_enable_all_wakeup_gpes() comes around to use it.

Please let me know if you need any more info / logs for this.
Comment 1 Rajat Jain 2019-05-12 04:42:30 UTC
Created attachment 282729 [details]
Proposed patch

Here is an RFC patch that I also plan to post to linux-pm mailing lists.
Comment 2 Rajat Jain 2019-05-12 04:42:50 UTC
Created attachment 282731 [details]
dmesg log
Comment 3 Rajat Jain 2019-05-13 19:23:16 UTC
I posted my patch here:

https://lkml.org/lkml/2019/5/13/835