Re: [RFC v1 PATCH 1/6] matrix_keypad: Increase the max limit of rowsand columns

From: Eric Miao
Date: Wed Nov 10 2010 - 13:34:15 EST


On Wed, Nov 10, 2010 at 8:47 PM, Trilok Soni <tsoni@xxxxxxxxxxxxxx> wrote:
> Some keyboard controller have support for more than
> 16 columns and rows.
>
> Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
> Cc: Eric Miao <eric.y.miao@xxxxxxxxx>
> Signed-off-by: Trilok Soni <tsoni@xxxxxxxxxxxxxx>
> ---
> Âinclude/linux/input/matrix_keypad.h | Â Â8 ++++----
> Â1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
> index 80352ad..d80845e 100644
> --- a/include/linux/input/matrix_keypad.h
> +++ b/include/linux/input/matrix_keypad.h
> @@ -4,11 +4,11 @@
> Â#include <linux/types.h>
> Â#include <linux/input.h>
>
> -#define MATRIX_MAX_ROWS Â Â Â Â Â Â Â Â16
> -#define MATRIX_MAX_COLS Â Â Â Â Â Â Â Â16
> +#define MATRIX_MAX_ROWS Â Â Â Â Â Â Â Â18
> +#define MATRIX_MAX_COLS Â Â Â Â Â Â Â Â18
>
> -#define KEY(row, col, val) Â Â ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â(((col) & (MATRIX_MAX_COLS - 1)) << 16) |\
> +#define KEY(row, col, val) Â Â ((((row) % (MATRIX_MAX_ROWS)) << 24) |\
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â(((col) % (MATRIX_MAX_COLS)) << 16) |\
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â (val & 0xffff))
>

Or maybe we can solve this completely by introducing something like:

struct matrix_keycode {
int row;
int col;
int value;
}

And make changes to KEY() macro and other places. You may also want to
eliminate the hardcoded MATRIX_MAX_* in matrix_keypad.c.
> Â#define KEY_ROW(k) Â Â Â Â Â Â (((k) >> 24) & 0xff)
> --
> 1.7.0.2
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/