diff options
| -rw-r--r-- | drivers/input/touchscreen/Kconfig | 12 | ||||
| -rw-r--r-- | drivers/input/touchscreen/Makefile | 1 | ||||
| -rw-r--r-- | drivers/input/touchscreen/ipaq-micro-ts.c | 142 |
3 files changed, 155 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index a23a94bb4bcb..6bb9a7dd23b6 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
| @@ -471,6 +471,18 @@ config TOUCHSCREEN_HP7XX | |||
| 471 | To compile this driver as a module, choose M here: the | 471 | To compile this driver as a module, choose M here: the |
| 472 | module will be called jornada720_ts. | 472 | module will be called jornada720_ts. |
| 473 | 473 | ||
| 474 | config TOUCHSCREEN_IPAQ_MICRO | ||
| 475 | tristate "HP iPAQ Atmel Micro ASIC touchscreen" | ||
| 476 | depends on MFD_IPAQ_MICRO | ||
| 477 | help | ||
| 478 | Say Y here to enable support for the touchscreen attached to | ||
| 479 | the Atmel Micro peripheral controller on iPAQ h3100/h3600/h3700 | ||
| 480 | |||
| 481 | If unsure, say N. | ||
| 482 | |||
| 483 | To compile this driver as a module, choose M here: the | ||
| 484 | module will be called ipaq-micro-ts. | ||
| 485 | |||
| 474 | config TOUCHSCREEN_HTCPEN | 486 | config TOUCHSCREEN_HTCPEN |
| 475 | tristate "HTC Shift X9500 touchscreen" | 487 | tristate "HTC Shift X9500 touchscreen" |
| 476 | depends on ISA | 488 | depends on ISA |
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 126479d8c29a..4be94fce41af 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile | |||
| @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o | |||
| 46 | obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o | 46 | obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o |
| 47 | obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o | 47 | obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o |
| 48 | obj-$(CONFIG_TOUCHSCREEN_HP7XX) += jornada720_ts.o | 48 | obj-$(CONFIG_TOUCHSCREEN_HP7XX) += jornada720_ts.o |
| 49 | obj-$(CONFIG_TOUCHSCREEN_IPAQ_MICRO) += ipaq-micro-ts.o | ||
| 49 | obj-$(CONFIG_TOUCHSCREEN_HTCPEN) += htcpen.o | 50 | obj-$(CONFIG_TOUCHSCREEN_HTCPEN) += htcpen.o |
| 50 | obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o | 51 | obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o |
| 51 | obj-$(CONFIG_TOUCHSCREEN_PCAP) += pcap_ts.o | 52 | obj-$(CONFIG_TOUCHSCREEN_PCAP) += pcap_ts.o |
diff --git a/drivers/input/touchscreen/ipaq-micro-ts.c b/drivers/input/touchscreen/ipaq-micro-ts.c new file mode 100644 index 000000000000..53fa5c361be1 --- /dev/null +++ b/drivers/input/touchscreen/ipaq-micro-ts.c | |||
| @@ -0,0 +1,142 @@ | |||
| 1 | /* | ||
| 2 | * This program is free software; you can redistribute it and/or modify | ||
| 3 | * it under the terms of the GNU General Public License version 2 as | ||
| 4 | * published by the Free Software Foundation. | ||
| 5 | * | ||
| 6 | * h3600 atmel micro companion support, touchscreen subdevice | ||
| 7 | * Author : Alessandro Gardich <gremlin@gremlin.it> | ||
| 8 | * Author : Dmitry Artamonow <mad_soft@inbox.ru> | ||
| 9 | * Author : Linus Walleij <linus.walleij@linaro.org> | ||
| 10 | * | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <asm/byteorder.h> | ||
| 14 | #include <linux/module.h> | ||
| 15 | #include <linux/init.h> | ||
| 16 | #include <linux/interrupt.h> | ||
| 17 | #include <linux/pm.h> | ||
| 18 | #include <linux/delay.h> | ||
| 19 | #include <linux/device.h> | ||
| 20 | #include <linux/input.h> | ||
| 21 | #include <linux/platform_device.h> | ||
| 22 | #include <linux/slab.h> | ||
| 23 | #include <linux/mfd/ipaq-micro.h> | ||
| 24 | |||
| 25 | struct touchscreen_data { | ||
| 26 | struct input_dev *input; | ||
| 27 | struct ipaq_micro *micro; | ||
| 28 | }; | ||
| 29 | |||
| 30 | static void micro_ts_receive(void *data, int len, unsigned char *msg) | ||
| 31 | { | ||
| 32 | struct touchscreen_data *ts = data; | ||
| 33 | |||
| 34 | if (len == 4) { | ||
| 35 | input_report_abs(ts->input, ABS_X, | ||
| 36 | be16_to_cpup((__be16 *) &msg[2])); | ||
| 37 | input_report_abs(ts->input, ABS_Y, | ||
| 38 | be16_to_cpup((__be16 *) &msg[0])); | ||
| 39 | input_report_key(ts->input, BTN_TOUCH, 1); | ||
| 40 | input_sync(ts->input); | ||
| 41 | } else if (len == 0) { | ||
| 42 | input_report_abs(ts->input, ABS_X, 0); | ||
| 43 | input_report_abs(ts->input, ABS_Y, 0); | ||
| 44 | input_report_key(ts->input, BTN_TOUCH, 0); | ||
| 45 | input_sync(ts->input); | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | static int micro_ts_probe(struct platform_device *pdev) | ||
| 50 | { | ||
| 51 | struct touchscreen_data *ts; | ||
| 52 | int ret; | ||
| 53 | |||
| 54 | ts = devm_kzalloc(&pdev->dev, sizeof(*ts), GFP_KERNEL); | ||
| 55 | if (!ts) | ||
| 56 | return -ENOMEM; | ||
| 57 | ts->micro = dev_get_drvdata(pdev->dev.parent); | ||
| 58 | |||
| 59 | platform_set_drvdata(pdev, ts); | ||
| 60 | |||
| 61 | ts->input = devm_input_allocate_device(&pdev->dev); | ||
| 62 | if (!ts->input) { | ||
| 63 | dev_err(&pdev->dev, "failed to allocate input device\n"); | ||
| 64 | return -ENOMEM; | ||
| 65 | } | ||
| 66 | |||
| 67 | input_set_capability(ts->input, EV_KEY, BTN_TOUCH); | ||
| 68 | input_set_capability(ts->input, EV_ABS, ABS_X); | ||
| 69 | input_set_capability(ts->input, EV_ABS, ABS_Y); | ||
| 70 | input_set_abs_params(ts->input, ABS_X, 0, 1023, 0, 0); | ||
| 71 | input_set_abs_params(ts->input, ABS_Y, 0, 1023, 0, 0); | ||
| 72 | |||
| 73 | ts->input->name = "ipaq micro ts"; | ||
| 74 | |||
| 75 | ret = input_register_device(ts->input); | ||
| 76 | if (ret) { | ||
| 77 | dev_err(&pdev->dev, "error registering touch input\n"); | ||
| 78 | return ret; | ||
| 79 | } | ||
| 80 | |||
| 81 | spin_lock_irq(&ts->micro->lock); | ||
| 82 | ts->micro->ts = micro_ts_receive; | ||
| 83 | ts->micro->ts_data = ts; | ||
| 84 | spin_unlock_irq(&ts->micro->lock); | ||
| 85 | |||
| 86 | dev_info(&pdev->dev, "iPAQ micro touchscreen\n"); | ||
| 87 | return 0; | ||
| 88 | } | ||
| 89 | |||
| 90 | static int micro_ts_remove(struct platform_device *pdev) | ||
| 91 | { | ||
| 92 | struct touchscreen_data *ts = platform_get_drvdata(pdev); | ||
| 93 | |||
| 94 | spin_lock_irq(&ts->micro->lock); | ||
| 95 | ts->micro->ts = NULL; | ||
| 96 | ts->micro->ts_data = NULL; | ||
| 97 | spin_unlock_irq(&ts->micro->lock); | ||
| 98 | |||
| 99 | return 0; | ||
| 100 | } | ||
| 101 | |||
| 102 | #ifdef CONFIG_PM_SLEEP | ||
| 103 | static int micro_ts_suspend(struct device *dev) | ||
| 104 | { | ||
| 105 | struct touchscreen_data *ts = dev_get_drvdata(dev); | ||
| 106 | |||
| 107 | spin_lock_irq(&ts->micro->lock); | ||
| 108 | ts->micro->ts = NULL; | ||
| 109 | ts->micro->ts_data = NULL; | ||
| 110 | spin_unlock_irq(&ts->micro->lock); | ||
| 111 | return 0; | ||
| 112 | } | ||
| 113 | |||
| 114 | static int micro_ts_resume(struct device *dev) | ||
| 115 | { | ||
| 116 | struct touchscreen_data *ts = dev_get_drvdata(dev); | ||
| 117 | |||
| 118 | spin_lock_irq(&ts->micro->lock); | ||
| 119 | ts->micro->ts = micro_ts_receive; | ||
| 120 | ts->micro->ts_data = ts; | ||
| 121 | spin_unlock_irq(&ts->micro->lock); | ||
| 122 | return 0; | ||
| 123 | } | ||
| 124 | #endif | ||
| 125 | |||
| 126 | static const struct dev_pm_ops micro_ts_dev_pm_ops = { | ||
| 127 | SET_SYSTEM_SLEEP_PM_OPS(micro_ts_suspend, micro_ts_resume) | ||
| 128 | }; | ||
| 129 | |||
| 130 | static struct platform_driver micro_ts_device_driver = { | ||
| 131 | .driver = { | ||
| 132 | .name = "ipaq-micro-ts", | ||
| 133 | .pm = µ_ts_dev_pm_ops, | ||
| 134 | }, | ||
| 135 | .probe = micro_ts_probe, | ||
| 136 | .remove = micro_ts_remove, | ||
| 137 | }; | ||
| 138 | module_platform_driver(micro_ts_device_driver); | ||
| 139 | |||
| 140 | MODULE_LICENSE("GPL"); | ||
| 141 | MODULE_DESCRIPTION("driver for iPAQ Atmel micro touchscreen"); | ||
| 142 | MODULE_ALIAS("platform:ipaq-micro-ts"); | ||
