diff mbox

[4/5] ARM: pxa168: added special case handler for keypad interrupts

Message ID AANLkTi=0ECTN8ro3H6=CUZy5qzJjhC0C02yPKzS-+0r5@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Miao Aug. 31, 2010, 7:05 a.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h
b/arch/arm/mach-mmp/include/mach/pxa168.h
index 27e1bc7..d2b7946 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.h
@@ -5,6 +5,7 @@  struct sys_timer;

 extern struct sys_timer pxa168_timer;
 extern void __init pxa168_init_irq(void);
+extern void pxa168_clear_keypad_wakeup(void);

 #include <linux/i2c.h>
 #include <mach/devices.h>
@@ -97,4 +98,10 @@  static inline int pxa168_add_nand(struct
pxa3xx_nand_platform_data *info)
 {
 	return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
 }
+
+static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *info)
+{
+	info->clear_wakeup = pxa168_clear_keypad_wakeup;
+	return pxa_register_device(&pxa168_device_keypad, info, sizeof(*info));
+}
 #endif /* __ASM_MACH_PXA168_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h
b/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h
index 7b4eadc..3a6bfe7 100644
--- a/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h
+++ b/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h
@@ -52,6 +52,7 @@  struct pxa27x_keypad_platform_data {

 	/* key debounce interval */
 	unsigned int	debounce_interval;
+	void		(*clear_wakeup);
 };

 extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info);
diff --git a/drivers/input/keyboard/pxa27x_keypad.c
b/drivers/input/keyboard/pxa27x_keypad.c
index f32404f..3fb94fe 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -330,10 +330,20 @@  static void pxa27x_keypad_scan_direct(struct
pxa27x_keypad *keypad)
 	keypad->direct_key_state = new_state;
 }

+static void clear_wakeup(struct pxa27x_keypad *keypad)
+{
+	struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
+
+	if (pdata->clear_wakeup)
+		(pdata->clear_wakeup)();
+}
+
 static irqreturn_t pxa27x_keypad_irq_handler(int irq, void *dev_id)
 {
 	struct pxa27x_keypad *keypad = dev_id;
-	unsigned long kpc = keypad_readl(KPC);
+	unsigned long kpc;
+
+	kpc = keypad_readl(KPC);

 	if (kpc & KPC_DI)