Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5025359ybl; Tue, 14 Jan 2020 02:11:07 -0800 (PST) X-Google-Smtp-Source: APXvYqzUemkGg238nec6ObxVlXMv2HKub442fcRi+/xTuTslonE2X2bHU8CD0uUCe0day4zvf1no X-Received: by 2002:a05:6830:1e30:: with SMTP id t16mr16646587otr.220.1578996667770; Tue, 14 Jan 2020 02:11:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578996667; cv=none; d=google.com; s=arc-20160816; b=FPocJvPee5haMZo6fpKMf6zFRtxKicR34QqglLUXTb7mR+jWNz7+LZkS1w1WJ8QI3X nRvoty2p15sA81iyKRoW6zXYqAQUuQkKH/bmuwhTS5zOOhGUR7l5dSD3bbYmD5fAQwW2 nzxppn7hbDEr+jKbxmaBi5CWggdLsX39Xmo0pY9ZSS2zftRLwG//6kHJstqcnbhDIcWO 10tJWGpCnLXRjQTGghmAL5GPbAaZVW9NP1pWiEh6z3/KaW09JrV0znwQqzpS/ouvtq0w XCzNeVaMk5QHRoUXKfwji80691G3xAbIrEN+MbANXy8UISYc2oYs2VgXwG1lJ2GZcKbo Sb8g== 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=uYdwZbbWs6xXSyNH9jwa7yJCpl6dII7iv+ZnmmxA2bk=; b=nRvYT3Ku4osJuGxEpiwot5RZjL2XzSIfHor6XC0/dGcYnBLz8VX/iHaFny0uUxhLde 6VBxryBf53QMBfO0oGzd/EGY3RQRoaOuX3Z4U16Ax0O6OZ2otMSJ7NUfqjV7e3NKWxoN +1cVFjGLClAKShxsz+xtOwmbDJUOGFqfEOTP3M3OIBGTROmwpei33qPh8muWIbLFbfkS o9xaBqpBFgkXm7vkMrZSjKtn6i+PwliVpbpctWMQ3g49qvEX87DreLq3yjEOj17NeSB6 O4O73O2w+i1/Z5t3L4GkBjDXMNMJdoGwTb36/k3mXv0MSxivrGlp8ZpkpFEYIq3TG330 CGeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OOUkZC+o; 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 s16si7643395oih.4.2020.01.14.02.10.57; Tue, 14 Jan 2020 02:11:07 -0800 (PST) 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=OOUkZC+o; 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 S1731342AbgANKJa (ORCPT + 99 others); Tue, 14 Jan 2020 05:09:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:42276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729817AbgANKJ1 (ORCPT ); Tue, 14 Jan 2020 05:09:27 -0500 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 61ED5207FF; Tue, 14 Jan 2020 10:09:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996566; bh=gKvv+/SrsS+y93wpbqPaEa5gVBCDz92L2kQPTaV/LFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OOUkZC+odxFGkCeXaTYUgANLd2aooNp9yCXUaoR0gJYdmkxPNeMwPMby/FgqN4ebC LDCKpiuEKbo0TodONo1rmwMTbg22QM2v9kggrRGQyT5z3ohXDmT4BceLcx8hGVGBgF RxTh04cIqQ2zYWXsKiMCx8KLUICNuFj09q/Ke3FM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Mika Westerberg , Hans de Goede , Linus Walleij Subject: [PATCH 4.14 14/39] gpiolib: acpi: Add honor_wakeup module-option + quirk mechanism Date: Tue, 14 Jan 2020 11:01:48 +0100 Message-Id: <20200114094342.309028889@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094336.210038037@linuxfoundation.org> References: <20200114094336.210038037@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: Hans de Goede commit aa23ca3d98f756d5b1e503fb140665fb24a41a38 upstream. On some laptops enabling wakeup on the GPIO interrupts used for ACPI _AEI event handling causes spurious wakeups. This commit adds a new honor_wakeup option, defaulting to true (our current behavior), which can be used to disable wakeup on troublesome hardware to avoid these spurious wakeups. This is a workaround for an architectural problem with s2idle under Linux where we do not have any mechanism to immediately go back to sleep after wakeup events, other then for embedded-controller events using the standard ACPI EC interface, for details see: https://lore.kernel.org/linux-acpi/61450f9b-cbc6-0c09-8b3a-aff6bf9a0b3c@redhat.com/ One series of laptops which is not able to suspend without this workaround is the HP x2 10 Cherry Trail models, this commit adds a DMI based quirk which makes sets honor_wakeup to false on these models. Cc: stable@vger.kernel.org Reviewed-by: Andy Shevchenko Acked-by: Mika Westerberg Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20200105160357.97154-3-hdegoede@redhat.com Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpiolib-acpi.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -25,12 +25,18 @@ #include "gpiolib.h" #define QUIRK_NO_EDGE_EVENTS_ON_BOOT 0x01l +#define QUIRK_NO_WAKEUP 0x02l static int run_edge_events_on_boot = -1; module_param(run_edge_events_on_boot, int, 0444); MODULE_PARM_DESC(run_edge_events_on_boot, "Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto"); +static int honor_wakeup = -1; +module_param(honor_wakeup, int, 0444); +MODULE_PARM_DESC(honor_wakeup, + "Honor the ACPI wake-capable flag: 0=no, 1=yes, -1=auto"); + /** * struct acpi_gpio_event - ACPI GPIO event handler data * @@ -341,7 +347,7 @@ static acpi_status acpi_gpiochip_alloc_e event->handle = evt_handle; event->handler = handler; event->irq = irq; - event->irq_is_wake = agpio->wake_capable == ACPI_WAKE_CAPABLE; + event->irq_is_wake = honor_wakeup && agpio->wake_capable == ACPI_WAKE_CAPABLE; event->pin = pin; event->desc = desc; @@ -1340,6 +1346,23 @@ static const struct dmi_system_id gpioli }, .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT, }, + { + /* + * Various HP X2 10 Cherry Trail models use an external + * embedded-controller connected via I2C + an ACPI GPIO + * event handler. The embedded controller generates various + * spurious wakeup events when suspended. So disable wakeup + * for its handler (it uses the only ACPI GPIO event handler). + * This breaks wakeup when opening the lid, the user needs + * to press the power-button to wakeup the system. The + * alternative is suspend simply not working, which is worse. + */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP x2 Detachable 10-p0XX"), + }, + .driver_data = (void *)QUIRK_NO_WAKEUP, + }, {} /* Terminating entry */ }; @@ -1359,6 +1382,13 @@ static int acpi_gpio_setup_params(void) run_edge_events_on_boot = 1; } + if (honor_wakeup < 0) { + if (quirks & QUIRK_NO_WAKEUP) + honor_wakeup = 0; + else + honor_wakeup = 1; + } + return 0; }