From patchwork Mon Mar 9 15:19:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 5968581 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3384D9F2A9 for ; Mon, 9 Mar 2015 14:56:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1A8C120259 for ; Mon, 9 Mar 2015 14:56:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C1FD22024F for ; Mon, 9 Mar 2015 14:56:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754419AbbCIO4K (ORCPT ); Mon, 9 Mar 2015 10:56:10 -0400 Received: from v094114.home.net.pl ([79.96.170.134]:57017 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753376AbbCIO4J (ORCPT ); Mon, 9 Mar 2015 10:56:09 -0400 Received: from aftr193.neoplus.adsl.tpnet.pl (178.42.251.193) (HELO vostro.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer v0.80) id 9aef4a86c8a4c20c; Mon, 9 Mar 2015 15:56:07 +0100 From: "Rafael J. Wysocki" To: Dmitry Torokhov Cc: Kristen Carlson Accardi , Linux PM list , Linux Kernel Mailing List , linux-input@vger.kernel.org Subject: [PATCH] i8042 / PM: Allow PC keyboard to wake up from suspend-to-idle Date: Mon, 09 Mar 2015 16:19:50 +0100 Message-ID: <2197217.yzvHkR7SyK@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/3.19.0+; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki If they keyboard interrupt is registered, mark the i8042 platform device as wakeup-capable and check the user space wakeup setting in i8042_pm_suspend() and i8042_pm_resume() to enable or disable, respectively, the keyboard interrupt to wake up the system. This makes it possible to use the PC keyboard to wake up the system from suspend-to-idle after writing "enabled" to the i8042 device's power/wakeup sysfs attribute. Signed-off-by: Rafael J. Wysocki --- drivers/input/serio/i8042.c | 6 ++++++ 1 file changed, 6 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-pm/drivers/input/serio/i8042.c =================================================================== --- linux-pm.orig/drivers/input/serio/i8042.c +++ linux-pm/drivers/input/serio/i8042.c @@ -1163,12 +1163,17 @@ static int i8042_controller_resume(bool static int i8042_pm_suspend(struct device *dev) { i8042_controller_reset(true); + if (device_may_wakeup(&i8042_platform_device->dev)) + enable_irq_wake(I8042_KBD_IRQ); return 0; } static int i8042_pm_resume(struct device *dev) { + if (device_may_wakeup(&i8042_platform_device->dev)) + disable_irq_wake(I8042_KBD_IRQ); + /* * On resume from S2R we always try to reset the controller * to bring it in a sane state. (In case of S2D we expect @@ -1406,6 +1411,7 @@ static int __init i8042_setup_kbd(void) if (error) goto err_free_irq; + device_set_wakeup_capable(&i8042_platform_device->dev, true); i8042_kbd_irq_registered = true; return 0;