From patchwork Wed Apr 11 08:59:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 10335113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3E9376053C for ; Wed, 11 Apr 2018 08:59:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3021928790 for ; Wed, 11 Apr 2018 08:59:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22FA9287A3; Wed, 11 Apr 2018 08:59:24 +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, 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 C29B728790 for ; Wed, 11 Apr 2018 08:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753200AbeDKI7O (ORCPT ); Wed, 11 Apr 2018 04:59:14 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:40664 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751972AbeDKI7L (ORCPT ); Wed, 11 Apr 2018 04:59:11 -0400 Received: from 2.general.khfeng.us.vpn ([10.172.68.175] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1f6Bav-0001t7-Kg; Wed, 11 Apr 2018 08:59:10 +0000 From: Kai-Heng Feng To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Kai-Heng Feng Subject: [PATCH] Input: i8042 - Fix KBD port cannot wake up system from suspend-to-idle Date: Wed, 11 Apr 2018 16:59:05 +0800 Message-Id: <20180411085905.22272-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.0 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 Commit f13b2065de81 ("Input: i8042 - allow KBD and AUX ports to wake up from suspend-to-idle") make system in s2idle can be woken up by i8042 keyboard, but it's disabled by default. In commit 3e6e15a862a0 ("Input: enable remote wakeup for PNP i8042 keyboard ports") states that "Keyboard ports are always supposed to be wakeup-enabled", it should be enabled by default. Keyboard wakeup from s2idles is also the default behavior for other OSes. But right now we can't wake up the system by keyboard, from s2idle. In i8042_probe(), device_set_wakeup_enable(), which gets called by i8042_pnp_kbd_probe(), runs before device_set_wakeup_capable(), which gets called by i8042_register_ports(). So device_set_wakeup_enable() doesn't really enable wakeup for keyboard. We can enable keyboard wakeup in i8042_register_ports() directly. Signed-off-by: Kai-Heng Feng --- drivers/input/serio/i8042-x86ia64io.h | 3 --- drivers/input/serio/i8042.c | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index b353d494ad40..e3def9195c2a 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h @@ -925,9 +925,6 @@ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id * i8042_pnp_id_to_string(dev->id, i8042_kbd_firmware_id, sizeof(i8042_kbd_firmware_id)); - /* Keyboard ports are always supposed to be wakeup-enabled */ - device_set_wakeup_enable(&dev->dev, true); - i8042_pnp_kbd_devices++; return 0; } diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 824f4c1c1f31..21a16b757931 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -1400,6 +1400,10 @@ static void __init i8042_register_ports(void) i8042_ports[i].irq); serio_register_port(serio); device_set_wakeup_capable(&serio->dev, true); + + /* Keyboard ports are always supposed to be wakeup-enabled */ + if (i == I8042_KBD_PORT_NO) + device_wakeup_enable(&serio->dev); } } }