aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Grzeschik <m.grzeschik@pengutronix.de>2012-08-22 00:57:15 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-08-22 01:03:09 -0400
commitf35dd69ba341bda3790713b9e964483934b995e1 (patch)
tree428de3b160d6afbb7f1ca154b1c6f212740bf154
parenta1d0fa776870aeda5eb91b131d0f1aede6d94ef1 (diff)
Input: imx_keypad - reset the hardware before enabling
Ensure the hardware is correctly initialized before requesting the interrupt, otherwise if a key was already touched since power-on the kernel enters an interrupt loop. To fix this issue we clear pending interrupt sources. We also have to make sure clk is enabled while changing the keypad registers. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/keyboard/imx_keypad.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c
index ff4c0a87a25f..ce68e361558c 100644
--- a/drivers/input/keyboard/imx_keypad.c
+++ b/drivers/input/keyboard/imx_keypad.c
@@ -358,6 +358,7 @@ static void imx_keypad_inhibit(struct imx_keypad *keypad)
358 /* Inhibit KDI and KRI interrupts. */ 358 /* Inhibit KDI and KRI interrupts. */
359 reg_val = readw(keypad->mmio_base + KPSR); 359 reg_val = readw(keypad->mmio_base + KPSR);
360 reg_val &= ~(KBD_STAT_KRIE | KBD_STAT_KDIE); 360 reg_val &= ~(KBD_STAT_KRIE | KBD_STAT_KDIE);
361 reg_val |= KBD_STAT_KPKR | KBD_STAT_KPKD;
361 writew(reg_val, keypad->mmio_base + KPSR); 362 writew(reg_val, keypad->mmio_base + KPSR);
362 363
363 /* Colums as open drain and disable all rows */ 364 /* Colums as open drain and disable all rows */
@@ -515,7 +516,9 @@ static int __devinit imx_keypad_probe(struct platform_device *pdev)
515 input_set_drvdata(input_dev, keypad); 516 input_set_drvdata(input_dev, keypad);
516 517
517 /* Ensure that the keypad will stay dormant until opened */ 518 /* Ensure that the keypad will stay dormant until opened */
519 clk_enable(keypad->clk);
518 imx_keypad_inhibit(keypad); 520 imx_keypad_inhibit(keypad);
521 clk_disable(keypad->clk);
519 522
520 error = request_irq(irq, imx_keypad_irq_handler, 0, 523 error = request_irq(irq, imx_keypad_irq_handler, 0,
521 pdev->name, keypad); 524 pdev->name, keypad);