Commit f35dd69b authored by Michael Grzeschik's avatar Michael Grzeschik Committed by Dmitry Torokhov

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: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent a1d0fa77
...@@ -358,6 +358,7 @@ static void imx_keypad_inhibit(struct imx_keypad *keypad) ...@@ -358,6 +358,7 @@ static void imx_keypad_inhibit(struct imx_keypad *keypad)
/* Inhibit KDI and KRI interrupts. */ /* Inhibit KDI and KRI interrupts. */
reg_val = readw(keypad->mmio_base + KPSR); reg_val = readw(keypad->mmio_base + KPSR);
reg_val &= ~(KBD_STAT_KRIE | KBD_STAT_KDIE); reg_val &= ~(KBD_STAT_KRIE | KBD_STAT_KDIE);
reg_val |= KBD_STAT_KPKR | KBD_STAT_KPKD;
writew(reg_val, keypad->mmio_base + KPSR); writew(reg_val, keypad->mmio_base + KPSR);
/* Colums as open drain and disable all rows */ /* Colums as open drain and disable all rows */
...@@ -515,7 +516,9 @@ static int __devinit imx_keypad_probe(struct platform_device *pdev) ...@@ -515,7 +516,9 @@ static int __devinit imx_keypad_probe(struct platform_device *pdev)
input_set_drvdata(input_dev, keypad); input_set_drvdata(input_dev, keypad);
/* Ensure that the keypad will stay dormant until opened */ /* Ensure that the keypad will stay dormant until opened */
clk_enable(keypad->clk);
imx_keypad_inhibit(keypad); imx_keypad_inhibit(keypad);
clk_disable(keypad->clk);
error = request_irq(irq, imx_keypad_irq_handler, 0, error = request_irq(irq, imx_keypad_irq_handler, 0,
pdev->name, keypad); pdev->name, keypad);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment