From patchwork Tue Sep 4 03:41:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 10586585 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 AE117139B for ; Tue, 4 Sep 2018 03:41:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 971F829085 for ; Tue, 4 Sep 2018 03:41:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AD99290A4; Tue, 4 Sep 2018 03:41:40 +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 0F32329085 for ; Tue, 4 Sep 2018 03:41:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726146AbeIDIEp (ORCPT ); Tue, 4 Sep 2018 04:04:45 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:40625 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726015AbeIDIEp (ORCPT ); Tue, 4 Sep 2018 04:04:45 -0400 Received: by mail-pl1-f195.google.com with SMTP id s17-v6so943142plp.7 for ; Mon, 03 Sep 2018 20:41:39 -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=kxZ5tQjJX05iTwFc/Y4mSrz9YK4iFwOuOyP7nlDOGfs=; b=MlaJlfBfNXnzV3UTfM4GOCCoSaLEVHvpNzy91D8JSvVXyiyw8UA3LFkmbU4Syw5BPz bmJvco90nGVmtqUMcph4PSByLWRnqv9LhAD+NGL4HCWnPnFgyTlFkD9tZU46i6Q+IYoz jm9rArYVp5NfbjdJpNsFXJuhFDissrobAjKgLtpp+8ivVLK/2qmNpw4Cd24pG7DsRJpg Qgj5FLYNkxRR7VSMsJt8mbNPrcncrC7UWDTKPRgQG5X+O7/F2UYeFHrdKNQRG3rAu72s FwYAAtdFaivz3qxTU9N84QVHSTc2FH7xZorCB8cjJJisuyEUnKMaDH5U3MUed4Q/ehKt xdNg== 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=kxZ5tQjJX05iTwFc/Y4mSrz9YK4iFwOuOyP7nlDOGfs=; b=IiSsAV5sHtVzBn+nlJ7e18WmJFxBwSvNY5Tp+HO1oE/lwNRwvs45/uAFrmi5mFdoHP qhNm7XoHEN+hasQ1ZGR3XvlIH2b6kGjyPMTjOFV7hx5ZoKwN/zopeWiGvaSnFV6riQtf EwtMGI2Zjth+Sye+qbHGRvKCynTrJF0pqgEV92i/NLP+07zg2YEVboe6+7mfX+iaGFYC O+vxEZSXFwqWoomjUX/1xlu+vIEQGWYx5Rn9NqGlVhPAQcbaVrZwPuCZYxMDJHQYizaj suxjnI5qVcc7go94mKb+NHhwkIuC21K8gPMHirFXGRW2ZNc2arADD1zOabr1KJP3QqpO /m5g== X-Gm-Message-State: APzg51DqgTsN8x3UAdhzsH7JUXOe7pnDnwDbxXk7uZoXK8qgNAJgH/gR asMnL4QYrL6Ctc1FVOJdZ6VYgQ== X-Google-Smtp-Source: ANB0VdbBYS83ahBmC57G63oDrUY2CV4qC1rXuu9/joGIy4EnvFviglsKNKaJHT1jLbGf2KksN6aRwA== X-Received: by 2002:a17:902:1683:: with SMTP id h3-v6mr31641232plh.201.1536032498752; Mon, 03 Sep 2018 20:41:38 -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 a15-v6sm35241143pfe.32.2018.09.03.20.41.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Sep 2018 20:41:38 -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] i8042: enable keyboard wakeups by default when s2idle is used Date: Tue, 4 Sep 2018 11:41:34 +0800 Message-Id: <20180904034134.15381-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 Signed-off-by: Daniel Drake Reviewed-by: Rafael J. Wysocki --- drivers/input/serio/i8042.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index a8cd9072481c..7229609a9397 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -1392,15 +1392,28 @@ 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); + + /* + * Modern laptops (as of 2018) typically no longer have the + * behaviour where pressing a key in suspend causes a SCI + * interrupt which unconditionally wakes up the system. + * + * On platforms that use s2idle, retain the previous keyboard + * wakeup behaviour by enabling wakeups by default. + */ + if (mem_sleep_current == PM_SUSPEND_TO_IDLE + && i == I8042_KBD_PORT_NO) + device_set_wakeup_enable(&serio->dev, true); } }