From patchwork Sat Jul 22 18:46:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9858133 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 B7979600CA for ; Sat, 22 Jul 2017 18:46:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A13B9284FC for ; Sat, 22 Jul 2017 18:46:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9632328524; Sat, 22 Jul 2017 18:46: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=-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 3A5DB284FC for ; Sat, 22 Jul 2017 18:46:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752343AbdGVSqp (ORCPT ); Sat, 22 Jul 2017 14:46:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36792 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752265AbdGVSqo (ORCPT ); Sat, 22 Jul 2017 14:46:44 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1F5B3DE3D; Sat, 22 Jul 2017 18:46:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B1F5B3DE3D Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=hdegoede@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B1F5B3DE3D Received: from shalem.localdomain.com (ovpn-116-48.ams2.redhat.com [10.36.116.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id E344160BE3; Sat, 22 Jul 2017 18:46:43 +0000 (UTC) From: Hans de Goede To: Dmitry Torokhov Cc: Hans de Goede , linux-input@vger.kernel.org Subject: [PATCH v2 2/2] Input: soc_button_array - Suppress power button presses during suspend Date: Sat, 22 Jul 2017 20:46:41 +0200 Message-Id: <20170722184641.12468-2-hdegoede@redhat.com> In-Reply-To: <20170722184641.12468-1-hdegoede@redhat.com> References: <20170722184641.12468-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 22 Jul 2017 18:46:44 +0000 (UTC) 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 If the power-button is pressed to wakeup the laptop/tablet from suspend and we report a KEY_POWER event to userspace when woken up this will cause userspace to immediately suspend the system again which is undesirable. This commit sets the new no_wakeup_events flag in the gpio_keys_button struct for the power-button suppressing the undesirable KEY_POWER input events on wake-up. Signed-off-by: Hans de Goede --- Changes in v2: -New patch in v2 of this patch-set --- drivers/input/misc/soc_button_array.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c index f600f3a7a3c6..27b99831cb97 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c @@ -27,6 +27,7 @@ struct soc_button_info { unsigned int event_code; bool autorepeat; bool wakeup; + bool no_wakeup_events; }; /* @@ -100,6 +101,7 @@ soc_button_device_create(struct platform_device *pdev, gpio_keys[n_buttons].active_low = 1; gpio_keys[n_buttons].desc = info->name; gpio_keys[n_buttons].wakeup = info->wakeup; + gpio_keys[n_buttons].no_wakeup_events = info->no_wakeup_events; /* These devices often use cheap buttons, use 50 ms debounce */ gpio_keys[n_buttons].debounce_interval = 50; n_buttons++; @@ -185,6 +187,7 @@ static int soc_button_parse_btn_desc(struct device *dev, info->name = "power"; info->event_code = KEY_POWER; info->wakeup = true; + info->no_wakeup_events = true; } else if (upage == 0x07 && usage == 0xe3) { info->name = "home"; info->event_code = KEY_LEFTMETA; @@ -369,7 +372,7 @@ static int soc_button_probe(struct platform_device *pdev) * Platforms" */ static struct soc_button_info soc_button_PNP0C40[] = { - { "power", 0, EV_KEY, KEY_POWER, false, true }, + { "power", 0, EV_KEY, KEY_POWER, false, true, true }, { "home", 1, EV_KEY, KEY_LEFTMETA, false, true }, { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false }, { "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false },