diff options
-rw-r--r-- | arch/arm/mach-pxa/include/mach/pxa27x_keypad.h | 4 | ||||
-rw-r--r-- | drivers/input/keyboard/pxa27x_keypad.c | 173 |
2 files changed, 94 insertions, 83 deletions
diff --git a/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h b/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h index 63e8965ad85d..7b4eadc6df3a 100644 --- a/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h +++ b/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | #define MAX_MATRIX_KEY_ROWS (8) | 7 | #define MAX_MATRIX_KEY_ROWS (8) |
8 | #define MAX_MATRIX_KEY_COLS (8) | 8 | #define MAX_MATRIX_KEY_COLS (8) |
9 | #define MATRIX_ROW_SHIFT (3) | ||
10 | #define MAX_DIRECT_KEY_NUM (8) | ||
9 | 11 | ||
10 | /* pxa3xx keypad platform specific parameters | 12 | /* pxa3xx keypad platform specific parameters |
11 | * | 13 | * |
@@ -34,7 +36,7 @@ struct pxa27x_keypad_platform_data { | |||
34 | 36 | ||
35 | /* direct keys */ | 37 | /* direct keys */ |
36 | int direct_key_num; | 38 | int direct_key_num; |
37 | unsigned int direct_key_map[8]; | 39 | unsigned int direct_key_map[MAX_DIRECT_KEY_NUM]; |
38 | 40 | ||
39 | /* rotary encoders 0 */ | 41 | /* rotary encoders 0 */ |
40 | int enable_rotary0; | 42 | int enable_rotary0; |
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index c987cc75674c..76f9668221a4 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -32,7 +32,6 @@ | |||
32 | 32 | ||
33 | #include <mach/hardware.h> | 33 | #include <mach/hardware.h> |
34 | #include <mach/pxa27x_keypad.h> | 34 | #include <mach/pxa27x_keypad.h> |
35 | |||
36 | /* | 35 | /* |
37 | * Keypad Controller registers | 36 | * Keypad Controller registers |
38 | */ | 37 | */ |
@@ -96,7 +95,8 @@ | |||
96 | #define keypad_readl(off) __raw_readl(keypad->mmio_base + (off)) | 95 | #define keypad_readl(off) __raw_readl(keypad->mmio_base + (off)) |
97 | #define keypad_writel(off, v) __raw_writel((v), keypad->mmio_base + (off)) | 96 | #define keypad_writel(off, v) __raw_writel((v), keypad->mmio_base + (off)) |
98 | 97 | ||
99 | #define MAX_MATRIX_KEY_NUM (8 * 8) | 98 | #define MAX_MATRIX_KEY_NUM (MAX_MATRIX_KEY_ROWS * MAX_MATRIX_KEY_COLS) |
99 | #define MAX_KEYPAD_KEYS (MAX_MATRIX_KEY_NUM + MAX_DIRECT_KEY_NUM) | ||
100 | 100 | ||
101 | struct pxa27x_keypad { | 101 | struct pxa27x_keypad { |
102 | struct pxa27x_keypad_platform_data *pdata; | 102 | struct pxa27x_keypad_platform_data *pdata; |
@@ -107,73 +107,82 @@ struct pxa27x_keypad { | |||
107 | 107 | ||
108 | int irq; | 108 | int irq; |
109 | 109 | ||
110 | /* matrix key code map */ | 110 | unsigned short keycodes[MAX_KEYPAD_KEYS]; |
111 | unsigned short matrix_keycodes[MAX_MATRIX_KEY_NUM]; | 111 | int rotary_rel_code[2]; |
112 | 112 | ||
113 | /* state row bits of each column scan */ | 113 | /* state row bits of each column scan */ |
114 | uint32_t matrix_key_state[MAX_MATRIX_KEY_COLS]; | 114 | uint32_t matrix_key_state[MAX_MATRIX_KEY_COLS]; |
115 | uint32_t direct_key_state; | 115 | uint32_t direct_key_state; |
116 | 116 | ||
117 | unsigned int direct_key_mask; | 117 | unsigned int direct_key_mask; |
118 | |||
119 | int rotary_rel_code[2]; | ||
120 | int rotary_up_key[2]; | ||
121 | int rotary_down_key[2]; | ||
122 | }; | 118 | }; |
123 | 119 | ||
124 | static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) | 120 | static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) |
125 | { | 121 | { |
126 | struct pxa27x_keypad_platform_data *pdata = keypad->pdata; | 122 | struct pxa27x_keypad_platform_data *pdata = keypad->pdata; |
127 | struct input_dev *input_dev = keypad->input_dev; | 123 | struct input_dev *input_dev = keypad->input_dev; |
124 | unsigned short keycode; | ||
128 | int i; | 125 | int i; |
129 | 126 | ||
130 | for (i = 0; i < pdata->matrix_key_map_size; i++) { | 127 | for (i = 0; i < pdata->matrix_key_map_size; i++) { |
131 | unsigned int key = pdata->matrix_key_map[i]; | 128 | unsigned int key = pdata->matrix_key_map[i]; |
132 | unsigned int row = KEY_ROW(key); | 129 | unsigned int row = KEY_ROW(key); |
133 | unsigned int col = KEY_COL(key); | 130 | unsigned int col = KEY_COL(key); |
134 | unsigned short code = KEY_VAL(key); | 131 | unsigned int scancode = MATRIX_SCAN_CODE(row, col, |
132 | MATRIX_ROW_SHIFT); | ||
135 | 133 | ||
136 | keypad->matrix_keycodes[(row << 3) + col] = code; | 134 | keycode = KEY_VAL(key); |
137 | __set_bit(code, input_dev->keybit); | 135 | keypad->keycodes[scancode] = keycode; |
136 | __set_bit(keycode, input_dev->keybit); | ||
138 | } | 137 | } |
139 | __clear_bit(KEY_RESERVED, input_dev->keybit); | ||
140 | |||
141 | for (i = 0; i < pdata->direct_key_num; i++) | ||
142 | __set_bit(pdata->direct_key_map[i], input_dev->keybit); | ||
143 | 138 | ||
144 | keypad->rotary_up_key[0] = pdata->rotary0_up_key; | 139 | for (i = 0; i < pdata->direct_key_num; i++) { |
145 | keypad->rotary_up_key[1] = pdata->rotary1_up_key; | 140 | keycode = pdata->direct_key_map[i]; |
146 | keypad->rotary_down_key[0] = pdata->rotary0_down_key; | 141 | keypad->keycodes[MAX_MATRIX_KEY_NUM + i] = keycode; |
147 | keypad->rotary_down_key[1] = pdata->rotary1_down_key; | 142 | __set_bit(keycode, input_dev->keybit); |
148 | keypad->rotary_rel_code[0] = pdata->rotary0_rel_code; | 143 | } |
149 | keypad->rotary_rel_code[1] = pdata->rotary1_rel_code; | ||
150 | 144 | ||
151 | if (pdata->enable_rotary0) { | 145 | if (pdata->enable_rotary0) { |
152 | if (pdata->rotary0_up_key && pdata->rotary0_down_key) { | 146 | if (pdata->rotary0_up_key && pdata->rotary0_down_key) { |
153 | __set_bit(pdata->rotary0_up_key, input_dev->keybit); | 147 | keycode = pdata->rotary0_up_key; |
154 | __set_bit(pdata->rotary0_down_key, input_dev->keybit); | 148 | keypad->keycodes[MAX_MATRIX_KEY_NUM + 0] = keycode; |
155 | } else | 149 | __set_bit(keycode, input_dev->keybit); |
150 | |||
151 | keycode = pdata->rotary0_down_key; | ||
152 | keypad->keycodes[MAX_MATRIX_KEY_NUM + 1] = keycode; | ||
153 | __set_bit(keycode, input_dev->keybit); | ||
154 | |||
155 | keypad->rotary_rel_code[0] = -1; | ||
156 | } else { | ||
157 | keypad->rotary_rel_code[0] = pdata->rotary0_rel_code; | ||
156 | __set_bit(pdata->rotary0_rel_code, input_dev->relbit); | 158 | __set_bit(pdata->rotary0_rel_code, input_dev->relbit); |
159 | } | ||
157 | } | 160 | } |
158 | 161 | ||
159 | if (pdata->enable_rotary1) { | 162 | if (pdata->enable_rotary1) { |
160 | if (pdata->rotary1_up_key && pdata->rotary1_down_key) { | 163 | if (pdata->rotary1_up_key && pdata->rotary1_down_key) { |
161 | __set_bit(pdata->rotary1_up_key, input_dev->keybit); | 164 | keycode = pdata->rotary1_up_key; |
162 | __set_bit(pdata->rotary1_down_key, input_dev->keybit); | 165 | keypad->keycodes[MAX_MATRIX_KEY_NUM + 2] = keycode; |
163 | } else | 166 | __set_bit(keycode, input_dev->keybit); |
167 | |||
168 | keycode = pdata->rotary1_down_key; | ||
169 | keypad->keycodes[MAX_MATRIX_KEY_NUM + 3] = keycode; | ||
170 | __set_bit(keycode, input_dev->keybit); | ||
171 | |||
172 | keypad->rotary_rel_code[1] = -1; | ||
173 | } else { | ||
174 | keypad->rotary_rel_code[1] = pdata->rotary1_rel_code; | ||
164 | __set_bit(pdata->rotary1_rel_code, input_dev->relbit); | 175 | __set_bit(pdata->rotary1_rel_code, input_dev->relbit); |
176 | } | ||
165 | } | 177 | } |
166 | } | ||
167 | 178 | ||
168 | static inline unsigned int lookup_matrix_keycode( | 179 | __clear_bit(KEY_RESERVED, input_dev->keybit); |
169 | struct pxa27x_keypad *keypad, int row, int col) | ||
170 | { | ||
171 | return keypad->matrix_keycodes[(row << 3) + col]; | ||
172 | } | 180 | } |
173 | 181 | ||
174 | static void pxa27x_keypad_scan_matrix(struct pxa27x_keypad *keypad) | 182 | static void pxa27x_keypad_scan_matrix(struct pxa27x_keypad *keypad) |
175 | { | 183 | { |
176 | struct pxa27x_keypad_platform_data *pdata = keypad->pdata; | 184 | struct pxa27x_keypad_platform_data *pdata = keypad->pdata; |
185 | struct input_dev *input_dev = keypad->input_dev; | ||
177 | int row, col, num_keys_pressed = 0; | 186 | int row, col, num_keys_pressed = 0; |
178 | uint32_t new_state[MAX_MATRIX_KEY_COLS]; | 187 | uint32_t new_state[MAX_MATRIX_KEY_COLS]; |
179 | uint32_t kpas = keypad_readl(KPAS); | 188 | uint32_t kpas = keypad_readl(KPAS); |
@@ -216,6 +225,7 @@ static void pxa27x_keypad_scan_matrix(struct pxa27x_keypad *keypad) | |||
216 | scan: | 225 | scan: |
217 | for (col = 0; col < pdata->matrix_key_cols; col++) { | 226 | for (col = 0; col < pdata->matrix_key_cols; col++) { |
218 | uint32_t bits_changed; | 227 | uint32_t bits_changed; |
228 | int code; | ||
219 | 229 | ||
220 | bits_changed = keypad->matrix_key_state[col] ^ new_state[col]; | 230 | bits_changed = keypad->matrix_key_state[col] ^ new_state[col]; |
221 | if (bits_changed == 0) | 231 | if (bits_changed == 0) |
@@ -225,12 +235,13 @@ scan: | |||
225 | if ((bits_changed & (1 << row)) == 0) | 235 | if ((bits_changed & (1 << row)) == 0) |
226 | continue; | 236 | continue; |
227 | 237 | ||
228 | input_report_key(keypad->input_dev, | 238 | code = MATRIX_SCAN_CODE(row, col, MATRIX_ROW_SHIFT); |
229 | lookup_matrix_keycode(keypad, row, col), | 239 | input_event(input_dev, EV_MSC, MSC_SCAN, code); |
230 | new_state[col] & (1 << row)); | 240 | input_report_key(input_dev, keypad->keycodes[code], |
241 | new_state[col] & (1 << row)); | ||
231 | } | 242 | } |
232 | } | 243 | } |
233 | input_sync(keypad->input_dev); | 244 | input_sync(input_dev); |
234 | memcpy(keypad->matrix_key_state, new_state, sizeof(new_state)); | 245 | memcpy(keypad->matrix_key_state, new_state, sizeof(new_state)); |
235 | } | 246 | } |
236 | 247 | ||
@@ -253,13 +264,15 @@ static void report_rotary_event(struct pxa27x_keypad *keypad, int r, int delta) | |||
253 | if (delta == 0) | 264 | if (delta == 0) |
254 | return; | 265 | return; |
255 | 266 | ||
256 | if (keypad->rotary_up_key[r] && keypad->rotary_down_key[r]) { | 267 | if (keypad->rotary_rel_code[r] == -1) { |
257 | int keycode = (delta > 0) ? keypad->rotary_up_key[r] : | 268 | int code = MAX_MATRIX_KEY_NUM + 2 * r + (delta > 0 ? 0 : 1); |
258 | keypad->rotary_down_key[r]; | 269 | unsigned char keycode = keypad->keycodes[code]; |
259 | 270 | ||
260 | /* simulate a press-n-release */ | 271 | /* simulate a press-n-release */ |
272 | input_event(dev, EV_MSC, MSC_SCAN, code); | ||
261 | input_report_key(dev, keycode, 1); | 273 | input_report_key(dev, keycode, 1); |
262 | input_sync(dev); | 274 | input_sync(dev); |
275 | input_event(dev, EV_MSC, MSC_SCAN, code); | ||
263 | input_report_key(dev, keycode, 0); | 276 | input_report_key(dev, keycode, 0); |
264 | input_sync(dev); | 277 | input_sync(dev); |
265 | } else { | 278 | } else { |
@@ -287,6 +300,7 @@ static void pxa27x_keypad_scan_rotary(struct pxa27x_keypad *keypad) | |||
287 | static void pxa27x_keypad_scan_direct(struct pxa27x_keypad *keypad) | 300 | static void pxa27x_keypad_scan_direct(struct pxa27x_keypad *keypad) |
288 | { | 301 | { |
289 | struct pxa27x_keypad_platform_data *pdata = keypad->pdata; | 302 | struct pxa27x_keypad_platform_data *pdata = keypad->pdata; |
303 | struct input_dev *input_dev = keypad->input_dev; | ||
290 | unsigned int new_state; | 304 | unsigned int new_state; |
291 | uint32_t kpdk, bits_changed; | 305 | uint32_t kpdk, bits_changed; |
292 | int i; | 306 | int i; |
@@ -296,9 +310,6 @@ static void pxa27x_keypad_scan_direct(struct pxa27x_keypad *keypad) | |||
296 | if (pdata->enable_rotary0 || pdata->enable_rotary1) | 310 | if (pdata->enable_rotary0 || pdata->enable_rotary1) |
297 | pxa27x_keypad_scan_rotary(keypad); | 311 | pxa27x_keypad_scan_rotary(keypad); |
298 | 312 | ||
299 | if (pdata->direct_key_map == NULL) | ||
300 | return; | ||
301 | |||
302 | new_state = KPDK_DK(kpdk) & keypad->direct_key_mask; | 313 | new_state = KPDK_DK(kpdk) & keypad->direct_key_mask; |
303 | bits_changed = keypad->direct_key_state ^ new_state; | 314 | bits_changed = keypad->direct_key_state ^ new_state; |
304 | 315 | ||
@@ -306,12 +317,15 @@ static void pxa27x_keypad_scan_direct(struct pxa27x_keypad *keypad) | |||
306 | return; | 317 | return; |
307 | 318 | ||
308 | for (i = 0; i < pdata->direct_key_num; i++) { | 319 | for (i = 0; i < pdata->direct_key_num; i++) { |
309 | if (bits_changed & (1 << i)) | 320 | if (bits_changed & (1 << i)) { |
310 | input_report_key(keypad->input_dev, | 321 | int code = MAX_MATRIX_KEY_NUM + i; |
311 | pdata->direct_key_map[i], | 322 | |
312 | (new_state & (1 << i))); | 323 | input_event(input_dev, EV_MSC, MSC_SCAN, code); |
324 | input_report_key(input_dev, keypad->keycodes[code], | ||
325 | new_state & (1 << i)); | ||
326 | } | ||
313 | } | 327 | } |
314 | input_sync(keypad->input_dev); | 328 | input_sync(input_dev); |
315 | keypad->direct_key_state = new_state; | 329 | keypad->direct_key_state = new_state; |
316 | } | 330 | } |
317 | 331 | ||
@@ -432,38 +446,41 @@ static const struct dev_pm_ops pxa27x_keypad_pm_ops = { | |||
432 | 446 | ||
433 | static int __devinit pxa27x_keypad_probe(struct platform_device *pdev) | 447 | static int __devinit pxa27x_keypad_probe(struct platform_device *pdev) |
434 | { | 448 | { |
449 | struct pxa27x_keypad_platform_data *pdata = pdev->dev.platform_data; | ||
435 | struct pxa27x_keypad *keypad; | 450 | struct pxa27x_keypad *keypad; |
436 | struct input_dev *input_dev; | 451 | struct input_dev *input_dev; |
437 | struct resource *res; | 452 | struct resource *res; |
438 | int irq, error; | 453 | int irq, error; |
439 | 454 | ||
440 | keypad = kzalloc(sizeof(struct pxa27x_keypad), GFP_KERNEL); | 455 | if (pdata == NULL) { |
441 | if (keypad == NULL) { | ||
442 | dev_err(&pdev->dev, "failed to allocate driver data\n"); | ||
443 | return -ENOMEM; | ||
444 | } | ||
445 | |||
446 | keypad->pdata = pdev->dev.platform_data; | ||
447 | if (keypad->pdata == NULL) { | ||
448 | dev_err(&pdev->dev, "no platform data defined\n"); | 456 | dev_err(&pdev->dev, "no platform data defined\n"); |
449 | error = -EINVAL; | 457 | return -EINVAL; |
450 | goto failed_free; | ||
451 | } | 458 | } |
452 | 459 | ||
453 | irq = platform_get_irq(pdev, 0); | 460 | irq = platform_get_irq(pdev, 0); |
454 | if (irq < 0) { | 461 | if (irq < 0) { |
455 | dev_err(&pdev->dev, "failed to get keypad irq\n"); | 462 | dev_err(&pdev->dev, "failed to get keypad irq\n"); |
456 | error = -ENXIO; | 463 | return -ENXIO; |
457 | goto failed_free; | ||
458 | } | 464 | } |
459 | 465 | ||
460 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 466 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
461 | if (res == NULL) { | 467 | if (res == NULL) { |
462 | dev_err(&pdev->dev, "failed to get I/O memory\n"); | 468 | dev_err(&pdev->dev, "failed to get I/O memory\n"); |
463 | error = -ENXIO; | 469 | return -ENXIO; |
470 | } | ||
471 | |||
472 | keypad = kzalloc(sizeof(struct pxa27x_keypad), GFP_KERNEL); | ||
473 | input_dev = input_allocate_device(); | ||
474 | if (!keypad || !input_dev) { | ||
475 | dev_err(&pdev->dev, "failed to allocate memory\n"); | ||
476 | error = -ENOMEM; | ||
464 | goto failed_free; | 477 | goto failed_free; |
465 | } | 478 | } |
466 | 479 | ||
480 | keypad->pdata = pdata; | ||
481 | keypad->input_dev = input_dev; | ||
482 | keypad->irq = irq; | ||
483 | |||
467 | res = request_mem_region(res->start, resource_size(res), pdev->name); | 484 | res = request_mem_region(res->start, resource_size(res), pdev->name); |
468 | if (res == NULL) { | 485 | if (res == NULL) { |
469 | dev_err(&pdev->dev, "failed to request I/O memory\n"); | 486 | dev_err(&pdev->dev, "failed to request I/O memory\n"); |
@@ -485,43 +502,35 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev) | |||
485 | goto failed_free_io; | 502 | goto failed_free_io; |
486 | } | 503 | } |
487 | 504 | ||
488 | /* Create and register the input driver. */ | ||
489 | input_dev = input_allocate_device(); | ||
490 | if (!input_dev) { | ||
491 | dev_err(&pdev->dev, "failed to allocate input device\n"); | ||
492 | error = -ENOMEM; | ||
493 | goto failed_put_clk; | ||
494 | } | ||
495 | |||
496 | input_dev->name = pdev->name; | 505 | input_dev->name = pdev->name; |
497 | input_dev->id.bustype = BUS_HOST; | 506 | input_dev->id.bustype = BUS_HOST; |
498 | input_dev->open = pxa27x_keypad_open; | 507 | input_dev->open = pxa27x_keypad_open; |
499 | input_dev->close = pxa27x_keypad_close; | 508 | input_dev->close = pxa27x_keypad_close; |
500 | input_dev->dev.parent = &pdev->dev; | 509 | input_dev->dev.parent = &pdev->dev; |
501 | 510 | ||
502 | keypad->input_dev = input_dev; | 511 | input_dev->keycode = keypad->keycodes; |
512 | input_dev->keycodesize = sizeof(keypad->keycodes[0]); | ||
513 | input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes); | ||
514 | |||
503 | input_set_drvdata(input_dev, keypad); | 515 | input_set_drvdata(input_dev, keypad); |
504 | 516 | ||
505 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); | 517 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); |
506 | if ((keypad->pdata->enable_rotary0 && | 518 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); |
507 | keypad->pdata->rotary0_rel_code) || | ||
508 | (keypad->pdata->enable_rotary1 && | ||
509 | keypad->pdata->rotary1_rel_code)) { | ||
510 | input_dev->evbit[0] |= BIT_MASK(EV_REL); | ||
511 | } | ||
512 | 519 | ||
513 | pxa27x_keypad_build_keycode(keypad); | 520 | pxa27x_keypad_build_keycode(keypad); |
514 | platform_set_drvdata(pdev, keypad); | 521 | |
522 | if ((pdata->enable_rotary0 && keypad->rotary_rel_code[0] != -1) || | ||
523 | (pdata->enable_rotary1 && keypad->rotary_rel_code[1] != -1)) { | ||
524 | input_dev->evbit[0] |= BIT_MASK(EV_REL); | ||
525 | } | ||
515 | 526 | ||
516 | error = request_irq(irq, pxa27x_keypad_irq_handler, IRQF_DISABLED, | 527 | error = request_irq(irq, pxa27x_keypad_irq_handler, IRQF_DISABLED, |
517 | pdev->name, keypad); | 528 | pdev->name, keypad); |
518 | if (error) { | 529 | if (error) { |
519 | dev_err(&pdev->dev, "failed to request IRQ\n"); | 530 | dev_err(&pdev->dev, "failed to request IRQ\n"); |
520 | goto failed_free_dev; | 531 | goto failed_put_clk; |
521 | } | 532 | } |
522 | 533 | ||
523 | keypad->irq = irq; | ||
524 | |||
525 | /* Register the input device */ | 534 | /* Register the input device */ |
526 | error = input_register_device(input_dev); | 535 | error = input_register_device(input_dev); |
527 | if (error) { | 536 | if (error) { |
@@ -529,15 +538,13 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev) | |||
529 | goto failed_free_irq; | 538 | goto failed_free_irq; |
530 | } | 539 | } |
531 | 540 | ||
541 | platform_set_drvdata(pdev, keypad); | ||
532 | device_init_wakeup(&pdev->dev, 1); | 542 | device_init_wakeup(&pdev->dev, 1); |
533 | 543 | ||
534 | return 0; | 544 | return 0; |
535 | 545 | ||
536 | failed_free_irq: | 546 | failed_free_irq: |
537 | free_irq(irq, pdev); | 547 | free_irq(irq, pdev); |
538 | platform_set_drvdata(pdev, NULL); | ||
539 | failed_free_dev: | ||
540 | input_free_device(input_dev); | ||
541 | failed_put_clk: | 548 | failed_put_clk: |
542 | clk_put(keypad->clk); | 549 | clk_put(keypad->clk); |
543 | failed_free_io: | 550 | failed_free_io: |
@@ -545,6 +552,7 @@ failed_free_io: | |||
545 | failed_free_mem: | 552 | failed_free_mem: |
546 | release_mem_region(res->start, resource_size(res)); | 553 | release_mem_region(res->start, resource_size(res)); |
547 | failed_free: | 554 | failed_free: |
555 | input_free_device(input_dev); | ||
548 | kfree(keypad); | 556 | kfree(keypad); |
549 | return error; | 557 | return error; |
550 | } | 558 | } |
@@ -567,6 +575,7 @@ static int __devexit pxa27x_keypad_remove(struct platform_device *pdev) | |||
567 | 575 | ||
568 | platform_set_drvdata(pdev, NULL); | 576 | platform_set_drvdata(pdev, NULL); |
569 | kfree(keypad); | 577 | kfree(keypad); |
578 | |||
570 | return 0; | 579 | return 0; |
571 | } | 580 | } |
572 | 581 | ||