diff options
author | Naveen Kumar Gaddipati <naveen.gaddipati@stericsson.com> | 2011-02-08 18:56:54 +0530 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 11:03:29 +0200 |
commit | eff2db6bf47e837ee3b1dd586850ff74e3b02fb3 (patch) | |
tree | 8e35d40448f20355a241f07d4ecac5a6cd98d976 /drivers/input/keyboard | |
parent | 3c4b1ba339ee01e57d6f9048937537f53f4e7478 (diff) |
input:ske:Decrease the CPU load during continue key press
Decrease the CPU load during continuous key press in
SKE keypad driver.
ST-Ericsson Id: ER 323157
Signed-off-by: Naveen Kumar Gaddipati <naveen.gaddipati@stericsson.com>
Change-Id: Ic450157de6cb21d3d36a51ffb54e5d3467163335
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/14705
Reviewed-by: QATOOLS
Reviewed-by: Rikard OLSSON <rikard.p.olsson@stericsson.com>
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/nomadik-ske-keypad.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c index e822c031427..88f34abae9b 100644 --- a/drivers/input/keyboard/nomadik-ske-keypad.c +++ b/drivers/input/keyboard/nomadik-ske-keypad.c @@ -48,6 +48,7 @@ #define SKE_ASR3 0x2C #define SKE_NUM_ASRX_REGISTERS (4) +#define KEY_PRESSED_DELAY 10 /** * struct ske_keypad - data structure used by keypad driver @@ -245,20 +246,21 @@ static void ske_keypad_read_data(struct ske_keypad *keypad) static irqreturn_t ske_keypad_irq(int irq, void *dev_id) { struct ske_keypad *keypad = dev_id; + int timeout = keypad->board->debounce_ms; /* disable auto scan interrupt; mask the interrupt generated */ ske_keypad_set_bits(keypad, SKE_IMSC, ~SKE_KPIMA, 0x0); ske_keypad_set_bits(keypad, SKE_ICR, 0x0, SKE_KPICA); - while (readl(keypad->reg_base + SKE_CR) & SKE_KPASON) + while ((readl(keypad->reg_base + SKE_CR) & SKE_KPASON) && --timeout) cpu_relax(); /* SKEx registers are stable and can be read */ ske_keypad_read_data(keypad); - /* wait one debounce ms */ - while (readl(keypad->reg_base + SKE_RIS)) - cpu_relax(); + /* wait until raw interrupt is clear */ + while ((readl(keypad->reg_base + SKE_RIS)) && --timeout) + msleep(KEY_PRESSED_DELAY); /* enable auto scan interrupts */ ske_keypad_set_bits(keypad, SKE_IMSC, 0x0, SKE_KPIMA); |