[PATCH 4/4] Keyboard driver janitor work

Holger Freyther zecke at openmoko.org
Tue Apr 8 22:48:13 CEST 2008


From b2fca8fc59e89a77fec44702f04a3f32aa22407f Mon Sep 17 00:00:00 2001
From: Holger Freyther <zecke at openmoko.org>
Date: Sun, 23 Mar 2008 23:45:41 +0100
Subject: [PATCH] Fix the FIXME and convert the driver to the generic GPIO 
framework.

Signed-Off-by: Holger Freyther <zecke at openmoko.org>
---
 drivers/input/keyboard/neo1973kbd.c |   24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/input/keyboard/neo1973kbd.c 
b/drivers/input/keyboard/neo1973kbd.c
index 30f324d..06fa8e0 100644
--- a/drivers/input/keyboard/neo1973kbd.c
+++ b/drivers/input/keyboard/neo1973kbd.c
@@ -22,8 +22,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 
-#include <asm/hardware.h>
-#include <asm/arch/gta01.h>
+#include <asm/gpio.h>
 #include <asm/mach-types.h>
 
 struct neo1973kbd {
@@ -35,8 +34,7 @@ static irqreturn_t neo1973kbd_aux_irq(int irq, void *dev_id)
 {
 	struct neo1973kbd *neo1973kbd_data = dev_id;
 
-	/* FIXME: use GPIO from platform_dev resources */
-	int key_pressed = !s3c2410_gpio_getpin(GTA01_GPIO_AUX_KEY);
+	int key_pressed = !gpio_get_value(irq_to_gpio(irq));
 	input_report_key(neo1973kbd_data->input, KEY_PHONE, key_pressed);
 	input_sync(neo1973kbd_data->input);
 
@@ -47,8 +45,7 @@ static irqreturn_t neo1973kbd_hold_irq(int irq, void 
*dev_id)
 {
 	struct neo1973kbd *neo1973kbd_data = dev_id;
 
-	/* FIXME: use GPIO from platform_dev resources */
-	int key_pressed = 3c2410_gpio_getpin(GTA01_GPIO_HOLD_KEY);
+	int key_pressed = gpio_get_value(irq_to_gpio(irq));
 	input_report_key(neo1973kbd_data->input, KEY_PAUSE, key_pressed);
 	input_sync(neo1973kbd_data->input);
 
@@ -59,8 +56,7 @@ static irqreturn_t neo1973kbd_headphone_irq(int irq, void 
*dev_id)
 {
 	struct neo1973kbd *neo1973kbd_data = dev_id;
 
-	/* FIXME: use GPIO from platform_dev resources */
-	int key_pressed = s3c2410_gpio_getpin(GTA01_GPIO_JACK_INSERT);
+	int key_pressed = gpio_get_value(irq_to_gpio(irq));
 	input_report_switch(neo1973kbd_data->input,
 			    SW_HEADPHONE_INSERT, key_pressed);
 	input_sync(neo1973kbd_data->input);
@@ -108,15 +104,15 @@ static int neo1973kbd_probe(struct platform_device 
*pdev)
 	if (pdev->resource[0].flags != 0)
 		return -EINVAL;
 
-	irq_aux = s3c2410_gpio_getirq(pdev->resource[0].start);
+	irq_aux = gpio_to_irq(pdev->resource[0].start);
 	if (irq_aux < 0)
 		return -EINVAL;
 
-	irq_hold = s3c2410_gpio_getirq(pdev->resource[1].start);
+	irq_hold = gpio_to_irq(pdev->resource[1].start);
 	if (irq_hold < 0)
 		return -EINVAL;
 
-	irq_jack = s3c2410_gpio_getirq(pdev->resource[2].start);
+	irq_jack = gpio_to_irq(pdev->resource[2].start);
 	if (irq_jack < 0)
 		return -EINVAL;
 
@@ -191,9 +187,9 @@ static int neo1973kbd_remove(struct platform_device *pdev)
 {
 	struct neo1973kbd *neo1973kbd = platform_get_drvdata(pdev);
 
-	free_irq(s3c2410_gpio_getirq(pdev->resource[2].start), neo1973kbd);
-	free_irq(s3c2410_gpio_getirq(pdev->resource[1].start), neo1973kbd);
-	free_irq(s3c2410_gpio_getirq(pdev->resource[0].start), neo1973kbd);
+	free_irq(gpio_to_irq(pdev->resource[2].start), neo1973kbd);
+	free_irq(gpio_to_irq(pdev->resource[1].start), neo1973kbd);
+	free_irq(gpio_to_irq(pdev->resource[0].start), neo1973kbd);
 
 	input_unregister_device(neo1973kbd->input);
 	input_free_device(neo1973kbd->input);
-- 
1.5.4.rc3.24.gb53139






More information about the openmoko-kernel mailing list