[PATCH v2 0/1] ACPI: button: Report wakeup key only for power button wakeups

Baorui.Liu posted 1 patch 1 month, 1 week ago
There is a newer version of this series
drivers/acpi/button.c | 38 ++++++++++++++++-------------
drivers/acpi/sleep.c  | 56 +++----------------------------------------
include/acpi/button.h |  5 ----
3 files changed, 24 insertions(+), 75 deletions(-)
[PATCH v2 0/1] ACPI: button: Report wakeup key only for power button wakeups
Posted by Baorui.Liu 1 month, 1 week ago
This v2 addresses the review feedback on v1 by documenting the
practical impact and by avoiding KEY_WAKEUP reporting from generic ACPI
sleep resume paths.

Problem reproduced on an AMD Android 15 Xen guest.

Input device mapping:

  event0: LNXPWRBN Power Button, KEY_POWER + KEY_WAKEUP
  event1: LNXSLPBN Sleep Button, KEY_SLEEP

Runtime trigger mapping:

  xl trigger android power -> event0 KEY_POWER
  xl trigger android sleep -> event1 KEY_SLEEP

without-fix kernel:

  6.6.118-android15-14-maybe-dirty-gc3c82a22502d

  echo mem > /sys/power/state
  xl trigger android s3resume

  /dev/input/event0 reports KEY_WAKEUP DOWN/UP.

with-fix v2 kernel:

  6.6.118-android15-14-maybe-dirty-g5b231ece911d

  The same non-power-button S3 resume path no longer reports KEY_WAKEUP
  from /dev/input/event0.  This was verified twice; both event0 logs are
  empty.

The dmesg log confirms that the test path is S3 suspend/resume:

  PM: suspend entry (deep)
  ACPI: PM: Preparing to enter system sleep state S3
  ACPI: PM: Waking up from system sleep state S3
  Resume cause unknown
  PM: suspend exit

A positive-control power-button S3 wake was attempted in the Xen guest:

  echo mem > /sys/power/state
  xl trigger android power

The guest remained suspended/offline and was recovered with:

  xl trigger android s3resume

Therefore, xl trigger android power is not a reliable S3 wake source in
this Xen setup.  That run is not used as positive-control power-button
wake evidence; it only confirms runtime input-device mapping.

Changes in v2:
  - Add test evidence showing the practical impact.
  - Track pending wakeup reporting in the ACPI button driver.
  - Report KEY_WAKEUP only if a power-button event/notify is observed
    while the ACPI button device is suspended.
  - Stop synthesizing Power Button KEY_WAKEUP events from generic ACPI
    sleep resume paths.

  ACPI: button: Report wakeup key only for power button wakeups

 drivers/acpi/button.c | 38 ++++++++++++++++-------------
 drivers/acpi/sleep.c  | 56 +++----------------------------------------
 include/acpi/button.h |  5 ----
 3 files changed, 24 insertions(+), 75 deletions(-)

-- 
2.34.1