linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/5] input: Update omap_keypad to use MATRIX_KEY macro
@ 2009-01-30 18:46 hartleys
  2009-02-06 22:54 ` hartleys
  0 siblings, 1 reply; 3+ messages in thread
From: hartleys @ 2009-01-30 18:46 UTC (permalink / raw)
  To: linux-input

Update the omap_keypad driver to use common MATRIX_KEY macro.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>

---

diff --git a/arch/arm/plat-omap/include/mach/keypad.h
b/arch/arm/plat-omap/include/mach/keypad.h
index 232923a..c8269c3 100644
--- a/arch/arm/plat-omap/include/mach/keypad.h
+++ b/arch/arm/plat-omap/include/mach/keypad.h
@@ -13,7 +13,7 @@
 struct omap_kp_platform_data {
 	int rows;
 	int cols;
-	int *keymap;
+	unsigned int *keymap;
 	unsigned int keymapsize;
 	unsigned int rep:1;
 	unsigned long delay;
@@ -33,7 +33,5 @@ struct omap_kp_platform_data {
 #define GROUP_3		(3 << 16)
 #define GROUP_MASK	GROUP_3

-#define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val))
-
 #endif

diff --git a/drivers/input/keyboard/omap-keypad.c
b/drivers/input/keyboard/omap-keypad.c
index 3f3d119..d5e9f24 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -64,7 +64,7 @@ struct omap_kp {

 static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0);

-static int *keymap;
+static unsigned int *keymap;
 static unsigned int *row_gpios;
 static unsigned int *col_gpios;

@@ -151,9 +151,10 @@ static void omap_kp_scan_keypad(struct omap_kp
*omap_kp, unsigned char *state)

 static inline int omap_kp_find_key(int col, int row)
 {
-	int i, key;
+	unsigned int key;
+	int i;

-	key = KEY(col, row, 0);
+	key = MATRIX_KEY(col, row, 0);
 	for (i = 0; keymap[i] != 0; i++)
 		if ((keymap[i] & 0xff000000) == key)
 			return keymap[i] & 0x00ffffff; 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH 2/5] input: Update omap_keypad to use MATRIX_KEY macro
  2009-01-30 18:46 [PATCH 2/5] input: Update omap_keypad to use MATRIX_KEY macro hartleys
@ 2009-02-06 22:54 ` hartleys
  2009-02-08 16:44   ` David Brownell
  0 siblings, 1 reply; 3+ messages in thread
From: hartleys @ 2009-02-06 22:54 UTC (permalink / raw)
  To: linux-input; +Cc: David Brownell

Update the omap_keypad driver to use common MATRIX_KEY macro.

As suggested by David Brownell, use two driver-internal defines:
     * MATRIX_ROWCOL_MASK to strip R/C from MATRIX_KEY()
     * MATRIX_KEYCODE_MASK to stip the keycode from a MATRIX_KEY()

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <david-b@pacbell.net>

---

diff --git a/arch/arm/plat-omap/include/mach/keypad.h
b/arch/arm/plat-omap/include/mach/keypad.h
index 232923a..c8269c3 100644
--- a/arch/arm/plat-omap/include/mach/keypad.h
+++ b/arch/arm/plat-omap/include/mach/keypad.h
@@ -13,7 +13,7 @@
 struct omap_kp_platform_data {
 	int rows;
 	int cols;
-	int *keymap;
+	unsigned int *keymap;
 	unsigned int keymapsize;
 	unsigned int rep:1;
 	unsigned long delay;
@@ -33,7 +33,5 @@ struct omap_kp_platform_data {
 #define GROUP_3		(3 << 16)
 #define GROUP_MASK	GROUP_3
 
-#define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val))
-
 #endif
 
diff --git a/drivers/input/keyboard/omap-keypad.c
b/drivers/input/keyboard/omap-keypad.c
index 3f3d119..550b360 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -64,7 +64,7 @@ struct omap_kp {
 
 static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0);
 
-static int *keymap;
+static unsigned int *keymap;
 static unsigned int *row_gpios;
 static unsigned int *col_gpios;
 
@@ -151,12 +151,13 @@ static void omap_kp_scan_keypad(struct omap_kp
*omap_kp, unsigned char *state)
 
 static inline int omap_kp_find_key(int col, int row)
 {
-	int i, key;
+	unsigned int key;
+	int i;
 
-	key = KEY(col, row, 0);
+	key = MATRIX_KEY(col, row, 0);
 	for (i = 0; keymap[i] != 0; i++)
-		if ((keymap[i] & 0xff000000) == key)
-			return keymap[i] & 0x00ffffff;
+		if ((keymap[i] & MATRIX_ROWCOL_MASK) == key)
+			return keymap[i] & MATRIX_KEYCODE_MASK;
 	return -1;
 }
  

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/5] input: Update omap_keypad to use MATRIX_KEY macro
  2009-02-06 22:54 ` hartleys
@ 2009-02-08 16:44   ` David Brownell
  0 siblings, 0 replies; 3+ messages in thread
From: David Brownell @ 2009-02-08 16:44 UTC (permalink / raw)
  To: hartleys; +Cc: linux-input

On Friday 06 February 2009, hartleys wrote:
> Update the omap_keypad driver to use common MATRIX_KEY macro.
> 
> As suggested by David Brownell, use two driver-internal defines:
>      * MATRIX_ROWCOL_MASK to strip R/C from MATRIX_KEY()
>      * MATRIX_KEYCODE_MASK to stip the keycode from a MATRIX_KEY()
> 
> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
> Cc: David Brownell <david-b@pacbell.net>

Looks OK to me, but you might be better off cc'ing folk who
actually have something to do with this driver... check the
GIT history for and copyrights for suggestions.  :)

- Dave


> ---
> 
> diff --git a/arch/arm/plat-omap/include/mach/keypad.h
> b/arch/arm/plat-omap/include/mach/keypad.h
> index 232923a..c8269c3 100644
> --- a/arch/arm/plat-omap/include/mach/keypad.h
> +++ b/arch/arm/plat-omap/include/mach/keypad.h
> @@ -13,7 +13,7 @@
>  struct omap_kp_platform_data {
>  	int rows;
>  	int cols;
> -	int *keymap;
> +	unsigned int *keymap;
>  	unsigned int keymapsize;
>  	unsigned int rep:1;
>  	unsigned long delay;
> @@ -33,7 +33,5 @@ struct omap_kp_platform_data {
>  #define GROUP_3		(3 << 16)
>  #define GROUP_MASK	GROUP_3
>  
> -#define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val))
> -
>  #endif
>  
> diff --git a/drivers/input/keyboard/omap-keypad.c
> b/drivers/input/keyboard/omap-keypad.c
> index 3f3d119..550b360 100644
> --- a/drivers/input/keyboard/omap-keypad.c
> +++ b/drivers/input/keyboard/omap-keypad.c
> @@ -64,7 +64,7 @@ struct omap_kp {
>  
>  static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0);
>  
> -static int *keymap;
> +static unsigned int *keymap;
>  static unsigned int *row_gpios;
>  static unsigned int *col_gpios;
>  
> @@ -151,12 +151,13 @@ static void omap_kp_scan_keypad(struct omap_kp
> *omap_kp, unsigned char *state)
>  
>  static inline int omap_kp_find_key(int col, int row)
>  {
> -	int i, key;
> +	unsigned int key;
> +	int i;
>  
> -	key = KEY(col, row, 0);
> +	key = MATRIX_KEY(col, row, 0);
>  	for (i = 0; keymap[i] != 0; i++)
> -		if ((keymap[i] & 0xff000000) == key)
> -			return keymap[i] & 0x00ffffff;
> +		if ((keymap[i] & MATRIX_ROWCOL_MASK) == key)
> +			return keymap[i] & MATRIX_KEYCODE_MASK;
>  	return -1;
>  }
>   
> 
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-02-08 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-30 18:46 [PATCH 2/5] input: Update omap_keypad to use MATRIX_KEY macro hartleys
2009-02-06 22:54 ` hartleys
2009-02-08 16:44   ` David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).