aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/keyboard/omap-keypad.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index dcea87a0bc56..9a816db7cc25 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -72,12 +72,9 @@ static unsigned int *col_gpios;
72static void set_col_gpio_val(struct omap_kp *omap_kp, u8 value) 72static void set_col_gpio_val(struct omap_kp *omap_kp, u8 value)
73{ 73{
74 int col; 74 int col;
75 for (col = 0; col < omap_kp->cols; col++) { 75
76 if (value & (1 << col)) 76 for (col = 0; col < omap_kp->cols; col++)
77 omap_set_gpio_dataout(col_gpios[col], 1); 77 gpio_set_value(col_gpios[col], value & (1 << col));
78 else
79 omap_set_gpio_dataout(col_gpios[col], 0);
80 }
81} 78}
82 79
83static u8 get_row_gpio_val(struct omap_kp *omap_kp) 80static u8 get_row_gpio_val(struct omap_kp *omap_kp)
@@ -86,7 +83,7 @@ static u8 get_row_gpio_val(struct omap_kp *omap_kp)
86 u8 value = 0; 83 u8 value = 0;
87 84
88 for (row = 0; row < omap_kp->rows; row++) { 85 for (row = 0; row < omap_kp->rows; row++) {
89 if (omap_get_gpio_datain(row_gpios[row])) 86 if (gpio_get_value(row_gpios[row]))
90 value |= (1 << row); 87 value |= (1 << row);
91 } 88 }
92 return value; 89 return value;
@@ -333,23 +330,23 @@ static int __init omap_kp_probe(struct platform_device *pdev)
333 if (cpu_is_omap24xx()) { 330 if (cpu_is_omap24xx()) {
334 /* Cols: outputs */ 331 /* Cols: outputs */
335 for (col_idx = 0; col_idx < omap_kp->cols; col_idx++) { 332 for (col_idx = 0; col_idx < omap_kp->cols; col_idx++) {
336 if (omap_request_gpio(col_gpios[col_idx]) < 0) { 333 if (gpio_request(col_gpios[col_idx], "omap_kp_col") < 0) {
337 printk(KERN_ERR "Failed to request" 334 printk(KERN_ERR "Failed to request"
338 "GPIO%d for keypad\n", 335 "GPIO%d for keypad\n",
339 col_gpios[col_idx]); 336 col_gpios[col_idx]);
340 goto err1; 337 goto err1;
341 } 338 }
342 omap_set_gpio_direction(col_gpios[col_idx], 0); 339 gpio_direction_output(col_gpios[col_idx], 0);
343 } 340 }
344 /* Rows: inputs */ 341 /* Rows: inputs */
345 for (row_idx = 0; row_idx < omap_kp->rows; row_idx++) { 342 for (row_idx = 0; row_idx < omap_kp->rows; row_idx++) {
346 if (omap_request_gpio(row_gpios[row_idx]) < 0) { 343 if (gpio_request(row_gpios[row_idx], "omap_kp_row") < 0) {
347 printk(KERN_ERR "Failed to request" 344 printk(KERN_ERR "Failed to request"
348 "GPIO%d for keypad\n", 345 "GPIO%d for keypad\n",
349 row_gpios[row_idx]); 346 row_gpios[row_idx]);
350 goto err2; 347 goto err2;
351 } 348 }
352 omap_set_gpio_direction(row_gpios[row_idx], 1); 349 gpio_direction_input(row_gpios[row_idx]);
353 } 350 }
354 } else { 351 } else {
355 col_idx = 0; 352 col_idx = 0;
@@ -418,10 +415,10 @@ err3:
418 device_remove_file(&pdev->dev, &dev_attr_enable); 415 device_remove_file(&pdev->dev, &dev_attr_enable);
419err2: 416err2:
420 for (i = row_idx - 1; i >=0; i--) 417 for (i = row_idx - 1; i >=0; i--)
421 omap_free_gpio(row_gpios[i]); 418 gpio_free(row_gpios[i]);
422err1: 419err1:
423 for (i = col_idx - 1; i >=0; i--) 420 for (i = col_idx - 1; i >=0; i--)
424 omap_free_gpio(col_gpios[i]); 421 gpio_free(col_gpios[i]);
425 422
426 kfree(omap_kp); 423 kfree(omap_kp);
427 input_free_device(input_dev); 424 input_free_device(input_dev);
@@ -438,9 +435,9 @@ static int omap_kp_remove(struct platform_device *pdev)
438 if (cpu_is_omap24xx()) { 435 if (cpu_is_omap24xx()) {
439 int i; 436 int i;
440 for (i = 0; i < omap_kp->cols; i++) 437 for (i = 0; i < omap_kp->cols; i++)
441 omap_free_gpio(col_gpios[i]); 438 gpio_free(col_gpios[i]);
442 for (i = 0; i < omap_kp->rows; i++) { 439 for (i = 0; i < omap_kp->rows; i++) {
443 omap_free_gpio(row_gpios[i]); 440 gpio_free(row_gpios[i]);
444 free_irq(OMAP_GPIO_IRQ(row_gpios[i]), 0); 441 free_irq(OMAP_GPIO_IRQ(row_gpios[i]), 0);
445 } 442 }
446 } else { 443 } else {