From patchwork Tue Sep 11 01:29:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 10595005 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04801921 for ; Tue, 11 Sep 2018 01:29:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9EE0290CC for ; Tue, 11 Sep 2018 01:29:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE31F290D0; Tue, 11 Sep 2018 01:29:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D907F290CF for ; Tue, 11 Sep 2018 01:29:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726353AbeIKGZx (ORCPT ); Tue, 11 Sep 2018 02:25:53 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:42585 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726429AbeIKGZx (ORCPT ); Tue, 11 Sep 2018 02:25:53 -0400 Received: by mail-pf1-f196.google.com with SMTP id l9-v6so11359826pff.9 for ; Mon, 10 Sep 2018 18:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessm-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=jjhKOEBAjny0EV1x4jb607kgxvHO5SZ5tvq6wxlVyZM=; b=l+qeOUi+XfQ52kh5+MCl92tbN3Ho4ZnMmM1N8dI9Gpg+dAjs8HTRbaooWtzPYKL3W4 8FrIosJ0/qs2raggMaJC8Dnwz+XIFmXjF+miCAJzcUkxi7Dtqtc8fWvUcWT6NBYOdO0Z F8emMqvaU60OIvXLI1C3OCGQ/ZtK7UegGg9nXPDL3/3HSb5GPDU3ScXcdKnEN9SJa8I7 UixE/NRtOUA8WEe2A5RvlKd/H7D7WNi2ToI19E6V7GYPiWvrafOZDCtUojD6nICcqVYC kJ2WZUdcZdVGMM/V/NO5Z3TE1ca3JpjWYdogFlpCUB+SwV/xs+04JhW8D4/8Dtz/38sm cyWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jjhKOEBAjny0EV1x4jb607kgxvHO5SZ5tvq6wxlVyZM=; b=NxtwgQeQnVI19gREB7Rhc0l6aYWm8dP/zVVcIKpTLmS0iY8uNpLRSQHG2AdgpmLeu7 Eaj1Wu+570HvWnxKwUL/QDUm52qgOJLP2073Ut+6eSJv0y29ERnYWLL/yfIp5lC+Z1Bc TjwX8uTJu+bv1XlgxGlO5WEnYJX/cMh+8KWiBQehTA1ulMLOsP5pZmu45AWf2+skoPi2 PIc3QTAGanLCytlf8cZdn7Apqr8fNpQO0LZJyVZwOD3HRN8q712KjsQOBrhYlBj6e554 Wd0AMNcOlDtcrYE3JmGpFS9FbQa0s+IOqu2Ph6+m6/TqssWoTohAXj+xbXYIW1OyxIBO T7YQ== X-Gm-Message-State: APzg51DKisIJSGyL5sFBMtV8YyRjBUZfyUVZTEfD7GzsiH63n1Gz5bSu GT+NrRbq79Ir7v9JpIXkOaNi6g== X-Google-Smtp-Source: ANB0Vdb/2P6wf/mOwxpePRmyLf+tSOclX04ZvhG3aj9fZKXMw7yTKR08DtLb4FO5GwNjQitz7VbJsg== X-Received: by 2002:a62:3184:: with SMTP id x126-v6mr26442100pfx.49.1536629347022; Mon, 10 Sep 2018 18:29:07 -0700 (PDT) Received: from limbo.local (125-227-158-176.HINET-IP.hinet.net. [125.227.158.176]) by smtp.gmail.com with ESMTPSA id b21-v6sm38093320pfm.97.2018.09.10.18.29.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Sep 2018 18:29:06 -0700 (PDT) From: Daniel Drake To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, linux-pm@vger.kernel.org, linux@endlessm.com, rjw@rjwysocki.net Subject: [PATCH v3] i8042: enable keyboard wakeups by default when s2idle is used Date: Tue, 11 Sep 2018 09:29:01 +0800 Message-Id: <20180911012901.3928-1-drake@endlessm.com> X-Mailer: git-send-email 2.17.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Previously, on typical consumer laptops, pressing a key on the keyboard when the system is in suspend would cause it to wake up (default or unconditional behaviour). This happens because the EC generates a SCI interrupt in this scenario. That is no longer true on modern laptops based on Intel WhiskyLake, including Acer Swift SF314-55G, Asus UX333FA, Asus UX433FN and Asus UX533FD. We confirmed with Asus EC engineers that the "Modern Standby" design has been modified so that the EC no longer generates a SCI in this case; the keyboard controller itself should be used for wakeup. In order to retain the standard behaviour of being able to use the keyboard to wake up the system, enable serio wakeups by default on platforms that are using s2idle. Link: https://lkml.kernel.org/r/CAB4CAwfQ0mPMqCLp95TVjw4J0r5zKPWkSvvkK4cpZUGE--w8bQ@mail.gmail.com Reviewed-by: Rafael J. Wysocki Signed-off-by: Daniel Drake --- drivers/input/serio/i8042.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) v2: tweak comment as suggested by Rafael v3: fix checkpatch line length warning diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index b8bc71569349..aa2f9e9521f3 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -1395,15 +1395,27 @@ static void __init i8042_register_ports(void) for (i = 0; i < I8042_NUM_PORTS; i++) { struct serio *serio = i8042_ports[i].serio; - if (serio) { - printk(KERN_INFO "serio: %s at %#lx,%#lx irq %d\n", - serio->name, - (unsigned long) I8042_DATA_REG, - (unsigned long) I8042_COMMAND_REG, - i8042_ports[i].irq); - serio_register_port(serio); - device_set_wakeup_capable(&serio->dev, true); - } + if (!serio) + continue; + + printk(KERN_INFO "serio: %s at %#lx,%#lx irq %d\n", + serio->name, + (unsigned long) I8042_DATA_REG, + (unsigned long) I8042_COMMAND_REG, + i8042_ports[i].irq); + serio_register_port(serio); + device_set_wakeup_capable(&serio->dev, true); + + /* + * On platforms using suspend-to-idle by default, make the + * keyboard wake up the system from sleep by enabling keyboard + * wakeups by default. That is consistent with keyboard + * wakeup behavior on many platforms using suspend-to-RAM + * (ACPI S3) by default. + */ + if (mem_sleep_current == PM_SUSPEND_TO_IDLE + && i == I8042_KBD_PORT_NO) + device_set_wakeup_enable(&serio->dev, true); } }