aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-20 13:33:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-20 13:33:06 -0400
commita0fe3cc5d36a5f5b4f60abfe1a4b1caf4a5cce5a (patch)
tree99a735d89df5bf49cf4edda1ba53bd9175d0f163 /drivers/input/touchscreen
parent04afb40593f9a3007e5ea817d009529ef10fb685 (diff)
parenta62f0d27b4196bad5e900d766b285feb7069cd16 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (40 commits) Input: psmouse - small formatting changes to better follow coding style Input: synaptics - set dimensions as reported by firmware Input: elantech - relax signature checks Input: elantech - enforce common prefix on messages Input: wistron_btns - switch to using kmemdup() Input: usbtouchscreen - switch to using kmemdup() Input: do not force selecting i8042 on Moorestown Input: Documentation/sysrq.txt - update KEY_SYSRQ info Input: 88pm860x_onkey - remove invalid irq number assignment Input: i8042 - add a PNP entry to the aux device list Input: i8042 - add some extra PNP keyboard types Input: wm9712 - fix wm97xx_set_gpio() logic Input: add keypad driver for keys interfaced to TCA6416 Input: remove obsolete {corgi,spitz,tosa}kbd.c Input: kbtab - do not advertise unsupported events Input: kbtab - simplify kbtab_disconnect() Input: kbtab - fix incorrect size parameter in usb_buffer_free Input: acecad - don't advertise mouse events Input: acecad - fix some formatting issues Input: acecad - simplify usb_acecad_disconnect() ... Trivial conflict in Documentation/feature-removal-schedule.txt
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/Kconfig12
-rw-r--r--drivers/input/touchscreen/Makefile1
-rw-r--r--drivers/input/touchscreen/hampshire.c205
-rw-r--r--drivers/input/touchscreen/tsc2007.c2
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c5
-rw-r--r--drivers/input/touchscreen/wm97xx-core.c2
6 files changed, 223 insertions, 4 deletions
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 6c0f1712f55..b9f58ca82fd 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -119,6 +119,18 @@ config TOUCHSCREEN_DYNAPRO
119 To compile this driver as a module, choose M here: the 119 To compile this driver as a module, choose M here: the
120 module will be called dynapro. 120 module will be called dynapro.
121 121
122config TOUCHSCREEN_HAMPSHIRE
123 tristate "Hampshire serial touchscreen"
124 select SERIO
125 help
126 Say Y here if you have a Hampshire serial touchscreen connected to
127 your system.
128
129 If unsure, say N.
130
131 To compile this driver as a module, choose M here: the
132 module will be called hampshire.
133
122config TOUCHSCREEN_EETI 134config TOUCHSCREEN_EETI
123 tristate "EETI touchscreen panel support" 135 tristate "EETI touchscreen panel support"
124 depends on I2C 136 depends on I2C
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 41145d074de..8ad36eef90a 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o
13obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o 13obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o
14obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o 14obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o
15obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o 15obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o
16obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o
16obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o 17obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o
17obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o 18obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o
18obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o 19obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o
diff --git a/drivers/input/touchscreen/hampshire.c b/drivers/input/touchscreen/hampshire.c
new file mode 100644
index 00000000000..2da6cc31bb2
--- /dev/null
+++ b/drivers/input/touchscreen/hampshire.c
@@ -0,0 +1,205 @@
1/*
2 * Hampshire serial touchscreen driver
3 *
4 * Copyright (c) 2010 Adam Bennett
5 * Based on the dynapro driver (c) Tias Guns
6 *
7 */
8
9/*
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published by
12 * the Free Software Foundation.
13 */
14
15/*
16 * 2010/04/08 Adam Bennett <abennett72@gmail.com>
17 * Copied dynapro.c and edited for Hampshire 4-byte protocol
18 */
19
20#include <linux/errno.h>
21#include <linux/kernel.h>
22#include <linux/module.h>
23#include <linux/slab.h>
24#include <linux/input.h>
25#include <linux/serio.h>
26#include <linux/init.h>
27
28#define DRIVER_DESC "Hampshire serial touchscreen driver"
29
30MODULE_AUTHOR("Adam Bennett <abennett72@gmail.com>");
31MODULE_DESCRIPTION(DRIVER_DESC);
32MODULE_LICENSE("GPL");
33
34/*
35 * Definitions & global arrays.
36 */
37
38#define HAMPSHIRE_FORMAT_TOUCH_BIT 0x40
39#define HAMPSHIRE_FORMAT_LENGTH 4
40#define HAMPSHIRE_RESPONSE_BEGIN_BYTE 0x80
41
42#define HAMPSHIRE_MIN_XC 0
43#define HAMPSHIRE_MAX_XC 0x1000
44#define HAMPSHIRE_MIN_YC 0
45#define HAMPSHIRE_MAX_YC 0x1000
46
47#define HAMPSHIRE_GET_XC(data) (((data[3] & 0x0c) >> 2) | (data[1] << 2) | ((data[0] & 0x38) << 6))
48#define HAMPSHIRE_GET_YC(data) ((data[3] & 0x03) | (data[2] << 2) | ((data[0] & 0x07) << 9))
49#define HAMPSHIRE_GET_TOUCHED(data) (HAMPSHIRE_FORMAT_TOUCH_BIT & data[0])
50
51/*
52 * Per-touchscreen data.
53 */
54
55struct hampshire {
56 struct input_dev *dev;
57 struct serio *serio;
58 int idx;
59 unsigned char data[HAMPSHIRE_FORMAT_LENGTH];
60 char phys[32];
61};
62
63static void hampshire_process_data(struct hampshire *phampshire)
64{
65 struct input_dev *dev = phampshire->dev;
66
67 if (HAMPSHIRE_FORMAT_LENGTH == ++phampshire->idx) {
68 input_report_abs(dev, ABS_X, HAMPSHIRE_GET_XC(phampshire->data));
69 input_report_abs(dev, ABS_Y, HAMPSHIRE_GET_YC(phampshire->data));
70 input_report_key(dev, BTN_TOUCH,
71 HAMPSHIRE_GET_TOUCHED(phampshire->data));
72 input_sync(dev);
73
74 phampshire->idx = 0;
75 }
76}
77
78static irqreturn_t hampshire_interrupt(struct serio *serio,
79 unsigned char data, unsigned int flags)
80{
81 struct hampshire *phampshire = serio_get_drvdata(serio);
82
83 phampshire->data[phampshire->idx] = data;
84
85 if (HAMPSHIRE_RESPONSE_BEGIN_BYTE & phampshire->data[0])
86 hampshire_process_data(phampshire);
87 else
88 dev_dbg(&serio->dev, "unknown/unsynchronized data: %x\n",
89 phampshire->data[0]);
90
91 return IRQ_HANDLED;
92}
93
94static void hampshire_disconnect(struct serio *serio)
95{
96 struct hampshire *phampshire = serio_get_drvdata(serio);
97
98 input_get_device(phampshire->dev);
99 input_unregister_device(phampshire->dev);
100 serio_close(serio);
101 serio_set_drvdata(serio, NULL);
102 input_put_device(phampshire->dev);
103 kfree(phampshire);
104}
105
106/*
107 * hampshire_connect() is the routine that is called when someone adds a
108 * new serio device that supports hampshire protocol and registers it as
109 * an input device. This is usually accomplished using inputattach.
110 */
111
112static int hampshire_connect(struct serio *serio, struct serio_driver *drv)
113{
114 struct hampshire *phampshire;
115 struct input_dev *input_dev;
116 int err;
117
118 phampshire = kzalloc(sizeof(struct hampshire), GFP_KERNEL);
119 input_dev = input_allocate_device();
120 if (!phampshire || !input_dev) {
121 err = -ENOMEM;
122 goto fail1;
123 }
124
125 phampshire->serio = serio;
126 phampshire->dev = input_dev;
127 snprintf(phampshire->phys, sizeof(phampshire->phys),
128 "%s/input0", serio->phys);
129
130 input_dev->name = "Hampshire Serial TouchScreen";
131 input_dev->phys = phampshire->phys;
132 input_dev->id.bustype = BUS_RS232;
133 input_dev->id.vendor = SERIO_HAMPSHIRE;
134 input_dev->id.product = 0;
135 input_dev->id.version = 0x0001;
136 input_dev->dev.parent = &serio->dev;
137 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
138 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
139 input_set_abs_params(phampshire->dev, ABS_X,
140 HAMPSHIRE_MIN_XC, HAMPSHIRE_MAX_XC, 0, 0);
141 input_set_abs_params(phampshire->dev, ABS_Y,
142 HAMPSHIRE_MIN_YC, HAMPSHIRE_MAX_YC, 0, 0);
143
144 serio_set_drvdata(serio, phampshire);
145
146 err = serio_open(serio, drv);
147 if (err)
148 goto fail2;
149
150 err = input_register_device(phampshire->dev);
151 if (err)
152 goto fail3;
153
154 return 0;
155
156 fail3: serio_close(serio);
157 fail2: serio_set_drvdata(serio, NULL);
158 fail1: input_free_device(input_dev);
159 kfree(phampshire);
160 return err;
161}
162
163/*
164 * The serio driver structure.
165 */
166
167static struct serio_device_id hampshire_serio_ids[] = {
168 {
169 .type = SERIO_RS232,
170 .proto = SERIO_HAMPSHIRE,
171 .id = SERIO_ANY,
172 .extra = SERIO_ANY,
173 },
174 { 0 }
175};
176
177MODULE_DEVICE_TABLE(serio, hampshire_serio_ids);
178
179static struct serio_driver hampshire_drv = {
180 .driver = {
181 .name = "hampshire",
182 },
183 .description = DRIVER_DESC,
184 .id_table = hampshire_serio_ids,
185 .interrupt = hampshire_interrupt,
186 .connect = hampshire_connect,
187 .disconnect = hampshire_disconnect,
188};
189
190/*
191 * The functions for inserting/removing us as a module.
192 */
193
194static int __init hampshire_init(void)
195{
196 return serio_register_driver(&hampshire_drv);
197}
198
199static void __exit hampshire_exit(void)
200{
201 serio_unregister_driver(&hampshire_drv);
202}
203
204module_init(hampshire_init);
205module_exit(hampshire_exit);
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index be23780e8a3..769b479fcaa 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
@@ -347,6 +347,8 @@ static int __devexit tsc2007_remove(struct i2c_client *client)
347 struct tsc2007 *ts = i2c_get_clientdata(client); 347 struct tsc2007 *ts = i2c_get_clientdata(client);
348 struct tsc2007_platform_data *pdata = client->dev.platform_data; 348 struct tsc2007_platform_data *pdata = client->dev.platform_data;
349 349
350 i2c_set_clientdata(client, NULL);
351
350 tsc2007_free_irq(ts); 352 tsc2007_free_irq(ts);
351 353
352 if (pdata->exit_platform_hw) 354 if (pdata->exit_platform_hw)
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 99330bbdbac..0b0ae2e17a6 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -811,12 +811,11 @@ static int nexio_init(struct usbtouch_usb *usbtouch)
811 811
812 priv = usbtouch->priv; 812 priv = usbtouch->priv;
813 813
814 priv->ack_buf = kmalloc(sizeof(nexio_ack_pkt), GFP_KERNEL); 814 priv->ack_buf = kmemdup(nexio_ack_pkt, sizeof(nexio_ack_pkt),
815 GFP_KERNEL);
815 if (!priv->ack_buf) 816 if (!priv->ack_buf)
816 goto err_priv; 817 goto err_priv;
817 818
818 memcpy(priv->ack_buf, nexio_ack_pkt, sizeof(nexio_ack_pkt));
819
820 priv->ack = usb_alloc_urb(0, GFP_KERNEL); 819 priv->ack = usb_alloc_urb(0, GFP_KERNEL);
821 if (!priv->ack) { 820 if (!priv->ack) {
822 dbg("%s - usb_alloc_urb failed: usbtouch->ack", __func__); 821 dbg("%s - usb_alloc_urb failed: usbtouch->ack", __func__);
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c
index 5109bf3dd85..cbfef1ea7e3 100644
--- a/drivers/input/touchscreen/wm97xx-core.c
+++ b/drivers/input/touchscreen/wm97xx-core.c
@@ -200,7 +200,7 @@ void wm97xx_set_gpio(struct wm97xx *wm, u32 gpio,
200 mutex_lock(&wm->codec_mutex); 200 mutex_lock(&wm->codec_mutex);
201 reg = wm97xx_reg_read(wm, AC97_GPIO_STATUS); 201 reg = wm97xx_reg_read(wm, AC97_GPIO_STATUS);
202 202
203 if (status & WM97XX_GPIO_HIGH) 203 if (status == WM97XX_GPIO_HIGH)
204 reg |= gpio; 204 reg |= gpio;
205 else 205 else
206 reg &= ~gpio; 206 reg &= ~gpio;