Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5553066yba; Mon, 13 May 2019 12:54:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqzafxwKBSfgWCzZB5HZgK9ak3+RbatlZnOcPd/1K4tmwN3bKlTGajhvl50j9YLIsU6Zg+Ev X-Received: by 2002:a62:56d9:: with SMTP id h86mr37247930pfj.195.1557777253778; Mon, 13 May 2019 12:54:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557777253; cv=none; d=google.com; s=arc-20160816; b=beDCbsdS//zl3vYE5BVsEY38vnMrRKaXT/xpjRG2IubcPz/YFvKN1l10VqPlqPxsCA N/tAISKafSseHPAuSu23N5aO67ZKb4kzinhTgQ8JrpH0Uru+GIwkditoTfLs6fiy0OFT k7IWo4wUNtob8FTkV7LIk33JUkVG/1DQEg86cu/BMxlJvPYk5PxhO2z553lOzVYDpuhY /HqTftxBwp+6hEVwfOBF9MZz+e87Ml8gRJChHYxqZhWmKvR0bN8WgiLv4MzSpwtQUYAF 1K34Q848ohjK/xaIWSj5uiCGOlif9YysACNmTci0Ko2uCPBXbsVwkgAMYrK9CWUXBFhY a+IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=qd758GC+tv+AefghvcuLnRgxqiTzW/XC7mQzkKY2rj4=; b=TVzn+xIpu5EACyLEIQqcQl6TzwcL/Z02hXgd1FKyxTYinBLPWTijL1+x3Nl0BqnLlv Enp1DPr8EPo08nqCim8AkMm34rWB0Q1+G+T8g3X6VZEuglAIa1+/BAFQUzl6ythq1s50 GFkwcJ6WE3hEZnx+PUw1+zrrMLpi+071FyDoukW+jNU+vNMwNs3glMds4YnH+yFi5/cc eVx7BpTH9EO0BQC4BmVFc4Vw3ZF2wNUJJx2aSoYtyG1pPGDvwdoe4uqrQzV5ir5pTTNT 4MlolpQkQzV++N1SupbCrEf6GslAuR84igm9PTMMHEgnDpQFfsVLqp16/5aLJLxAy8Qr 1Y4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Ie0xtH/U"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y64si7266356pfg.5.2019.05.13.12.53.58; Mon, 13 May 2019 12:54:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Ie0xtH/U"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729298AbfEMTR2 (ORCPT + 99 others); Mon, 13 May 2019 15:17:28 -0400 Received: from mail-qt1-f202.google.com ([209.85.160.202]:36269 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729169AbfEMTR1 (ORCPT ); Mon, 13 May 2019 15:17:27 -0400 Received: by mail-qt1-f202.google.com with SMTP id j12so15486009qth.3 for ; Mon, 13 May 2019 12:17:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=qd758GC+tv+AefghvcuLnRgxqiTzW/XC7mQzkKY2rj4=; b=Ie0xtH/UhJmKkwyMt3DIlOmfAWwFxcEfKEwn11rAWercN5KeYzBkDoSZgcdQpYMIv5 6d/Ch5aANElCl/1/DnBj7+ViUBYnbKEuLKDpi2lK/JFns0tO1DqfYsEdtSK4cNPB75rV +LNDLfSKJUuEQ2DpfLfv9JffBzeMSq3OGAgBm3begLhWVN+0XfbWKpwOa6RCUDIXtNif xweR5Eg/3hAtSfX5PHNppVjekv/tsaSBZ5Yrb+9x4SfU4UfiQ/er76Fottg7ARQnGMgi RaSWK8r3KaOVVm7Yz8XShgND+oiFCYrpMMeBaxhEJMTluGOONH4qVWnmWk5D6WdINfke m30Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=qd758GC+tv+AefghvcuLnRgxqiTzW/XC7mQzkKY2rj4=; b=iaMfssV/zD66zGre6MijEpXvfzidC+G65BswOKuKkNWjNc68oDZf7HgAtKA4BhB/7c P4+xJmWLpREfxcCNiJP6LnwFawgKb7K6LPWkuAElv6pTgtip1wWm9V6BAdVAKKMH8Nkp rgXQdn9axdus3w9YxoGcfm/RcwXkF7zoB98QShEL2Nsfd1cAbYpsUEpKSHDkQ4Lh+yZs NW10sIr06tFAqPHwJ/9LAlhKziZpaMkCPvCjAr4eOjgpVVPfPa8zBL1TLRiehEWGdEtW 5WJjD9jlpIm+IttwJs+OLSLmgtQ0gxGyfq+RCYAMHlSiYvDCWkgS7dg+suvIS2X/877Q 9G/A== X-Gm-Message-State: APjAAAWRsi7dh7Za++vq6JCPoTlEAuvA2HuqM2sFZvY4MgRNXNKmQzEZ pjT5E62i1XMJysa7pzyuCzDTyCpIhDs8 X-Received: by 2002:a37:a705:: with SMTP id q5mr23313599qke.123.1557775046895; Mon, 13 May 2019 12:17:26 -0700 (PDT) Date: Mon, 13 May 2019 12:17:08 -0700 Message-Id: <20190513191708.87956-1-rajatja@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog Subject: [RFC PATCH] ACPI: PM: Enable wake-up device GPEs for suspend-to-idle From: Rajat Jain To: rjw@rjwysocki.net, lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Rajat Jain , rajatxjain@gmail.com, furquan@google.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I noticed that recently multiple systems (chromebooks) couldn't wake from S0ix using LID or Keyboard after updating to a newer kernel, I bisected and the issue is seen starting the following commit: commit f941d3e41da7 ("ACPI: EC / PM: Disable non-wakeup GPEs for suspend-to-idle") and found that the issue gets fixed if I revert it. I debugged and found that although PNP0C0D:00 (representing the LID) is wake capable and should wakeup the system per the code in acpi_wakeup_gpe_init() and in drivers/acpi/button.c: 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 # On debugging, I found that 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. I looked at code and could not find any other code path that should set the bits in "enable_for_wake" bitmask for the wake enabled devices for s2idle (I do see that it happens for S3 in acpi_sleep_prepare()). Thus I used the same call to enable the GPEs for wake enabled devices, and verified that this fixes the regression I was seeing on multiple of my devices. Link: https://bugzilla.kernel.org/show_bug.cgi?id=203579 Signed-off-by: Rajat Jain --- drivers/acpi/sleep.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 403c4ff15349..e52f1238d2d6 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -977,6 +977,8 @@ static int acpi_s2idle_prepare(void) if (acpi_sci_irq_valid()) enable_irq_wake(acpi_sci_irq); + acpi_enable_wakeup_devices(ACPI_STATE_S0); + /* Change the configuration of GPEs to avoid spurious wakeup. */ acpi_enable_all_wakeup_gpes(); acpi_os_wait_events_complete(); @@ -1027,6 +1029,8 @@ static void acpi_s2idle_restore(void) { acpi_enable_all_runtime_gpes(); + acpi_disable_wakeup_devices(ACPI_STATE_S0); + if (acpi_sci_irq_valid()) disable_irq_wake(acpi_sci_irq); -- 2.21.0.1020.gf2820cf01a-goog