[PATCH] Input: imx_keypad - reset the hardware before enabling

Subsystems: input (keyboard, mouse, joystick, touchscreen) drivers, the rest

STALE5112d

2 messages, 2 authors, 2012-08-22 · open the first message on its own page

[PATCH] Input: imx_keypad - reset the hardware before enabling

From: Michael Grzeschik <hidden>
Date: 2012-08-20 15:34:58

assert 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 have to ensure to enable clks while changing the
keypad registers.

Signed-off-by: Michael Grzeschik <redacted>
---
 drivers/input/keyboard/imx_keypad.c |    3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c
index ff4c0a8..ce68e36 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)
 	/* Inhibit KDI and KRI interrupts. */
 	reg_val = readw(keypad->mmio_base + KPSR);
 	reg_val &= ~(KBD_STAT_KRIE | KBD_STAT_KDIE);
+	reg_val |= KBD_STAT_KPKR | KBD_STAT_KPKD;
 	writew(reg_val, keypad->mmio_base + KPSR);
 
 	/* Colums as open drain and disable all rows */
@@ -515,7 +516,9 @@ static int __devinit imx_keypad_probe(struct platform_device *pdev)
 	input_set_drvdata(input_dev, keypad);
 
 	/* Ensure that the keypad will stay dormant until opened */
+	clk_enable(keypad->clk);
 	imx_keypad_inhibit(keypad);
+	clk_disable(keypad->clk);
 
 	error = request_irq(irq, imx_keypad_irq_handler, 0,
 			    pdev->name, keypad);
-- 
1.7.10.4

Re: [PATCH] Input: imx_keypad - reset the hardware before enabling

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2012-08-22 05:06:21

On Mon, Aug 20, 2012 at 05:34:53PM +0200, Michael Grzeschik wrote:
assert 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 have to ensure to enable clks while changing the
keypad registers.

Signed-off-by: Michael Grzeschik <redacted>
Applied, thank you Michael.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help