From: Rajeev Kumar <rajeev-dlh.kumar@xxxxxx> Let platform pass mode information to keyboard driver according to which it configures itself. The mode can be - KEYPAD_9x9 0 - KEYPAD_6x6 1 - KEYPAD_2x2 2 Signed-off-by: Rajeev Kumar <rajeev-dlh.kumar@xxxxxx> Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxx> --- arch/arm/plat-spear/include/plat/keyboard.h | 6 ++++++ drivers/input/keyboard/spear-keyboard.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/arch/arm/plat-spear/include/plat/keyboard.h b/arch/arm/plat-spear/include/plat/keyboard.h index 130c045..c16cc31 100644 --- a/arch/arm/plat-spear/include/plat/keyboard.h +++ b/arch/arm/plat-spear/include/plat/keyboard.h @@ -140,10 +140,15 @@ int _name[] = { \ KEY(5, 5, KEY_ZENKAKUHANKAKU), \ } +#define KEYPAD_9x9 0 +#define KEYPAD_6x6 1 +#define KEYPAD_2x2 2 + /** * struct kbd_platform_data - spear keyboard platform data * keymap: pointer to keymap data (table and size) * rep: enables key autorepeat + * mode: choose keyboard support(9x9, 6x6, 2x2) * * This structure is supposed to be used by platform code to supply * keymaps to drivers that implement keyboards. @@ -151,6 +156,7 @@ int _name[] = { \ struct kbd_platform_data { const struct matrix_keymap_data *keymap; bool rep; + unsigned int mode; }; /* This function is used to set platform data field of pdev->dev */ diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index c88bd63..0e7f686 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -50,6 +50,7 @@ #define ROW_MASK 0xF0 #define COLUMN_MASK 0x0F #define ROW_SHIFT 4 +#define KEY_MATRIX_SHIFT 6 struct spear_kbd { struct input_dev *input; @@ -58,6 +59,7 @@ struct spear_kbd { struct clk *clk; unsigned int irq; unsigned short last_key; + unsigned int mode; unsigned short keycodes[256]; }; @@ -106,7 +108,8 @@ static int spear_kbd_open(struct input_dev *dev) return error; /* program keyboard */ - val = SCAN_RATE_80 | MODE_KEYBOARD | PCLK_FREQ_MSK; + val = SCAN_RATE_80 | MODE_KEYBOARD | PCLK_FREQ_MSK | + (kbd->mode << KEY_MATRIX_SHIFT); writew(val, kbd->io_base + MODE_REG); writeb(1, kbd->io_base + STATUS_REG); @@ -176,6 +179,8 @@ static int __devinit spear_kbd_probe(struct platform_device *pdev) kbd->input = input_dev; kbd->irq = irq; + kbd->mode = pdata->mode; + kbd->res = request_mem_region(res->start, resource_size(res), pdev->name); if (!kbd->res) { -- 1.7.8.110.g4cb5d -- 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