aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-09-15 03:01:46 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 12:52:53 -0400
commiteca1ed196cd5b523c1057204cd3672555ad58dfe (patch)
treebf60f0c3ab6cbaf3235fe01387009e7df4b0926c /drivers/input/touchscreen
parentbd622663192e8ebebb27dc1d9397f352a82d2495 (diff)
[PATCH] drivers/input/touchscreen: convert to dynamic input_dev allocation
Input: convert drivers/input/touchscreen to dynamic input_dev allocation This is required for input_dev sysfs integration Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/corgi_ts.c89
-rw-r--r--drivers/input/touchscreen/elo.c89
-rw-r--r--drivers/input/touchscreen/gunze.c66
-rw-r--r--drivers/input/touchscreen/h3600_ts_input.c149
-rw-r--r--drivers/input/touchscreen/hp680_ts_input.c50
-rw-r--r--drivers/input/touchscreen/mk712.c80
-rw-r--r--drivers/input/touchscreen/mtouch.c64
7 files changed, 279 insertions, 308 deletions
diff --git a/drivers/input/touchscreen/corgi_ts.c b/drivers/input/touchscreen/corgi_ts.c
index 4c7fbe550365..40ae183ba1cd 100644
--- a/drivers/input/touchscreen/corgi_ts.c
+++ b/drivers/input/touchscreen/corgi_ts.c
@@ -41,8 +41,7 @@ struct ts_event {
41}; 41};
42 42
43struct corgi_ts { 43struct corgi_ts {
44 char phys[32]; 44 struct input_dev *input;
45 struct input_dev input;
46 struct timer_list timer; 45 struct timer_list timer;
47 struct ts_event tc; 46 struct ts_event tc;
48 int pendown; 47 int pendown;
@@ -182,14 +181,12 @@ static void new_data(struct corgi_ts *corgi_ts, struct pt_regs *regs)
182 if (!corgi_ts->tc.pressure && corgi_ts->pendown == 0) 181 if (!corgi_ts->tc.pressure && corgi_ts->pendown == 0)
183 return; 182 return;
184 183
185 if (regs) 184 input_regs(corgi_ts->input, regs);
186 input_regs(&corgi_ts->input, regs); 185 input_report_abs(corgi_ts->input, ABS_X, corgi_ts->tc.x);
187 186 input_report_abs(corgi_ts->input, ABS_Y, corgi_ts->tc.y);
188 input_report_abs(&corgi_ts->input, ABS_X, corgi_ts->tc.x); 187 input_report_abs(corgi_ts->input, ABS_PRESSURE, corgi_ts->tc.pressure);
189 input_report_abs(&corgi_ts->input, ABS_Y, corgi_ts->tc.y); 188 input_report_key(corgi_ts->input, BTN_TOUCH, (corgi_ts->pendown != 0));
190 input_report_abs(&corgi_ts->input, ABS_PRESSURE, corgi_ts->tc.pressure); 189 input_sync(corgi_ts->input);
191 input_report_key(&corgi_ts->input, BTN_TOUCH, (corgi_ts->pendown != 0));
192 input_sync(&corgi_ts->input);
193} 190}
194 191
195static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer, struct pt_regs *regs) 192static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer, struct pt_regs *regs)
@@ -273,39 +270,44 @@ static int __init corgits_probe(struct device *dev)
273{ 270{
274 struct corgi_ts *corgi_ts; 271 struct corgi_ts *corgi_ts;
275 struct platform_device *pdev = to_platform_device(dev); 272 struct platform_device *pdev = to_platform_device(dev);
273 struct input_dev *input_dev;
274 int err = -ENOMEM;
276 275
277 if (!(corgi_ts = kmalloc(sizeof(struct corgi_ts), GFP_KERNEL))) 276 corgi_ts = kzalloc(sizeof(struct corgi_ts), GFP_KERNEL);
278 return -ENOMEM; 277 input_dev = input_allocate_device();
278 if (!corgi_ts || !input_dev)
279 goto fail;
279 280
280 dev_set_drvdata(dev, corgi_ts); 281 dev_set_drvdata(dev, corgi_ts);
281 282
282 memset(corgi_ts, 0, sizeof(struct corgi_ts));
283
284 corgi_ts->machinfo = dev->platform_data; 283 corgi_ts->machinfo = dev->platform_data;
285 corgi_ts->irq_gpio = platform_get_irq(pdev, 0); 284 corgi_ts->irq_gpio = platform_get_irq(pdev, 0);
286 285
287 if (corgi_ts->irq_gpio < 0) { 286 if (corgi_ts->irq_gpio < 0) {
288 kfree(corgi_ts); 287 err = -ENODEV;
289 return -ENODEV; 288 goto fail;
290 } 289 }
291 290
292 init_input_dev(&corgi_ts->input); 291 corgi_ts->input = input_dev;
293 corgi_ts->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
294 corgi_ts->input.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
295 input_set_abs_params(&corgi_ts->input, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0);
296 input_set_abs_params(&corgi_ts->input, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0);
297 input_set_abs_params(&corgi_ts->input, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0);
298 292
299 strcpy(corgi_ts->phys, "corgits/input0"); 293 init_timer(&corgi_ts->timer);
294 corgi_ts->timer.data = (unsigned long) corgi_ts;
295 corgi_ts->timer.function = corgi_ts_timer;
300 296
301 corgi_ts->input.private = corgi_ts; 297 input_dev->name = "Corgi Touchscreen";
302 corgi_ts->input.name = "Corgi Touchscreen"; 298 input_dev->phys = "corgits/input0";
303 corgi_ts->input.dev = dev; 299 input_dev->id.bustype = BUS_HOST;
304 corgi_ts->input.phys = corgi_ts->phys; 300 input_dev->id.vendor = 0x0001;
305 corgi_ts->input.id.bustype = BUS_HOST; 301 input_dev->id.product = 0x0002;
306 corgi_ts->input.id.vendor = 0x0001; 302 input_dev->id.version = 0x0100;
307 corgi_ts->input.id.product = 0x0002; 303 input_dev->cdev.dev = dev;
308 corgi_ts->input.id.version = 0x0100; 304 input_dev->private = corgi_ts;
305
306 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
307 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
308 input_set_abs_params(input_dev, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0);
309 input_set_abs_params(input_dev, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0);
310 input_set_abs_params(input_dev, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0);
309 311
310 pxa_gpio_mode(IRQ_TO_GPIO(corgi_ts->irq_gpio) | GPIO_IN); 312 pxa_gpio_mode(IRQ_TO_GPIO(corgi_ts->irq_gpio) | GPIO_IN);
311 313
@@ -319,25 +321,24 @@ static int __init corgits_probe(struct device *dev)
319 corgi_ssp_ads7846_putget((5u << ADSCTRL_ADR_SH) | ADSCTRL_STS); 321 corgi_ssp_ads7846_putget((5u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
320 mdelay(5); 322 mdelay(5);
321 323
322 init_timer(&corgi_ts->timer);
323 corgi_ts->timer.data = (unsigned long) corgi_ts;
324 corgi_ts->timer.function = corgi_ts_timer;
325
326 input_register_device(&corgi_ts->input);
327 corgi_ts->power_mode = PWR_MODE_ACTIVE;
328
329 if (request_irq(corgi_ts->irq_gpio, ts_interrupt, SA_INTERRUPT, "ts", corgi_ts)) { 324 if (request_irq(corgi_ts->irq_gpio, ts_interrupt, SA_INTERRUPT, "ts", corgi_ts)) {
330 input_unregister_device(&corgi_ts->input); 325 err = -EBUSY;
331 kfree(corgi_ts); 326 goto fail;
332 return -EBUSY;
333 } 327 }
334 328
329 input_register_device(corgi_ts->input);
330
331 corgi_ts->power_mode = PWR_MODE_ACTIVE;
332
335 /* Enable Falling Edge */ 333 /* Enable Falling Edge */
336 set_irq_type(corgi_ts->irq_gpio, IRQT_FALLING); 334 set_irq_type(corgi_ts->irq_gpio, IRQT_FALLING);
337 335
338 printk(KERN_INFO "input: Corgi Touchscreen Registered\n");
339
340 return 0; 336 return 0;
337
338 fail: input_free_device(input_dev);
339 kfree(corgi_ts);
340 return err;
341
341} 342}
342 343
343static int corgits_remove(struct device *dev) 344static int corgits_remove(struct device *dev)
@@ -347,7 +348,7 @@ static int corgits_remove(struct device *dev)
347 free_irq(corgi_ts->irq_gpio, NULL); 348 free_irq(corgi_ts->irq_gpio, NULL);
348 del_timer_sync(&corgi_ts->timer); 349 del_timer_sync(&corgi_ts->timer);
349 corgi_ts->machinfo->put_hsync(); 350 corgi_ts->machinfo->put_hsync();
350 input_unregister_device(&corgi_ts->input); 351 input_unregister_device(corgi_ts->input);
351 kfree(corgi_ts); 352 kfree(corgi_ts);
352 return 0; 353 return 0;
353} 354}
diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c
index 3cdc9cab688d..c86a2eb310fd 100644
--- a/drivers/input/touchscreen/elo.c
+++ b/drivers/input/touchscreen/elo.c
@@ -36,14 +36,12 @@ MODULE_LICENSE("GPL");
36 36
37#define ELO_MAX_LENGTH 10 37#define ELO_MAX_LENGTH 10
38 38
39static char *elo_name = "Elo Serial TouchScreen";
40
41/* 39/*
42 * Per-touchscreen data. 40 * Per-touchscreen data.
43 */ 41 */
44 42