From 1814db69698479eec2c000a43c83b5f263f6fbb6 Mon Sep 17 00:00:00 2001 From: Eric Miao Date: Thu, 31 Jan 2008 00:58:37 -0500 Subject: Input: pxa27x_keypad - introduce driver structure and use KEY() to define matrix keys 1. Introduce the "struct pxa27x_keypad" structure for driver specific information, such as "struct clk", generated matrix key codes and so on 2. Use KEY() macro to define matrix keys, instead of original 8x8 map this makes definition easier with keypad where keys are sparse 3. Keep a generated array in "struct pxa27x_keypad" for fast lookup 4. Separate the matrix scan into a dedicated function for readability and report only those keys whose state has been changed, instead of report all states 5. Make use of KPAS to decide the faster path if only one key has been detected Signed-off-by: Eric Miao Signed-off-by: Dmitry Torokhov --- include/asm-arm/arch-pxa/pxa27x_keypad.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'include/asm-arm') diff --git a/include/asm-arm/arch-pxa/pxa27x_keypad.h b/include/asm-arm/arch-pxa/pxa27x_keypad.h index ef17db6d791e..1b1bf9fe6d81 100644 --- a/include/asm-arm/arch-pxa/pxa27x_keypad.h +++ b/include/asm-arm/arch-pxa/pxa27x_keypad.h @@ -1,12 +1,25 @@ -#define PXAKBD_MAXROW 8 -#define PXAKBD_MAXCOL 8 +#ifndef __ASM_ARCH_PXA27x_KEYPAD_H +#define __ASM_ARCH_PXA27x_KEYPAD_H + +#include + +#define MAX_MATRIX_KEY_ROWS (8) +#define MAX_MATRIX_KEY_COLS (8) struct pxa27x_keypad_platform_data { - int nr_rows, nr_cols; - int keycodes[PXAKBD_MAXROW][PXAKBD_MAXCOL]; + + /* code map for the matrix keys */ + unsigned int matrix_key_rows; + unsigned int matrix_key_cols; + unsigned int *matrix_key_map; + int matrix_key_map_size; #ifdef CONFIG_PM u32 reg_kpc; u32 reg_kprec; #endif }; + +#define KEY(row, col, val) (((row) << 28) | ((col) << 24) | (val)) + +#endif /* __ASM_ARCH_PXA27x_KEYPAD_H */ -- cgit v1.2.3-59-g8ed1b