From patchwork Wed Jan 10 12:26:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 10155035 X-Patchwork-Delegate: andy.shevchenko@gmail.com 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 0F811601A1 for ; Wed, 10 Jan 2018 12:28:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F046722380 for ; Wed, 10 Jan 2018 12:28:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4FB524151; Wed, 10 Jan 2018 12:28:34 +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=-6.9 required=2.0 tests=BAYES_00,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 4EB3E22380 for ; Wed, 10 Jan 2018 12:28:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965553AbeAJM2c (ORCPT ); Wed, 10 Jan 2018 07:28:32 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:43287 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965551AbeAJM20 (ORCPT ); Wed, 10 Jan 2018 07:28:26 -0500 Received: from 79.184.254.76.ipv4.supernova.orange.pl (79.184.254.76) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.82) id 7ea127e8a13d66d8; Wed, 10 Jan 2018 13:28:24 +0100 From: "Rafael J. Wysocki" To: Linux ACPI Cc: Andy Shevchenko , Darren Hart , LKML , Linux PM , Platform Driver , Valentin Manea Subject: [PATCH 2/2] platform/x86: surfacepro3: Support for wakeup from suspend-to-idle Date: Wed, 10 Jan 2018 13:26:35 +0100 Message-ID: <6492549.QWquAG8VGe@aspire.rjw.lan> In-Reply-To: <4046497.JI7UjL75gC@aspire.rjw.lan> References: <4046497.JI7UjL75gC@aspire.rjw.lan> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki Modify surface_button_notify() to make it wake up the system from suspend-to-idle (by reporting "hard" wakeup events while suspended) and add wakeup initialization to surface_button_add() for wakeup events reported by this driver to work at all. Link: https://bugzilla.kernel.org/show_bug.cgi?id=198389 Reported-by: Valentin Manea Signed-off-by: Rafael J. Wysocki Acked-by: Andy Shevchenko --- drivers/platform/x86/surfacepro3_button.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: linux-pm/drivers/platform/x86/surfacepro3_button.c =================================================================== --- linux-pm.orig/drivers/platform/x86/surfacepro3_button.c +++ linux-pm/drivers/platform/x86/surfacepro3_button.c @@ -119,7 +119,7 @@ static void surface_button_notify(struct if (key_code == KEY_RESERVED) return; if (pressed) - pm_wakeup_event(&device->dev, 0); + pm_wakeup_dev_event(&device->dev, 0, button->suspended); if (button->suspended) return; input_report_key(input, key_code, pressed?1:0); @@ -185,6 +185,8 @@ static int surface_button_add(struct acp error = input_register_device(input); if (error) goto err_free_input; + + device_init_wakeup(&device->dev, true); dev_info(&device->dev, "%s [%s]\n", name, acpi_device_bid(device)); return 0;