Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp107888yba; Mon, 20 May 2019 05:51:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCsO3bOeObWRpcqSyrT4HJ40Lh7DGsqNv64paS2Ev3q4mRS/PXDnJ+U3DLbLwFMzqdSMmK X-Received: by 2002:a63:d04b:: with SMTP id s11mr75768147pgi.187.1558356680235; Mon, 20 May 2019 05:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558356680; cv=none; d=google.com; s=arc-20160816; b=TiK8fcqJRzzejHputT9kEPWH1gcSuO0io3kmD7q6fRCIgdYmjO2ASnHfvMgBRoPAUI 8I4QENppNFC5Zjr0FTQmVLGNGsRJ0wFQ59YHZwy5cBjWYUN251W8CNrHm4iZIMByKzH8 1iepeCvQkTCV5ZKXmzuDtINkWaRDmioNzY18NgOnALVqNyAqVybwxDeQgwHCaByX83wO WKXM56Y8UmhJAIA4WtjZSKz2Nk8s/iUyJ0ai/cPGaPeRfWdIUwMGxCs2AQV5tnGd/Ipm 5InFZlBgpDlcKQHlZnzWHK+GqbyO0sNAvd0/YeonQr/Rr5rEIrN4Z96rJSWiMrV56qem LIOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yNvlsTJtWHMf0ekQBAQL6KG0UN7PaFqhol8bwU2aDgQ=; b=rG30o0D1DiFgae1R0ShqSyy4RQUi4TwxzEMUQgi+BNIcJkbc2YZ0gFqcn/4pZw7Anp VkzjylfwN7L62nt6LB40SSsSszIe2H6vlPNXOg43+FolUvsZpwUioHIrCPZfaL9FOp05 UZhJKR81cH9+xwdjcpZQW34iceqk1t6WddhuaIduvAOF0mZ7+UQeNYy+y3o3xWOPw7m9 6cHx53HSIHmPOmPMw6qDgh5kE3zYAZjOZtooxxOKvdLZqV3JVn8eUttpkajjCxJco46j wDLgDir/L3V9GBcOp9FPy25OlFjnkTEZy/opiGtk9NbqlAKvx/0krDyU5SmDkMu9G2CM NtXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ERYY2z9w; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 204si3614899pga.373.2019.05.20.05.51.05; Mon, 20 May 2019 05:51:20 -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=@kernel.org header.s=default header.b=ERYY2z9w; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391354AbfETMsI (ORCPT + 99 others); Mon, 20 May 2019 08:48:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:37648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388129AbfETMXU (ORCPT ); Mon, 20 May 2019 08:23:20 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2EBBD21479; Mon, 20 May 2019 12:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558354998; bh=cm3X3sPLFncga0AO6FdB7CwX0XUcBLx38ZGNlPvHQfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ERYY2z9wgAszGxTtv1RW/P0hG/cgmSWqP9m6P0xVJ+RjO9Y49Sz/5UrQNiXZjLGKU ZPBTzQzvXvtvGYXUMKpdz2ZyT0jr1yuB601QjgGIW+tCJkSeQd240ARD4gRvv1Swxm HEIdHwor0aOYOgepkTC360ELFsOz/lBjgRX2uOkQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rajat Jain , "Rafael J. Wysocki" Subject: [PATCH 4.19 059/105] ACPI: PM: Set enable_for_wake for wakeup GPEs during suspend-to-idle Date: Mon, 20 May 2019 14:14:05 +0200 Message-Id: <20190520115251.197424915@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rajat Jain commit 2f844b61db8297a1f7a06adf2eb5c43381f2c183 upstream. 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 it turned up commit f941d3e41da7 ("ACPI: EC / PM: Disable non-wakeup GPEs for suspend-to-idle"). I checked that the issue got fixed if that commit was reverted. 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. [ rjw: The problem is that commit f941d3e41da7 ("ACPI: EC / PM: Disable non-wakeup GPEs for suspend-to-idle") forgot to add the acpi_enable_wakeup_devices() call for s2idle along with acpi_enable_all_wakeup_gpes(). ] Fixes: f941d3e41da7 ("ACPI: EC / PM: Disable non-wakeup GPEs for suspend-to-idle") Link: https://bugzilla.kernel.org/show_bug.cgi?id=203579 Signed-off-by: Rajat Jain [ rjw: Subject & changelog ] Cc: 5.0+ # 5.0+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/sleep.c | 4 ++++ 1 file changed, 4 insertions(+) --- 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(); @@ -1026,6 +1028,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);