All pastes #426660 Raw Edit

Something

public text v1 · immutable
·published 2007-04-06 09:32 UTC
rendered paste body
diff -Naur a/arch/arm/mach-s3c2410/rx3000/rx3000_buttons.c b/arch/arm/mach-s3c2410/rx3000/rx3000_buttons.c
--- a/arch/arm/mach-s3c2410/rx3000/rx3000_buttons.c	2007-02-25 19:50:28.000000000 +0100
+++ b/arch/arm/mach-s3c2410/rx3000/rx3000_buttons.c	2007-04-05 22:49:36.000000000 +0200
@@ -35,6 +35,7 @@
         {_KEY_MAIL,     S3C2410_GPG3,   1,      "Mail button"}, /* nevo */
         {_KEY_HOMEPAGE, S3C2410_GPG7,   1,      "Home button"}, /* arrow */
         {KEY_ENTER,     S3C2410_GPG9,   1,      "Ok button"}, /* ok */
+        {SW_HEADPHONE_INSERT, S3C2410_GPG11,  1,      "Headphone switch", EV_SW}, /* headphone switch */
 };
 
 static struct gpio_keys_platform_data rx3000_gpio_keys_data = {
diff -Naur a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
--- a/drivers/input/keyboard/gpio_keys.c	2007-02-25 19:50:43.000000000 +0100
+++ b/drivers/input/keyboard/gpio_keys.c	2007-04-05 22:53:02.000000000 +0200
@@ -39,7 +39,10 @@
 		if (irq == gpio_to_irq(gpio)) {
 			int state = (gpio_get_value(gpio) ? 1 : 0) ^ (pdata->buttons[i].active_low);
 
-			input_report_key(input, pdata->buttons[i].keycode, state);
+			if (pdata->buttons[i].type == EV_SW)
+				input_report_switch(input, pdata->buttons[i].keycode, state);
+			else
+				input_report_key(input, pdata->buttons[i].keycode, state);
 			input_sync(input);
 		}
 	}
@@ -59,7 +62,7 @@
 
 	platform_set_drvdata(pdev, input);
 
-	input->evbit[0] = BIT(EV_KEY);
+	input->evbit[0] = BIT(EV_KEY) | BIT(EV_SW);
 
 	input->name = pdev->name;
 	input->phys = "gpio-keys/input0";
@@ -84,7 +87,10 @@
 				irq, error);
 			goto fail;
 		}
-		set_bit(code, input->keybit);
+		if (pdata->buttons[i].type == EV_SW)
+			set_bit(code, input->swbit);
+		else
+			set_bit(code, input->keybit);
 	}
 
 	error = input_register_device(input);
diff -Naur a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
--- a/include/linux/gpio_keys.h	2007-02-25 16:21:52.000000000 +0100
+++ b/include/linux/gpio_keys.h	2007-04-05 20:23:31.000000000 +0200
@@ -6,6 +6,7 @@
 	int gpio;
 	int active_low;
 	char *desc;
+	int type;
 };
 
 struct gpio_keys_platform_data {