summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/input-polldev.c7
-rw-r--r--drivers/input/input.c65
-rw-r--r--drivers/input/keyboard/Kconfig20
-rw-r--r--drivers/input/keyboard/Makefile2
-rw-r--r--drivers/input/keyboard/adp5520-keys.c220
-rw-r--r--drivers/input/keyboard/atkbd.c132
-rw-r--r--drivers/input/keyboard/davinci_keyscan.c337
-rw-r--r--drivers/input/keyboard/lkkbd.c496
-rw-r--r--drivers/input/keyboard/omap-keypad.c6
-rw-r--r--drivers/input/misc/hp_sdc_rtc.c2
-rw-r--r--drivers/input/misc/pcf50633-input.c7
-rw-r--r--drivers/input/misc/wistron_btns.c2
-rw-r--r--drivers/input/mouse/logips2pp.c2
-rw-r--r--drivers/input/mouse/synaptics.c10
-rw-r--r--drivers/input/mouse/vsxxxaa.c374
-rw-r--r--drivers/input/serio/Kconfig8
-rw-r--r--drivers/input/serio/Makefile1
-rw-r--r--drivers/input/serio/altera_ps2.c200
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h13
-rw-r--r--drivers/input/touchscreen/Kconfig12
-rw-r--r--drivers/input/touchscreen/Makefile1
-rw-r--r--drivers/input/touchscreen/dynapro.c206
-rw-r--r--drivers/input/xen-kbdfront.c3
23 files changed, 1598 insertions, 528 deletions
diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c
index 0d3ce7a50fb1..910220c127cb 100644
--- a/drivers/input/input-polldev.c
+++ b/drivers/input/input-polldev.c
@@ -80,8 +80,8 @@ static int input_open_polled_device(struct input_dev *input)
if (error)
return error;
- if (dev->flush)
- dev->flush(dev);
+ if (dev->open)
+ dev->open(dev);
queue_delayed_work(polldev_wq, &dev->work,
msecs_to_jiffies(dev->poll_interval));
@@ -95,6 +95,9 @@ static void input_close_polled_device(struct input_dev *input)
cancel_delayed_work_sync(&dev->work);
input_polldev_stop_workqueue();
+
+ if (dev->close)
+ dev->close(dev);
}
/**
diff --git a/drivers/input/input.c b/drivers/input/input.c
index c6f88ebb40c7..cc763c96fada 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -782,10 +782,29 @@ static unsigned int input_proc_devices_poll(struct file *file, poll_table *wait)
return 0;
}
+union input_seq_state {
+ struct {
+ unsigned short pos;
+ bool mutex_acquired;
+ };
+ void *p;
+};
+
static void *input_devices_seq_start(struct seq_file *seq, loff_t *pos)
{
- if (mutex_lock_interruptible(&input_mutex))
- return NULL;
+ union input_seq_state *state = (union input_seq_state *)&seq->private;
+ int error;
+
+ /* We need to fit into seq->private pointer */
+ BUILD_BUG_ON(sizeof(union input_seq_state) != sizeof(seq->private));
+
+ error = mutex_lock_interruptible(&input_mutex);
+ if (error) {
+ state->mutex_acquired = false;
+ return ERR_PTR(error);
+ }
+
+ state->mutex_acquired = true;
return seq_list_start(&input_dev_list, *pos);
}
@@ -795,9 +814,12 @@ static void *input_devices_seq_next(struct seq_file *seq, void *v, loff_t *pos)
return seq_list_next(v, &input_dev_list, pos);
}
-static void input_devices_seq_stop(struct seq_file *seq, void *v)
+static void input_seq_stop(struct seq_file *seq, void *v)
{
- mutex_unlock(&input_mutex);
+ union input_seq_state *state = (union input_seq_state *)&seq->private;
+
+ if (state->mutex_acquired)
+ mutex_unlock(&input_mutex);
}
static void input_seq_print_bitmap(struct seq_file *seq, const char *name,
@@ -861,7 +883,7 @@ static int input_devices_seq_show(struct seq_file *seq, void *v)
static const struct seq_operations input_devices_seq_ops = {
.start = input_devices_seq_start,
.next = input_devices_seq_next,
- .stop = input_devices_seq_stop,
+ .stop = input_seq_stop,
.show = input_devices_seq_show,
};
@@ -881,40 +903,49 @@ static const struct file_operations input_devices_fileops = {
static void *input_handlers_seq_start(struct seq_file *seq, loff_t *pos)
{
- if (mutex_lock_interruptible(&input_mutex))
- return NULL;
+ union input_seq_state *state = (union input_seq_state *)&seq->private;
+ int error;
+
+ /* We need to fit into seq->private pointer */
+ BUILD_BUG_ON(sizeof(union input_seq_state) != sizeof(seq->private));
+
+ error = mutex_lock_interruptible(&input_mutex);
+ if (error) {
+ state->mutex_acquired = false;
+ return ERR_PTR(error);
+ }
+
+ state->mutex_acquired = true;
+ state->pos = *pos;
- seq->private = (void *)(unsigned long)*pos;
return seq_list_start(&input_handler_list, *pos);
}
static void *input_handlers_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
- seq->private = (void *)(unsigned long)(*pos + 1);
- return seq_list_next(v, &input_handler_list, pos);
-}
+ union input_seq_state *state = (union input_seq_state *)&seq->private;
-static void input_handlers_seq_stop(struct seq_file *seq, void *v)
-{
- mutex_unlock(&input_mutex);
+ state->pos = *pos + 1;
+ return seq_list_next(v, &input_handler_list, pos);
}
static int input_handlers_seq_show(struct seq_file *seq, void *v)
{
struct input_handler *handler = container_of(v, struct input_handler, node);
+ union input_seq_state *state = (union input_seq_state *)&seq->private;
- seq_printf(seq, "N: Number=%ld Name=%s",
- (unsigned long)seq->private, handler->name);
+ seq_printf(seq, "N: Number=%u Name=%s", state->pos, handler->name);
if (handler->fops)
seq_printf(seq, " Minor=%d", handler->minor);
seq_putc(seq, '\n');
return 0;
}
+
static const struct seq_operations input_handlers_seq_ops = {
.start = input_handlers_seq_start,
.next = input_handlers_seq_next,
- .stop = input_handlers_seq_stop,
+ .stop = input_seq_stop,
.show = input_handlers_seq_show,
};
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index ee98b1bc5d89..02c836e11813 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -24,6 +24,16 @@ config KEYBOARD_AAED2000
To compile this driver as a module, choose M here: the
module will be called aaed2000_kbd.
+config KEYBOARD_ADP5520
+ tristate "Keypad Support for ADP5520 PMIC"
+ depends on PMIC_ADP5520
+ help
+ This option enables support for the keypad scan matrix
+ on Analog Devices ADP5520 PMICs.
+
+ To compile this driver as a module, choose M here: the module will
+ be called adp5520-keys.
+
config KEYBOARD_ADP5588
tristate "ADP5588 I2C QWERTY Keypad and IO Expander"
depends on I2C
@@ -361,6 +371,16 @@ config KEYBOARD_SH_KEYSC
To compile this driver as a module, choose M here: the
module will be called sh_keysc.
+config KEYBOARD_DAVINCI
+ tristate "TI DaVinci Key Scan"
+ depends on ARCH_DAVINCI_DM365
+ help
+ Say Y to enable keypad module support for the TI DaVinci
+ platforms (DM365).
+
+ To compile this driver as a module, choose M here: the
+ module will be called davinci_keyscan.
+
config KEYBOARD_OMAP
tristate "TI OMAP keypad support"
depends on (ARCH_OMAP1 || ARCH_OMAP2)
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index babad5e58b77..78654ef65206 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -5,12 +5,14 @@
# Each configuration option enables a list of files.
obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o
+obj-$(CONFIG_KEYBOARD_ADP5520) += adp5520-keys.o
obj-$(CONFIG_KEYBOARD_ADP5588) += adp5588-keys.o
obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o
obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o
obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o
obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o
obj-$(CONFIG_KEYBOARD_CORGI) += corgikbd.o
+obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o
obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o
obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
diff --git a/drivers/input/keyboard/adp5520-keys.c b/drivers/input/keyboard/adp5520-keys.c
new file mode 100644
index 000000000000..a7ba27fb4109
--- /dev/null
+++ b/drivers/input/keyboard/adp5520-keys.c
@@ -0,0 +1,220 @@
+/*
+ * Keypad driver for Analog Devices ADP5520 MFD PMICs
+ *
+ * Copyright 2009 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/mfd/adp5520.h>
+
+struct adp5520_keys {
+ struct input_dev *input;
+ struct notifier_block notifier;
+ struct device *master;
+ unsigned short keycode[ADP5520_KEYMAPSIZE];
+};
+
+static void adp5520_keys_report_event(struct adp5520_keys *dev,
+ unsigned short keymask, int value)
+{
+ int i;
+
+ for (i = 0; i < ADP5520_MAXKEYS; i++)
+ if (keymask & (1 << i))
+ input_report_key(dev->input, dev->keycode[i], value);
+
+ input_sync(dev->input);
+}
+
+static int adp5520_keys_notifier(struct notifier_block *nb,
+ unsigned long event, void *data)
+{
+ struct adp5520_keys *dev;
+ uint8_t reg_val_lo, reg_val_hi;
+ unsigned short keymask;
+
+ dev = container_of(nb, struct adp5520_keys, notifier);
+
+ if (event & ADP5520_KP_INT) {
+ adp5520_read(dev->master, ADP5520_KP_INT_STAT_1, &reg_val_lo);
+ adp5520_read(dev->master, ADP5520_KP_INT_STAT_2, &reg_val_hi);
+
+ keymask = (reg_val_hi << 8) | reg_val_lo;
+ /* Read twice to clear */
+ adp5520_read(dev->master, ADP5520_KP_INT_STAT_1, &reg_val_lo);
+ adp5520_read(dev->master, ADP5520_KP_INT_STAT_2, &reg_val_hi);
+ keymask |= (reg_val_hi << 8) | reg_val_lo;
+ adp5520_keys_report_event(dev, keymask, 1);
+ }
+
+ if (event & ADP5520_KR_INT) {
+ adp5520_read(dev->master, ADP5520_KR_INT_STAT_1, &reg_val_lo);
+ adp5520_read(dev->master, ADP5520_KR_INT_STAT_2, &reg_val_hi);
+
+ keymask = (reg_val_hi << 8) | reg_val_lo;
+ /* Read twice to clear */
+ adp5520_read(dev->master, ADP5520_KR_INT_STAT_1, &reg_val_lo);
+ adp5520_read(dev->master, ADP5520_KR_INT_STAT_2, &reg_val_hi);
+ keymask |= (reg_val_hi << 8) | reg_val_lo;
+ adp5520_keys_report_event(dev, keymask, 0);
+ }
+
+ return 0;
+}
+
+static int __devinit adp5520_keys_probe(struct platform_device *pdev)
+{
+ struct adp5520_keys_platform_data *pdata = pdev->dev.platform_data;
+ struct input_dev *input;
+ struct adp5520_keys *dev;
+ int ret, i;
+ unsigned char en_mask, ctl_mask = 0;
+
+ if (pdev->id != ID_ADP5520) {
+ dev_err(&pdev->dev, "only ADP5520 supports Keypad\n");
+ return -EINVAL;
+ }
+
+ if (pdata == NULL) {
+ dev_err(&pdev->dev, "missing platform data\n");
+ return -EINVAL;
+ }
+
+ if (!(pdata->rows_en_mask && pdata->cols_en_mask))
+ return -EINVAL;
+
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ if (dev == NULL) {
+ dev_err(&pdev->dev, "failed to alloc memory\n");
+ return -ENOMEM;
+ }
+
+ input = input_allocate_device();
+ if (!input) {
+ ret = -ENOMEM;
+ goto err;
+ }
+
+ dev->master = pdev->dev.parent;
+ dev->input = input;
+
+ input->name = pdev->name;
+ input->phys = "adp5520-keys/input0";
+ input->dev.parent = &pdev->dev;
+
+ input_set_drvdata(input, dev);
+
+ input->id.bustype = BUS_I2C;
+ input->id.vendor = 0x0001;
+ input->id.product = 0x5520;
+ input->id.version = 0x0001;
+
+ input->keycodesize = sizeof(dev->keycode[0]);
+ input->keycodemax = pdata->keymapsize;
+ input->keycode = dev->keycode;
+
+ memcpy(dev->keycode, pdata->keymap,
+ pdata->keymapsize * input->keycodesize);
+
+ /* setup input device */
+ __set_bit(EV_KEY, input->evbit);
+
+ if (pdata->repeat)
+ __set_bit(EV_REP, input->evbit);
+
+ for (i = 0; i < input->keycodemax; i++)
+ __set_bit(dev->keycode[i], input->keybit);
+ __clear_bit(KEY_RESERVED, input->keybit);
+
+ ret = input_register_device(input);
+ if (ret) {
+ dev_err(&pdev->dev, "unable to register input device\n");
+ goto err;
+ }
+
+ en_mask = pdata->rows_en_mask | pdata->cols_en_mask;
+
+ ret = adp5520_set_bits(dev->master, ADP5520_GPIO_CFG_1, en_mask);
+
+ if (en_mask & ADP5520_COL_C3)
+ ctl_mask |= ADP5520_C3_MODE;
+
+ if (en_mask & ADP5520_ROW_R3)
+ ctl_mask |= ADP5520_R3_MODE;
+
+ if (ctl_mask)
+ ret |= adp5520_set_bits(dev->master, ADP5520_LED_CONTROL,
+ ctl_mask);
+
+ ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_PULLUP,
+ pdata->rows_en_mask);
+
+ if (ret) {
+ dev_err(&pdev->dev, "failed to write\n");
+ ret = -EIO;
+ goto err1;
+ }
+
+ dev->notifier.notifier_call = adp5520_keys_notifier;
+ ret = adp5520_register_notifier(dev->master, &dev->notifier,
+ ADP5520_KP_IEN | ADP5520_KR_IEN);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to register notifier\n");
+ goto err1;
+ }
+
+ platform_set_drvdata(pdev, dev);
+ return 0;
+
+err1:
+ input_unregister_device(input);
+ input = NULL;
+err:
+ input_free_device(input);
+ kfree(dev);
+ return ret;
+}
+
+static int __devexit adp5520_keys_remove(struct platform_device *pdev)
+{
+ struct adp5520_keys *dev = platform_get_drvdata(pdev);
+
+ adp5520_unregister_notifier(dev->master, &dev->notifier,
+ ADP5520_KP_IEN | ADP5520_KR_IEN);
+
+ input_unregister_device(dev->input);
+ kfree(dev);
+ return 0;
+}
+
+static struct platform_driver adp5520_keys_driver = {
+ .driver = {
+ .name = "adp5520-keys",
+ .owner = THIS_MODULE,
+ },
+ .probe = adp5520_keys_probe,
+ .remove = __devexit_p(adp5520_keys_remove),
+};
+
+static int __init adp5520_keys_init(void)
+{
+ return platform_driver_register(&adp5520_keys_driver);
+}
+module_init(adp5520_keys_init);
+
+static void __exit adp5520_keys_exit(void)
+{
+ platform_driver_unregister(&adp5520_keys_driver);
+}
+module_exit(adp5520_keys_exit);
+
+MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
+MODULE_DESCRIPTION("Keys ADP5520 Driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:adp5520-keys");
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 4709e15af607..4452eabbee6d 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -233,6 +233,7 @@ struct atkbd {
*/
static void (*atkbd_platform_fixup)(struct atkbd *, const void *data);
static void *atkbd_platform_fixup_data;
+static unsigned int (*atkbd_platform_scancode_fixup)(struct atkbd *, unsigned int);
static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf,
ssize_t (*handler)(struct atkbd *, char *));
@@ -393,6 +394,9 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
input_event(dev, EV_MSC, MSC_RAW, code);
+ if (atkbd_platform_scancode_fixup)
+ code = atkbd_platform_scancode_fixup(atkbd, code);
+
if (atkbd->translated) {
if (atkbd->emul || atkbd_need_xlate(atkbd->xl_bit, code)) {
@@ -574,11 +578,22 @@ static void atkbd_event_work(struct work_struct *work)
mutex_lock(&atkbd->event_mutex);
- if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask))
- atkbd_set_leds(atkbd);
+ if (!atkbd->enabled) {
+ /*
+ * Serio ports are resumed asynchronously so while driver core
+ * thinks that device is already fully operational in reality
+ * it may not be ready yet. In this case we need to keep
+ * rescheduling till reconnect completes.
+ */
+ schedule_delayed_work(&atkbd->event_work,
+ msecs_to_jiffies(100));
+ } else {
+ if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask))
+ atkbd_set_leds(atkbd);
- if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask))
- atkbd_set_repeat_rate(atkbd);
+ if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask))
+ atkbd_set_repeat_rate(atkbd);
+ }
mutex_unlock(&atkbd->event_mutex);
}
@@ -770,6 +785,30 @@ static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra
return 3;
}
+static int atkbd_reset_state(struct atkbd *atkbd)
+{
+ struct ps2dev *ps2dev = &atkbd->ps2dev;
+ unsigned char param[1];
+
+/*
+ * Set the LEDs to a predefined state (all off).
+ */
+
+ param[0] = 0;
+ if (ps2_command(ps2dev, param, ATKBD_CMD_SETLEDS))
+ return -1;
+
+/*
+ * Set autorepeat to fastest possible.
+ */
+
+ param[0] = 0;
+ if (ps2_command(ps2dev, param, ATKBD_CMD_SETREP))
+ return -1;
+
+ return 0;
+}
+
static int atkbd_activate(struct atkbd *atkbd)
{
struct ps2dev *ps2dev = &atkbd->ps2dev;
@@ -852,29 +891,6 @@ static unsigned int atkbd_hp_forced_release_keys[] = {
};
/*
- * Inventec system with broken key release on volume keys
- */
-static unsigned int atkbd_inventec_forced_release_keys[] = {
- 0xae, 0xb0, -1U
-};
-
-/*
- * Perform fixup for HP Pavilion ZV6100 laptop that doesn't generate release
- * for its volume buttons
- */
-static unsigned int atkbd_hp_zv6100_forced_release_keys[] = {
- 0xae, 0xb0, -1U
-};
-
-/*
- * Perform fixup for HP (Compaq) Presario R4000 R4100 R4200 that don't generate
- * release for their volume buttons
- */
-static unsigned int atkbd_hp_r4000_forced_release_keys[] = {
- 0xae, 0xb0, -1U
-};
-
-/*
* Samsung NC10,NC20 with Fn+F? key release not working
*/
static unsigned int atkbd_samsung_forced_release_keys[] = {
@@ -882,14 +898,6 @@ static unsigned int atkbd_samsung_forced_release_keys[] = {
};
/*
- * The volume up and volume down special keys on a Fujitsu Amilo PA 1510 laptop
- * do not generate release events so we have to do it ourselves.
- */
-static unsigned int atkbd_amilo_pa1510_forced_release_keys[] = {
- 0xb0, 0xae, -1U
-};
-
-/*
* Amilo Pi 3525 key release for Fn+Volume keys not working
*/
static unsigned int atkbd_amilo_pi3525_forced_release_keys[] = {
@@ -911,6 +919,30 @@ static unsigned int atkdb_soltech_ta12_forced_release_keys[] = {
};
/*
+ * Many notebooks don't send key release event for volume up/down
+ * keys, with key list below common among them
+ */
+static unsigned int atkbd_volume_forced_release_keys[] = {
+ 0xae, 0xb0, -1U
+};
+
+/*
+ * OQO 01+ multimedia keys (64--66) generate e0 6x upon release whereas
+ * they should be generating e4-e6 (0x80 | code).
+ */
+static unsigned int atkbd_oqo_01plus_scancode_fixup(struct atkbd *atkbd,
+ unsigned int code)
+{
+ if (atkbd->translated && atkbd->emul == 1 &&
+ (code == 0x64 || code == 0x65 || code == 0x66)) {
+ atkbd->emul = 0;
+ code |= 0x80;
+ }
+
+ return code;
+}
+
+/*
* atkbd_set_keycode_table() initializes keyboard's keycode table
* according to the selected scancode set
*/
@@ -1087,6 +1119,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
}
atkbd->set = atkbd_select_set(atkbd, atkbd_set, atkbd_extra);
+ atkbd_reset_state(atkbd);
atkbd_activate(atkbd);
} else {
@@ -1267,6 +1300,7 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun
atkbd->dev = new_dev;
atkbd->set = atkbd_select_set(atkbd, atkbd->set, value);
+ atkbd_reset_state(atkbd);
atkbd_activate(atkbd);
atkbd_set_keycode_table(atkbd);
atkbd_set_device_attrs(atkbd);
@@ -1513,6 +1547,13 @@ static int __init atkbd_setup_forced_release(const struct dmi_system_id *id)
return 0;
}
+static int __init atkbd_setup_scancode_fixup(const struct dmi_system_id *id)
+{
+ atkbd_platform_scancode_fixup = id->driver_data;
+
+ return 0;
+}
+
static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
{
.ident = "Dell Laptop",
@@ -1548,7 +1589,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion ZV6100"),
},
.callback = atkbd_setup_forced_release,
- .driver_data = atkbd_hp_zv6100_forced_release_keys,
+ .driver_data = atkbd_volume_forced_release_keys,
},
{
.ident = "HP Presario R4000",
@@ -1557,7 +1598,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4000"),
},
.callback = atkbd_setup_forced_release,
- .driver_data = atkbd_hp_r4000_forced_release_keys,
+ .driver_data = atkbd_volume_forced_release_keys,
},
{
.ident = "HP Presario R4100",
@@ -1566,7 +1607,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4100"),
},
.callback = atkbd_setup_forced_release,
- .driver_data = atkbd_hp_r4000_forced_release_keys,
+ .driver_data = atkbd_volume_forced_release_keys,
},
{
.ident = "HP Presario R4200",
@@ -1575,7 +1616,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4200"),
},
.callback = atkbd_setup_forced_release,
- .driver_data = atkbd_hp_r4000_forced_release_keys,
+ .driver_data = atkbd_volume_forced_release_keys,
},
{
.ident = "Inventec Symphony",
@@ -1584,7 +1625,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "SYMPHONY 6.0/7.0"),
},
.callback = atkbd_setup_forced_release,
- .driver_data = atkbd_inventec_forced_release_keys,
+ .driver_data = atkbd_volume_forced_release_keys,
},
{
.ident = "Samsung NC10",
@@ -1620,7 +1661,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pa 1510"),
},
.callback = atkbd_setup_forced_release,
- .driver_data = atkbd_amilo_pa1510_forced_release_keys,
+ .driver_data = atkbd_volume_forced_release_keys,
},
{
.ident = "Fujitsu Amilo Pi 3525",
@@ -1649,6 +1690,15 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
.callback = atkbd_setup_forced_release,
.driver_data = atkdb_soltech_ta12_forced_release_keys,
},
+ {
+ .ident = "OQO Model 01+",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
+ },
+ .callback = atkbd_setup_scancode_fixup,
+ .driver_data = atkbd_oqo_01plus_scancode_fixup,
+ },
{ }
};
diff --git a/drivers/input/keyboard/davinci_keyscan.c b/drivers/input/keyboard/davinci_keyscan.c
new file mode 100644
index 000000000000..6e52d855f637
--- /dev/null
+++ b/drivers/input/keyboard/davinci_keyscan.c
@@ -0,0 +1,337 @@
+/*
+ * DaVinci Key Scan Driver for TI platforms
+ *
+ * Copyright (C) 2009 Texas Instruments, Inc
+ *
+ * Author: Miguel Aguilar <miguel.aguilar@ridgerun.com>
+ *
+ * Intial Code: Sandeep Paulraj <s-paulraj@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/types.h>
+#include <linux/input.h>
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/errno.h>
+
+#include <asm/irq.h>
+
+#include <mach/hardware.h>
+#include <mach/irqs.h>
+#include <mach/keyscan.h>
+
+/* Key scan registers */
+#define DAVINCI_KEYSCAN_KEYCTRL 0x0000
+#define DAVINCI_KEYSCAN_INTENA 0x0004
+#define DAVINCI_KEYSCAN_INTFLAG 0x0008
+#define DAVINCI_KEYSCAN_INTCLR 0x000c
+#define DAVINCI_KEYSCAN_STRBWIDTH 0x0010
+#define DAVINCI_KEYSCAN_INTERVAL 0x0014
+#define DAVINCI_KEYSCAN_CONTTIME 0x0018
+#define DAVINCI_KEYSCAN_CURRENTST 0x001c
+#define DAVINCI_KEYSCAN_PREVSTATE 0x0020
+#define DAVINCI_KEYSCAN_EMUCTRL 0x0024
+#define DAVINCI_KEYSCAN_IODFTCTRL 0x002c
+
+/* Key Control Register (KEYCTRL) */
+#define DAVINCI_KEYSCAN_KEYEN 0x00000001
+#define DAVINCI_KEYSCAN_PREVMODE 0x00000002
+#define DAVINCI_KEYSCAN_CHATOFF 0x00000004
+#define DAVINCI_KEYSCAN_AUTODET 0x00000008
+#define DAVINCI_KEYSCAN_SCANMODE 0x00000010
+#define DAVINCI_KEYSCAN_OUTTYPE 0x00000020
+
+/* Masks for the interrupts */
+#define DAVINCI_KEYSCAN_INT_CONT 0x00000008
+#define DAVINCI_KEYSCAN_INT_OFF 0x00000004
+#define DAVINCI_KEYSCAN_INT_ON 0x00000002
+#define DAVINCI_KEYSCAN_INT_CHANGE 0x00000001
+#define DAVINCI_KEYSCAN_INT_ALL 0x0000000f
+
+struct davinci_ks {
+ struct input_dev *input;
+ struct davinci_ks_platform_data *pdata;
+ int irq;
+ void __iomem *base;
+ resource_size_t pbase;
+ size_t base_size;
+ unsigned short keymap[];
+};
+
+/* Initializing the kp Module */
+static int __init davinci_ks_initialize(struct davinci_ks *davinci_ks)
+{
+ struct device *dev = &davinci_ks->input->dev;
+ struct davinci_ks_platform_data *pdata = davinci_ks->pdata;
+ u32 matrix_ctrl;
+
+ /* Enable all interrupts */
+ __raw_writel(DAVINCI_KEYSCAN_INT_ALL,
+ davinci_ks->base + DAVINCI_KEYSCAN_INTENA);
+
+ /* Clear interrupts if any */
+ __raw_writel(DAVINCI_KEYSCAN_INT_ALL,
+ davinci_ks->base + DAVINCI_KEYSCAN_INTCLR);
+
+ /* Setup the scan period = strobe + interval */
+ __raw_writel(pdata->strobe,
+ davinci_ks->base + DAVINCI_KEYSCAN_STRBWIDTH);
+ __raw_writel(pdata->interval,
+ davinci_ks->base + DAVINCI_KEYSCAN_INTERVAL);
+ __raw_writel(0x01,
+ davinci_ks->base + DAVINCI_KEYSCAN_CONTTIME);
+
+ /* Define matrix type */
+ switch (pdata->matrix_type) {
+ case DAVINCI_KEYSCAN_MATRIX_4X4:
+ matrix_ctrl = 0;
+ break;
+ case DAVINCI_KEYSCAN_MATRIX_5X3:
+ matrix_ctrl = (1 << 6);
+ break;
+ default:
+ dev_err(dev->parent, "wrong matrix type\n");
+ return -EINVAL;
+ }
+
+ /* Enable key scan module and set matrix type */
+ __raw_writel(DAVINCI_KEYSCAN_AUTODET | DAVINCI_KEYSCAN_KEYEN |
+ matrix_ctrl, davinci_ks->base + DAVINCI_KEYSCAN_KEYCTRL);
+
+ return 0;
+}
+
+static irqreturn_t davinci_ks_interrupt(int irq, void *dev_id)
+{
+ struct davinci_ks *davinci_ks = dev_id;
+ struct device *dev = &davinci_ks->input->dev;
+ unsigned short *keymap = davinci_ks->keymap;
+ int keymapsize = davinci_ks->pdata->keymapsize;
+ u32 prev_status, new_status, changed;
+ bool release;
+ int keycode = KEY_UNKNOWN;
+ int i;
+
+ /* Disable interrupt */
+ __raw_writel(0x0, davinci_ks->base + DAVINCI_KEYSCAN_INTENA);
+
+ /* Reading previous and new status of the key scan */
+ prev_status = __raw_readl(davinci_ks->base + DAVINCI_KEYSCAN_PREVSTATE);
+ new_status = __raw_readl(davinci_ks->base + DAVINCI_KEYSCAN_CURRENTST);
+
+ changed = prev_status ^ new_status;
+
+ if (changed) {
+ /*
+ * It goes through all bits in 'changed' to ensure
+ * that no key changes are being missed
+ */
+ for (i = 0 ; i < keymapsize; i++) {
+ if ((changed>>i) & 0x1) {
+ keycode = keymap[i];
+ release = (new_status >> i) & 0x1;
+ dev_dbg(dev->parent, "key %d %s\n", keycode,
+ release ? "released" : "pressed");
+ input_report_key(davinci_ks->input, keycode,
+ !release);
+ input_sync(davinci_ks->input);
+ }
+ }
+ /* Clearing interrupt */
+ __raw_writel(DAVINCI_KEYSCAN_INT_ALL,
+ davinci_ks->base + DAVINCI_KEYSCAN_INTCLR);
+ }
+
+ /* Enable interrupts */
+ __raw_writel(0x1, davinci_ks->base + DAVINCI_KEYSCAN_INTENA);
+
+ return IRQ_HANDLED;
+}
+
+static int __init davinci_ks_probe(struct platform_device *pdev)
+{
+ struct davinci_ks *davinci_ks;
+ struct input_dev *key_dev;
+ struct resource *res, *mem;
+ struct device *dev = &pdev->dev;
+ struct davinci_ks_platform_data *pdata = pdev->dev.platform_data;
+ int error, i;
+
+ if (!pdata->keymap) {
+ dev_dbg(dev, "no keymap from pdata\n");
+ return -EINVAL;
+ }
+
+ davinci_ks = kzalloc(sizeof(struct davinci_ks) +
+ sizeof(unsigned short) * pdata->keymapsize, GFP_KERNEL);
+ if (!davinci_ks) {
+ dev_dbg(dev, "could not allocate memory for private data\n");
+ return -ENOMEM;
+ }
+
+ memcpy(davinci_ks->keymap, pdata->keymap,
+ sizeof(unsigned short) * pdata->keymapsize);
+
+ key_dev = input_allocate_device();
+ if (!key_dev) {
+ dev_dbg(dev, "could not allocate input device\n");
+ error = -ENOMEM;
+ goto fail1;
+ }
+
+ davinci_ks->input = key_dev;
+
+ davinci_ks->irq = platform_get_irq(pdev, 0);
+ if (davinci_ks->irq < 0) {
+ dev_err(dev, "no key scan irq\n");
+ error = davinci_ks->irq;
+ goto fail2;
+ }
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res) {
+ dev_err(dev, "no mem resource\n");
+ error = -EINVAL;
+ goto fail2;
+ }
+
+ davinci_ks->pbase = res->start;
+ davinci_ks->base_size = resource_size(res);
+
+ mem = request_mem_region(davinci_ks->pbase, davinci_ks->base_size,
+ pdev->name);
+ if (!mem) {
+ dev_err(dev, "key scan registers at %08x are not free\n",
+ davinci_ks->pbase);
+ error = -EBUSY;
+ goto fail2;
+ }
+
+ davinci_ks->base = ioremap(davinci_ks->pbase, davinci_ks->base_size);
+ if (!davinci_ks->base) {
+ dev_err(dev, "can't ioremap MEM resource.\n");
+ error = -ENOMEM;
+ goto fail3;
+ }
+
+ /* Enable auto repeat feature of Linux input subsystem */
+ if (pdata->rep)
+ __set_bit(EV_REP, key_dev->evbit);
+
+ /* Setup input device */
+ __set_bit(EV_KEY, key_dev->evbit);
+
+ /* Setup the platform data */
+ davinci_ks->pdata = pdata;
+
+ for (i = 0; i < davinci_ks->pdata->keymapsize; i++)
+ __set_bit(davinci_ks->pdata->keymap[i], key_dev->keybit);
+
+ key_dev->name = "davinci_keyscan";
+ key_dev->phys = "davinci_keyscan/input0";
+ key_dev->dev.parent = &pdev->dev;
+ key_dev->id.bustype = BUS_HOST;
+ key_dev->id.vendor = 0x0001;
+ key_dev->id.product = 0x0001;
+ key_dev->id.version = 0x0001;
+ key_dev->keycode = davinci_ks->keymap;
+ key_dev->keycodesize = sizeof(davinci_ks->keymap[0]);
+ key_dev->keycodemax = davinci_ks->pdata->keymapsize;
+
+ error = input_register_device(davinci_ks->input);
+ if (error < 0) {
+ dev_err(dev, "unable to register davinci key scan device\n");
+ goto fail4;
+ }
+
+ error = request_irq(davinci_ks->irq, davinci_ks_interrupt,
+ IRQF_DISABLED, pdev->name, davinci_ks);
+ if (error < 0) {
+ dev_err(dev, "unable to register davinci key scan interrupt\n");
+ goto fail5;
+ }
+
+ error = davinci_ks_initialize(davinci_ks);
+ if (error < 0) {
+ dev_err(dev, "unable to initialize davinci key scan device\n");
+ goto fail6;
+ }
+
+ platform_set_drvdata(pdev, davinci_ks);
+ return 0;
+
+fail6:
+ free_irq(davinci_ks->irq, davinci_ks);
+fail5:
+ input_unregister_device(davinci_ks->input);
+ key_dev = NULL;
+fail4:
+ iounmap(davinci_ks->base);
+fail3:
+ release_mem_region(davinci_ks->pbase, davinci_ks->base_size);
+fail2:
+ input_free_device(key_dev);
+fail1:
+ kfree(davinci_ks);
+
+ return error;
+}
+
+static int __devexit davinci_ks_remove(struct platform_device *pdev)
+{
+ struct davinci_ks *davinci_ks = platform_get_drvdata(pdev);
+
+ free_irq(davinci_ks->irq, davinci_ks);
+
+ input_unregister_device(davinci_ks->input);
+
+ iounmap(davinci_ks->base);
+ release_mem_region(davinci_ks->pbase, davinci_ks->base_size);
+
+ platform_set_drvdata(pdev, NULL);
+
+ kfree(davinci_ks);
+
+ return 0;
+}
+
+static struct platform_driver davinci_ks_driver = {
+ .driver = {
+ .name = "davinci_keyscan",
+ .owner = THIS_MODULE,
+ },
+ .remove = __devexit_p(davinci_ks_remove),
+};
+
+static int __init davinci_ks_init(void)
+{
+ return platform_driver_probe(&davinci_ks_driver, davinci_ks_probe);
+}
+module_init(davinci_ks_init);
+
+static void __exit davinci_ks_exit(void)
+{
+ platform_driver_unregister(&davinci_ks_driver);
+}
+module_exit(davinci_ks_exit);
+
+MODULE_AUTHOR("Miguel Aguilar");
+MODULE_DESCRIPTION("Texas Instruments DaVinci Key Scan Driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c
index f9847e0fb553..fa9bb6d235e2 100644
--- a/drivers/input/keyboard/lkkbd.c
+++ b/drivers/input/keyboard/lkkbd.c
@@ -72,9 +72,9 @@
#define DRIVER_DESC "LK keyboard driver"
-MODULE_AUTHOR ("Jan-Benedict Glaw <jbglaw@lug-owl.de>");
-MODULE_DESCRIPTION (DRIVER_DESC);
-MODULE_LICENSE ("GPL");
+MODULE_AUTHOR("Jan-Benedict Glaw <jbglaw@lug-owl.de>");
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
/*
* Known parameters:
@@ -85,27 +85,27 @@ MODULE_LICENSE ("GPL");
* Please notice that there's not yet an API to set these at runtime.
*/
static int bell_volume = 100; /* % */
-module_param (bell_volume, int, 0);
-MODULE_PARM_DESC (bell_volume, "Bell volume (in %). default is 100%");
+module_param(bell_volume, int, 0);
+MODULE_PARM_DESC(bell_volume, "Bell volume (in %). default is 100%");
static int keyclick_volume = 100; /* % */
-module_param (keyclick_volume, int, 0);
-MODULE_PARM_DESC (keyclick_volume, "Keyclick volume (in %), default is 100%");
+module_param(keyclick_volume, int, 0);
+MODULE_PARM_DESC(keyclick_volume, "Keyclick volume (in %), default is 100%");
static int ctrlclick_volume = 100; /* % */
-module_param (ctrlclick_volume, int, 0);
-MODULE_PARM_DESC (ctrlclick_volume, "Ctrlclick volume (in %), default is 100%");
+module_param(ctrlclick_volume, int, 0);
+MODULE_PARM_DESC(ctrlclick_volume, "Ctrlclick volume (in %), default is 100%");
static int lk201_compose_is_alt;
-module_param (lk201_compose_is_alt, int, 0);
-MODULE_PARM_DESC (lk201_compose_is_alt, "If set non-zero, LK201' Compose key "
- "will act as an Alt key");
+module_param(lk201_compose_is_alt, int, 0);
+MODULE_PARM_DESC(lk201_compose_is_alt,
+ "If set non-zero, LK201' Compose key will act as an Alt key");
#undef LKKBD_DEBUG
#ifdef LKKBD_DEBUG
-#define DBG(x...) printk (x)
+#define DBG(x...) printk(x)
#else
#define DBG(x...) do {} while (0)
#endif
@@ -122,7 +122,7 @@ MODULE_PARM_DESC (lk201_compose_is_alt, "If set non-zero, LK201' Compose key "
#define LK_MODE_DOWN 0x80
#define LK_MODE_AUTODOWN 0x82
#define LK_MODE_UPDOWN 0x86
-#define LK_CMD_SET_MODE(mode,div) ((mode) | ((div) << 3))
+#define LK_CMD_SET_MODE(mode, div) ((mode) | ((div) << 3))
/* Misc commands */
#define LK_CMD_ENABLE_KEYCLICK 0x1b
@@ -152,11 +152,8 @@ MODULE_PARM_DESC (lk201_compose_is_alt, "If set non-zero, LK201' Compose key "
#define LK_NUM_KEYCODES 256
#define LK_NUM_IGNORE_BYTES 6
-typedef u_int16_t lk_keycode_t;
-
-
-static lk_keycode_t lkkbd_keycode[LK_NUM_KEYCODES] = {
+static unsigned short lkkbd_keycode[LK_NUM_KEYCODES] = {
[0x56] = KEY_F1,
[0x57] = KEY_F2,
[0x58] = KEY_F3,
@@ -268,7 +265,7 @@ static lk_keycode_t lkkbd_keycode[LK_NUM_KEYCODES] = {
};
#define CHECK_LED(LK, VAR_ON, VAR_OFF, LED, BITS) do { \
- if (test_bit (LED, (LK)->dev->led)) \
+ if (test_bit(LED, (LK)->dev->led)) \
VAR_ON |= BITS; \
else \
VAR_OFF |= BITS; \
@@ -278,7 +275,7 @@ static lk_keycode_t lkkbd_keycode[LK_NUM_KEYCODES] = {
* Per-keyboard data
*/
struct lkkbd {
- lk_keycode_t keycode[LK_NUM_KEYCODES];
+ unsigned short keycode[LK_NUM_KEYCODES];
int ignore_bytes;
unsigned char id[LK_NUM_IGNORE_BYTES];
struct input_dev *dev;
@@ -301,26 +298,25 @@ static struct {
unsigned char *name;
} lk_response[] = {
#define RESPONSE(x) { .value = (x), .name = #x, }
- RESPONSE (LK_STUCK_KEY),
- RESPONSE (LK_SELFTEST_FAILED),
- RESPONSE (LK_ALL_KEYS_UP),
- RESPONSE (LK_METRONOME),
- RESPONSE (LK_OUTPUT_ERROR),
- RESPONSE (LK_INPUT_ERROR),
- RESPONSE (LK_KBD_LOCKED),
- RESPONSE (LK_KBD_TEST_MODE_ACK),
- RESPONSE (LK_PREFIX_KEY_DOWN),
- RESPONSE (LK_MODE_CHANGE_ACK),
- RESPONSE (LK_RESPONSE_RESERVED),
+ RESPONSE(LK_STUCK_KEY),
+ RESPONSE(LK_SELFTEST_FAILED),
+ RESPONSE(LK_ALL_KEYS_UP),
+ RESPONSE(LK_METRONOME),
+ RESPONSE(LK_OUTPUT_ERROR),
+ RESPONSE(LK_INPUT_ERROR),
+ RESPONSE(LK_KBD_LOCKED),
+ RESPONSE(LK_KBD_TEST_MODE_ACK),
+ RESPONSE(LK_PREFIX_KEY_DOWN),
+ RESPONSE(LK_MODE_CHANGE_ACK),
+ RESPONSE(LK_RESPONSE_RESERVED),
#undef RESPONSE
};
-static unsigned char *
-response_name (unsigned char value)
+static unsigned char *response_name(unsigned char value)
{
int i;
- for (i = 0; i < ARRAY_SIZE (lk_response); i++)
+ for (i = 0; i < ARRAY_SIZE(lk_response); i++)
if (lk_response[i].value == value)
return lk_response[i].name;
@@ -331,8 +327,7 @@ response_name (unsigned char value)
/*
* Calculate volume parameter byte for a given volume.
*/
-static unsigned char
-volume_to_hw (int volume_percent)
+static unsigned char volume_to_hw(int volume_percent)
{
unsigned char ret = 0;
@@ -363,8 +358,7 @@ volume_to_hw (int volume_percent)
return ret;
}
-static void
-lkkbd_detection_done (struct lkkbd *lk)
+static void lkkbd_detection_done(struct lkkbd *lk)
{
int i;
@@ -377,190 +371,202 @@ lkkbd_detection_done (struct lkkbd *lk)
* Print keyboard name and modify Compose=Alt on user's request.
*/
switch (lk->id[4]) {
- case 1:
- strlcpy (lk->name, "DEC LK201 keyboard",
- sizeof (lk->name));
-
- if (lk201_compose_is_alt)
- lk->keycode[0xb1] = KEY_LEFTALT;
- break;
-
- case 2:
- strlcpy (lk->name, "DEC LK401 keyboard",
- sizeof (lk->name));
- break;
-
- default:
- strlcpy (lk->name, "Unknown DEC keyboard",
- sizeof (lk->name));
- printk (KERN_ERR "lkkbd: keyboard on %s is unknown, "
- "please report to Jan-Benedict Glaw "
- "<jbglaw@lug-owl.de>\n", lk->phys);
- printk (KERN_ERR "lkkbd: keyboard ID'ed as:");
- for (i = 0; i < LK_NUM_IGNORE_BYTES; i++)
- printk (" 0x%02x", lk->id[i]);
- printk ("\n");
- break;
+ case 1:
+ strlcpy(lk->name, "DEC LK201 keyboard", sizeof(lk->name));
+
+ if (lk201_compose_is_alt)
+ lk->keycode[0xb1] = KEY_LEFTALT;
+ break;
+
+ case 2:
+ strlcpy(lk->name, "DEC LK401 keyboard", sizeof(lk->name));
+ break;
+
+ default:
+ strlcpy(lk->name, "Unknown DEC keyboard", sizeof(lk->name));
+ printk(KERN_ERR
+ "lkkbd: keyboard on %s is unknown, please report to "
+ "Jan-Benedict Glaw <jbglaw@lug-owl.de>\n", lk->phys);
+ printk(KERN_ERR "lkkbd: keyboard ID'ed as:");
+ for (i = 0; i < LK_NUM_IGNORE_BYTES; i++)
+ printk(" 0x%02x", lk->id[i]);
+ printk("\n");
+ break;
}
- printk (KERN_INFO "lkkbd: keyboard on %s identified as: %s\n",
- lk->phys, lk->name);
+
+ printk(KERN_INFO "lkkbd: keyboard on %s identified as: %s\n",
+ lk->phys, lk->name);
/*
* Report errors during keyboard boot-up.
*/
switch (lk->id[2]) {
- case 0x00:
- /* All okay */
- break;
-
- case LK_STUCK_KEY:
- printk (KERN_ERR "lkkbd: Stuck key on keyboard at "
- "%s\n", lk->phys);
- break;
-
- case LK_SELFTEST_FAILED:
- printk (KERN_ERR "lkkbd: Selftest failed on keyboard "
- "at %s, keyboard may not work "
- "properly\n", lk->phys);
- break;
-
- default:
- printk (KERN_ERR "lkkbd: Unknown error %02x on "
- "keyboard at %s\n", lk->id[2],
- lk->phys);
- break;
+ case 0x00:
+ /* All okay */
+ break;
+
+ case LK_STUCK_KEY:
+ printk(KERN_ERR "lkkbd: Stuck key on keyboard at %s\n",
+ lk->phys);
+ break;
+
+ case LK_SELFTEST_FAILED:
+ printk(KERN_ERR
+ "lkkbd: Selftest failed on keyboard at %s, "
+ "keyboard may not work properly\n", lk->phys);
+ break;
+
+ default:
+ printk(KERN_ERR
+ "lkkbd: Unknown error %02x on keyboard at %s\n",
+ lk->id[2], lk->phys);
+ break;
}
/*
* Try to hint user if there's a stuck key.
*/
if (lk->id[2] == LK_STUCK_KEY && lk->id[3] != 0)
- printk (KERN_ERR "Scancode of stuck key is 0x%02x, keycode "
- "is 0x%04x\n", lk->id[3],
- lk->keycode[lk->id[3]]);
-
- return;
+ printk(KERN_ERR
+ "Scancode of stuck key is 0x%02x, keycode is 0x%04x\n",
+ lk->id[3], lk->keycode[lk->id[3]]);
}
/*
* lkkbd_interrupt() is called by the low level driver when a character
* is received.
*/
-static irqreturn_t
-lkkbd_interrupt (struct serio *serio, unsigned char data, unsigned int flags)
+static irqreturn_t lkkbd_interrupt(struct serio *serio,
+ unsigned char data, unsigned int flags)
{
- struct lkkbd *lk = serio_get_drvdata (serio);
+ struct lkkbd *lk = serio_get_drvdata(serio);
+ struct input_dev *input_dev = lk->dev;
+ unsigned int keycode;
int i;
- DBG (KERN_INFO "Got byte 0x%02x\n", data);
+ DBG(KERN_INFO "Got byte 0x%02x\n", data);
if (lk->ignore_bytes > 0) {
- DBG (KERN_INFO "Ignoring a byte on %s\n", lk->name);
+ DBG(KERN_INFO "Ignoring a byte on %s\n", lk->name);
lk->id[LK_NUM_IGNORE_BYTES - lk->ignore_bytes--] = data;
if (lk->ignore_bytes == 0)
- lkkbd_detection_done (lk);
+ lkkbd_detection_done(lk);
return IRQ_HANDLED;
}
switch (data) {
- case LK_ALL_KEYS_UP:
- for (i = 0; i < ARRAY_SIZE (lkkbd_keycode); i++)
- if (lk->keycode[i] != KEY_RESERVED)
- input_report_key (lk->dev, lk->keycode[i], 0);
- input_sync (lk->dev);
- break;
-
- case 0x01:
- DBG (KERN_INFO "Got 0x01, scheduling re-initialization\n");
- lk->ignore_bytes = LK_NUM_IGNORE_BYTES;
- lk->id[LK_NUM_IGNORE_BYTES - lk->ignore_bytes--] = data;
- schedule_work (&lk->tq);
- break;
-
- case LK_METRONOME:
- case LK_OUTPUT_ERROR:
- case LK_INPUT_ERROR:
- case LK_KBD_LOCKED:
- case LK_KBD_TEST_MODE_ACK:
- case LK_PREFIX_KEY_DOWN:
- case LK_MODE_CHANGE_ACK:
- case LK_RESPONSE_RESERVED:
- DBG (KERN_INFO "Got %s and don't know how to handle...\n",
- response_name (data));
- break;
-
- default:
- if (lk->keycode[data] != KEY_RESERVED) {
- if (!test_bit (lk->keycode[data], lk->dev->key))
- input_report_key (lk->dev, lk->keycode[data], 1);
- else
- input_report_key (lk->dev, lk->keycode[data], 0);
- input_sync (lk->dev);
- } else
- printk (KERN_WARNING "%s: Unknown key with "
- "scancode 0x%02x on %s.\n",
- __FILE__, data, lk->name);
+ case LK_ALL_KEYS_UP:
+ for (i = 0; i < ARRAY_SIZE(lkkbd_keycode); i++)
+ input_report_key(input_dev, lk->keycode[i], 0);
+ input_sync(input_dev);
+ break;
+
+ case 0x01:
+ DBG(KERN_INFO "Got 0x01, scheduling re-initialization\n");
+ lk->ignore_bytes = LK_NUM_IGNORE_BYTES;
+ lk->id[LK_NUM_IGNORE_BYTES - lk->ignore_bytes--] = data;
+ schedule_work(&lk->tq);
+ break;
+
+ case LK_METRONOME:
+ case LK_OUTPUT_ERROR:
+ case LK_INPUT_ERROR:
+ case LK_KBD_LOCKED:
+ case LK_KBD_TEST_MODE_ACK:
+ case LK_PREFIX_KEY_DOWN:
+ case LK_MODE_CHANGE_ACK:
+ case LK_RESPONSE_RESERVED:
+ DBG(KERN_INFO "Got %s and don't know how to handle...\n",
+ response_name(data));
+ break;
+
+ default:
+ keycode = lk->keycode[data];
+ if (keycode != KEY_RESERVED) {
+ input_report_key(input_dev, keycode,
+ !test_bit(keycode, input_dev->key));
+ input_sync(input_dev);
+ } else {
+ printk(KERN_WARNING
+ "%s: Unknown key with scancode 0x%02x on %s.\n",
+ __FILE__, data, lk->name);
+ }
}
return IRQ_HANDLED;
}
+static void lkkbd_toggle_leds(struct lkkbd *lk)
+{
+ struct serio *serio = lk->serio;
+ unsigned char leds_on = 0;
+ unsigned char leds_off = 0;
+
+ CHECK_LED(lk, leds_on, leds_off, LED_CAPSL, LK_LED_SHIFTLOCK);
+ CHECK_LED(lk, leds_on, leds_off, LED_COMPOSE, LK_LED_COMPOSE);
+ CHECK_LED(lk, leds_on, leds_off, LED_SCROLLL, LK_LED_SCROLLLOCK);
+ CHECK_LED(lk, leds_on, leds_off, LED_SLEEP, LK_LED_WAIT);
+ if (leds_on != 0) {
+ serio_write(serio, LK_CMD_LED_ON);
+ serio_write(serio, leds_on);
+ }
+ if (leds_off != 0) {
+ serio_write(serio, LK_CMD_LED_OFF);
+ serio_write(serio, leds_off);
+ }
+}
+
+static void lkkbd_toggle_keyclick(struct lkkbd *lk, bool on)
+{
+ struct serio *serio = lk->serio;
+
+ if (on) {
+ DBG("%s: Activating key clicks\n", __func__);
+ serio_write(serio, LK_CMD_ENABLE_KEYCLICK);
+ serio_write(serio, volume_to_hw(lk->keyclick_volume));
+ serio_write(serio, LK_CMD_ENABLE_CTRCLICK);
+ serio_write(serio, volume_to_hw(lk->ctrlclick_volume));
+ } else {
+ DBG("%s: Deactivating key clicks\n", __func__);
+ serio_write(serio, LK_CMD_DISABLE_KEYCLICK);
+ serio_write(serio, LK_CMD_DISABLE_CTRCLICK);
+ }
+
+}
+
/*
* lkkbd_event() handles events from the input module.
*/
-static int
-lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code,
- int value)
+static int lkkbd_event(struct input_dev *dev,
+ unsigned int type, unsigned int code, int value)
{
- struct lkkbd *lk = input_get_drvdata (dev);
- unsigned char leds_on = 0;
- unsigned char leds_off = 0;
+ struct lkkbd *lk = input_get_drvdata(dev);
switch (type) {
- case EV_LED:
- CHECK_LED (lk, leds_on, leds_off, LED_CAPSL, LK_LED_SHIFTLOCK);
- CHECK_LED (lk, leds_on, leds_off, LED_COMPOSE, LK_LED_COMPOSE);
- CHECK_LED (lk, leds_on, leds_off, LED_SCROLLL, LK_LED_SCROLLLOCK);
- CHECK_LED (lk, leds_on, leds_off, LED_SLEEP, LK_LED_WAIT);
- if (leds_on != 0) {
- serio_write (lk->serio, LK_CMD_LED_ON);
- serio_write (lk->serio, leds_on);
- }
- if (leds_off != 0) {
- serio_write (lk->serio, LK_CMD_LED_OFF);
- serio_write (lk->serio, leds_off);
- }
+ case EV_LED:
+ lkkbd_toggle_leds(lk);
+ return 0;
+
+ case EV_SND:
+ switch (code) {
+ case SND_CLICK:
+ lkkbd_toggle_keyclick(lk, value);
return 0;
- case EV_SND:
- switch (code) {
- case SND_CLICK:
- if (value == 0) {
- DBG ("%s: Deactivating key clicks\n", __func__);
- serio_write (lk->serio, LK_CMD_DISABLE_KEYCLICK);
- serio_write (lk->serio, LK_CMD_DISABLE_CTRCLICK);
- } else {
- DBG ("%s: Activating key clicks\n", __func__);
- serio_write (lk->serio, LK_CMD_ENABLE_KEYCLICK);
- serio_write (lk->serio, volume_to_hw (lk->keyclick_volume));
- serio_write (lk->serio, LK_CMD_ENABLE_CTRCLICK);
- serio_write (lk->serio, volume_to_hw (lk->ctrlclick_volume));
- }
- return 0;
-
- case SND_BELL:
- if (value != 0)
- serio_write (lk->serio, LK_CMD_SOUND_BELL);
-
- return 0;
- }
- break;
-
- default:
- printk (KERN_ERR "%s (): Got unknown type %d, code %d, value %d\n",
- __func__, type, code, value);
+ case SND_BELL:
+ if (value != 0)
+ serio_write(lk->serio, LK_CMD_SOUND_BELL);
+
+ return 0;
+ }
+
+ break;
+
+ default:
+ printk(KERN_ERR "%s(): Got unknown type %d, code %d, value %d\n",
+ __func__, type, code, value);
}
return -1;
@@ -570,79 +576,56 @@ lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code,
* lkkbd_reinit() sets leds and beeps to a state the computer remembers they
* were in.
*/
-static void
-lkkbd_reinit (struct work_struct *work)
+static void lkkbd_reinit(struct work_struct *work)
{
struct lkkbd *lk = container_of(work, struct lkkbd, tq);
int division;
- unsigned char leds_on = 0;
- unsigned char leds_off = 0;
/* Ask for ID */
- serio_write (lk->serio, LK_CMD_REQUEST_ID);
+ serio_write(lk->serio, LK_CMD_REQUEST_ID);
/* Reset parameters */
- serio_write (lk->serio, LK_CMD_SET_DEFAULTS);
+ serio_write(lk->serio, LK_CMD_SET_DEFAULTS);
/* Set LEDs */
- CHECK_LED (lk, leds_on, leds_off, LED_CAPSL, LK_LED_SHIFTLOCK);
- CHECK_LED (lk, leds_on, leds_off, LED_COMPOSE, LK_LED_COMPOSE);
- CHECK_LED (lk, leds_on, leds_off, LED_SCROLLL, LK_LED_SCROLLLOCK);
- CHECK_LED (lk, leds_on, leds_off, LED_SLEEP, LK_LED_WAIT);
- if (leds_on != 0) {
- serio_write (lk->serio, LK_CMD_LED_ON);
- serio_write (lk->serio, leds_on);
- }
- if (leds_off != 0) {
- serio_write (lk->serio, LK_CMD_LED_OFF);
- serio_write (lk->serio, leds_off);
- }
+ lkkbd_toggle_leds(lk);
/*
* Try to activate extended LK401 mode. This command will
* only work with a LK401 keyboard and grants access to
* LAlt, RAlt, RCompose and RShift.
*/
- serio_write (lk->serio, LK_CMD_ENABLE_LK401);
+ serio_write(lk->serio, LK_CMD_ENABLE_LK401);
/* Set all keys to UPDOWN mode */
for (division = 1; division <= 14; division++)
- serio_write (lk->serio, LK_CMD_SET_MODE (LK_MODE_UPDOWN,
- division));
+ serio_write(lk->serio,
+ LK_CMD_SET_MODE(LK_MODE_UPDOWN, division));
/* Enable bell and set volume */
- serio_write (lk->serio, LK_CMD_ENABLE_BELL);
- serio_write (lk->serio, volume_to_hw (lk->bell_volume));
+ serio_write(lk->serio, LK_CMD_ENABLE_BELL);
+ serio_write(lk->serio, volume_to_hw(lk->bell_volume));
/* Enable/disable keyclick (and possibly set volume) */
- if (test_bit (SND_CLICK, lk->dev->snd)) {
- serio_write (lk->serio, LK_CMD_ENABLE_KEYCLICK);
- serio_write (lk->serio, volume_to_hw (lk->keyclick_volume));
- serio_write (lk->serio, LK_CMD_ENABLE_CTRCLICK);
- serio_write (lk->serio, volume_to_hw (lk->ctrlclick_volume));
- } else {
- serio_write (lk->serio, LK_CMD_DISABLE_KEYCLICK);
- serio_write (lk->serio, LK_CMD_DISABLE_CTRCLICK);
- }
+ lkkbd_toggle_keyclick(lk, test_bit(SND_CLICK, lk->dev->snd));
/* Sound the bell if needed */
- if (test_bit (SND_BELL, lk->dev->snd))
- serio_write (lk->serio, LK_CMD_SOUND_BELL);
+ if (test_bit(SND_BELL, lk->dev->snd))
+ serio_write(lk->serio, LK_CMD_SOUND_BELL);
}
/*
* lkkbd_connect() probes for a LK keyboard and fills the necessary structures.
*/
-static int
-lkkbd_connect (struct serio *serio, struct serio_driver *drv)
+static int lkkbd_connect(struct serio *serio, struct serio_driver *drv)
{
struct lkkbd *lk;
struct input_dev *input_dev;
int i;
int err;
- lk = kzalloc (sizeof (struct lkkbd), GFP_KERNEL);
- input_dev = input_allocate_device ();
+ lk = kzalloc(sizeof(struct lkkbd), GFP_KERNEL);
+ input_dev = input_allocate_device();
if (!lk || !input_dev) {
err = -ENOMEM;
goto fail1;
@@ -650,14 +633,14 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv)
lk->serio = serio;
lk->dev = input_dev;
- INIT_WORK (&lk->tq, lkkbd_reinit);
+ INIT_WORK(&lk->tq, lkkbd_reinit);
lk->bell_volume = bell_volume;
lk->keyclick_volume = keyclick_volume;
lk->ctrlclick_volume = ctrlclick_volume;
- memcpy (lk->keycode, lkkbd_keycode, sizeof (lk_keycode_t) * LK_NUM_KEYCODES);
+ memcpy(lk->keycode, lkkbd_keycode, sizeof(lk->keycode));
- strlcpy (lk->name, "DEC LK keyboard", sizeof(lk->name));
- snprintf (lk->phys, sizeof(lk->phys), "%s/input0", serio->phys);
+ strlcpy(lk->name, "DEC LK keyboard", sizeof(lk->name));
+ snprintf(lk->phys, sizeof(lk->phys), "%s/input0", serio->phys);
input_dev->name = lk->name;
input_dev->phys = lk->phys;
@@ -668,62 +651,61 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv)
input_dev->dev.parent = &serio->dev;
input_dev->event = lkkbd_event;
- input_set_drvdata (input_dev, lk);
+ input_set_drvdata(input_dev, lk);
- set_bit (EV_KEY, input_dev->evbit);
- set_bit (EV_LED, input_dev->evbit);
- set_bit (EV_SND, input_dev->evbit);
- set_bit (EV_REP, input_dev->evbit);
- set_bit (LED_CAPSL, input_dev->ledbit);
- set_bit (LED_SLEEP, input_dev->ledbit);
- set_bit (LED_COMPOSE, input_dev->ledbit);
- set_bit (LED_SCROLLL, input_dev->ledbit);
- set_bit (SND_BELL, input_dev->sndbit);
- set_bit (SND_CLICK, input_dev->sndbit);
+ __set_bit(EV_KEY, input_dev->evbit);
+ __set_bit(EV_LED, input_dev->evbit);
+ __set_bit(EV_SND, input_dev->evbit);
+ __set_bit(EV_REP, input_dev->evbit);
+ __set_bit(LED_CAPSL, input_dev->ledbit);
+ __set_bit(LED_SLEEP, input_dev->ledbit);
+ __set_bit(LED_COMPOSE, input_dev->ledbit);
+ __set_bit(LED_SCROLLL, input_dev->ledbit);
+ __set_bit(SND_BELL, input_dev->sndbit);
+ __set_bit(SND_CLICK, input_dev->sndbit);
input_dev->keycode = lk->keycode;
- input_dev->keycodesize = sizeof (lk_keycode_t);
- input_dev->keycodemax = LK_NUM_KEYCODES;
+ input_dev->keycodesize = sizeof(lk->keycode[0]);
+ input_dev->keycodemax = ARRAY_SIZE(lk->keycode);
for (i = 0; i < LK_NUM_KEYCODES; i++)
- __set_bit (lk->keycode[i], input_dev->keybit);
+ __set_bit(lk->keycode[i], input_dev->keybit);
__clear_bit(KEY_RESERVED, input_dev->keybit);
- serio_set_drvdata (serio, lk);
+ serio_set_drvdata(serio, lk);
- err = serio_open (serio, drv);
+ err = serio_open(serio, drv);
if (err)
goto fail2;
- err = input_register_device (lk->dev);
+ err = input_register_device(lk->dev);
if (err)
goto fail3;
- serio_write (lk->serio, LK_CMD_POWERCYCLE_RESET);
+ serio_write(lk->serio, LK_CMD_POWERCYCLE_RESET);
return 0;
- fail3: serio_close (serio);
- fail2: serio_set_drvdata (serio, NULL);
- fail1: input_free_device (input_dev);
- kfree (lk);
+ fail3: serio_close(serio);
+ fail2: serio_set_drvdata(serio, NULL);
+ fail1: input_free_device(input_dev);
+ kfree(lk);
return err;
}
/*
* lkkbd_disconnect() unregisters and closes behind us.
*/
-static void
-lkkbd_disconnect (struct serio *serio)
+static void lkkbd_disconnect(struct serio *serio)
{
- struct lkkbd *lk = serio_get_drvdata (serio);
-
- input_get_device (lk->dev);
- input_unregister_device (lk->dev);
- serio_close (serio);
- serio_set_drvdata (serio, NULL);
- input_put_device (lk->dev);
- kfree (lk);
+ struct lkkbd *lk = serio_get_drvdata(serio);
+
+ input_get_device(lk->dev);
+ input_unregister_device(lk->dev);
+ serio_close(serio);
+ serio_set_drvdata(serio, NULL);
+ input_put_device(lk->dev);
+ kfree(lk);
}
static struct serio_device_id lkkbd_serio_ids[] = {
@@ -752,18 +734,16 @@ static struct serio_driver lkkbd_drv = {
/*
* The functions for insering/removing us as a module.
*/
-static int __init
-lkkbd_init (void)
+static int __init lkkbd_init(void)
{
return serio_register_driver(&lkkbd_drv);
}
-static void __exit
-lkkbd_exit (void)
+static void __exit lkkbd_exit(void)
{
serio_unregister_driver(&lkkbd_drv);
}
-module_init (lkkbd_init);
-module_exit (lkkbd_exit);
+module_init(lkkbd_init);
+module_exit(lkkbd_exit);
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index bba85add35a3..1a494d505431 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -35,12 +35,12 @@
#include <linux/mutex.h>
#include <linux/errno.h>
#include <mach/gpio.h>
-#include <mach/keypad.h>
-#include <mach/menelaus.h>
+#include <plat/keypad.h>
+#include <plat/menelaus.h>
#include <asm/irq.h>
#include <mach/hardware.h>
#include <asm/io.h>
-#include <mach/mux.h>
+#include <plat/mux.h>
#undef NEW_BOARD_LEARNING_MODE
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c
index 216a559f55ea..ea821b546969 100644
--- a/drivers/input/misc/hp_sdc_rtc.c
+++ b/drivers/input/misc/hp_sdc_rtc.c
@@ -209,7 +209,7 @@ static inline int hp_sdc_rtc_read_rt(struct timeval *res) {
/* Read the i8042 fast handshake timer */
static inline int hp_sdc_rtc_read_fhs(struct timeval *res) {
- uint64_t raw;
+ int64_t raw;
unsigned int tenms;
raw = hp_sdc_rtc_read_i8042timer(HP_SDC_CMD_LOAD_FHS, 2);
diff --git a/drivers/input/misc/pcf50633-input.c b/drivers/input/misc/pcf50633-input.c
index 039dcb00ebd9..008de0c5834b 100644
--- a/drivers/input/misc/pcf50633-input.c
+++ b/drivers/input/misc/pcf50633-input.c
@@ -55,7 +55,6 @@ pcf50633_input_irq(int irq, void *data)
static int __devinit pcf50633_input_probe(struct platform_device *pdev)
{
struct pcf50633_input *input;
- struct pcf50633_subdev_pdata *pdata = pdev->dev.platform_data;
struct input_dev *input_dev;
int ret;
@@ -71,7 +70,7 @@ static int __devinit pcf50633_input_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, input);
- input->pcf = pdata->pcf;
+ input->pcf = dev_to_pcf50633(pdev->dev.parent);
input->input_dev = input_dev;
input_dev->name = "PCF50633 PMU events";
@@ -85,9 +84,9 @@ static int __devinit pcf50633_input_probe(struct platform_device *pdev)
kfree(input);
return ret;
}
- pcf50633_register_irq(pdata->pcf, PCF50633_IRQ_ONKEYR,
+ pcf50633_register_irq(input->pcf, PCF50633_IRQ_ONKEYR,
pcf50633_input_irq, input);
- pcf50633_register_irq(pdata->pcf, PCF50633_IRQ_ONKEYF,
+ pcf50633_register_irq(input->pcf, PCF50633_IRQ_ONKEYF,
pcf50633_input_irq, input);
return 0;
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index a932179c4c9e..00eb9d651d97 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -1263,7 +1263,7 @@ static int __devinit setup_input_dev(void)
if (!wistron_idev)
return -ENOMEM;
- wistron_idev->flush = wistron_flush;
+ wistron_idev->open = wistron_flush;
wistron_idev->poll = wistron_poll;
wistron_idev->poll_interval = POLL_INTERVAL_DEFAULT;
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
index de745d751162..ab5dc5f5fd83 100644
--- a/drivers/input/mouse/logips2pp.c
+++ b/drivers/input/mouse/logips2pp.c
@@ -219,7 +219,7 @@ static const struct ps2pp_info *get_model_info(unsigned char model)
PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
PS2PP_EXTRA_BTN | PS2PP_NAV_BTN | PS2PP_HWHEEL },
{ 72, PS2PP_KIND_TRACKMAN, 0 }, /* T-CH11: TrackMan Marble */
- { 73, 0, PS2PP_SIDE_BTN },
+ { 73, PS2PP_KIND_TRACKMAN, PS2PP_SIDE_BTN }, /* TrackMan FX */
{ 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL },
{ 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL },
{ 79, PS2PP_KIND_TRACKMAN, PS2PP_WHEEL }, /* TrackMan with wheel */
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index b66ff1ac7dea..f4a61252bcc9 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -652,6 +652,16 @@ static const struct dmi_system_id toshiba_dmi_table[] = {
DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"),
},
+
+ },
+ {
+ .ident = "Toshiba Portege M300",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"),
+ DMI_MATCH(DMI_PRODUCT_VERSION, "Version 1.0"),
+ },
+
},
{ }
};
diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c
index 70111443678e..bf2c0c80d6cc 100644
--- a/drivers/input/mouse/vsxxxaa.c
+++ b/drivers/input/mouse/vsxxxaa.c
@@ -86,27 +86,28 @@
#define DRIVER_DESC "Driver for DEC VSXXX-AA and -GA mice and VSXXX-AB tablet"
-MODULE_AUTHOR ("Jan-Benedict Glaw <jbglaw@lug-owl.de>");
-MODULE_DESCRIPTION (DRIVER_DESC);
-MODULE_LICENSE ("GPL");
+MODULE_AUTHOR("Jan-Benedict Glaw <jbglaw@lug-owl.de>");
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
#undef VSXXXAA_DEBUG
#ifdef VSXXXAA_DEBUG
-#define DBG(x...) printk (x)
+#define DBG(x...) printk(x)
#else
#define DBG(x...) do {} while (0)
#endif
#define VSXXXAA_INTRO_MASK 0x80
#define VSXXXAA_INTRO_HEAD 0x80
-#define IS_HDR_BYTE(x) (((x) & VSXXXAA_INTRO_MASK) \
- == VSXXXAA_INTRO_HEAD)
+#define IS_HDR_BYTE(x) \
+ (((x) & VSXXXAA_INTRO_MASK) == VSXXXAA_INTRO_HEAD)
#define VSXXXAA_PACKET_MASK 0xe0
#define VSXXXAA_PACKET_REL 0x80
#define VSXXXAA_PACKET_ABS 0xc0
#define VSXXXAA_PACKET_POR 0xa0
-#define MATCH_PACKET_TYPE(data, type) (((data) & VSXXXAA_PACKET_MASK) == (type))
+#define MATCH_PACKET_TYPE(data, type) \
+ (((data) & VSXXXAA_PACKET_MASK) == (type))
@@ -123,52 +124,50 @@ struct vsxxxaa {
char phys[32];
};
-static void
-vsxxxaa_drop_bytes (struct vsxxxaa *mouse, int num)
+static void vsxxxaa_drop_bytes(struct vsxxxaa *mouse, int num)
{
- if (num >= mouse->count)
+ if (num >= mouse->count) {
mouse->count = 0;
- else {
- memmove (mouse->buf, mouse->buf + num - 1, BUFLEN - num);
+ } else {
+ memmove(mouse->buf, mouse->buf + num - 1, BUFLEN - num);
mouse->count -= num;
}
}
-static void
-vsxxxaa_queue_byte (struct vsxxxaa *mouse, unsigned char byte)
+static void vsxxxaa_queue_byte(struct vsxxxaa *mouse, unsigned char byte)
{
if (mouse->count == BUFLEN) {
- printk (KERN_ERR "%s on %s: Dropping a byte of full buffer.\n",
- mouse->name, mouse->phys);
- vsxxxaa_drop_bytes (mouse, 1);
+ printk(KERN_ERR "%s on %s: Dropping a byte of full buffer.\n",
+ mouse->name, mouse->phys);
+ vsxxxaa_drop_bytes(mouse, 1);
}
- DBG (KERN_INFO "Queueing byte 0x%02x\n", byte);
+
+ DBG(KERN_INFO "Queueing byte 0x%02x\n", byte);
mouse->buf[mouse->count++] = byte;
}
-static void
-vsxxxaa_detection_done (struct vsxxxaa *mouse)
+static void vsxxxaa_detection_done(struct vsxxxaa *mouse)
{
switch (mouse->type) {
- case 0x02:
- strlcpy (mouse->name, "DEC VSXXX-AA/-GA mouse",
- sizeof (mouse->name));
- break;
-
- case 0x04:
- strlcpy (mouse->name, "DEC VSXXX-AB digitizer",
- sizeof (mouse->name));
- break;
-
- default:
- snprintf (mouse->name, sizeof (mouse->name),
- "unknown DEC pointer device (type = 0x%02x)",
- mouse->type);
- break;
+ case 0x02:
+ strlcpy(mouse->name, "DEC VSXXX-AA/-GA mouse",
+ sizeof(mouse->name));
+ break;
+
+ case 0x04:
+ strlcpy(mouse->name, "DEC VSXXX-AB digitizer",
+ sizeof(mouse->name));
+ break;
+
+ default:
+ snprintf(mouse->name, sizeof(mouse->name),
+ "unknown DEC pointer device (type = 0x%02x)",
+ mouse->type);
+ break;
}
- printk (KERN_INFO
+ printk(KERN_INFO
"Found %s version 0x%02x from country 0x%02x on port %s\n",
mouse->name, mouse->version, mouse->country, mouse->phys);
}
@@ -176,42 +175,38 @@ vsxxxaa_detection_done (struct vsxxxaa *mouse)
/*
* Returns number of bytes to be dropped, 0 if packet is okay.
*/
-static int
-vsxxxaa_check_packet (struct vsxxxaa *mouse, int packet_len)
+static int vsxxxaa_check_packet(struct vsxxxaa *mouse, int packet_len)
{
int i;
/* First byte must be a header byte */
- if (!IS_HDR_BYTE (mouse->buf[0])) {
- DBG ("vsck: len=%d, 1st=0x%02x\n", packet_len, mouse->buf[0]);
+ if (!IS_HDR_BYTE(mouse->buf[0])) {
+ DBG("vsck: len=%d, 1st=0x%02x\n", packet_len, mouse->buf[0]);
return 1;
}
/* Check all following bytes */
- if (packet_len > 1) {
- for (i = 1; i < packet_len; i++) {
- if (IS_HDR_BYTE (mouse->buf[i])) {
- printk (KERN_ERR "Need to drop %d bytes "
- "of a broken packet.\n",
- i - 1);
- DBG (KERN_INFO "check: len=%d, b[%d]=0x%02x\n",
- packet_len, i, mouse->buf[i]);
- return i - 1;
- }
+ for (i = 1; i < packet_len; i++) {
+ if (IS_HDR_BYTE(mouse->buf[i])) {
+ printk(KERN_ERR
+ "Need to drop %d bytes of a broken packet.\n",
+ i - 1);
+ DBG(KERN_INFO "check: len=%d, b[%d]=0x%02x\n",
+ packet_len, i, mouse->buf[i]);
+ return i - 1;
}
}
return 0;
}
-static __inline__ int
-vsxxxaa_smells_like_packet (struct vsxxxaa *mouse, unsigned char type, size_t len)
+static inline int vsxxxaa_smells_like_packet(struct vsxxxaa *mouse,
+ unsigned char type, size_t len)
{
- return (mouse->count >= len) && MATCH_PACKET_TYPE (mouse->buf[0], type);
+ return mouse->count >= len && MATCH_PACKET_TYPE(mouse->buf[0], type);
}
-static void
-vsxxxaa_handle_REL_packet (struct vsxxxaa *mouse)
+static void vsxxxaa_handle_REL_packet(struct vsxxxaa *mouse)
{
struct input_dev *dev = mouse->dev;
unsigned char *buf = mouse->buf;
@@ -232,43 +227,42 @@ vsxxxaa_handle_REL_packet (struct vsxxxaa *mouse)
* 0, bit 4 of byte 0 is direction.
*/
dx = buf[1] & 0x7f;
- dx *= ((buf[0] >> 4) & 0x01)? 1: -1;
+ dx *= ((buf[0] >> 4) & 0x01) ? 1 : -1;
/*
* Low 7 bit of byte 2 are abs(dy), bit 7 is
* 0, bit 3 of byte 0 is direction.
*/
dy = buf[2] & 0x7f;
- dy *= ((buf[0] >> 3) & 0x01)? -1: 1;
+ dy *= ((buf[0] >> 3) & 0x01) ? -1 : 1;
/*
* Get button state. It's the low three bits
* (for three buttons) of byte 0.
*/
- left = (buf[0] & 0x04)? 1: 0;
- middle = (buf[0] & 0x02)? 1: 0;
- right = (buf[0] & 0x01)? 1: 0;
+ left = buf[0] & 0x04;
+ middle = buf[0] & 0x02;
+ right = buf[0] & 0x01;
- vsxxxaa_drop_bytes (mouse, 3);
+ vsxxxaa_drop_bytes(mouse, 3);
- DBG (KERN_INFO "%s on %s: dx=%d, dy=%d, buttons=%s%s%s\n",
- mouse->name, mouse->phys, dx, dy,
- left? "L": "l", middle? "M": "m", right? "R": "r");
+ DBG(KERN_INFO "%s on %s: dx=%d, dy=%d, buttons=%s%s%s\n",
+ mouse->name, mouse->phys, dx, dy,
+ left ? "L" : "l", middle ? "M" : "m", right ? "R" : "r");
/*
* Report what we've found so far...
*/
- input_report_key (dev, BTN_LEFT, left);
- input_report_key (dev, BTN_MIDDLE, middle);
- input_report_key (dev, BTN_RIGHT, right);
- input_report_key (dev, BTN_TOUCH, 0);
- input_report_rel (dev, REL_X, dx);
- input_report_rel (dev, REL_Y, dy);
- input_sync (dev);
+ input_report_key(dev, BTN_LEFT, left);
+ input_report_key(dev, BTN_MIDDLE, middle);
+ input_report_key(dev, BTN_RIGHT, right);
+ input_report_key(dev, BTN_TOUCH, 0);
+ input_report_rel(dev, REL_X, dx);
+ input_report_rel(dev, REL_Y, dy);
+ input_sync(dev);
}
-static void
-vsxxxaa_handle_ABS_packet (struct vsxxxaa *mouse)
+static void vsxxxaa_handle_ABS_packet(struct vsxxxaa *mouse)
{
struct input_dev *dev = mouse->dev;
unsigned char *buf = mouse->buf;
@@ -296,32 +290,31 @@ vsxxxaa_handle_ABS_packet (struct vsxxxaa *mouse)
/*
* Get button state. It's bits <4..1> of byte 0.
*/
- left = (buf[0] & 0x02)? 1: 0;
- middle = (buf[0] & 0x04)? 1: 0;
- right = (buf[0] & 0x08)? 1: 0;
- touch = (buf[0] & 0x10)? 1: 0;
+ left = buf[0] & 0x02;
+ middle = buf[0] & 0x04;
+ right = buf[0] & 0x08;
+ touch = buf[0] & 0x10;
- vsxxxaa_drop_bytes (mouse, 5);
+ vsxxxaa_drop_bytes(mouse, 5);
- DBG (KERN_INFO "%s on %s: x=%d, y=%d, buttons=%s%s%s%s\n",
- mouse->name, mouse->phys, x, y,
- left? "L": "l", middle? "M": "m",
- right? "R": "r", touch? "T": "t");
+ DBG(KERN_INFO "%s on %s: x=%d, y=%d, buttons=%s%s%s%s\n",
+ mouse->name, mouse->phys, x, y,
+ left ? "L" : "l", middle ? "M" : "m",
+ right ? "R" : "r", touch ? "T" : "t");
/*
* Report what we've found so far...
*/
- input_report_key (dev, BTN_LEFT, left);
- input_report_key (dev, BTN_MIDDLE, middle);
- input_report_key (dev, BTN_RIGHT, right);
- input_report_key (dev, BTN_TOUCH, touch);
- input_report_abs (dev, ABS_X, x);
- input_report_abs (dev, ABS_Y, y);
- input_sync (dev);
+ input_report_key(dev, BTN_LEFT, left);
+ input_report_key(dev, BTN_MIDDLE, middle);
+ input_report_key(dev, BTN_RIGHT, right);
+ input_report_key(dev, BTN_TOUCH, touch);
+ input_report_abs(dev, ABS_X, x);
+ input_report_abs(dev, ABS_Y, y);
+ input_sync(dev);
}
-static void
-vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse)
+static void vsxxxaa_handle_POR_packet(struct vsxxxaa *mouse)
{
struct input_dev *dev = mouse->dev;
unsigned char *buf = mouse->buf;
@@ -356,24 +349,24 @@ vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse)
* (for three buttons) of byte 0. Maybe even the bit <3>
* has some meaning if a tablet is attached.
*/
- left = (buf[0] & 0x04)? 1: 0;
- middle = (buf[0] & 0x02)? 1: 0;
- right = (buf[0] & 0x01)? 1: 0;
+ left = buf[0] & 0x04;
+ middle = buf[0] & 0x02;
+ right = buf[0] & 0x01;
- vsxxxaa_drop_bytes (mouse, 4);
- vsxxxaa_detection_done (mouse);
+ vsxxxaa_drop_bytes(mouse, 4);
+ vsxxxaa_detection_done(mouse);
if (error <= 0x1f) {
/* No (serious) error. Report buttons */
- input_report_key (dev, BTN_LEFT, left);
- input_report_key (dev, BTN_MIDDLE, middle);
- input_report_key (dev, BTN_RIGHT, right);
- input_report_key (dev, BTN_TOUCH, 0);
- input_sync (dev);
+ input_report_key(dev, BTN_LEFT, left);
+ input_report_key(dev, BTN_MIDDLE, middle);
+ input_report_key(dev, BTN_RIGHT, right);
+ input_report_key(dev, BTN_TOUCH, 0);
+ input_sync(dev);
if (error != 0)
- printk (KERN_INFO "Your %s on %s reports error=0x%02x\n",
- mouse->name, mouse->phys, error);
+ printk(KERN_INFO "Your %s on %s reports error=0x%02x\n",
+ mouse->name, mouse->phys, error);
}
@@ -381,18 +374,18 @@ vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse)
* If the mouse was hot-plugged, we need to force differential mode
* now... However, give it a second to recover from it's reset.
*/
- printk (KERN_NOTICE "%s on %s: Forceing standard packet format, "
- "incremental streaming mode and 72 samples/sec\n",
- mouse->name, mouse->phys);
- serio_write (mouse->serio, 'S'); /* Standard format */
- mdelay (50);
- serio_write (mouse->serio, 'R'); /* Incremental */
- mdelay (50);
- serio_write (mouse->serio, 'L'); /* 72 samples/sec */
+ printk(KERN_NOTICE
+ "%s on %s: Forcing standard packet format, "
+ "incremental streaming mode and 72 samples/sec\n",
+ mouse->name, mouse->phys);
+ serio_write(mouse->serio, 'S'); /* Standard format */
+ mdelay(50);
+ serio_write(mouse->serio, 'R'); /* Incremental */
+ mdelay(50);
+ serio_write(mouse->serio, 'L'); /* 72 samples/sec */
}
-static void
-vsxxxaa_parse_buffer (struct vsxxxaa *mouse)
+static void vsxxxaa_parse_buffer(struct vsxxxaa *mouse)
{
unsigned char *buf = mouse->buf;
int stray_bytes;
@@ -409,122 +402,107 @@ vsxxxaa_parse_buffer (struct vsxxxaa *mouse)
* activity on the mouse.
*/
while (mouse->count > 0 && !IS_HDR_BYTE(buf[0])) {
- printk (KERN_ERR "%s on %s: Dropping a byte to regain "
- "sync with mouse data stream...\n",
- mouse->name, mouse->phys);
- vsxxxaa_drop_bytes (mouse, 1);
+ printk(KERN_ERR "%s on %s: Dropping a byte to regain "
+ "sync with mouse data stream...\n",
+ mouse->name, mouse->phys);
+ vsxxxaa_drop_bytes(mouse, 1);
}
/*
* Check for packets we know about.
*/
- if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_REL, 3)) {
+ if (vsxxxaa_smells_like_packet(mouse, VSXXXAA_PACKET_REL, 3)) {
/* Check for broken packet */
- stray_bytes = vsxxxaa_check_packet (mouse, 3);
- if (stray_bytes > 0) {
- printk (KERN_ERR "Dropping %d bytes now...\n",
- stray_bytes);
- vsxxxaa_drop_bytes (mouse, stray_bytes);
- continue;
- }
-
- vsxxxaa_handle_REL_packet (mouse);
- continue; /* More to parse? */
- }
+ stray_bytes = vsxxxaa_check_packet(mouse, 3);
+ if (!stray_bytes)
+ vsxxxaa_handle_REL_packet(mouse);
- if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_ABS, 5)) {
+ } else if (vsxxxaa_smells_like_packet(mouse,
+ VSXXXAA_PACKET_ABS, 5)) {
/* Check for broken packet */
- stray_bytes = vsxxxaa_check_packet (mouse, 5);
- if (stray_bytes > 0) {
- printk (KERN_ERR "Dropping %d bytes now...\n",
- stray_bytes);
- vsxxxaa_drop_bytes (mouse, stray_bytes);
- continue;
- }
-
- vsxxxaa_handle_ABS_packet (mouse);
- continue; /* More to parse? */
- }
+ stray_bytes = vsxxxaa_check_packet(mouse, 5);
+ if (!stray_bytes)
+ vsxxxaa_handle_ABS_packet(mouse);
- if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_POR, 4)) {
+ } else if (vsxxxaa_smells_like_packet(mouse,
+ VSXXXAA_PACKET_POR, 4)) {
/* Check for broken packet */
- stray_bytes = vsxxxaa_check_packet (mouse, 4);
- if (stray_bytes > 0) {
- printk (KERN_ERR "Dropping %d bytes now...\n",
- stray_bytes);
- vsxxxaa_drop_bytes (mouse, stray_bytes);
- continue;
- }
-
- vsxxxaa_handle_POR_packet (mouse);
- continue; /* More to parse? */
+ stray_bytes = vsxxxaa_check_packet(mouse, 4);
+ if (!stray_bytes)
+ vsxxxaa_handle_POR_packet(mouse);
+
+ } else {
+ break; /* No REL, ABS or POR packet found */
+ }
+
+ if (stray_bytes > 0) {
+ printk(KERN_ERR "Dropping %d bytes now...\n",
+ stray_bytes);
+ vsxxxaa_drop_bytes(mouse, stray_bytes);
}
- break; /* No REL, ABS or POR packet found */
} while (1);
}
-static irqreturn_t
-vsxxxaa_interrupt (struct serio *serio, unsigned char data, unsigned int flags)
+static irqreturn_t vsxxxaa_interrupt(struct serio *serio,
+ unsigned char data, unsigned int flags)
{
- struct vsxxxaa *mouse = serio_get_drvdata (serio);
+ struct vsxxxaa *mouse = serio_get_drvdata(serio);
- vsxxxaa_queue_byte (mouse, data);
- vsxxxaa_parse_buffer (mouse);
+ vsxxxaa_queue_byte(mouse, data);
+ vsxxxaa_parse_buffer(mouse);
return IRQ_HANDLED;
}
-static void
-vsxxxaa_disconnect (struct serio *serio)
+static void vsxxxaa_disconnect(struct serio *serio)
{
- struct vsxxxaa *mouse = serio_get_drvdata (serio);
+ struct vsxxxaa *mouse = serio_get_drvdata(serio);
- serio_close (serio);
- serio_set_drvdata (serio, NULL);
- input_unregister_device (mouse->dev);
- kfree (mouse);
+ serio_close(serio);
+ serio_set_drvdata(serio, NULL);
+ input_unregister_device(mouse->dev);
+ kfree(mouse);
}
-static int
-vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
+static int vsxxxaa_connect(struct serio *serio, struct serio_driver *drv)
{
struct vsxxxaa *mouse;
struct input_dev *input_dev;
int err = -ENOMEM;
- mouse = kzalloc (sizeof (struct vsxxxaa), GFP_KERNEL);
- input_dev = input_allocate_device ();
+ mouse = kzalloc(sizeof(struct vsxxxaa), GFP_KERNEL);
+ input_dev = input_allocate_device();
if (!mouse || !input_dev)
goto fail1;
mouse->dev = input_dev;
mouse->serio = serio;
- strlcat (mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer",
- sizeof (mouse->name));
- snprintf (mouse->phys, sizeof (mouse->phys), "%s/input0", serio->phys);
+ strlcat(mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer",
+ sizeof(mouse->name));
+ snprintf(mouse->phys, sizeof(mouse->phys), "%s/input0", serio->phys);
input_dev->name = mouse->name;
input_dev->phys = mouse->phys;
input_dev->id.bustype = BUS_RS232;
input_dev->dev.parent = &serio->dev;
- set_bit (EV_KEY, input_dev->evbit); /* We have buttons */
- set_bit (EV_REL, input_dev->evbit);
- set_bit (EV_ABS, input_dev->evbit);
- set_bit (BTN_LEFT, input_dev->keybit); /* We have 3 buttons */
- set_bit (BTN_MIDDLE, input_dev->keybit);
- set_bit (BTN_RIGHT, input_dev->keybit);
- set_bit (BTN_TOUCH, input_dev->keybit); /* ...and Tablet */
- set_bit (REL_X, input_dev->relbit);
- set_bit (REL_Y, input_dev->relbit);
- input_set_abs_params (input_dev, ABS_X, 0, 1023, 0, 0);
- input_set_abs_params (input_dev, ABS_Y, 0, 1023, 0, 0);
-
- serio_set_drvdata (serio, mouse);
-
- err = serio_open (serio, drv);
+ __set_bit(EV_KEY, input_dev->evbit); /* We have buttons */
+ __set_bit(EV_REL, input_dev->evbit);
+ __set_bit(EV_ABS, input_dev->evbit);
+ __set_bit(BTN_LEFT, input_dev->keybit); /* We have 3 buttons */
+ __set_bit(BTN_MIDDLE, input_dev->keybit);
+ __set_bit(BTN_RIGHT, input_dev->keybit);
+ __set_bit(BTN_TOUCH, input_dev->keybit); /* ...and Tablet */
+ __set_bit(REL_X, input_dev->relbit);
+ __set_bit(REL_Y, input_dev->relbit);
+ input_set_abs_params(input_dev, ABS_X, 0, 1023, 0, 0);
+ input_set_abs_params(input_dev, ABS_Y, 0, 1023, 0, 0);
+
+ serio_set_drvdata(serio, mouse);
+
+ err = serio_open(serio, drv);
if (err)
goto fail2;
@@ -532,18 +510,18 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
* Request selftest. Standard packet format and differential
* mode will be requested after the device ID'ed successfully.
*/
- serio_write (serio, 'T'); /* Test */
+ serio_write(serio, 'T'); /* Test */
- err = input_register_device (input_dev);
+ err = input_register_device(input_dev);
if (err)
goto fail3;
return 0;
- fail3: serio_close (serio);
- fail2: serio_set_drvdata (serio, NULL);
- fail1: input_free_device (input_dev);
- kfree (mouse);
+ fail3: serio_close(serio);
+ fail2: serio_set_drvdata(serio, NULL);
+ fail1: input_free_device(input_dev);
+ kfree(mouse);
return err;
}
@@ -570,18 +548,16 @@ static struct serio_driver vsxxxaa_drv = {
.disconnect = vsxxxaa_disconnect,
};
-static int __init
-vsxxxaa_init (void)
+static int __init vsxxxaa_init(void)
{
return serio_register_driver(&vsxxxaa_drv);
}
-static void __exit
-vsxxxaa_exit (void)
+static void __exit vsxxxaa_exit(void)
{
serio_unregister_driver(&vsxxxaa_drv);
}
-module_init (vsxxxaa_init);
-module_exit (vsxxxaa_exit);
+module_init(vsxxxaa_init);
+module_exit(vsxxxaa_exit);
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index aa533ceffe34..7e319d65ec57 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -201,4 +201,12 @@ config SERIO_XILINX_XPS_PS2
To compile this driver as a module, choose M here: the
module will be called xilinx_ps2.
+config SERIO_ALTERA_PS2
+ tristate "Altera UP PS/2 controller"
+ help
+ Say Y here if you have Altera University Program PS/2 ports.
+
+ To compile this driver as a module, choose M here: the
+ module will be called altera_ps2.
+
endif
diff --git a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile
index 9b6c8135955f..bf945f789d05 100644
--- a/drivers/input/serio/Makefile
+++ b/drivers/input/serio/Makefile
@@ -22,3 +22,4 @@ obj-$(CONFIG_SERIO_MACEPS2) += maceps2.o
obj-$(CONFIG_SERIO_LIBPS2) += libps2.o
obj-$(CONFIG_SERIO_RAW) += serio_raw.o
obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.o
+obj-$(CONFIG_SERIO_ALTERA_PS2) += altera_ps2.o
diff --git a/drivers/input/serio/altera_ps2.c b/drivers/input/serio/altera_ps2.c
new file mode 100644
index 000000000000..f479ea50919f
--- /dev/null
+++ b/drivers/input/serio/altera_ps2.c
@@ -0,0 +1,200 @@
+/*
+ * Altera University Program PS2 controller driver
+ *
+ * Copyright (C) 2008 Thomas Chou <thomas@wytron.com.tw>
+ *
+ * Based on sa1111ps2.c, which is:
+ * Copyright (C) 2002 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/serio.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+
+#define DRV_NAME "altera_ps2"
+
+struct ps2if {
+ struct serio *io;
+ struct resource *iomem_res;
+ void __iomem *base;
+ unsigned irq;
+};
+
+/*
+ * Read all bytes waiting in the PS2 port. There should be
+ * at the most one, but we loop for safety.
+ */
+static irqreturn_t altera_ps2_rxint(int irq, void *dev_id)
+{
+ struct ps2if *ps2if = dev_id;
+ unsigned int status;
+ int handled = IRQ_NONE;
+
+ while ((status = readl(ps2if->base)) & 0xffff0000) {
+ serio_interrupt(ps2if->io, status & 0xff, 0);
+ handled = IRQ_HANDLED;
+ }
+
+ return handled;
+}
+
+/*
+ * Write a byte to the PS2 port.
+ */
+static int altera_ps2_write(struct serio *io, unsigned char val)
+{
+ struct ps2if *ps2if = io->port_data;
+
+ writel(val, ps2if->base);
+ return 0;
+}
+
+static int altera_ps2_open(struct serio *io)
+{
+ struct ps2if *ps2if = io->port_data;
+
+ /* clear fifo */
+ while (readl(ps2if->base) & 0xffff0000)
+ /* empty */;
+
+ writel(1, ps2if->base + 4); /* enable rx irq */
+ return 0;
+}
+
+static void altera_ps2_close(struct serio *io)
+{
+ struct ps2if *ps2if = io->port_data;
+
+ writel(0, ps2if->base); /* disable rx irq */
+}
+
+/*
+ * Add one device to this driver.
+ */
+static int altera_ps2_probe(struct platform_device *pdev)
+{
+ struct ps2if *ps2if;
+ struct serio *serio;
+ int error;
+
+ ps2if = kzalloc(sizeof(struct ps2if), GFP_KERNEL);
+ serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
+ if (!ps2if || !serio) {
+ error = -ENOMEM;
+ goto err_free_mem;
+ }
+
+ serio->id.type = SERIO_8042;
+ serio->write = altera_ps2_write;
+ serio->open = altera_ps2_open;
+ serio->close = altera_ps2_close;
+ strlcpy(serio->name, dev_name(&pdev->dev), sizeof(serio->name));
+ strlcpy(serio->phys, dev_name(&pdev->dev), sizeof(serio->phys));
+ serio->port_data = ps2if;
+ serio->dev.parent = &pdev->dev;
+ ps2if->io = serio;
+
+ ps2if->iomem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (ps2if->iomem_res == NULL) {
+ error = -ENOENT;
+ goto err_free_mem;
+ }
+
+ ps2if->irq = platform_get_irq(pdev, 0);
+ if (ps2if->irq < 0) {
+ error = -ENXIO;
+ goto err_free_mem;
+ }
+
+ if (!request_mem_region(ps2if->iomem_res->start,
+ resource_size(ps2if->iomem_res), pdev->name)) {
+ error = -EBUSY;
+ goto err_free_mem;
+ }
+
+ ps2if->base = ioremap(ps2if->iomem_res->start,
+ resource_size(ps2if->iomem_res));
+ if (!ps2if->base) {
+ error = -ENOMEM;
+ goto err_free_res;
+ }
+
+ error = request_irq(ps2if->irq, altera_ps2_rxint, 0, pdev->name, ps2if);
+ if (error) {
+ dev_err(&pdev->dev, "could not allocate IRQ %d: %d\n",
+ ps2if->irq, error);
+ goto err_unmap;
+ }
+
+ dev_info(&pdev->dev, "base %p, irq %d\n", ps2if->base, ps2if->irq);
+
+ serio_register_port(ps2if->io);
+ platform_set_drvdata(pdev, ps2if);
+
+ return 0;
+
+ err_unmap:
+ iounmap(ps2if->base);
+ err_free_res:
+ release_mem_region(ps2if->iomem_res->start,
+ resource_size(ps2if->iomem_res));
+ err_free_mem:
+ kfree(ps2if);
+ kfree(serio);
+ return error;
+}
+
+/*
+ * Remove one device from this driver.
+ */
+static int altera_ps2_remove(struct platform_device *pdev)
+{
+ struct ps2if *ps2if = platform_get_drvdata(pdev);
+
+ platform_set_drvdata(pdev, NULL);
+ serio_unregister_port(ps2if->io);
+ free_irq(ps2if->irq, ps2if);
+ iounmap(ps2if->base);
+ release_mem_region(ps2if->iomem_res->start,
+ resource_size(ps2if->iomem_res));
+ kfree(ps2if);
+
+ return 0;
+}
+
+/*
+ * Our device driver structure
+ */
+static struct platform_driver altera_ps2_driver = {
+ .probe = altera_ps2_probe,
+ .remove = altera_ps2_remove,
+ .driver = {
+ .name = DRV_NAME,
+ },
+};
+
+static int __init altera_ps2_init(void)
+{
+ return platform_driver_register(&altera_ps2_driver);
+}
+
+static void __exit altera_ps2_exit(void)
+{
+ platform_driver_unregister(&altera_ps2_driver);
+}
+
+module_init(altera_ps2_init);
+module_exit(altera_ps2_exit);
+
+MODULE_DESCRIPTION("Altera University Program PS2 controller driver");
+MODULE_AUTHOR("Thomas Chou <thomas@wytron.com.tw>");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index a39bc4eb902b..a537925f7651 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -327,6 +327,17 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
},
},
{
+ /*
+ * Reset and GET ID commands issued via KBD port are
+ * sometimes being delivered to AUX3.
+ */
+ .ident = "Sony Vaio FZ-240E",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ240E"),
+ },
+ },
+ {
.ident = "Amoi M636/A737",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
@@ -661,7 +672,7 @@ static void i8042_pnp_exit(void)
static int __init i8042_pnp_init(void)
{
char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
- int pnp_data_busted = false;
+ bool pnp_data_busted = false;
int err;
#ifdef CONFIG_X86
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 8cc453c85ea7..f7ad1a13c74e 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -111,6 +111,18 @@ config TOUCHSCREEN_DA9034
Say Y here to enable the support for the touchscreen found
on Dialog Semiconductor DA9034 PMIC.
+config TOUCHSCREEN_DYNAPRO
+ tristate "Dynapro serial touchscreen"
+ select SERIO
+ help
+ Say Y here if you have a Dynapro serial touchscreen connected to
+ your system.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called elo.
+
config TOUCHSCREEN_EETI
tristate "EETI touchscreen panel support"
depends on I2C
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 15fa62cffc77..1f5cccd3a16a 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o
obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o
obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o
obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o
+obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o
obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o
obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o
obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o
diff --git a/drivers/input/touchscreen/dynapro.c b/drivers/input/touchscreen/dynapro.c
new file mode 100644
index 000000000000..455353908bdf
--- /dev/null
+++ b/drivers/input/touchscreen/dynapro.c
@@ -0,0 +1,206 @@
+/*
+ * Dynapro serial touchscreen driver
+ *
+ * Copyright (c) 2009 Tias Guns
+ * Based on the inexio driver (c) Vojtech Pavlik and Dan Streetman and
+ * Richard Lemon
+ *
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+
+/*
+ * 2009/09/19 Tias Guns <tias@ulyssis.org>
+ * Copied inexio.c and edited for Dynapro protocol (from retired Xorg module)
+ */
+
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/input.h>
+#include <linux/serio.h>
+#include <linux/init.h>
+
+#define DRIVER_DESC "Dynapro serial touchscreen driver"
+
+MODULE_AUTHOR("Tias Guns <tias@ulyssis.org>");
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
+
+/*
+ * Definitions & global arrays.
+ */
+
+#define DYNAPRO_FORMAT_TOUCH_BIT 0x40
+#define DYNAPRO_FORMAT_LENGTH 3
+#define DYNAPRO_RESPONSE_BEGIN_BYTE 0x80
+
+#define DYNAPRO_MIN_XC 0
+#define DYNAPRO_MAX_XC 0x3ff
+#define DYNAPRO_MIN_YC 0
+#define DYNAPRO_MAX_YC 0x3ff
+
+#define DYNAPRO_GET_XC(data) (data[1] | ((data[0] & 0x38) << 4))
+#define DYNAPRO_GET_YC(data) (data[2] | ((data[0] & 0x07) << 7))
+#define DYNAPRO_GET_TOUCHED(data) (DYNAPRO_FORMAT_TOUCH_BIT & data[0])
+
+/*
+ * Per-touchscreen data.
+ */
+
+struct dynapro {
+ struct input_dev *dev;
+ struct serio *serio;
+ int idx;
+ unsigned char data[DYNAPRO_FORMAT_LENGTH];
+ char phys[32];
+};
+
+static void dynapro_process_data(struct dynapro *pdynapro)
+{
+ struct input_dev *dev = pdynapro->dev;
+
+ if (DYNAPRO_FORMAT_LENGTH == ++pdynapro->idx) {
+ input_report_abs(dev, ABS_X, DYNAPRO_GET_XC(pdynapro->data));
+ input_report_abs(dev, ABS_Y, DYNAPRO_GET_YC(pdynapro->data));
+ input_report_key(dev, BTN_TOUCH,
+ DYNAPRO_GET_TOUCHED(pdynapro->data));
+ input_sync(dev);
+
+ pdynapro->idx = 0;
+ }
+}
+
+static irqreturn_t dynapro_interrupt(struct serio *serio,
+ unsigned char data, unsigned int flags)
+{
+ struct dynapro *pdynapro = serio_get_drvdata(serio);
+
+ pdynapro->data[pdynapro->idx] = data;
+
+ if (DYNAPRO_RESPONSE_BEGIN_BYTE & pdynapro->data[0])
+ dynapro_process_data(pdynapro);
+ else
+ dev_dbg(&serio->dev, "unknown/unsynchronized data: %x\n",
+ pdynapro->data[0]);
+
+ return IRQ_HANDLED;
+}
+
+static void dynapro_disconnect(struct serio *serio)
+{
+ struct dynapro *pdynapro = serio_get_drvdata(serio);
+
+ input_get_device(pdynapro->dev);
+ input_unregister_device(pdynapro->dev);
+ serio_close(serio);
+ serio_set_drvdata(serio, NULL);
+ input_put_device(pdynapro->dev);
+ kfree(pdynapro);
+}
+
+/*
+ * dynapro_connect() is the routine that is called when someone adds a
+ * new serio device that supports dynapro protocol and registers it as
+ * an input device. This is usually accomplished using inputattach.
+ */
+
+static int dynapro_connect(struct serio *serio, struct serio_driver *drv)
+{
+ struct dynapro *pdynapro;
+ struct input_dev *input_dev;
+ int err;
+
+ pdynapro = kzalloc(sizeof(struct dynapro), GFP_KERNEL);
+ input_dev = input_allocate_device();
+ if (!pdynapro || !input_dev) {
+ err = -ENOMEM;
+ goto fail1;
+ }
+
+ pdynapro->serio = serio;
+ pdynapro->dev = input_dev;
+ snprintf(pdynapro->phys, sizeof(pdynapro->phys),
+ "%s/input0", serio->phys);
+
+ input_dev->name = "Dynapro Serial TouchScreen";
+ input_dev->phys = pdynapro->phys;
+ input_dev->id.bustype = BUS_RS232;
+ input_dev->id.vendor = SERIO_DYNAPRO;
+ input_dev->id.product = 0;
+ input_dev->id.version = 0x0001;
+ input_dev->dev.parent = &serio->dev;
+ input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+ input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
+ input_set_abs_params(pdynapro->dev, ABS_X,
+ DYNAPRO_MIN_XC, DYNAPRO_MAX_XC, 0, 0);
+ input_set_abs_params(pdynapro->dev, ABS_Y,
+ DYNAPRO_MIN_YC, DYNAPRO_MAX_YC, 0, 0);
+
+ serio_set_drvdata(serio, pdynapro);
+
+ err = serio_open(serio, drv);
+ if (err)
+ goto fail2;
+
+ err = input_register_device(pdynapro->dev);
+ if (err)
+ goto fail3;
+
+ return 0;
+
+ fail3: serio_close(serio);
+ fail2: serio_set_drvdata(serio, NULL);
+ fail1: input_free_device(input_dev);
+ kfree(pdynapro);
+ return err;
+}
+
+/*
+ * The serio driver structure.
+ */
+
+static struct serio_device_id dynapro_serio_ids[] = {
+ {
+ .type = SERIO_RS232,
+ .proto = SERIO_DYNAPRO,
+ .id = SERIO_ANY,
+ .extra = SERIO_ANY,
+ },
+ { 0 }
+};
+
+MODULE_DEVICE_TABLE(serio, dynapro_serio_ids);
+
+static struct serio_driver dynapro_drv = {
+ .driver = {
+ .name = "dynapro",
+ },
+ .description = DRIVER_DESC,
+ .id_table = dynapro_serio_ids,
+ .interrupt = dynapro_interrupt,
+ .connect = dynapro_connect,
+ .disconnect = dynapro_disconnect,
+};
+
+/*
+ * The functions for inserting/removing us as a module.
+ */
+
+static int __init dynapro_init(void)
+{
+ return serio_register_driver(&dynapro_drv);
+}
+
+static void __exit dynapro_exit(void)
+{
+ serio_unregister_driver(&dynapro_drv);
+}
+
+module_init(dynapro_init);
+module_exit(dynapro_exit);
diff --git a/drivers/input/xen-kbdfront.c b/drivers/input/xen-kbdfront.c
index b115726dc088..c721c0a23eb8 100644
--- a/drivers/input/xen-kbdfront.c
+++ b/drivers/input/xen-kbdfront.c
@@ -21,7 +21,10 @@
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/input.h>
+
#include <asm/xen/hypervisor.h>
+
+#include <xen/xen.h>
#include <xen/events.h>
#include <xen/page.h>
#include <xen/interface/io/fbif.h>