rendered paste bodydiff -Naur kernel26/arch/arm/mach-s3c2410/rx3000/rx3000_buttons.c kernel26.key/arch/arm/mach-s3c2410/rx3000/rx3000_buttons.c
--- kernel26/arch/arm/mach-s3c2410/rx3000/rx3000_buttons.c 2007-02-25 19:50:28.000000000 +0100
+++ kernel26.key/arch/arm/mach-s3c2410/rx3000/rx3000_buttons.c 2007-04-05 20:26:04.000000000 +0200
@@ -28,13 +28,14 @@
extern struct platform_device s3c_device_asic3;
static struct gpio_keys_button rx3000_gpio_keys_table[] = {
- {_KEY_POWER, S3C2410_GPF0, 1, "Power button"}, /* power*/
- {_KEY_RECORD, S3C2410_GPF7, 1, "Record button"}, /* camera */
- {_KEY_CALENDAR, S3C2410_GPG0, 1, "Calendar button"}, /* play */
- {_KEY_CONTACTS, S3C2410_GPG2, 1, "Contacts button"}, /* person */
- {_KEY_MAIL, S3C2410_GPG3, 1, "Mail button"}, /* nevo */
- {_KEY_HOMEPAGE, S3C2410_GPG7, 1, "Home button"}, /* arrow */
- {KEY_ENTER, S3C2410_GPG9, 1, "Ok button"}, /* ok */
+ {_KEY_POWER, S3C2410_GPF0, 1, "Power button"}, /* power*/
+ {_KEY_RECORD, S3C2410_GPF7, 1, "Record button"}, /* camera */
+ {_KEY_CALENDAR, S3C2410_GPG0, 1, "Calendar button"}, /* play */
+ {_KEY_CONTACTS, S3C2410_GPG2, 1, "Contacts button"}, /* person */
+ {_KEY_MAIL, S3C2410_GPG3, 1, "Mail button"}, /* nevo */
+ {_KEY_HOMEPAGE, S3C2410_GPG7, 1, "Home button"}, /* arrow */
+ {KEY_ENTER, S3C2410_GPG9, 1, "Ok button"}, /* ok */
+ {SWITCH_HEADPHONE_INSERT, S3C2410_GPG11, 1, "Headphone switch", EV_SW}, /* headphone switch 9 */
};
static struct gpio_keys_platform_data rx3000_gpio_keys_data = {
diff -Naur kernel26/drivers/input/keyboard/gpio_keys.c kernel26.key/drivers/input/keyboard/gpio_keys.c
--- kernel26/drivers/input/keyboard/gpio_keys.c 2007-02-25 19:50:43.000000000 +0100
+++ kernel26.key/drivers/input/keyboard/gpio_keys.c 2007-04-05 20:30:34.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,11 @@
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 kernel26/include/linux/gpio_keys.h kernel26.key/include/linux/gpio_keys.h
--- kernel26/include/linux/gpio_keys.h 2007-02-25 16:21:52.000000000 +0100
+++ kernel26.key/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 {