diff mbox

[U-Boot,v2,4/4] samsung: misc: keys: fix gpio key debouncing by adding 50 ms delay

Message ID 1396431721-13522-4-git-send-email-p.marczak@samsung.com
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Commit Message

Przemyslaw Marczak April 2, 2014, 9:42 a.m. UTC
This change prevents gpio keys debouncing by adding 50 ms delay
when key pressed condition met.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>

---
Changes v2:
- new commit
---
 board/samsung/common/misc.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Gerhard Sittig April 2, 2014, 5:26 p.m. UTC | #1
On Wed, 2014-04-02 at 11:42 +0200, Przemyslaw Marczak wrote:
> 
> This change prevents gpio keys debouncing by adding 50 ms delay
> when key pressed condition met.

comment nit:  keys are bouncing, de-bouncing is the counter
measure, you don't want to avoid it :)


virtually yours
Gerhard Sittig
Przemyslaw Marczak April 3, 2014, 7:03 a.m. UTC | #2
Hi,
On 04/02/2014 07:26 PM, Gerhard Sittig wrote:
> On Wed, 2014-04-02 at 11:42 +0200, Przemyslaw Marczak wrote:
>>
>> This change prevents gpio keys debouncing by adding 50 ms delay
>> when key pressed condition met.
>
> comment nit:  keys are bouncing, de-bouncing is the counter
> measure, you don't want to avoid it :)
>
>
> virtually yours
> Gerhard Sittig
>
Ok, I will correct this.

Thanks
diff mbox

Patch

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 65b5c30..5b43821 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -105,6 +105,10 @@  static int check_keys(void)
 	if (key_pressed(KEY_VOLUMEDOWN))
 		keys += KEY_VOLUMEDOWN;
 
+	/* Avoids gpio keys debouncing */
+	if (keys)
+		mdelay(50);
+
 	return keys;
 }