From patchwork Mon Sep 10 11:24:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 10593953 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 B65B3921 for ; Mon, 10 Sep 2018 11:24:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A560D28D1C for ; Mon, 10 Sep 2018 11:24:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 974CB28D1E; Mon, 10 Sep 2018 11:24:47 +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 BA30028D1C for ; Mon, 10 Sep 2018 11:24:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728283AbeIJQST (ORCPT ); Mon, 10 Sep 2018 12:18:19 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:38782 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728282AbeIJQST (ORCPT ); Mon, 10 Sep 2018 12:18:19 -0400 Received: by mail-pf1-f193.google.com with SMTP id x17-v6so10336873pfh.5 for ; Mon, 10 Sep 2018 04:24:44 -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=jWt/E5yqcX/5gdJ8tridNdIogqpYZKc+SrnwNoFJ8Pg=; b=faxrWkO2EjNv5E3o6Gtzvi+FyG/fl/+lE+uNg6jxD6EVMW69NX9G9A1qmccQ52P9tR JOjaEXHVMb1I0IzZrz6f/HKdd7kfWXaVaxGedxVchUB1rmJm1+wmfSOQL/WMNQmWeTBG U74SKE7+CDIZZ4yLxZSN567NyGfE9UZ1Rm6GquToi9dmfAaUeoa/vDBQbF/Y3z3xtQGU a+B5TK0G8QGG/7LTTnspntGgP2jUmkOIAwgPDivihFhfJ8fxNGQ22HrdJ/2p0lAKuxWz C0poivfXvbayIRhevUOga2IRWq8v2d4bFXHdewkmOPSDwvKKOHlT68753+ZbKNyg/e7T iGXA== 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=jWt/E5yqcX/5gdJ8tridNdIogqpYZKc+SrnwNoFJ8Pg=; b=g3lf2Lj+VKFE3lE0ei4TZ0gP0NRhD0MZH1xjRslTkpOfHoG3/w6TVTn1qREyFz+KqG 9BNI7ZWD4GkJ/9vAuEkXNHQyNqSQeGhdY5Ta0EMV3Sv2q+RugjwkXlRlMPIDw9CksRwv 7Y+jacq+ClFxfnQs+5mt9z2tHbhqd+D8H9nqDeae3wqM6oThp8SAvybVJhdhRCigbkk2 kvUBysj7/wwFv1GsO94ZUD24oWvKXFnxRrf8sbzO4ehsboPKR0JK1IsXKzvrtxZ/fPA+ HO0tEOMSuySweAJG7meQZCp6DGyA9DW9BqE2/eaRbazwj4jP7AfgX126QnNgzB6kJIEm 6/fg== X-Gm-Message-State: APzg51CoH0GOky2dDsw4DaUwCJx/h2X8BRjskiyqdb4k790i0FZsGhbG 9a4T5/9yj1Uw8VvbhviIwGS1Yw== X-Google-Smtp-Source: ANB0Vdb2jsxWmp4RNag0y4T+ND43Vr7/7RqgcufMjwiardm9FWU1HZA7DPJKaKRxriwKoGgb9xIc/Q== X-Received: by 2002:a62:1c7:: with SMTP id 190-v6mr23098398pfb.1.1536578683187; Mon, 10 Sep 2018 04:24:43 -0700 (PDT) Received: from limbo.local (123-193-12-44.dynamic.kbronet.com.tw. [123.193.12.44]) by smtp.gmail.com with ESMTPSA id r19-v6sm22217474pgo.43.2018.09.10.04.24.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Sep 2018 04:24:42 -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 v2] i8042: enable keyboard wakeups by default when s2idle is used Date: Mon, 10 Sep 2018 19:24:38 +0800 Message-Id: <20180910112438.7291-1-drake@endlessm.com> X-Mailer: git-send-email 2.17.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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 | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) v2: tweak comment as suggested by Rafael diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index b8bc71569349..e2186a5fa489 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -1395,15 +1395,26 @@ 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); } }