From e8704ac96d42a4f3093dc253b7f2b44cf8c150e8 Mon Sep 17 00:00:00 2001 From: Naveen Kumar Gaddipati Date: Wed, 16 Jun 2010 10:34:44 +0530 Subject: ske_driver: support for internal keypad Added the driver to support the internal keypad on ux500 platform ST-Ericsson Id:CR 256008 Signed-off-by: Naveen Kumar Gaddipati Signed-off-by: Mian Yousaf Kaukab Change-Id: I8f776d4ff1e8ac4bc3ad0b629c1144b7e5daefb8 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/2541 Reviewed-by: Jonas ABERG --- arch/arm/mach-ux500/include/mach/devices.h | 1 + arch/arm/mach-ux500/include/mach/irqs.h | 1 + arch/arm/mach-ux500/include/mach/kpd.h | 60 ++++++++++++++++-------------- 3 files changed, 35 insertions(+), 27 deletions(-) (limited to 'arch/arm/mach-ux500/include') diff --git a/arch/arm/mach-ux500/include/mach/devices.h b/arch/arm/mach-ux500/include/mach/devices.h index 73ddb146626..5acb60460f3 100755 --- a/arch/arm/mach-ux500/include/mach/devices.h +++ b/arch/arm/mach-ux500/include/mach/devices.h @@ -50,6 +50,7 @@ extern struct platform_device ux500_musb_device; extern struct amba_device ux500_uart0_device; extern struct amba_device ux500_uart1_device; extern struct amba_device ux500_uart2_device; +extern struct platform_device ske_keypad_device; #ifdef CONFIG_U5500_MLOADER_HELPER extern struct platform_device mloader_helper_device; diff --git a/arch/arm/mach-ux500/include/mach/irqs.h b/arch/arm/mach-ux500/include/mach/irqs.h index b883d013773..88e51d1c4da 100755 --- a/arch/arm/mach-ux500/include/mach/irqs.h +++ b/arch/arm/mach-ux500/include/mach/irqs.h @@ -51,6 +51,7 @@ #define IRQ_SDMMC1 (IRQ_SPI_START + 50) #define IRQ_I2C4 (IRQ_SPI_START + 51) #define IRQ_SSP1 (IRQ_SPI_START + 52) +#define IRQ_SKE_KP (IRQ_SPI_START + 54) #define IRQ_I2C2 (IRQ_SPI_START + 55) #define IRQ_SDMMC3 (IRQ_SPI_START + 59) #define IRQ_SDMMC0 (IRQ_SPI_START + 60) diff --git a/arch/arm/mach-ux500/include/mach/kpd.h b/arch/arm/mach-ux500/include/mach/kpd.h index 46177466078..ffff8eea193 100755 --- a/arch/arm/mach-ux500/include/mach/kpd.h +++ b/arch/arm/mach-ux500/include/mach/kpd.h @@ -14,12 +14,14 @@ #define CONFIG_AUTOSCAN_ENABLED 1 #endif #include +#include #define MAX_KPROW 8 #define MAX_KPCOL 8 +#define MAX_KEYS (MAX_KPROW * MAX_KPCOL) /*keypad related Constants*/ -#define KEYPAD_RELEASE_PERIOD 11 /*110 Msec, repeate key scan time */ -#define KEYPAD_SCAN_PERIOD 4 /*40Msec for new keypress */ +#define KEYPAD_RELEASE_PERIOD 11 /*11 msec, repeate key scan time */ +#define KEYPAD_SCAN_PERIOD 4 /*4msec for new keypress */ #define KEYPAD_STATE_DEFAULT 0 #define KEYPAD_STATE_PRESSED 1 #define KEYPAD_STATE_PRESSACK 2 @@ -33,18 +35,18 @@ struct keypad_t; * struct keypad_device - Device data structure for platform specific data * @init: pointer to keypad init function * @exit: pointer to keypad deinitialisation function - * @autoscan_check: pointer to read autoscan status function, not used + * @autoscan_check: pointer to read autoscan status function * currently * @autoscan_disable: pointer to autoscan feature disable function, * not used currently * @autoscan_results: pointer to read autoscan results function - * @autoscan_en: pointer to enable autoscan feature function, not used + * @autoscan_en: pointer to enable autoscan feature function * currently * @irqen: pointer to enable irq function * @irqdis: pointer to disable irq function * @kcode_tbl: lookup table for keycodes * @krow: mask for available rows, value is 0xFF - * @kcol: mask for available columns, value is 0xFF + * @kcol: mask for available columns, value is 0xFF * @irqdis_int: pointer to disable irq function, to be called from ISR * @debounce_period: platform specific debounce time, can be fine tuned later * @irqtype: type of interrupt @@ -54,47 +56,51 @@ struct keypad_t; * @enable_wakeup: specifies if keypad event can wake up system from sleep */ struct keypad_device { - int (*init)(struct keypad_t *kp); - int (*exit)(struct keypad_t *kp); - int (*autoscan_check)(void); - void (*autoscan_disable)(void); - int (*autoscan_results)(struct keypad_t *kp); - void (*autoscan_en)(void); - int (*irqen)(struct keypad_t *kp); - int (*irqdis)(struct keypad_t *kp); /* normal disable */ - u8 *kcode_tbl; - u8 krow; - u8 kcol; - int (*irqdis_int)(struct keypad_t *kp); - /* func used wen disable in interrupt handler */ - u8 debounce_period; - unsigned long irqtype; - u8 irq; /*IRQ no*/ - u8 int_status; - u8 int_line_behaviour; - bool enable_wakeup; + int (*init)(struct keypad_t *kp); + int (*exit)(struct keypad_t *kp); + int (*autoscan_check)(void); + void (*autoscan_disable)(void); + int (*autoscan_results)(struct keypad_t *kp); + void (*autoscan_en)(void); + int (*irqen)(struct keypad_t *kp); + int (*irqdis)(struct keypad_t *kp); + u8 *kcode_tbl; + u8 krow; + u8 kcol; + int (*irqdis_int)(struct keypad_t *kp); + u8 debounce_period; + unsigned long irqtype; + u8 irq; + u8 int_status; + u8 int_line_behaviour; + bool enable_wakeup; }; - /** * struct keypad_t - keypad data structure used internally by keypad driver * @irq: irq no * @mode: 0 for interrupt mode, 1 for polling mode + * @ske_regs: ske regsiters base address + * @cr_lock: spinlock variable * @key_state: array for saving keystates * @lockbits: used for synchronisation in ISR * @inp_dev: pointer to input device object - * @address_for_data: not used * @kscan_work: work queue * @board: keypad platform device + * @key_cnt: count the keys pressed + * @clk: clock structure pointer */ struct keypad_t { int irq; int mode; + void __iomem *ske_regs; int key_state[MAX_KPROW][MAX_KPCOL]; unsigned long lockbits; + spinlock_t cr_lock; struct input_dev *inp_dev; - void *address_for_data; struct delayed_work kscan_work; struct keypad_device *board; + int key_cnt; + struct clk *clk; }; /** * enum kp_int_status - enum for INTR status -- cgit v1.2.3