[PATCH V2 21/69] Keyboard: Adding support for spear-keyboard

Dmitry Torokhov dmitry.torokhov at gmail.com
Tue Oct 5 11:47:37 EDT 2010


Hi Rajeev,

On Fri, Oct 01, 2010 at 05:25:41PM +0530, Viresh KUMAR wrote:
> +
> +#define KEY_MASK	0xFF000000
> +#define KEY_VALUE	0x00FFFFFF
> +#define ROW_MASK	0xF0
> +#define COLUMN_MASK	0x0F
> +#define ROW_SHIFT	4
> +
> +struct spear_kbd {
> +	struct input_dev *input;
> +	void __iomem *io_base;		/* Keyboard Base Address */
> +	struct clk *clk;
> +	u8 last_key ;
> +	u8 last_event;
> +	int *keymap;
> +	int keymapsize;
> +};
> +/* TODO: Need to optimize this function */
> +static inline int get_key_value(struct spear_kbd *dev, int row, int col)
> +{
> +	int i, key;
> +
> +	key = KEY(row, col, 0);
> +	for (i = 0; i < dev->keymapsize; i++)
> +		if ((dev->keymap[i] & KEY_MASK) == key)
> +			return dev->keymap[i] & KEY_VALUE;
> +	return -ENOKEY;
> +}

As discussed previously I'd like to see the driver using as much of
matrix_keypad infrastructure as practical and also to see the initial
keypad copied into the spear_kbd structure to ensure that the board code
could be made const and bind/rebind of the device would restore the
original keymap.

Thanks.

-- 
Dmitry



More information about the linux-arm-kernel mailing list