Skip to contentSkip to conversation

ARM: pxa27x_keypad: clear pending interrupts on keypad config

PATCH RESEND Superseded Vasily Khoruzhick 3 participants 5 messages Oct 28, 2012 – Nov 1, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 ARM: pxa27x_keypad: clear pending interrupts on keypad config

Bootloader can leave interrupt bit pending, and it confuses driver.

---
Rebased against v3.7-rc2

 drivers/input/keyboard/pxa27x_keypad.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/input/keyboard/pxa27x_keypad.c +3 -0
index 803ff6f..cad9d5d 100644
@@ -368,6 +368,9 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad)
 	unsigned int mask = 0, direct_key_num = 0;
 	unsigned long kpc = 0;
 
+	/* clear pending interrupt bit */
+	keypad_readl(KPC);
+
 	/* enable matrix keys with automatic scan */
 	if (pdata->matrix_key_rows && pdata->matrix_key_cols) {
 		kpc |= KPC_ASACT | KPC_MIE | KPC_ME | KPC_MS_ALL;
Signature · 1 line
1.7.12.4
#1 lore raw

PATCH RESEND 1/1 ARM: pxa27x_keypad: clear pending interrupts on keypad config

Quoted 1 line · Vasily Khoruzhick

Bootloader can leave interrupt bit pending, and it confuses driver.

OK, looks good to me.
One question though, just to make sure everything is covered :
Suppose that the resume is the consequence of keypad press. If anybody relied previously on "reading the keypad" to know which key was pressed to wakeup the SoC, is it still working after your patch ?

And I suppose you can't "convince" your bootloader to behave correctly, can you ?

Cheers.

--
Robert

#2 lore raw

PATCH RESEND 1/1 ARM: pxa27x_keypad: clear pending interrupts on keypad config

Quoted 8 lines · Robert Jarzmik
Quoted 1 line · Vasily Khoruzhick

Bootloader can leave interrupt bit pending, and it confuses driver.

OK, looks good to me.
One question though, just to make sure everything is covered :
Suppose that the resume is the consequence of keypad press. If anybody relied previously on "reading the keypad" to know which key was pressed to wakeup the SoC, is it still working after your patch ?

Hi Robert,

Code from git master will not call pxa27x_keypad_config on resume if device can cause wakeup,
so everything is OK (however it's another issue for pxa27x, because device is not resuming correctly)

Quoted 1 line

And I suppose you can't "convince" your bootloader to behave correctly, can you ?

It behaves correctly, it just can't handle last keypress (because it's booting Linux).
Even if it would be possible to fix this issue in bootloader it's always nice to keep driver
failure-proof, so it does not fail even if bootloader left something in non-consistent state.

Regards
Vasily

#3 lore raw

PATCH RESEND 1/1 ARM: pxa27x_keypad: clear pending interrupts on keypad config

Quoted 6 lines · Vasily Khoruzhick

It behaves correctly, it just can't handle last keypress (because it's booting Linux).
Even if it would be possible to fix this issue in bootloader it's always nice to keep driver
failure-proof, so it does not fail even if bootloader left something in non-consistent state.

True.

Signature · 1 line
Robert
#4 lore raw

PATCH RESEND 1/1 ARM: pxa27x_keypad: clear pending interrupts on keypad config

Quoted 8 lines · Robert Jarzmik
Quoted 6 lines · Vasily Khoruzhick

It behaves correctly, it just can't handle last keypress (because it's booting Linux).
Even if it would be possible to fix this issue in bootloader it's always nice to keep driver
failure-proof, so it does not fail even if bootloader left something in non-consistent state.

Quoted 5 lines

True.

--
Robert

Applied

Thanks
Haojian