Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5034507ybl; Tue, 14 Jan 2020 02:21:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzphfivDBccdVQSZ3CAgqeX205IqQVkUT0vxPRH48Z7rV2nmy+Xz9OP/+SK9N9s0++at0vh X-Received: by 2002:aca:f5c1:: with SMTP id t184mr16668254oih.23.1578997269031; Tue, 14 Jan 2020 02:21:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578997269; cv=none; d=google.com; s=arc-20160816; b=TceGGhnlrvmdTu0whXQ2tEN95Zdqa9ae1c/bHDiy18q9qvWB68rH1zVdWzj/FY1TEb ljKe21gYTDrc40RG4Vgx2Sk7gEp1EUJejRmrddiuLC/2pLoxRq3xlHXGItazxn8yj7bB Mf8N0UME0GSKL/y3CCbQ6cz/erC+69CQY6BgGPARevAvuaSAkmiRDIZNUWPn1ACsST+s AmjSh/F7Ta3aCs2PAJPcco+7DkxNCZ21jaDhOi/LWyLD3VMAupnZ7dtCIM7Lb+c28RQN 1E/IcvwCWAMYivXLglPtidstOY0bjtENcmEMTxElCpNpvjxUMFoC3A6l4Jf+vxDNLHLi jVyQ== 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=uTvYyAM+KYTM+WPXXMBB7ms/lqcmc2AhYFfvuojz1Mc=; b=UCYVjcbXMWadR/P5B55UhEom+KHcF0g4WHXeSh2ccqQckRSLDFLjPoPPWpm5U2OwSl hlhuanDvg7j894cx1tV7qoDlY/enjLvOqbCb0V0qLTTh8b1LasFWjucqsN0sb4jlsCCV 6oHusAucBqS5lwBm8UrboE5lDqH3m3YfOS7eHozDLiLa88t0iYEpINjAj6Xeb5QHczkg RI7g5xZvG1BTqL9gP3Jm5jg9ekliCSsn+V1JT6jhbTH0zA7ih542ELk+TIHZjp2wXZb/ nAkFi/PvEBv6V53Wt4kiyIzwXvW7zNOAmRo9Nkb1iVtQZPALsrPBL6xEvDrTJ0R0kmaW hz9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eJL9b3MN; 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 d22si8785648oti.316.2020.01.14.02.20.58; Tue, 14 Jan 2020 02:21:09 -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=eJL9b3MN; 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 S1730835AbgANKTn (ORCPT + 99 others); Tue, 14 Jan 2020 05:19:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:33386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729727AbgANKFW (ORCPT ); Tue, 14 Jan 2020 05:05:22 -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 B4AB224672; Tue, 14 Jan 2020 10:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996321; bh=f+zasHaFZPGHYrBOj3ttLWGwZTdT81teXLi8J/9nfYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eJL9b3MN4qfecomgMvphJNbqTooks3hM/XMgTV+ZYjeOY63DNgJpGInlbJ90hTA0R yU01SRJyUzFEuYxG5grckDX/YjGVQ+Z7s6Bd5X3bUNq7Jsg2jc5aUXuXExtMFSHjuS LhgADU208AtXQImxG+J22uPnpvOvqoIVAxchIcfo= 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 5.4 38/78] gpiolib: acpi: Add honor_wakeup module-option + quirk mechanism Date: Tue, 14 Jan 2020 11:01:12 +0100 Message-Id: <20200114094358.716630382@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094352.428808181@linuxfoundation.org> References: <20200114094352.428808181@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 @@ -22,12 +22,18 @@ #include "gpiolib-acpi.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 * @@ -276,7 +282,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; @@ -1330,6 +1336,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 */ }; @@ -1349,6 +1372,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; }