diff options
Diffstat (limited to 'drivers/input/keyboard/w90p910_keypad.c')
-rw-r--r-- | drivers/input/keyboard/w90p910_keypad.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/input/keyboard/w90p910_keypad.c b/drivers/input/keyboard/w90p910_keypad.c index 99bbb7e775ae..085ede4d972d 100644 --- a/drivers/input/keyboard/w90p910_keypad.c +++ b/drivers/input/keyboard/w90p910_keypad.c | |||
@@ -42,7 +42,8 @@ | |||
42 | #define KGET_RAW(n) (((n) & KEY0R) >> 3) | 42 | #define KGET_RAW(n) (((n) & KEY0R) >> 3) |
43 | #define KGET_COLUMN(n) ((n) & KEY0C) | 43 | #define KGET_COLUMN(n) ((n) & KEY0C) |
44 | 44 | ||
45 | #define W90P910_MAX_KEY_NUM (8 * 8) | 45 | #define W90P910_NUM_ROWS 8 |
46 | #define W90P910_NUM_COLS 8 | ||
46 | #define W90P910_ROW_SHIFT 3 | 47 | #define W90P910_ROW_SHIFT 3 |
47 | 48 | ||
48 | struct w90p910_keypad { | 49 | struct w90p910_keypad { |
@@ -51,7 +52,7 @@ struct w90p910_keypad { | |||
51 | struct input_dev *input_dev; | 52 | struct input_dev *input_dev; |
52 | void __iomem *mmio_base; | 53 | void __iomem *mmio_base; |
53 | int irq; | 54 | int irq; |
54 | unsigned short keymap[W90P910_MAX_KEY_NUM]; | 55 | unsigned short keymap[W90P910_NUM_ROWS * W90P910_NUM_COLS]; |
55 | }; | 56 | }; |
56 | 57 | ||
57 | static void w90p910_keypad_scan_matrix(struct w90p910_keypad *keypad, | 58 | static void w90p910_keypad_scan_matrix(struct w90p910_keypad *keypad, |
@@ -190,17 +191,13 @@ static int __devinit w90p910_keypad_probe(struct platform_device *pdev) | |||
190 | input_dev->close = w90p910_keypad_close; | 191 | input_dev->close = w90p910_keypad_close; |
191 | input_dev->dev.parent = &pdev->dev; | 192 | input_dev->dev.parent = &pdev->dev; |
192 | 193 | ||
193 | input_dev->keycode = keypad->keymap; | 194 | error = matrix_keypad_build_keymap(keymap_data, NULL, |
194 | input_dev->keycodesize = sizeof(keypad->keymap[0]); | 195 | W90P910_NUM_ROWS, W90P910_NUM_COLS, |
195 | input_dev->keycodemax = ARRAY_SIZE(keypad->keymap); | 196 | keypad->keymap, input_dev); |
196 | 197 | if (error) { | |
197 | input_set_drvdata(input_dev, keypad); | 198 | dev_err(&pdev->dev, "failed to build keymap\n"); |
198 | 199 | goto failed_put_clk; | |
199 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); | 200 | } |
200 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); | ||
201 | |||
202 | matrix_keypad_build_keymap(keymap_data, W90P910_ROW_SHIFT, | ||
203 | input_dev->keycode, input_dev->keybit); | ||
204 | 201 | ||
205 | error = request_irq(keypad->irq, w90p910_keypad_irq_handler, | 202 | error = request_irq(keypad->irq, w90p910_keypad_irq_handler, |
206 | 0, pdev->name, keypad); | 203 | 0, pdev->name, keypad); |
@@ -209,6 +206,10 @@ static int __devinit w90p910_keypad_probe(struct platform_device *pdev) | |||
209 | goto failed_put_clk; | 206 | goto failed_put_clk; |
210 | } | 207 | } |
211 | 208 | ||
209 | __set_bit(EV_REP, input_dev->evbit); | ||
210 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); | ||
211 | input_set_drvdata(input_dev, keypad); | ||
212 | |||
212 | /* Register the input device */ | 213 | /* Register the input device */ |
213 | error = input_register_device(input_dev); | 214 | error = input_register_device(input_dev); |
214 | if (error) { | 215 | if (error) { |