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: 10593951 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 7D56014E5 for ; Mon, 10 Sep 2018 11:24:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C0E928D1E for ; Mon, 10 Sep 2018 11:24:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D9BF28D1D; Mon, 10 Sep 2018 11:24:46 +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=ham 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 DB51928D1D for ; Mon, 10 Sep 2018 11:24:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728282AbeIJQST (ORCPT ); Mon, 10 Sep 2018 12:18:19 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40458 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727269AbeIJQST (ORCPT ); Mon, 10 Sep 2018 12:18:19 -0400 Received: by mail-pg1-f195.google.com with SMTP id l63-v6so10320253pga.7 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=ukR1sCh51OSjbpLZGafTKawA8WZiMkBK0jZYYn8dgrmE9jzWhk1PgxDliUGycYDMA3 dfS22QhEsv11TYAGK0tpZO5hWi7KnqKq+3MrJHVU4l6w7/V0KdHbKtRgZMNAUr71WlOs HWBvvGbM9OfKr6GXLp0JWS6nyOEhyjSNUNrOqWc8gIKDU/ysc0815/Iif0FYBhYSq0Kr D5vB6Fcg2NUp2kkHtFrGjypV4q/DwvwUB2RQNKolPOdDnXj8g/g/LsqEgyWNssmjukE1 +s4lQrcRJaQrDD1BvmRoWl2jV2zF/CgeB7/oObOvJNzzsXtooc6z3bTB2BU7p2JR0Sfu /3aQ== X-Gm-Message-State: APzg51ACwkj9U+NfY3Iz00nKf7a10drrbzpwvJnWwq3eaRDR7X3wxGI/ sx9a53Uxz7E9/tOIRqadNgpaUSppoX4= 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-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 | 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); } }