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 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html