From patchwork Mon Jan 9 17:57:07 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: 9505683 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 3B06E606E1 for ; Mon, 9 Jan 2017 17:57:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CB24284C0 for ; Mon, 9 Jan 2017 17:57:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61989284C9; Mon, 9 Jan 2017 17:57:13 +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 21536284C0 for ; Mon, 9 Jan 2017 17:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422809AbdAIR5M (ORCPT ); Mon, 9 Jan 2017 12:57:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57154 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422779AbdAIR5L (ORCPT ); Mon, 9 Jan 2017 12:57:11 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E6C2C008AEA; Mon, 9 Jan 2017 17:57:12 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v09Hv9Dw030430; Mon, 9 Jan 2017 12:57:11 -0500 From: Hans de Goede To: Dmitry Torokhov Cc: Hans de Goede , "russianneuromancer @ ya . ru" , Gregor Riepl , linux-input@vger.kernel.org Subject: [PATCH 2/2] Input: soc_button_array - Debounce the buttons Date: Mon, 9 Jan 2017 18:57:07 +0100 Message-Id: <20170109175707.12854-2-hdegoede@redhat.com> In-Reply-To: <20170109175707.12854-1-hdegoede@redhat.com> References: <20170109175707.12854-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 09 Jan 2017 17:57:12 +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 The soc_button_array driver was initializing (kzalloc) the debounce_interval value to 0, leading to no debouncing at all, while the buttons are simple mechanical switches. This commit sets debounce_interval to 50ms to avoid spurious button press reports both on press and release of the button. Note 50ms may seem like a lot but soc_button_array is typically used with cheap tablets, with not so great buttons. I tried 10ms on my tablet and it is not enough, where as 50ms works well. Signed-off-by: Hans de Goede --- drivers/input/misc/soc_button_array.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c index d2e5186..e53b0a1 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c @@ -101,6 +101,8 @@ 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; + /* These devices often use cheap buttons, use 50 ms debounce */ + gpio_keys[n_buttons].debounce_interval = 50; n_buttons++; }