summaryrefslogtreecommitdiff
path: root/drivers/input/keyboard/spear-keyboard.c
diff options
context:
space:
mode:
authorRajeev Kumar <rajeev-dlh.kumar@st.com>2012-02-24 00:51:40 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-02-28 01:18:32 -0800
commitf8354c60ca2212810c168d8f992559226c8c0e71 (patch)
treea9d8d77c9e6c7e76fa982c757e0eb82d98024998 /drivers/input/keyboard/spear-keyboard.c
parent5e238b548aac6227ce296d41364a3f7b10caff44 (diff)
downloadlwn-f8354c60ca2212810c168d8f992559226c8c0e71.tar.gz
lwn-f8354c60ca2212810c168d8f992559226c8c0e71.zip
Input: spear-keyboard - configure device according to supplied mode
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@st.com> Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard/spear-keyboard.c')
-rw-r--r--drivers/input/keyboard/spear-keyboard.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index c88bd63dc9cc..933fb019b967 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;
@@ -57,6 +58,7 @@ struct spear_kbd {
void __iomem *io_base;
struct clk *clk;
unsigned int irq;
+ unsigned int mode;
unsigned short last_key;
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) {