aboutsummaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/input/touchscreen
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/Kconfig98
-rw-r--r--drivers/input/touchscreen/Makefile13
-rw-r--r--drivers/input/touchscreen/corgi_ts.c380
-rw-r--r--drivers/input/touchscreen/elo.c315
-rw-r--r--drivers/input/touchscreen/gunze.c205
-rw-r--r--drivers/input/touchscreen/h3600_ts_input.c528
-rw-r--r--drivers/input/touchscreen/hp680_ts_input.c135
-rw-r--r--drivers/input/touchscreen/mk712.c222
-rw-r--r--drivers/input/touchscreen/mtouch.c219
9 files changed, 2115 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
new file mode 100644
index 00000000000..7e991274ea4
--- /dev/null
+++ b/drivers/input/touchscreen/Kconfig
@@ -0,0 +1,98 @@
+#
+# Mouse driver configuration
+#
+menuconfig INPUT_TOUCHSCREEN
+ bool "Touchscreens"
+ help
+ Say Y here, and a list of supported touchscreens will be displayed.
+ This option doesn't affect the kernel.
+
+ If unsure, say Y.
+
+if INPUT_TOUCHSCREEN
+
+config TOUCHSCREEN_BITSY
+ tristate "Compaq iPAQ H3600 (Bitsy) touchscreen"
+ depends on SA1100_BITSY
+ select SERIO
+ help
+ Say Y here if you have the h3600 (Bitsy) touchscreen.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called h3600_ts_input.
+
+config TOUCHSCREEN_CORGI
+ tristate "Corgi touchscreen (for Sharp SL-C7xx)"
+ depends on PXA_SHARPSL
+ default y
+ help
+ Say Y here to enable the driver for the touchscreen on the
+ Sharp SL-C7xx series of PDAs.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ads7846_ts.
+
+config TOUCHSCREEN_GUNZE
+ tristate "Gunze AHL-51S touchscreen"
+ select SERIO
+ help
+ Say Y here if you have the Gunze AHL-51 touchscreen connected to
+ your system.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called gunze.
+
+config TOUCHSCREEN_ELO
+ tristate "Elo serial touchscreens"
+ select SERIO
+ help
+ Say Y here if you have an Elo 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 gunze.
+
+config TOUCHSCREEN_MTOUCH
+ tristate "MicroTouch serial touchscreens"
+ select SERIO
+ help
+ Say Y here if you have a MicroTouch (3M) 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 mtouch.
+
+config TOUCHSCREEN_MK712
+ tristate "ICS MicroClock MK712 touchscreen"
+ help
+ Say Y here if you have the ICS MicroClock MK712 touchscreen
+ controller chip in your system.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called mk712.
+
+config TOUCHSCREEN_HP600
+ tristate "HP Jornada 680/690 touchscreen"
+ depends on SH_HP600 && SH_ADC
+ help
+ Say Y here if you have a HP Jornada 680 or 690 and want to
+ support the built-in touchscreen.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called hp680_ts_input.
+
+endif
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
new file mode 100644
index 00000000000..6842869c9a2
--- /dev/null
+++ b/drivers/input/touchscreen/Makefile
@@ -0,0 +1,13 @@
+#
+# Makefile for the mouse drivers.
+#
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o
+obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o
+obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o
+obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o
+obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o
+obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o
+obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o
diff --git a/drivers/input/touchscreen/corgi_ts.c b/drivers/input/touchscreen/corgi_ts.c
new file mode 100644
index 00000000000..3f8b61cfbc3
--- /dev/null
+++ b/drivers/input/touchscreen/corgi_ts.c
@@ -0,0 +1,380 @@
+/*
+ * Touchscreen driver for Sharp Corgi models (SL-C7xx)
+ *
+ * Copyright (c) 2004-2005 Richard Purdie
+ *
+ * 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/delay.h>
+#include <linux/device.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <asm/irq.h>
+
+#include <asm/arch/corgi.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/pxa-regs.h>
+
+
+#define PWR_MODE_ACTIVE 0
+#define PWR_MODE_SUSPEND 1
+
+#define X_AXIS_MAX 3830
+#define X_AXIS_MIN 150
+#define Y_AXIS_MAX 3830
+#define Y_AXIS_MIN 190
+#define PRESSURE_MIN 0
+#define PRESSURE_MAX 15000
+
+struct ts_event {
+ short pressure;
+ short x;
+ short y;
+};
+
+struct corgi_ts {
+ char phys[32];
+ struct input_dev input;
+ struct timer_list timer;
+ struct ts_event tc;
+ int pendown;
+ int power_mode;
+};
+
+#define STATUS_HSYNC (GPLR(CORGI_GPIO_HSYNC) & GPIO_bit(CORGI_GPIO_HSYNC))
+
+#define SyncHS() while((STATUS_HSYNC) == 0); while((STATUS_HSYNC) != 0);
+#define CCNT(a) asm volatile ("mrc p14, 0, %0, C1, C0, 0" : "=r"(a))
+#define CCNT_ON() {int pmnc = 1; asm volatile ("mcr p14, 0, %0, C0, C0, 0" : : "r"(pmnc));}
+#define CCNT_OFF() {int pmnc = 0; asm volatile ("mcr p14, 0, %0, C0, C0, 0" : : "r"(pmnc));}
+
+#define WAIT_HS_400_VGA 7013U // 17.615us
+#define WAIT_HS_400_QVGA 16622U // 41.750us
+
+
+/* ADS7846 Touch Screen Controller bit definitions */
+#define ADSCTRL_PD0 (1u << 0) /* PD0 */
+#define ADSCTRL_PD1 (1u << 1) /* PD1 */
+#define ADSCTRL_DFR (1u << 2) /* SER/DFR */
+#define ADSCTRL_MOD (1u << 3) /* Mode */
+#define ADSCTRL_ADR_SH 4 /* Address setting */
+#define ADSCTRL_STS (1u << 7) /* Start Bit */
+
+/* External Functions */
+extern int w100fb_get_xres(void);
+extern int w100fb_get_blanking(void);
+extern int w100fb_get_fastsysclk(void);
+extern unsigned int get_clk_frequency_khz(int info);
+
+static unsigned long calc_waittime(void)
+{
+ int w100fb_xres = w100fb_get_xres();
+ unsigned int waittime = 0;
+
+ if (w100fb_xres == 480 || w100fb_xres == 640) {
+ waittime = WAIT_HS_400_VGA * get_clk_frequency_khz(0) / 398131U;
+
+ if (w100fb_get_fastsysclk() == 100)
+ waittime = waittime * 75 / 100;
+
+ if (w100fb_xres == 640)
+ waittime *= 3;
+
+ return waittime;
+ }
+
+ return WAIT_HS_400_QVGA * get_clk_frequency_khz(0) / 398131U;
+}
+
+static int sync_receive_data_send_cmd(int doRecive, int doSend, unsigned int address, unsigned long wait_time)
+{
+ int pos = 0;
+ unsigned long timer1 = 0, timer2;
+ int dosleep;
+
+ dosleep = !w100fb_get_blanking();
+
+ if (dosleep && doSend) {
+ CCNT_ON();
+ /* polling HSync */
+ SyncHS();
+ /* get CCNT */
+ CCNT(timer1);
+ }
+
+ if (doRecive)
+ pos = corgi_ssp_ads7846_get();
+
+ if (doSend) {
+ int cmd = ADSCTRL_PD0 | ADSCTRL_PD1 | (address << ADSCTRL_ADR_SH) | ADSCTRL_STS;
+ /* dummy command */
+ corgi_ssp_ads7846_put(cmd);
+ corgi_ssp_ads7846_get();
+
+ if (dosleep) {
+ /* Wait after HSync */
+ CCNT(timer2);
+ if (timer2-timer1 > wait_time) {
+ /* timeout */
+ SyncHS();
+ /* get OSCR */
+ CCNT(timer1);
+ /* Wait after HSync */
+ CCNT(timer2);
+ }
+ while (timer2 - timer1 < wait_time)
+ CCNT(timer2);
+ }
+ corgi_ssp_ads7846_put(cmd);
+ if (dosleep)
+ CCNT_OFF();
+ }
+ return pos;
+}
+
+static int read_xydata(struct corgi_ts *corgi_ts)
+{
+ unsigned int x, y, z1, z2;
+ unsigned long flags, wait_time;
+
+ /* critical section */
+ local_irq_save(flags);
+ corgi_ssp_ads7846_lock();
+ wait_time=calc_waittime();
+
+ /* Y-axis */
+ sync_receive_data_send_cmd(0, 1, 1u, wait_time);
+
+ /* Y-axis */
+ sync_receive_data_send_cmd(1, 1, 1u, wait_time);
+
+ /* X-axis */
+ y = sync_receive_data_send_cmd(1, 1, 5u, wait_time);
+
+ /* Z1 */
+ x = sync_receive_data_send_cmd(1, 1, 3u, wait_time);
+
+ /* Z2 */
+ z1 = sync_receive_data_send_cmd(1, 1, 4u, wait_time);
+ z2 = sync_receive_data_send_cmd(1, 0, 4u, wait_time);
+
+ /* Power-Down Enable */
+ corgi_ssp_ads7846_put((1u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
+ corgi_ssp_ads7846_get();
+
+ corgi_ssp_ads7846_unlock();
+ local_irq_restore(flags);
+
+ if (x== 0 || y == 0 || z1 == 0 || (x * (z2 - z1) / z1) >= 15000) {
+ corgi_ts->tc.pressure = 0;
+ return 0;
+ }
+
+ corgi_ts->tc.x = x;
+ corgi_ts->tc.y = y;
+ corgi_ts->tc.pressure = (x * (z2 - z1)) / z1;
+ return 1;
+}
+
+static void new_data(struct corgi_ts *corgi_ts, struct pt_regs *regs)
+{
+ if (corgi_ts->power_mode != PWR_MODE_ACTIVE)
+ return;
+
+ if (!corgi_ts->tc.pressure && corgi_ts->pendown == 0)
+ return;
+
+ if (regs)
+ input_regs(&corgi_ts->input, regs);
+
+ input_report_abs(&corgi_ts->input, ABS_X, corgi_ts->tc.x);
+ input_report_abs(&corgi_ts->input, ABS_Y, corgi_ts->tc.y);
+ input_report_abs(&corgi_ts->input, ABS_PRESSURE, corgi_ts->tc.pressure);
+ input_report_key(&corgi_ts->input, BTN_TOUCH, (corgi_ts->pendown != 0));
+ input_sync(&corgi_ts->input);
+}
+
+static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer, struct pt_regs *regs)
+{
+ if ((GPLR(CORGI_GPIO_TP_INT) & GPIO_bit(CORGI_GPIO_TP_INT)) == 0) {
+ /* Disable Interrupt */
+ set_irq_type(CORGI_IRQ_GPIO_TP_INT, IRQT_NOEDGE);
+ if (read_xydata(corgi_ts)) {
+ corgi_ts->pendown = 1;
+ new_data(corgi_ts, regs);
+ }
+ mod_timer(&corgi_ts->timer, jiffies + HZ / 100);
+ } else {
+ if (corgi_ts->pendown == 1 || corgi_ts->pendown == 2) {
+ mod_timer(&corgi_ts->timer, jiffies + HZ / 100);
+ corgi_ts->pendown++;
+ return;
+ }
+
+ if (corgi_ts->pendown) {
+ corgi_ts->tc.pressure = 0;
+ new_data(corgi_ts, regs);
+ }
+
+ /* Enable Falling Edge */
+ set_irq_type(CORGI_IRQ_GPIO_TP_INT, IRQT_FALLING);
+ corgi_ts->pendown = 0;
+ }
+}
+
+static void corgi_ts_timer(unsigned long data)
+{
+ struct corgi_ts *corgits_data = (struct corgi_ts *) data;
+ ts_interrupt_main(corgits_data, 1, NULL);
+}
+
+static irqreturn_t ts_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+ struct corgi_ts *corgits_data = dev_id;
+ ts_interrupt_main(corgits_data, 0, regs);
+ return IRQ_HANDLED;
+}
+
+#ifdef CONFIG_PM
+static int corgits_suspend(struct device *dev, uint32_t state, uint32_t level)
+{
+ if (level == SUSPEND_POWER_DOWN) {
+ struct corgi_ts *corgi_ts = dev_get_drvdata(dev);
+
+ if (corgi_ts->pendown) {
+ del_timer_sync(&corgi_ts->timer);
+ corgi_ts->tc.pressure = 0;
+ new_data(corgi_ts, NULL);
+ corgi_ts->pendown = 0;
+ }
+ corgi_ts->power_mode = PWR_MODE_SUSPEND;
+
+ corgi_ssp_ads7846_putget((1u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
+ }
+ return 0;
+}
+
+static int corgits_resume(struct device *dev, uint32_t level)
+{
+ if (level == RESUME_POWER_ON) {
+ struct corgi_ts *corgi_ts = dev_get_drvdata(dev);
+
+ corgi_ssp_ads7846_putget((4u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
+ /* Enable Falling Edge */
+ set_irq_type(CORGI_IRQ_GPIO_TP_INT, IRQT_FALLING);
+ corgi_ts->power_mode = PWR_MODE_ACTIVE;
+ }
+ return 0;
+}
+#else
+#define corgits_suspend NULL
+#define corgits_resume NULL
+#endif
+
+static int __init corgits_probe(struct device *dev)
+{
+ struct corgi_ts *corgi_ts;
+
+ if (!(corgi_ts = kmalloc(sizeof(struct corgi_ts), GFP_KERNEL)))
+ return -ENOMEM;
+
+ dev_set_drvdata(dev, corgi_ts);
+
+ memset(corgi_ts, 0, sizeof(struct corgi_ts));
+
+ init_input_dev(&corgi_ts->input);
+ corgi_ts->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
+ corgi_ts->input.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
+ input_set_abs_params(&corgi_ts->input, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0);
+ input_set_abs_params(&corgi_ts->input, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0);
+ input_set_abs_params(&corgi_ts->input, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0);
+
+ strcpy(corgi_ts->phys, "corgits/input0");
+
+ corgi_ts->input.private = corgi_ts;
+ corgi_ts->input.name = "Corgi Touchscreen";
+ corgi_ts->input.dev = dev;
+ corgi_ts->input.phys = corgi_ts->phys;
+ corgi_ts->input.id.bustype = BUS_HOST;
+ corgi_ts->input.id.vendor = 0x0001;
+ corgi_ts->input.id.product = 0x0002;
+ corgi_ts->input.id.version = 0x0100;
+
+ pxa_gpio_mode(CORGI_GPIO_TP_INT | GPIO_IN);
+ pxa_gpio_mode(CORGI_GPIO_HSYNC | GPIO_IN);
+
+ /* Initiaize ADS7846 Difference Reference mode */
+ corgi_ssp_ads7846_putget((1u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
+ mdelay(5);
+ corgi_ssp_ads7846_putget((3u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
+ mdelay(5);
+ corgi_ssp_ads7846_putget((4u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
+ mdelay(5);
+ corgi_ssp_ads7846_putget((5u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
+ mdelay(5);
+
+ init_timer(&corgi_ts->timer);
+ corgi_ts->timer.data = (unsigned long) corgi_ts;
+ corgi_ts->timer.function = corgi_ts_timer;
+
+ input_register_device(&corgi_ts->input);
+ corgi_ts->power_mode = PWR_MODE_ACTIVE;
+
+ if (request_irq(CORGI_IRQ_GPIO_TP_INT, ts_interrupt, SA_INTERRUPT, "ts", corgi_ts)) {
+ input_unregister_device(&corgi_ts->input);
+ kfree(corgi_ts);
+ return -EBUSY;
+ }
+
+ /* Enable Falling Edge */
+ set_irq_type(CORGI_IRQ_GPIO_TP_INT, IRQT_FALLING);
+
+ printk(KERN_INFO "input: Corgi Touchscreen Registered\n");
+
+ return 0;
+}
+
+static int corgits_remove(struct device *dev)
+{
+ struct corgi_ts *corgi_ts = dev_get_drvdata(dev);
+
+ free_irq(CORGI_IRQ_GPIO_TP_INT, NULL);
+ del_timer_sync(&corgi_ts->timer);
+ input_unregister_device(&corgi_ts->input);
+ kfree(corgi_ts);
+ return 0;
+}
+
+static struct device_driver corgits_driver = {
+ .name = "corgi-ts",
+ .bus = &platform_bus_type,
+ .probe = corgits_probe,
+ .remove = corgits_remove,
+ .suspend = corgits_suspend,
+ .resume = corgits_resume,
+};
+
+static int __devinit corgits_init(void)
+{
+ return driver_register(&corgits_driver);
+}
+
+static void __exit corgits_exit(void)
+{
+ driver_unregister(&corgits_driver);
+}
+
+module_init(corgits_init);
+module_exit(corgits_exit);
+
+MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
+MODULE_DESCRIPTION("Corgi TouchScreen Driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c
new file mode 100644
index 00000000000..546ce599334
--- /dev/null
+++ b/drivers/input/touchscreen/elo.c
@@ -0,0 +1,315 @@
+/*
+ * Elo serial touchscreen driver
+ *
+ * Copyright (c) 2004 Vojtech Pavlik
+ */
+
+/*
+ * 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.
+ */
+
+/*
+ * This driver can handle serial Elo touchscreens using either the Elo standard
+ * 'E271-2210' 10-byte protocol, Elo legacy 'E281A-4002' 6-byte protocol, Elo
+ * legacy 'E271-140' 4-byte protocol and Elo legacy 'E261-280' 3-byte protocol.
+ */
+
+#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 "Elo serial touchscreen driver"
+
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
+
+/*
+ * Definitions & global arrays.
+ */
+
+#define ELO_MAX_LENGTH 10
+
+static char *elo_name = "Elo Serial TouchScreen";
+
+/*
+ * Per-touchscreen data.
+ */
+
+struct elo {
+ struct input_dev dev;
+ struct serio *serio;
+ int id;
+ int idx;
+ unsigned char csum;
+ unsigned char data[ELO_MAX_LENGTH];
+ char phys[32];
+};
+
+static void elo_process_data_10(struct elo* elo, unsigned char data, struct pt_regs *regs)
+{
+ struct input_dev *dev = &elo->dev;
+
+ elo->csum += elo->data[elo->idx] = data;
+
+ switch (elo->idx++) {
+
+ case 0:
+ if (data != 'U') {
+ elo->idx = 0;
+ elo->csum = 0;
+ }
+ break;
+
+ case 1:
+ if (data != 'T') {
+ elo->idx = 0;
+ elo->csum = 0;
+ }
+ break;
+
+ case 9:
+ if (elo->csum) {
+ input_regs(dev, regs);
+ input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]);
+ input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]);
+ input_report_abs(dev, ABS_PRESSURE, (elo->data[8] << 8) | elo->data[7]);
+ input_report_key(dev, BTN_TOUCH, elo->data[2] & 3);
+ input_sync(dev);
+ }
+ elo->idx = 0;
+ elo->csum = 0;
+ break;
+ }
+}
+
+static void elo_process_data_6(struct elo* elo, unsigned char data, struct pt_regs *regs)
+{
+ struct input_dev *dev = &elo->dev;
+
+ elo->data[elo->idx] = data;
+
+ switch (elo->idx++) {
+
+ case 0: if ((data & 0xc0) != 0xc0) elo->idx = 0; break;
+ case 1: if ((data & 0xc0) != 0x80) elo->idx = 0; break;
+ case 2: if ((data & 0xc0) != 0x40) elo->idx = 0; break;
+
+ case 3:
+ if (data & 0xc0) {
+ elo->idx = 0;
+ break;
+ }
+
+ input_regs(dev, regs);
+ input_report_abs(dev, ABS_X, ((elo->data[0] & 0x3f) << 6) | (elo->data[1] & 0x3f));
+ input_report_abs(dev, ABS_Y, ((elo->data[2] & 0x3f) << 6) | (elo->data[3] & 0x3f));
+
+ if (elo->id == 2) {
+ input_report_key(dev, BTN_TOUCH, 1);
+ input_sync(dev);
+ elo->idx = 0;
+ }
+
+ break;
+
+ case 4:
+ if (data) {
+ input_sync(dev);
+ elo->idx = 0;
+ }
+ break;
+
+ case 5:
+ if ((data & 0xf0) == 0) {
+ input_report_abs(dev, ABS_PRESSURE, elo->data[5]);
+ input_report_key(dev, BTN_TOUCH, elo->data[5]);
+ }
+ input_sync(dev);
+ elo->idx = 0;
+ break;
+ }
+}
+
+static void elo_process_data_3(struct elo* elo, unsigned char data, struct pt_regs *regs)
+{
+ struct input_dev *dev = &elo->dev;
+
+ elo->data[elo->idx] = data;
+
+ switch (elo->idx++) {
+
+ case 0:
+ if ((data & 0x7f) != 0x01)
+ elo->idx = 0;
+ break;
+ case 2:
+ input_regs(dev, regs);
+ input_report_key(dev, BTN_TOUCH, !(elo->data[1] & 0x80));
+ input_report_abs(dev, ABS_X, elo->data[1]);
+ input_report_abs(dev, ABS_Y, elo->data[2]);
+ input_sync(dev);
+ elo->idx = 0;
+ break;
+ }
+}
+
+static irqreturn_t elo_interrupt(struct serio *serio,
+ unsigned char data, unsigned int flags, struct pt_regs *regs)
+{
+ struct elo* elo = serio_get_drvdata(serio);
+
+ switch(elo->id) {
+ case 0:
+ elo_process_data_10(elo, data, regs);
+ break;
+
+ case 1:
+ case 2:
+ elo_process_data_6(elo, data, regs);
+ break;
+
+ case 3:
+ elo_process_data_3(elo, data, regs);
+ break;
+ }
+
+ return IRQ_HANDLED;
+}
+
+/*
+ * elo_disconnect() is the opposite of elo_connect()
+ */
+
+static void elo_disconnect(struct serio *serio)
+{
+ struct elo* elo = serio_get_drvdata(serio);
+
+ input_unregister_device(&elo->dev);
+ serio_close(serio);
+ serio_set_drvdata(serio, NULL);
+ kfree(elo);
+}
+
+/*
+ * elo_connect() is the routine that is called when someone adds a
+ * new serio device that supports Gunze protocol and registers it as
+ * an input device.
+ */
+
+static int elo_connect(struct serio *serio, struct serio_driver *drv)
+{
+ struct elo *elo;
+ int err;
+
+ if (!(elo = kmalloc(sizeof(struct elo), GFP_KERNEL)))
+ return -ENOMEM;
+
+ memset(elo, 0, sizeof(struct elo));
+
+ init_input_dev(&elo->dev);
+ elo->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
+ elo->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
+
+ elo->id = serio->id.id;
+
+ switch (elo->id) {
+
+ case 0: /* 10-byte protocol */
+ input_set_abs_params(&elo->dev, ABS_X, 96, 4000, 0, 0);
+ input_set_abs_params(&elo->dev, ABS_Y, 96, 4000, 0, 0);
+ input_set_abs_params(&elo->dev, ABS_PRESSURE, 0, 255, 0, 0);
+ break;
+
+ case 1: /* 6-byte protocol */
+ input_set_abs_params(&elo->dev, ABS_PRESSURE, 0, 15, 0, 0);
+
+ case 2: /* 4-byte protocol */
+ input_set_abs_params(&elo->dev, ABS_X, 96, 4000, 0, 0);
+ input_set_abs_params(&elo->dev, ABS_Y, 96, 4000, 0, 0);
+ break;
+
+ case 3: /* 3-byte protocol */
+ input_set_abs_params(&elo->dev, ABS_X, 0, 255, 0, 0);
+ input_set_abs_params(&elo->dev, ABS_Y, 0, 255, 0, 0);
+ break;
+ }
+
+ elo->serio = serio;
+
+ sprintf(elo->phys, "%s/input0", serio->phys);
+
+ elo->dev.private = elo;
+ elo->dev.name = elo_name;
+ elo->dev.phys = elo->phys;
+ elo->dev.id.bustype = BUS_RS232;
+ elo->dev.id.vendor = SERIO_ELO;
+ elo->dev.id.product = elo->id;
+ elo->dev.id.version = 0x0100;
+
+ serio_set_drvdata(serio, elo);
+
+ err = serio_open(serio, drv);
+ if (err) {
+ serio_set_drvdata(serio, NULL);
+ kfree(elo);
+ return err;
+ }
+
+ input_register_device(&elo->dev);
+
+ printk(KERN_INFO "input: %s on %s\n", elo_name, serio->phys);
+
+ return 0;
+}
+
+/*
+ * The serio driver structure.
+ */
+
+static struct serio_device_id elo_serio_ids[] = {
+ {
+ .type = SERIO_RS232,
+ .proto = SERIO_ELO,
+ .id = SERIO_ANY,
+ .extra = SERIO_ANY,
+ },
+ { 0 }
+};
+
+MODULE_DEVICE_TABLE(serio, elo_serio_ids);
+
+static struct serio_driver elo_drv = {
+ .driver = {
+ .name = "elo",
+ },
+ .description = DRIVER_DESC,
+ .id_table = elo_serio_ids,
+ .interrupt = elo_interrupt,
+ .connect = elo_connect,
+ .disconnect = elo_disconnect,
+};
+
+/*
+ * The functions for inserting/removing us as a module.
+ */
+
+static int __init elo_init(void)
+{
+ serio_register_driver(&elo_drv);
+ return 0;
+}
+
+static void __exit elo_exit(void)
+{
+ serio_unregister_driver(&elo_drv);
+}
+
+module_init(elo_init);
+module_exit(elo_exit);
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c
new file mode 100644
index 00000000000..c9d0a153671
--- /dev/null
+++ b/drivers/input/touchscreen/gunze.c
@@ -0,0 +1,205 @@
+/*
+ * $Id: gunze.c,v 1.12 2001/09/25 10:12:07 vojtech Exp $
+ *
+ * Copyright (c) 2000-2001 Vojtech Pavlik
+ */
+
+/*
+ * Gunze AHL-51S touchscreen driver for Linux
+ */
+
+/*
+ * 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
+ *
+ * Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
+ */
+
+#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 "Gunze AHL-51S touchscreen driver"
+
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
+
+/*
+ * Definitions & global arrays.
+ */
+
+#define GUNZE_MAX_LENGTH 10
+
+static char *gunze_name = "Gunze AHL-51S TouchScreen";
+
+/*
+ * Per-touchscreen data.
+ */
+
+struct gunze {
+ struct input_dev dev;
+ struct serio *serio;
+ int idx;
+ unsigned char data[GUNZE_MAX_LENGTH];
+ char phys[32];
+};
+
+static void gunze_process_packet(struct gunze* gunze, struct pt_regs *regs)
+{
+ struct input_dev *dev = &gunze->dev;
+
+ if (gunze->idx != GUNZE_MAX_LENGTH || gunze->data[5] != ',' ||
+ (gunze->data[0] != 'T' && gunze->data[0] != 'R')) {
+ gunze->data[10] = 0;
+ printk(KERN_WARNING "gunze.c: bad packet: >%s<\n", gunze->data);
+ return;
+ }
+
+ input_regs(dev, regs);
+ input_report_abs(dev, ABS_X, simple_strtoul(gunze->data + 1, NULL, 10));
+ input_report_abs(dev, ABS_Y, 1024 - simple_strtoul(gunze->data + 6, NULL, 10));
+ input_report_key(dev, BTN_TOUCH, gunze->data[0] == 'T');
+ input_sync(dev);
+}
+
+static irqreturn_t gunze_interrupt(struct serio *serio,
+ unsigned char data, unsigned int flags, struct pt_regs *regs)
+{
+ struct gunze* gunze = serio_get_drvdata(serio);
+
+ if (data == '\r') {
+ gunze_process_packet(gunze, regs);
+ gunze->idx = 0;
+ } else {
+ if (gunze->idx < GUNZE_MAX_LENGTH)
+ gunze->data[gunze->idx++] = data;
+ }
+ return IRQ_HANDLED;
+}
+
+/*
+ * gunze_disconnect() is the opposite of gunze_connect()
+ */
+
+static void gunze_disconnect(struct serio *serio)
+{
+ struct gunze* gunze = serio_get_drvdata(serio);
+
+ input_unregister_device(&gunze->dev);
+ serio_close(serio);
+ serio_set_drvdata(serio, NULL);
+ kfree(gunze);
+}
+
+/*
+ * gunze_connect() is the routine that is called when someone adds a
+ * new serio device that supports Gunze protocol and registers it as
+ * an input device.
+ */
+
+static int gunze_connect(struct serio *serio, struct serio_driver *drv)
+{
+ struct gunze *gunze;
+ int err;
+
+ if (!(gunze = kmalloc(sizeof(struct gunze), GFP_KERNEL)))
+ return -ENOMEM;
+
+ memset(gunze, 0, sizeof(struct gunze));
+
+ init_input_dev(&gunze->dev);
+ gunze->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
+ gunze->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
+ input_set_abs_params(&gunze->dev, ABS_X, 24, 1000, 0, 0);
+ input_set_abs_params(&gunze->dev, ABS_Y, 24, 1000, 0, 0);
+
+ gunze->serio = serio;
+
+ sprintf(gunze->phys, "%s/input0", serio->phys);
+
+ gunze->dev.private = gunze;
+ gunze->dev.name = gunze_name;
+ gunze->dev.phys = gunze->phys;
+ gunze->dev.id.bustype = BUS_RS232;
+ gunze->dev.id.vendor = SERIO_GUNZE;
+ gunze->dev.id.product = 0x0051;
+ gunze->dev.id.version = 0x0100;
+
+ serio_set_drvdata(serio, gunze);
+
+ err = serio_open(serio, drv);
+ if (err) {
+ serio_set_drvdata(serio, NULL);
+ kfree(gunze);
+ return err;
+ }
+
+ input_register_device(&gunze->dev);
+
+ printk(KERN_INFO "input: %s on %s\n", gunze_name, serio->phys);
+
+ return 0;
+}
+
+/*
+ * The serio driver structure.
+ */
+
+static struct serio_device_id gunze_serio_ids[] = {
+ {
+ .type = SERIO_RS232,
+ .proto = SERIO_GUNZE,
+ .id = SERIO_ANY,
+ .extra = SERIO_ANY,
+ },
+ { 0 }
+};
+
+MODULE_DEVICE_TABLE(serio, gunze_serio_ids);
+
+static struct serio_driver gunze_drv = {
+ .driver = {
+ .name = "gunze",
+ },
+ .description = DRIVER_DESC,
+ .id_table = gunze_serio_ids,
+ .interrupt = gunze_interrupt,
+ .connect = gunze_connect,
+ .disconnect = gunze_disconnect,
+};
+
+/*
+ * The functions for inserting/removing us as a module.
+ */
+
+static int __init gunze_init(void)
+{
+ serio_register_driver(&gunze_drv);
+ return 0;
+}
+
+static void __exit gunze_exit(void)
+{
+ serio_unregister_driver(&gunze_drv);
+}
+
+module_init(gunze_init);
+module_exit(gunze_exit);
diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c
new file mode 100644
index 00000000000..acb9137a022
--- /dev/null
+++ b/drivers/input/touchscreen/h3600_ts_input.c
@@ -0,0 +1,528 @@
+/*
+ * $Id: h3600_ts_input.c,v 1.4 2002/01/23 06:39:37 jsimmons Exp $
+ *
+ * Copyright (c) 2001 "Crazy" James Simmons jsimmons@transvirtual.com
+ *
+ * Sponsored by Transvirtual Technology.
+ *
+ * Derived from the code in h3600_ts.[ch] by Charles Flynn
+ */
+
+/*
+ * Driver for the h3600 Touch Screen and other Atmel controlled devices.
+ */
+
+/*
+ * 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
+ *
+ * Should you need to contact me, the author, you can do so by
+ * e-mail - mail your message to <jsimmons@transvirtual.com>.
+ */
+
+#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>
+#include <linux/delay.h>
+#include <linux/pm.h>
+
+/* SA1100 serial defines */
+#include <asm/arch/hardware.h>
+#include <asm/arch/irqs.h>
+
+#define DRIVER_DESC "H3600 touchscreen driver"
+
+MODULE_AUTHOR("James Simmons <jsimmons@transvirtual.com>");
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
+
+/*
+ * Definitions & global arrays.
+ */
+
+/* The start and end of frame characters SOF and EOF */
+#define CHAR_SOF 0x02
+#define CHAR_EOF 0x03
+#define FRAME_OVERHEAD 3 /* CHAR_SOF,CHAR_EOF,LENGTH = 3 */
+
+/*
+ Atmel events and response IDs contained in frame.
+ Programmer has no control over these numbers.
+ TODO there are holes - specifically 1,7,0x0a
+*/
+#define VERSION_ID 0 /* Get Version (request/respose) */
+#define KEYBD_ID 2 /* Keyboard (event) */
+#define TOUCHS_ID 3 /* Touch Screen (event)*/
+#define EEPROM_READ_ID 4 /* (request/response) */
+#define EEPROM_WRITE_ID 5 /* (request/response) */
+#define THERMAL_ID 6 /* (request/response) */
+#define NOTIFY_LED_ID 8 /* (request/response) */
+#define BATTERY_ID 9 /* (request/response) */
+#define SPI_READ_ID 0x0b /* ( request/response) */