All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	"russianneuromancer @ ya . ru" <russianneuromancer@ya.ru>,
	Gregor Riepl <onitake@gmail.com>,
	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	[thread overview]
Message-ID: <20170109175707.12854-2-hdegoede@redhat.com> (raw)
In-Reply-To: <20170109175707.12854-1-hdegoede@redhat.com>

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 <hdegoede@redhat.com>
---
 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++;
 	}
 
-- 
2.9.3


  reply	other threads:[~2017-01-09 17:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 17:57 [PATCH 1/2] Input: soc_button_array - Set input device name Hans de Goede
2017-01-09 17:57 ` Hans de Goede [this message]
2017-01-21 19:14   ` [PATCH 2/2] Input: soc_button_array - Debounce the buttons Dmitry Torokhov
2017-01-21 19:13 ` [PATCH 1/2] Input: soc_button_array - Set input device name Dmitry Torokhov
2017-01-22  8:49   ` Hans de Goede
2017-01-22 10:00     ` Dmitry Torokhov
2017-01-22 10:10       ` Hans de Goede
2017-01-23 21:17         ` Hans de Goede
2017-01-23 22:10         ` Dmitry Torokhov
2017-01-23 22:14           ` Dmitry Torokhov
2017-02-12 12:36           ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170109175707.12854-2-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=onitake@gmail.com \
    --cc=russianneuromancer@ya.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.