Input: imx_keypad - reset the hardware before enabling

Started by Michael Grzeschik on Aug 20, 2012 · 2 messages from 2 authors · Last reply Aug 22, 2012

Subsystems (2)

Maintainers (2)

STALE5216d

open the first message on its own page

Message details and related content
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
Message details and related content
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 / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help