Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1922543imm; Wed, 16 May 2018 05:15:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrtH6igDqCokSMWPhovKIiS/m67ytPRt/AzeG2ko19MsAGMn0BvRDkx0cBN0e6KP2EK0Z53 X-Received: by 2002:a63:2b46:: with SMTP id r67-v6mr552147pgr.89.1526472942692; Wed, 16 May 2018 05:15:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526472942; cv=none; d=google.com; s=arc-20160816; b=Z75Bj1WhmEIHWZWVUKM4hDa6fdPeGmfO2L4bxs9YDrEpcz+txcDNs8uKQW2zsFiBIz eHxt6pgshPkeJOUz3VMb7DX8OOoYRSr2PQA0TTRi5GrGWB5Q6e5xd4NkWqWKl8BW2lyV YFg9n/eLMO2GivjNisE/JB9GbTGzl8uztpbPi8Avxai/UkD93Ggzgn5HujEBCtUxjJqM /qKW/6HONVG7kLcO6k1NePnsq0IDDWkhNPDNvXH1mslUiUv+8hZR+cueMz8klCwNdVpu /uPvgDVYKszyvLKefaWePj3GS9ZRPwG7dq1qa8rnKSaXpE9e6BZ+L8FJoo/8dIvyCkZS 3ubQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=/e0Q/AkkB91Mf9vo4SSK0WZxxUvY4RZGdEGeeOPqTjk=; b=h4LNLeVNKY28GXKBG8wkt4Ax2zcqKzjnyxq40Fl+Ppt/3pJ8lIAUSIGS7z1tQJsztw rahmBGCgufDNHCwIlC60lcusLuqT+CsP9eZwOqzVxZZfF1VHjj0izJ3zu9GAourqQMgL ZTHN2Hz9R/77ONCU/2cSFMDKURyv/wYb68ciiQrLTsiC8SU0M7RnwzY6YZXxgvpesn8u dG1K9HKFoIfnSAh4U5S2ARVfmhJ4GS5Esn3EMT7wXA7DYzEOI7GF6SfKQElks1QduJuE SH2egzQ+N4q+8eQJd85LmDuFJKQD8XAnqcSabBFQH5vQybNg0oxcp17G8cF3/N17SIfT JVlg== ARC-Authentication-Results: i=1; mx.google.com; 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 f1-v6si1944940pgo.590.2018.05.16.05.15.28; Wed, 16 May 2018 05:15:42 -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; 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 S1752644AbeEPMOU (ORCPT + 99 others); Wed, 16 May 2018 08:14:20 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:48311 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751151AbeEPMOS (ORCPT ); Wed, 16 May 2018 08:14:18 -0400 Received: from 79.184.254.241.ipv4.supernova.orange.pl (79.184.254.241) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83) id cf131dda405197d2; Wed, 16 May 2018 14:14:16 +0200 From: "Rafael J. Wysocki" To: Linux ACPI Cc: Zhang Rui , Linux PM , LKML , Erik Schmauss , Bob Moore , "Wang, Wendy" Subject: [PATCH 2/2] ACPI: EC: Dispatch the EC GPE directly on s2idle wake Date: Wed, 16 May 2018 14:13:21 +0200 Message-ID: <3221007.8CUDle5b3u@aspire.rjw.lan> In-Reply-To: <2406722.gU2bUHd7bl@aspire.rjw.lan> References: <2406722.gU2bUHd7bl@aspire.rjw.lan> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki On platforms where the Low Power S0 Idle _DSM interface is used, on wakeup from suspend-to-idle, when it is known that the ACPI SCI has triggered while suspended, dispatch the EC GPE in order to catch all EC events that may have triggered the wakeup before carrying out the noirq phase of device resume. That is needed to handle power button wakeup on some platforms where the EC goes into a low-power mode during suspend-to-idle and while in that mode it will discard events after a timeout. If that timeout is shorter than the time it takes to complete the noirq resume of devices, looking for EC events after the latter is too late. Signed-off-by: Rafael J. Wysocki Reported-by: Zhang Rui Tested-by: Wendy Wang --- drivers/acpi/ec.c | 6 ++++++ drivers/acpi/internal.h | 1 + drivers/acpi/sleep.c | 7 +++++++ 3 files changed, 14 insertions(+) Index: linux-pm/drivers/acpi/ec.c =================================================================== --- linux-pm.orig/drivers/acpi/ec.c +++ linux-pm/drivers/acpi/ec.c @@ -1034,6 +1034,12 @@ void acpi_ec_unblock_transactions(void) acpi_ec_start(first_ec, true); } +void acpi_ec_dispatch_gpe(void) +{ + if (first_ec) + acpi_dispatch_gpe(NULL, first_ec->gpe); +} + /* -------------------------------------------------------------------------- Event Management -------------------------------------------------------------------------- */ Index: linux-pm/drivers/acpi/internal.h =================================================================== --- linux-pm.orig/drivers/acpi/internal.h +++ linux-pm/drivers/acpi/internal.h @@ -188,6 +188,7 @@ int acpi_ec_ecdt_probe(void); int acpi_ec_dsdt_probe(void); void acpi_ec_block_transactions(void); void acpi_ec_unblock_transactions(void); +void acpi_ec_dispatch_gpe(void); int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit, acpi_handle handle, acpi_ec_query_func func, void *data); Index: linux-pm/drivers/acpi/sleep.c =================================================================== --- linux-pm.orig/drivers/acpi/sleep.c +++ linux-pm/drivers/acpi/sleep.c @@ -989,6 +989,13 @@ static void acpi_s2idle_wake(void) !irqd_is_wakeup_armed(irq_get_irq_data(acpi_sci_irq))) { pm_system_cancel_wakeup(); s2idle_wakeup = true; + /* + * On some platforms with the LPS0 _DSM device noirq resume + * takes too much time for EC wakeup events to survive, so look + * for them now. + */ + if (lps0_device_handle) + acpi_ec_dispatch_gpe(); } }