diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 13:55:52 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 13:55:52 -0500 |
| commit | dbe950f201a8edd353b0bd9079e8d536ee4ce37c (patch) | |
| tree | dffbada6b3d33cc67383758570de22b4f45693b6 /drivers/input/touchscreen | |
| parent | f62f61917d72c1fb0101ad405664f6fc868d676b (diff) | |
| parent | da733563be5a9da26fe81d9f007262d00b846e22 (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: (64 commits)
Input: tc3589x-keypad - add missing kerneldoc
Input: ucb1400-ts - switch to using dev_xxx() for diagnostic messages
Input: ucb1400_ts - convert to threaded IRQ
Input: ucb1400_ts - drop inline annotations
Input: usb1400_ts - add __devinit/__devexit section annotations
Input: ucb1400_ts - set driver owner
Input: ucb1400_ts - convert to use dev_pm_ops
Input: psmouse - make sure we do not use stale methods
Input: evdev - do not block waiting for an event if fd is nonblock
Input: evdev - if no events and non-block, return EAGAIN not 0
Input: evdev - only allow reading events if a full packet is present
Input: add driver for pixcir i2c touchscreens
Input: samsung-keypad - implement runtime power management support
Input: tegra-kbc - report wakeup key for some platforms
Input: tegra-kbc - add device tree bindings
Input: add driver for AUO In-Cell touchscreens using pixcir ICs
Input: mpu3050 - configure the sampling method
Input: mpu3050 - ensure we enable interrupts
Input: mpu3050 - add of_match table for device-tree probing
Input: sentelic - document the latest hardware
...
Fix up fairly trivial conflicts (device tree matching conflicting with
some independent cleanups) in drivers/input/keyboard/samsung-keypad.c
Diffstat (limited to 'drivers/input/touchscreen')
32 files changed, 1508 insertions, 520 deletions
diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c index b3aebc2166ba..05f30b73c3c3 100644 --- a/drivers/input/touchscreen/88pm860x-ts.c +++ b/drivers/input/touchscreen/88pm860x-ts.c | |||
| @@ -217,18 +217,7 @@ static struct platform_driver pm860x_touch_driver = { | |||
| 217 | .probe = pm860x_touch_probe, | 217 | .probe = pm860x_touch_probe, |
| 218 | .remove = __devexit_p(pm860x_touch_remove), | 218 | .remove = __devexit_p(pm860x_touch_remove), |
| 219 | }; | 219 | }; |
| 220 | 220 | module_platform_driver(pm860x_touch_driver); | |
| 221 | static int __init pm860x_touch_init(void) | ||
| 222 | { | ||
| 223 | return platform_driver_register(&pm860x_touch_driver); | ||
| 224 | } | ||
| 225 | module_init(pm860x_touch_init); | ||
| 226 | |||
| 227 | static void __exit pm860x_touch_exit(void) | ||
| 228 | { | ||
| 229 | platform_driver_unregister(&pm860x_touch_driver); | ||
| 230 | } | ||
| 231 | module_exit(pm860x_touch_exit); | ||
| 232 | 221 | ||
| 233 | MODULE_DESCRIPTION("Touchscreen driver for Marvell Semiconductor 88PM860x"); | 222 | MODULE_DESCRIPTION("Touchscreen driver for Marvell Semiconductor 88PM860x"); |
| 234 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); | 223 | MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); |
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 3488ffe1fa0a..4af2a18eb3ba 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
| @@ -98,6 +98,19 @@ config TOUCHSCREEN_ATMEL_MXT | |||
| 98 | To compile this driver as a module, choose M here: the | 98 | To compile this driver as a module, choose M here: the |
| 99 | module will be called atmel_mxt_ts. | 99 | module will be called atmel_mxt_ts. |
| 100 | 100 | ||
| 101 | config TOUCHSCREEN_AUO_PIXCIR | ||
| 102 | tristate "AUO in-cell touchscreen using Pixcir ICs" | ||
| 103 | depends on I2C | ||
| 104 | depends on GPIOLIB | ||
| 105 | help | ||
| 106 | Say Y here if you have a AUO display with in-cell touchscreen | ||
| 107 | using Pixcir ICs. | ||
| 108 | |||
| 109 | If unsure, say N. | ||
| 110 | |||
| 111 | To compile this driver as a module, choose M here: the | ||
| 112 | module will be called auo-pixcir-ts. | ||
| 113 | |||
| 101 | config TOUCHSCREEN_BITSY | 114 | config TOUCHSCREEN_BITSY |
| 102 | tristate "Compaq iPAQ H3600 (Bitsy) touchscreen" | 115 | tristate "Compaq iPAQ H3600 (Bitsy) touchscreen" |
| 103 | depends on SA1100_BITSY | 116 | depends on SA1100_BITSY |
| @@ -177,6 +190,16 @@ config TOUCHSCREEN_EETI | |||
| 177 | To compile this driver as a module, choose M here: the | 190 | To compile this driver as a module, choose M here: the |
| 178 | module will be called eeti_ts. | 191 | module will be called eeti_ts. |
| 179 | 192 | ||
| 193 | config TOUCHSCREEN_EGALAX | ||
| 194 | tristate "EETI eGalax multi-touch panel support" | ||
| 195 | depends on I2C | ||
| 196 | help | ||
| 197 | Say Y here to enable support for I2C connected EETI | ||
| 198 | eGalax multi-touch panels. | ||
| 199 | |||
| 200 | To compile this driver as a module, choose M here: the | ||
| 201 | module will be called egalax_ts. | ||
| 202 | |||
| 180 | config TOUCHSCREEN_FUJITSU | 203 | config TOUCHSCREEN_FUJITSU |
| 181 | tristate "Fujitsu serial touchscreen" | 204 | tristate "Fujitsu serial touchscreen" |
| 182 | select SERIO | 205 | select SERIO |
| @@ -435,6 +458,18 @@ config TOUCHSCREEN_UCB1400 | |||
| 435 | To compile this driver as a module, choose M here: the | 458 | To compile this driver as a module, choose M here: the |
| 436 | module will be called ucb1400_ts. | 459 | module will be called ucb1400_ts. |
| 437 | 460 | ||
| 461 | config TOUCHSCREEN_PIXCIR | ||
| 462 | tristate "PIXCIR I2C touchscreens" | ||
| 463 | depends on I2C | ||
| 464 | help | ||
| 465 | Say Y here if you have a pixcir i2c touchscreen | ||
| 466 | controller. | ||
| 467 | |||
| 468 | If unsure, say N. | ||
| 469 | |||
| 470 | To compile this driver as a module, choose M here: the | ||
| 471 | module will be called pixcir_i2c_ts. | ||
| 472 | |||
| 438 | config TOUCHSCREEN_WM831X | 473 | config TOUCHSCREEN_WM831X |
| 439 | tristate "Support for WM831x touchscreen controllers" | 474 | tristate "Support for WM831x touchscreen controllers" |
| 440 | depends on MFD_WM831X | 475 | depends on MFD_WM831X |
| @@ -541,6 +576,7 @@ config TOUCHSCREEN_USB_COMPOSITE | |||
| 541 | - GoTop Super_Q2/GogoPen/PenPower tablets | 576 | - GoTop Super_Q2/GogoPen/PenPower tablets |
| 542 | - JASTEC USB Touch Controller/DigiTech DTR-02U | 577 | - JASTEC USB Touch Controller/DigiTech DTR-02U |
| 543 | - Zytronic controllers | 578 | - Zytronic controllers |
| 579 | - Elo TouchSystems 2700 IntelliTouch | ||
| 544 | 580 | ||
| 545 | Have a look at <http://linux.chapter7.ch/touchkit/> for | 581 | Have a look at <http://linux.chapter7.ch/touchkit/> for |
| 546 | a usage description and the required user-space stuff. | 582 | a usage description and the required user-space stuff. |
| @@ -620,6 +656,11 @@ config TOUCHSCREEN_USB_JASTEC | |||
| 620 | bool "JASTEC/DigiTech DTR-02U USB touch controller device support" if EXPERT | 656 | bool "JASTEC/DigiTech DTR-02U USB touch controller device support" if EXPERT |
| 621 | depends on TOUCHSCREEN_USB_COMPOSITE | 657 | depends on TOUCHSCREEN_USB_COMPOSITE |
| 622 | 658 | ||
| 659 | config TOUCHSCREEN_USB_ELO | ||
| 660 | default y | ||
| 661 | bool "Elo TouchSystems 2700 IntelliTouch controller device support" if EXPERT | ||
| 662 | depends on TOUCHSCREEN_USB_COMPOSITE | ||
| 663 | |||
| 623 | config TOUCHSCREEN_USB_E2I | 664 | config TOUCHSCREEN_USB_E2I |
| 624 | default y | 665 | default y |
| 625 | bool "e2i Touchscreen controller (e.g. from Mimo 740)" | 666 | bool "e2i Touchscreen controller (e.g. from Mimo 740)" |
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index f957676035a4..496091e88460 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile | |||
| @@ -14,6 +14,7 @@ obj-$(CONFIG_TOUCHSCREEN_AD7879_SPI) += ad7879-spi.o | |||
| 14 | obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o | 14 | obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o |
| 15 | obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += atmel_mxt_ts.o | 15 | obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += atmel_mxt_ts.o |
| 16 | obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o | 16 | obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o |
| 17 | obj-$(CONFIG_TOUCHSCREEN_AUO_PIXCIR) += auo-pixcir-ts.o | ||
| 17 | obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o | 18 | obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o |
| 18 | obj-$(CONFIG_TOUCHSCREEN_BU21013) += bu21013_ts.o | 19 | obj-$(CONFIG_TOUCHSCREEN_BU21013) += bu21013_ts.o |
| 19 | obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110) += cy8ctmg110_ts.o | 20 | obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110) += cy8ctmg110_ts.o |
| @@ -23,6 +24,7 @@ obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o | |||
| 23 | obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o | 24 | obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o |
| 24 | obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o | 25 | obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o |
| 25 | obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o | 26 | obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o |
| 27 | obj-$(CONFIG_TOUCHSCREEN_EGALAX) += egalax_ts.o | ||
| 26 | obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o | 28 | obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o |
| 27 | obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o | 29 | obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o |
| 28 | obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o | 30 | obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o |
| @@ -39,6 +41,7 @@ obj-$(CONFIG_TOUCHSCREEN_HTCPEN) += htcpen.o | |||
| 39 | obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o | 41 | obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o |
| 40 | obj-$(CONFIG_TOUCHSCREEN_PCAP) += pcap_ts.o | 42 | obj-$(CONFIG_TOUCHSCREEN_PCAP) += pcap_ts.o |
| 41 | obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o | 43 | obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o |
| 44 | obj-$(CONFIG_TOUCHSCREEN_PIXCIR) += pixcir_i2c_ts.o | ||
| 42 | obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o | 45 | obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o |
| 43 | obj-$(CONFIG_TOUCHSCREEN_ST1232) += st1232.o | 46 | obj-$(CONFIG_TOUCHSCREEN_ST1232) += st1232.o |
| 44 | obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o | 47 | obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o |
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c index baa43df6502d..49a36df0b752 100644 --- a/drivers/input/touchscreen/ad7877.c +++ b/drivers/input/touchscreen/ad7877.c | |||
| @@ -488,10 +488,10 @@ static ssize_t ad7877_disable_store(struct device *dev, | |||
| 488 | const char *buf, size_t count) | 488 | const char *buf, size_t count) |
| 489 | { | 489 | { |
| 490 | struct ad7877 *ts = dev_get_drvdata(dev); | 490 | struct ad7877 *ts = dev_get_drvdata(dev); |
| 491 | unsigned long val; | 491 | unsigned int val; |
| 492 | int error; | 492 | int error; |
| 493 | 493 | ||
| 494 | error = strict_strtoul(buf, 10, &val); | 494 | error = kstrtouint(buf, 10, &val); |
| 495 | if (error) | 495 | if (error) |
| 496 | return error; | 496 | return error; |
| 497 | 497 | ||
| @@ -518,10 +518,10 @@ static ssize_t ad7877_dac_store(struct device *dev, | |||
| 518 | const char *buf, size_t count) | 518 | const char *buf, size_t count) |
| 519 | { | 519 | { |
| 520 | struct ad7877 *ts = dev_get_drvdata(dev); | 520 | struct ad7877 *ts = dev_get_drvdata(dev); |
| 521 | unsigned long val; | 521 | unsigned int val; |
| 522 | int error; | 522 | int error; |
| 523 | 523 | ||
| 524 | error = strict_strtoul(buf, 10, &val); | 524 | error = kstrtouint(buf, 10, &val); |
| 525 | if (error) | 525 | if (error) |
| 526 | return error; | 526 | return error; |
| 527 | 527 | ||
| @@ -548,10 +548,10 @@ static ssize_t ad7877_gpio3_store(struct device *dev, | |||
| 548 | const char *buf, size_t count) | 548 | const char *buf, size_t count) |
| 549 | { | 549 | { |
| 550 | struct ad7877 *ts = dev_get_drvdata(dev); | 550 | struct ad7877 *ts = dev_get_drvdata(dev); |
| 551 | unsigned long val; | 551 | unsigned int val; |
| 552 | int error; | 552 | int error; |
| 553 | 553 | ||
| 554 | error = strict_strtoul(buf, 10, &val); | 554 | error = kstrtouint(buf, 10, &val); |
| 555 | if (error) | 555 | if (error) |
| 556 | return error; | 556 | return error; |
| 557 | 557 | ||
| @@ -579,10 +579,10 @@ static ssize_t ad7877_gpio4_store(struct device *dev, | |||
| 579 | const char *buf, size_t count) | 579 | const char *buf, size_t count) |
| 580 | { | 580 | { |
| 581 | struct ad7877 *ts = dev_get_drvdata(dev); | 581 | struct ad7877 *ts = dev_get_drvdata(dev); |
| 582 | unsigned long val; | 582 | unsigned int val; |
| 583 | int error; | 583 | int error; |
| 584 | 584 | ||
| 585 | error = strict_strtoul(buf, 10, &val); | 585 | error = kstrtouint(buf, 10, &val); |
| 586 | if (error) | 586 | if (error) |
| 587 | return error; | 587 | return error; |
| 588 | 588 | ||
| @@ -853,7 +853,6 @@ static SIMPLE_DEV_PM_OPS(ad7877_pm, ad7877_suspend, ad7877_resume); | |||
| 853 | static struct spi_driver ad7877_driver = { | 853 | static struct spi_driver ad7877_driver = { |
| 854 | .driver = { | 854 | .driver = { |
| 855 | .name = "ad7877", | 855 | .name = "ad7877", |
| 856 | .bus = &spi_bus_type, | ||
| 857 | .owner = THIS_MODULE, | 856 | .owner = THIS_MODULE, |
| 858 | .pm = &ad7877_pm, | 857 | .pm = &ad7877_pm, |
| 859 | }, | 858 | }, |
diff --git a/drivers/input/touchscreen/ad7879-i2c.c b/drivers/input/touchscreen/ad7879-i2c.c index c789b974c795..0dac6712f42b 100644 --- a/drivers/input/touchscreen/ad7879-i2c.c +++ b/drivers/input/touchscreen/ad7879-i2c.c | |||
| @@ -16,30 +16,6 @@ | |||
| 16 | 16 | ||
| 17 | #define AD7879_DEVID 0x79 /* AD7879-1/AD7889-1 */ | 17 | #define AD7879_DEVID 0x79 /* AD7879-1/AD7889-1 */ |
| 18 | 18 | ||
| 19 | #ifdef CONFIG_PM_SLEEP | ||
| 20 | static int ad7879_i2c_suspend(struct device *dev) | ||
| 21 | { | ||
| 22 | struct i2c_client *client = to_i2c_client(dev); | ||
| 23 | struct ad7879 *ts = i2c_get_clientdata(client); | ||
| 24 | |||
| 25 | ad7879_suspend(ts); | ||
| 26 | |||
| 27 | return 0; | ||
| 28 | } | ||
| 29 | |||
| 30 | static int ad7879_i2c_resume(struct device *dev) | ||
| 31 | { | ||
| 32 | struct i2c_client *client = to_i2c_client(dev); | ||
| 33 | struct ad7879 *ts = i2c_get_clientdata(client); | ||
| 34 | |||
| 35 | ad7879_resume(ts); | ||
| 36 | |||
| 37 | return 0; | ||
| 38 | } | ||
| 39 | #endif | ||
| 40 | |||
| 41 | static SIMPLE_DEV_PM_OPS(ad7879_i2c_pm, ad7879_i2c_suspend, ad7879_i2c_resume); | ||
| 42 | |||
| 43 | /* All registers are word-sized. | 19 | /* All registers are word-sized. |
| 44 | * AD7879 uses a high-byte first convention. | 20 | * AD7879 uses a high-byte first convention. |
| 45 | */ | 21 | */ |
| @@ -47,7 +23,7 @@ static int ad7879_i2c_read(struct device *dev, u8 reg) | |||
| 47 | { | 23 | { |
| 48 | struct i2c_client *client = to_i2c_client(dev); | 24 | struct i2c_client *client = to_i2c_client(dev); |
| 49 | 25 | ||
| 50 | return swab16(i2c_smbus_read_word_data(client, reg)); | 26 | return i2c_smbus_read_word_swapped(client, reg); |
| 51 | } | 27 | } |
| 52 | 28 | ||
| 53 | static int ad7879_i2c_multi_read(struct device *dev, | 29 | static int ad7879_i2c_multi_read(struct device *dev, |
| @@ -68,7 +44,7 @@ static int ad7879_i2c_write(struct device *dev, u8 reg, u16 val) | |||
| 68 | { | 44 | { |
| 69 | struct i2c_client *client = to_i2c_client(dev); | 45 | struct i2c_client *client = to_i2c_client(dev); |
| 70 | 46 | ||
| 71 | return i2c_smbus_write_word_data(client, reg, swab16(val)); | 47 | return i2c_smbus_write_word_swapped(client, reg, val); |
| 72 | } | 48 | } |
| 73 | 49 | ||
| 74 | static const struct ad7879_bus_ops ad7879_i2c_bus_ops = { | 50 | static const struct ad7879_bus_ops ad7879_i2c_bus_ops = { |
| @@ -119,7 +95,7 @@ static struct i2c_driver ad7879_i2c_driver = { | |||
| 119 | .driver = { | 95 | .driver = { |
| 120 | .name = "ad7879", | 96 | .name = "ad7879", |
| 121 | .owner = THIS_MODULE, | 97 | .owner = THIS_MODULE, |
| 122 | .pm = &ad7879_i2c_pm, | 98 | .pm = &ad7879_pm_ops, |
| 123 | }, | 99 | }, |
| 124 | .probe = ad7879_i2c_probe, | 100 | .probe = ad7879_i2c_probe, |
| 125 | .remove = __devexit_p(ad7879_i2c_remove), | 101 | .remove = __devexit_p(ad7879_i2c_remove), |
| @@ -141,4 +117,3 @@ module_exit(ad7879_i2c_exit); | |||
| 141 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | 117 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); |
| 142 | MODULE_DESCRIPTION("AD7879(-1) touchscreen I2C bus driver"); | 118 | MODULE_DESCRIPTION("AD7879(-1) touchscreen I2C bus driver"); |
| 143 | MODULE_LICENSE("GPL"); | 119 | MODULE_LICENSE("GPL"); |
| 144 | MODULE_ALIAS("i2c:ad7879"); | ||
diff --git a/drivers/input/touchscreen/ad7879-spi.c b/drivers/input/touchscreen/ad7879-spi.c index b1643c8fa7c9..9b2e1c2b1971 100644 --- a/drivers/input/touchscreen/ad7879-spi.c +++ b/drivers/input/touchscreen/ad7879-spi.c | |||
| @@ -22,30 +22,6 @@ | |||
| 22 | #define AD7879_WRITECMD(reg) (AD7879_CMD(reg)) | 22 | #define AD7879_WRITECMD(reg) (AD7879_CMD(reg)) |
| 23 | #define AD7879_READCMD(reg) (AD7879_CMD(reg) | AD7879_CMD_READ) | 23 | #define AD7879_READCMD(reg) (AD7879_CMD(reg) | AD7879_CMD_READ) |
| 24 | 24 | ||
| 25 | #ifdef CONFIG_PM_SLEEP | ||
| 26 | static int ad7879_spi_suspend(struct device *dev) | ||
| 27 | { | ||
| 28 | struct spi_device *spi = to_spi_device(dev); | ||
| 29 | struct ad7879 *ts = spi_get_drvdata(spi); | ||
| 30 | |||
| 31 | ad7879_suspend(ts); | ||
| 32 | |||
| 33 | return 0; | ||
| 34 | } | ||
| 35 | |||
| 36 | static int ad7879_spi_resume(struct device *dev) | ||
| 37 | { | ||
| 38 | struct spi_device *spi = to_spi_device(dev); | ||
| 39 | struct ad7879 *ts = spi_get_drvdata(spi); | ||
| 40 | |||
| 41 | ad7879_resume(ts); | ||
| 42 | |||
| 43 | return 0; | ||
| 44 | } | ||
| 45 | #endif | ||
| 46 | |||
| 47 | static SIMPLE_DEV_PM_OPS(ad7879_spi_pm, ad7879_spi_suspend, ad7879_spi_resume); | ||
| 48 | |||
| 49 | /* | 25 | /* |
| 50 | * ad7879_read/write are only used for initial setup and for sysfs controls. | 26 | * ad7879_read/write are only used for initial setup and for sysfs controls. |
| 51 | * The main traffic is done in ad7879_collect(). | 27 | * The main traffic is done in ad7879_collect(). |
| @@ -174,9 +150,8 @@ static int __devexit ad7879_spi_remove(struct spi_device *spi) | |||
| 174 | static struct spi_driver ad7879_spi_driver = { | 150 | static struct spi_driver ad7879_spi_driver = { |
| 175 | .driver = { | 151 | .driver = { |
| 176 | .name = "ad7879", | 152 | .name = "ad7879", |
| 177 | .bus = &spi_bus_type, | ||
| 178 | .owner = THIS_MODULE, | 153 | .owner = THIS_MODULE, |
| 179 | .pm = &ad7879_spi_pm, | 154 | .pm = &ad7879_pm_ops, |
| 180 | }, | 155 | }, |
| 181 | .probe = ad7879_spi_probe, | 156 | .probe = ad7879_spi_probe, |
| 182 | .remove = __devexit_p(ad7879_spi_remove), | 157 | .remove = __devexit_p(ad7879_spi_remove), |
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index 3b2e9ed2aeec..e2482b40da51 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c | |||
| @@ -281,8 +281,11 @@ static void ad7879_close(struct input_dev* input) | |||
| 281 | __ad7879_disable(ts); | 281 | __ad7879_disable(ts); |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | void ad7879_suspend(struct ad7879 *ts) | 284 | #ifdef CONFIG_PM_SLEEP |
| 285 | static int ad7879_suspend(struct device *dev) | ||
| 285 | { | 286 | { |
| 287 | struct ad7879 *ts = dev_get_drvdata(dev); | ||
| 288 | |||
| 286 | mutex_lock(&ts->input->mutex); | 289 | mutex_lock(&ts->input->mutex); |
| 287 | 290 | ||
| 288 | if (!ts->suspended && !ts->disabled && ts->input->users) | 291 | if (!ts->suspended && !ts->disabled && ts->input->users) |
| @@ -291,11 +294,14 @@ void ad7879_suspend(struct ad7879 *ts) | |||
| 291 | ts->suspended = true; | 294 | ts->suspended = true; |
| 292 | 295 | ||
| 293 | mutex_unlock(&ts->input->mutex); | 296 | mutex_unlock(&ts->input->mutex); |
| 297 | |||
| 298 | return 0; | ||
| 294 | } | 299 | } |
| 295 | EXPORT_SYMBOL(ad7879_suspend); | ||
| 296 | 300 | ||
| 297 | void ad7879_resume(struct ad7879 *ts) | 301 | static int ad7879_resume(struct device *dev) |
| 298 | { | 302 | { |
| 303 | struct ad7879 *ts = dev_get_drvdata(dev); | ||
| 304 | |||
| 299 | mutex_lock(&ts->input->mutex); | 305 | mutex_lock(&ts->input->mutex); |
| 300 | 306 | ||
| 301 | if (ts->suspended && !ts->disabled && ts->input->users) | 307 | if (ts->suspended && !ts->disabled && ts->input->users) |
| @@ -304,8 +310,13 @@ void ad7879_resume(struct ad7879 *ts) | |||
| 304 | ts->suspended = false; | 310 | ts->suspended = false; |
| 305 | 311 | ||
| 306 | mutex_unlock(&ts->input->mutex); | 312 | mutex_unlock(&ts->input->mutex); |
| 313 | |||
| 314 | return 0; | ||
| 307 | } | 315 | } |
| 308 | EXPORT_SYMBOL(ad7879_resume); | 316 | #endif |
| 317 | |||
| 318 | SIMPLE_DEV_PM_OPS(ad7879_pm_ops, ad7879_suspend, ad7879_resume); | ||
| 319 | EXPORT_SYMBOL(ad7879_pm_ops); | ||
| 309 | 320 | ||
| 310 | static void ad7879_toggle(struct ad7879 *ts, bool disable) | 321 | static void ad7879_toggle(struct ad7879 *ts, bool disable) |
| 311 | { | 322 | { |
| @@ -340,10 +351,10 @@ static ssize_t ad7879_disable_store(struct device *dev, | |||
| 340 | const char *buf, size_t count) | 351 | const char *buf, size_t count) |
| 341 | { | 352 | { |
| 342 | struct ad7879 *ts = dev_get_drvdata(dev); | 353 | struct ad7879 *ts = dev_get_drvdata(dev); |
| 343 | unsigned long val; | 354 | unsigned int val; |
| 344 | int error; | 355 | int error; |
| 345 | 356 | ||
| 346 | error = strict_strtoul(buf, 10, &val); | 357 | error = kstrtouint(buf, 10, &val); |
| 347 | if (error) | 358 | if (error) |
| 348 | return error; | 359 | return error; |
| 349 | 360 | ||
diff --git a/drivers/input/touchscreen/ad7879.h b/drivers/input/touchscreen/ad7879.h index 6b45a27236c7..6fd13c48d373 100644 --- a/drivers/input/touchscreen/ad7879.h +++ b/drivers/input/touchscreen/ad7879.h | |||
| @@ -21,8 +21,8 @@ struct ad7879_bus_ops { | |||
| 21 | int (*write)(struct device *dev, u8 reg, u16 val); | 21 | int (*write)(struct device *dev, u8 reg, u16 val); |
| 22 | }; | 22 | }; |
| 23 | 23 | ||
| 24 | void ad7879_suspend(struct ad7879 *); | 24 | extern const struct dev_pm_ops ad7879_pm_ops; |
| 25 | void ad7879_resume(struct ad7879 *); | 25 | |
| 26 | struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned irq, | 26 | struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned irq, |
| 27 | const struct ad7879_bus_ops *bops); | 27 | const struct ad7879_bus_ops *bops); |
| 28 | void ad7879_remove(struct ad7879 *); | 28 | void ad7879_remove(struct ad7879 *); |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index de31ec6fe9e4..23fd90185659 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
| @@ -602,10 +602,12 @@ static ssize_t ads7846_disable_store(struct device *dev, | |||
| 602 | const char *buf, size_t count) | 602 | const char *buf, size_t count) |
| 603 | { | 603 | { |
| 604 | struct ads7846 *ts = dev_get_drvdata(dev); | 604 | struct ads7846 *ts = dev_get_drvdata(dev); |
| 605 | unsigned long i; | 605 | unsigned int i; |
| 606 | int err; | ||
| 606 | 607 | ||
| 607 | if (strict_strtoul(buf, 10, &i)) | 608 | err = kstrtouint(buf, 10, &i); |
| 608 | return -EINVAL; | 609 | if (err) |
| 610 | return err; | ||
| 609 | 611 | ||
| 610 | if (i) | 612 | if (i) |
| 611 | ads7846_disable(ts); | 613 | ads7846_disable(ts); |
| @@ -1424,7 +1426,6 @@ static int __devexit ads7846_remove(struct spi_device *spi) | |||
| 1424 | static struct spi_driver ads7846_driver = { | 1426 | static struct spi_driver ads7846_driver = { |
| 1425 | .driver = { | 1427 | .driver = { |
| 1426 | .name = "ads7846", | 1428 | .name = "ads7846", |
| 1427 | .bus = &spi_bus_type, | ||
| 1428 | .owner = THIS_MODULE, | 1429 | .owner = THIS_MODULE, |
| 1429 | .pm = &ads7846_pm, | 1430 | .pm = &ads7846_pm, |
| 1430 | }, | 1431 | }, |
diff --git a/drivers/input/touchscreen/atmel-wm97xx.c b/drivers/input/touchscreen/atmel-wm97xx.c index 8034cbb20f74..d016cb26d125 100644 --- a/drivers/input/touchscreen/atmel-wm97xx.c +++ b/drivers/input/touchscreen/atmel-wm97xx.c | |||
| @@ -429,18 +429,7 @@ static struct platform_driver atmel_wm97xx_driver = { | |||
| 429 | .suspend = atmel_wm97xx_suspend, | 429 | .suspend = atmel_wm97xx_suspend, |
| 430 | .resume = atmel_wm97xx_resume, | 430 | .resume = atmel_wm97xx_resume, |
| 431 | }; | 431 | }; |
| 432 | 432 | module_platform_driver(atmel_wm97xx_driver); | |
| 433 | static int __init atmel_wm97xx_init(void) | ||
| 434 | { | ||
| 435 | return platform_driver_probe(&atmel_wm97xx_driver, atmel_wm97xx_probe); | ||
| 436 | } | ||
| 437 | module_init(atmel_wm97xx_init); | ||
| 438 | |||
| 439 | static void __exit atmel_wm97xx_exit(void) | ||
| 440 | { | ||
| 441 | platform_driver_unregister(&atmel_wm97xx_driver); | ||
| 442 | } | ||
| 443 | module_exit(atmel_wm97xx_exit); | ||
| 444 | 433 | ||
| 445 | MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>"); | 434 | MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>"); |
| 446 | MODULE_DESCRIPTION("wm97xx continuous touch driver for Atmel AT91 and AVR32"); | 435 | MODULE_DESCRIPTION("wm97xx continuous touch driver for Atmel AT91 and AVR32"); |
diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c index 122a87883659..201b2d2ec1b3 100644 --- a/drivers/input/touchscreen/atmel_tsadcc.c +++ b/drivers/input/touchscreen/atmel_tsadcc.c | |||
| @@ -351,20 +351,7 @@ static struct platform_driver atmel_tsadcc_driver = { | |||
| 351 | .name = "atmel_tsadcc", | 351 | .name = "atmel_tsadcc", |
| 352 | }, | 352 | }, |
| 353 | }; | 353 | }; |
| 354 | 354 | module_platform_driver(atmel_tsadcc_driver); | |
| 355 | static int __init atmel_tsadcc_init(void) | ||
| 356 | { | ||
| 357 | return platform_driver_register(&atmel_tsadcc_driver); | ||
| 358 | } | ||
| 359 | |||
| 360 | static void __exit atmel_tsadcc_exit(void) | ||
| 361 | { | ||
| 362 | platform_driver_unregister(&atmel_tsadcc_driver); | ||
| 363 | } | ||
| 364 | |||
| 365 | module_init(atmel_tsadcc_init); | ||
| 366 | module_exit(atmel_tsadcc_exit); | ||
| 367 | |||
| 368 | 355 | ||
| 369 | MODULE_LICENSE("GPL"); | 356 | MODULE_LICENSE("GPL"); |
| 370 | MODULE_DESCRIPTION("Atmel TouchScreen Driver"); | 357 | MODULE_DESCRIPTION("Atmel TouchScreen Driver"); |
diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c b/drivers/input/touchscreen/auo-pixcir-ts.c new file mode 100644 index 000000000000..94fb9fbb08a9 --- /dev/null +++ b/drivers/input/touchscreen/auo-pixcir-ts.c | |||
| @@ -0,0 +1,652 @@ | |||
| 1 | /* | ||
| 2 | * Driver for AUO in-cell touchscreens | ||
| 3 | * | ||
| 4 | * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de> | ||
| 5 | * | ||
| 6 | * loosely based on auo_touch.c from Dell Streak vendor-kernel | ||
| 7 | * | ||
| 8 | * Copyright (c) 2008 QUALCOMM Incorporated. | ||
| 9 | * Copyright (c) 2008 QUALCOMM USA, INC. | ||
| 10 | * | ||
| 11 | * | ||
| 12 | * This software is licensed under the terms of the GNU General Public | ||
| 13 | * License version 2, as published by the Free Software Foundation, and | ||
| 14 | * may be copied, distributed, and modified under those terms. | ||
| 15 | * | ||
| 16 | * This program is distributed in the hope that it will be useful, | ||
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | * GNU General Public License for more details. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include <linux/kernel.h> | ||
| 24 | #include <linux/module.h> | ||
| 25 | #include <linux/interrupt.h> | ||
| 26 | #include <linux/slab.h> | ||
| 27 | #include <linux/input.h> | ||
| 28 | #include <linux/jiffies.h> | ||
| 29 | #include <linux/i2c.h> | ||
| 30 | #include <linux/mutex.h> | ||
| 31 | #include <linux/delay.h> | ||
| 32 | #include <linux/gpio.h> | ||
| 33 | #include <linux/input/auo-pixcir-ts.h> | ||
| 34 | |||
| 35 | /* | ||
| 36 | * Coordinate calculation: | ||
| 37 | * X1 = X1_LSB + X1_MSB*256 | ||
| 38 | * Y1 = Y1_LSB + Y1_MSB*256 | ||
| 39 | * X2 = X2_LSB + X2_MSB*256 | ||
| 40 | * Y2 = Y2_LSB + Y2_MSB*256 | ||
| 41 | */ | ||
| 42 | #define AUO_PIXCIR_REG_X1_LSB 0x00 | ||
| 43 | #define AUO_PIXCIR_REG_X1_MSB 0x01 | ||
| 44 | #define AUO_PIXCIR_REG_Y1_LSB 0x02 | ||
| 45 | #define AUO_PIXCIR_REG_Y1_MSB 0x03 | ||
| 46 | #define AUO_PIXCIR_REG_X2_LSB 0x04 | ||
| 47 | #define AUO_PIXCIR_REG_X2_MSB 0x05 | ||
| 48 | #define AUO_PIXCIR_REG_Y2_LSB 0x06 | ||
| 49 | #define AUO_PIXCIR_REG_Y2_MSB 0x07 | ||
| 50 | |||
| 51 | #define AUO_PIXCIR_REG_STRENGTH 0x0d | ||
| 52 | #define AUO_PIXCIR_REG_STRENGTH_X1_LSB 0x0e | ||
| 53 | #define AUO_PIXCIR_REG_STRENGTH_X1_MSB 0x0f | ||
| 54 | |||
| 55 | #define AUO_PIXCIR_REG_RAW_DATA_X 0x2b | ||
| 56 | #define AUO_PIXCIR_REG_RAW_DATA_Y 0x4f | ||
| 57 | |||
| 58 | #define AUO_PIXCIR_REG_X_SENSITIVITY 0x6f | ||
| 59 | #define AUO_PIXCIR_REG_Y_SENSITIVITY 0x70 | ||
| 60 | #define AUO_PIXCIR_REG_INT_SETTING 0x71 | ||
| 61 | #define AUO_PIXCIR_REG_INT_WIDTH 0x72 | ||
| 62 | #define AUO_PIXCIR_REG_POWER_MODE 0x73 | ||
| 63 | |||
| 64 | #define AUO_PIXCIR_REG_VERSION 0x77 | ||
| 65 | #define AUO_PIXCIR_REG_CALIBRATE 0x78 | ||
| 66 | |||
| 67 | #define AUO_PIXCIR_REG_TOUCHAREA_X1 0x1e | ||
| 68 | #define AUO_PIXCIR_REG_TOUCHAREA_Y1 0x1f | ||
| 69 | #define AUO_PIXCIR_REG_TOUCHAREA_X2 0x20 | ||
| 70 | #define AUO_PIXCIR_REG_TOUCHAREA_Y2 0x21 | ||
| 71 | |||
| 72 | #define AUO_PIXCIR_REG_EEPROM_CALIB_X 0x42 | ||
| 73 | #define AUO_PIXCIR_REG_EEPROM_CALIB_Y 0xad | ||
| 74 | |||
| 75 | #define AUO_PIXCIR_INT_TPNUM_MASK 0xe0 | ||
| 76 | #define AUO_PIXCIR_INT_TPNUM_SHIFT 5 | ||
| 77 | #define AUO_PIXCIR_INT_RELEASE (1 << 4) | ||
| 78 | #define AUO_PIXCIR_INT_ENABLE (1 << 3) | ||
| 79 | #define AUO_PIXCIR_INT_POL_HIGH (1 << 2) | ||
| 80 | #define AUO_PIXCIR_INT_MODE_MASK 0x03 | ||
| 81 | |||
| 82 | /* | ||
| 83 | * Power modes: | ||
| 84 | * active: scan speed 60Hz | ||
| 85 | * sleep: scan speed 10Hz can be auto-activated, wakeup on 1st touch | ||
| 86 | * deep sleep: scan speed 1Hz can only be entered or left manually. | ||
| 87 | */ | ||
| 88 | #define AUO_PIXCIR_POWER_ACTIVE 0x00 | ||
| 89 | #define AUO_PIXCIR_POWER_SLEEP 0x01 | ||
| 90 | #define AUO_PIXCIR_POWER_DEEP_SLEEP 0x02 | ||
| 91 | #define AUO_PIXCIR_POWER_MASK 0x03 | ||
| 92 | |||
| 93 | #define AUO_PIXCIR_POWER_ALLOW_SLEEP (1 << 2) | ||
| 94 | #define AUO_PIXCIR_POWER_IDLE_TIME(ms) ((ms & 0xf) << 4) | ||
| 95 | |||
| 96 | #define AUO_PIXCIR_CALIBRATE 0x03 | ||
| 97 | |||
| 98 | #define AUO_PIXCIR_EEPROM_CALIB_X_LEN 62 | ||
| 99 | #define AUO_PIXCIR_EEPROM_CALIB_Y_LEN 36 | ||
| 100 | |||
| 101 | #define AUO_PIXCIR_RAW_DATA_X_LEN 18 | ||
| 102 | #define AUO_PIXCIR_RAW_DATA_Y_LEN 11 | ||
| 103 | |||
| 104 | #define AUO_PIXCIR_STRENGTH_ENABLE (1 << 0) | ||
| 105 | |||
| 106 | /* Touchscreen absolute values */ | ||
| 107 | #define AUO_PIXCIR_REPORT_POINTS 2 | ||
| 108 | #define AUO_PIXCIR_MAX_AREA 0xff | ||
| 109 | #define AUO_PIXCIR_PENUP_TIMEOUT_MS 10 | ||
| 110 | |||
| 111 | struct auo_pixcir_ts { | ||
| 112 | struct i2c_client *client; | ||
| 113 | struct input_dev *input; | ||
| 114 | char phys[32]; | ||
| 115 | |||
| 116 | /* special handling for touch_indicate interupt mode */ | ||
| 117 | bool touch_ind_mode; | ||
| 118 | |||
| 119 | wait_queue_head_t wait; | ||
| 120 | bool stopped; | ||
| 121 | }; | ||
| 122 | |||
| 123 | struct auo_point_t { | ||
| 124 | int coord_x; | ||
| 125 | int coord_y; | ||
| 126 | int area_major; | ||
| 127 | int area_minor; | ||
| 128 | int orientation; | ||
| 129 | }; | ||
| 130 | |||
| 131 | static int auo_pixcir_collect_data(struct auo_pixcir_ts *ts, | ||
| 132 | struct auo_point_t *point) | ||
| 133 | { | ||
| 134 | struct i2c_client *client = ts->client; | ||
| 135 | const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; | ||
| 136 | uint8_t raw_coord[8]; | ||
| 137 | uint8_t raw_area[4]; | ||
| 138 | int i, ret; | ||
| 139 | |||
| 140 | /* touch coordinates */ | ||
| 141 | ret = i2c_smbus_read_i2c_block_data(client, AUO_PIXCIR_REG_X1_LSB, | ||
| 142 | 8, raw_coord); | ||
| 143 | if (ret < 0) { | ||
| 144 | dev_err(&client->dev, "failed to read coordinate, %d\n", ret); | ||
| 145 | return ret; | ||
| 146 | } | ||
| 147 | |||
| 148 | /* touch area */ | ||
| 149 | ret = i2c_smbus_read_i2c_block_data(client, AUO_PIXCIR_REG_TOUCHAREA_X1, | ||
| 150 | 4, raw_area); | ||
| 151 | if (ret < 0) { | ||
| 152 | dev_err(&client->dev, "could not read touch area, %d\n", ret); | ||
| 153 | return ret; | ||
| 154 | } | ||
| 155 | |||
| 156 | for (i = 0; i < AUO_PIXCIR_REPORT_POINTS; i++) { | ||
| 157 | point[i].coord_x = | ||
| 158 | raw_coord[4 * i + 1] << 8 | raw_coord[4 * i]; | ||
| 159 | point[i].coord_y = | ||
| 160 | raw_coord[4 * i + 3] << 8 | raw_coord[4 * i + 2]; | ||
| 161 | |||
| 162 | if (point[i].coord_x > pdata->x_max || | ||
| 163 | point[i].coord_y > pdata->y_max) { | ||
| 164 | dev_warn(&client->dev, "coordinates (%d,%d) invalid\n", | ||
| 165 | point[i].coord_x, point[i].coord_y); | ||
| 166 | point[i].coord_x = point[i].coord_y = 0; | ||
| 167 | } | ||
| 168 | |||
| 169 | /* determine touch major, minor and orientation */ | ||
| 170 | point[i].area_major = max(raw_area[2 * i], raw_area[2 * i + 1]); | ||
| 171 | point[i].area_minor = min(raw_area[2 * i], raw_area[2 * i + 1]); | ||
| 172 | point[i].orientation = raw_area[2 * i] > raw_area[2 * i + 1]; | ||
| 173 | } | ||
| 174 | |||
| 175 | return 0; | ||
| 176 | } | ||
| 177 | |||
| 178 | static irqreturn_t auo_pixcir_interrupt(int irq, void *dev_id) | ||
| 179 | { | ||
| 180 | struct auo_pixcir_ts *ts = dev_id; | ||
| 181 | struct i2c_client *client = ts->client; | ||
| 182 | const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; | ||
| 183 | struct auo_point_t point[AUO_PIXCIR_REPORT_POINTS]; | ||
| 184 | int i; | ||
| 185 | int ret; | ||
| 186 | int fingers = 0; | ||
| 187 | int abs = -1; | ||
| 188 | |||
| 189 | while (!ts->stopped) { | ||
| 190 | |||
| 191 | /* check for up event in touch touch_ind_mode */ | ||
| 192 | if (ts->touch_ind_mode) { | ||
| 193 | if (gpio_get_value(pdata->gpio_int) == 0) { | ||
| 194 | input_mt_sync(ts->input); | ||
| 195 | input_report_key(ts->input, BTN_TOUCH, 0); | ||
| 196 | input_sync(ts->input); | ||
| 197 | break; | ||
| 198 | } | ||
| 199 | } | ||
| 200 | |||
| 201 | ret = auo_pixcir_collect_data(ts, point); | ||
| 202 | if (ret < 0) { | ||
| 203 | /* we want to loop only in touch_ind_mode */ | ||
| 204 | if (!ts->touch_ind_mode) | ||
| 205 | break; | ||
| 206 | |||
| 207 | wait_event_timeout(ts->wait, ts->stopped, | ||
| 208 | msecs_to_jiffies(AUO_PIXCIR_PENUP_TIMEOUT_MS)); | ||
| 209 | continue; | ||
| 210 | } | ||
| 211 | |||
| 212 | for (i = 0; i < AUO_PIXCIR_REPORT_POINTS; i++) { | ||
| 213 | if (point[i].coord_x > 0 || point[i].coord_y > 0) { | ||
| 214 | input_report_abs(ts->input, ABS_MT_POSITION_X, | ||
| 215 | point[i].coord_x); | ||
| 216 | input_report_abs(ts->input, ABS_MT_POSITION_Y, | ||
| 217 | point[i].coord_y); | ||
| 218 | input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, | ||
| 219 | point[i].area_major); | ||
| 220 | input_report_abs(ts->input, ABS_MT_TOUCH_MINOR, | ||
| 221 | point[i].area_minor); | ||
| 222 | input_report_abs(ts->input, ABS_MT_ORIENTATION, | ||
| 223 | point[i].orientation); | ||
| 224 | input_mt_sync(ts->input); | ||
| 225 | |||
| 226 | /* use first finger as source for singletouch */ | ||
| 227 | if (fingers == 0) | ||
| 228 | abs = i; | ||
| 229 | |||
| 230 | /* number of touch points could also be queried | ||
| 231 | * via i2c but would require an additional call | ||
| 232 | */ | ||
| 233 | fingers++; | ||
| 234 | } | ||
| 235 | } | ||
| 236 | |||
| 237 | input_report_key(ts->input, BTN_TOUCH, fingers > 0); | ||
| 238 | |||
| 239 | if (abs > -1) { | ||
| 240 | input_report_abs(ts->input, ABS_X, point[abs].coord_x); | ||
| 241 | input_report_abs(ts->input, ABS_Y, point[abs].coord_y); | ||
| 242 | } | ||
| 243 | |||
| 244 | input_sync(ts->input); | ||
| 245 | |||
| 246 | /* we want to loop only in touch_ind_mode */ | ||
| 247 | if (!ts->touch_ind_mode) | ||
| 248 | break; | ||
| 249 | |||
| 250 | wait_event_timeout(ts->wait, ts->stopped, | ||
| 251 | msecs_to_jiffies(AUO_PIXCIR_PENUP_TIMEOUT_MS)); | ||
| 252 | } | ||
| 253 | |||
| 254 | return IRQ_HANDLED; | ||
| 255 | } | ||
| 256 | |||
| 257 | /* | ||
| 258 | * Set the power mode of the device. | ||
| 259 | * Valid modes are | ||
| 260 | * - AUO_PIXCIR_POWER_ACTIVE | ||
| 261 | * - AUO_PIXCIR_POWER_SLEEP - automatically left on first touch | ||
| 262 | * - AUO_PIXCIR_POWER_DEEP_SLEEP | ||
| 263 | */ | ||
| 264 | static int auo_pixcir_power_mode(struct auo_pixcir_ts *ts, int mode) | ||
| 265 | { | ||
| 266 | struct i2c_client *client = ts->client; | ||
| 267 | int ret; | ||
| 268 | |||
| 269 | ret = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_POWER_MODE); | ||
| 270 | if (ret < 0) { | ||
| 271 | dev_err(&client->dev, "unable to read reg %Xh, %d\n", | ||
| 272 | AUO_PIXCIR_REG_POWER_MODE, ret); | ||
| 273 | return ret; | ||
| 274 | } | ||
| 275 | |||
| 276 | ret &= ~AUO_PIXCIR_POWER_MASK; | ||
| 277 | ret |= mode; | ||
| 278 | |||
| 279 | ret = i2c_smbus_write_byte_data(client, AUO_PIXCIR_REG_POWER_MODE, ret); | ||
| 280 | if (ret) { | ||
| 281 | dev_err(&client->dev, "unable to write reg %Xh, %d\n", | ||
| 282 | AUO_PIXCIR_REG_POWER_MODE, ret); | ||
| 283 | return ret; | ||
| 284 | } | ||
| 285 | |||
| 286 | return 0; | ||
| 287 | } | ||
| 288 | |||
| 289 | static __devinit int auo_pixcir_int_config(struct auo_pixcir_ts *ts, | ||
| 290 | int int_setting) | ||
| 291 | { | ||
| 292 | struct i2c_client *client = ts->client; | ||
| 293 | struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; | ||
| 294 | int ret; | ||
| 295 | |||
| 296 | ret = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_INT_SETTING); | ||
| 297 | if (ret < 0) { | ||
| 298 | dev_err(&client->dev, "unable to read reg %Xh, %d\n", | ||
| 299 | AUO_PIXCIR_REG_INT_SETTING, ret); | ||
| 300 | return ret; | ||
| 301 | } | ||
| 302 | |||
| 303 | ret &= ~AUO_PIXCIR_INT_MODE_MASK; | ||
| 304 | ret |= int_setting; | ||
| 305 | ret |= AUO_PIXCIR_INT_POL_HIGH; /* always use high for interrupts */ | ||
| 306 | |||
| 307 | ret = i2c_smbus_write_byte_data(client, AUO_PIXCIR_REG_INT_SETTING, | ||
| 308 | ret); | ||
| 309 | if (ret < 0) { | ||
| 310 | dev_err(&client->dev, "unable to write reg %Xh, %d\n", | ||
| 311 | AUO_PIXCIR_REG_INT_SETTING, ret); | ||
| 312 | return ret; | ||
| 313 | } | ||
| 314 | |||
| 315 | ts->touch_ind_mode = pdata->int_setting == AUO_PIXCIR_INT_TOUCH_IND; | ||
| 316 | |||
| 317 | return 0; | ||
| 318 | } | ||
| 319 | |||
| 320 | /* control the generation of interrupts on the device side */ | ||
| 321 | static int auo_pixcir_int_toggle(struct auo_pixcir_ts *ts, bool enable) | ||
| 322 | { | ||
| 323 | struct i2c_client *client = ts->client; | ||
| 324 | int ret; | ||
| 325 | |||
| 326 | ret = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_INT_SETTING); | ||
| 327 | if (ret < 0) { | ||
| 328 | dev_err(&client->dev, "unable to read reg %Xh, %d\n", | ||
| 329 | AUO_PIXCIR_REG_INT_SETTING, ret); | ||
| 330 | return ret; | ||
| 331 | } | ||
| 332 | |||
| 333 | if (enable) | ||
| 334 | ret |= AUO_PIXCIR_INT_ENABLE; | ||
| 335 | else | ||
| 336 | ret &= ~AUO_PIXCIR_INT_ENABLE; | ||
| 337 | |||
| 338 | ret = i2c_smbus_write_byte_data(client, AUO_PIXCIR_REG_INT_SETTING, | ||
| 339 | ret); | ||
| 340 | if (ret < 0) { | ||
| 341 | dev_err(&client->dev, "unable to write reg %Xh, %d\n", | ||
| 342 | AUO_PIXCIR_REG_INT_SETTING, ret); | ||
| 343 | return ret; | ||
| 344 | } | ||
| 345 | |||
| 346 | return 0; | ||
| 347 | } | ||
| 348 | |||
| 349 | static int auo_pixcir_start(struct auo_pixcir_ts *ts) | ||
| 350 | { | ||
| 351 | struct i2c_client *client = ts->client; | ||
| 352 | int ret; | ||
| 353 | |||
| 354 | ret = auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_ACTIVE); | ||
| 355 | if (ret < 0) { | ||
| 356 | dev_err(&client->dev, "could not set power mode, %d\n", | ||
| 357 | ret); | ||
| 358 | return ret; | ||
| 359 | } | ||
| 360 | |||
| 361 | ts->stopped = false; | ||
| 362 | mb(); | ||
| 363 | enable_irq(client->irq); | ||
| 364 | |||
| 365 | ret = auo_pixcir_int_toggle(ts, 1); | ||
| 366 | if (ret < 0) { | ||
| 367 | dev_err(&client->dev, "could not enable interrupt, %d\n", | ||
| 368 | ret); | ||
| 369 | disable_irq(client->irq); | ||
| 370 | return ret; | ||
| 371 | } | ||
| 372 | |||
| 373 | return 0; | ||
| 374 | } | ||
| 375 | |||
| 376 | static int auo_pixcir_stop(struct auo_pixcir_ts *ts) | ||
| 377 | { | ||
| 378 | struct i2c_client *client = ts->client; | ||
| 379 | int ret; | ||
| 380 | |||
| 381 | ret = auo_pixcir_int_toggle(ts, 0); | ||
| 382 | if (ret < 0) { | ||
| 383 | dev_err(&client->dev, "could not disable interrupt, %d\n", | ||
| 384 | ret); | ||
| 385 | return ret; | ||
| 386 | } | ||
| 387 | |||
| 388 | /* disable receiving of interrupts */ | ||
| 389 | disable_irq(client->irq); | ||
| 390 | ts->stopped = true; | ||
| 391 | mb(); | ||
| 392 | wake_up(&ts->wait); | ||
| 393 | |||
| 394 | return auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_DEEP_SLEEP); | ||
| 395 | } | ||
| 396 | |||
| 397 | static int auo_pixcir_input_open(struct input_dev *dev) | ||
| 398 | { | ||
| 399 | struct auo_pixcir_ts *ts = input_get_drvdata(dev); | ||
| 400 | int ret; | ||
| 401 | |||
| 402 | ret = auo_pixcir_start(ts); | ||
| 403 | if (ret) | ||
| 404 | return ret; | ||
| 405 | |||
| 406 | return 0; | ||
| 407 | } | ||
| 408 | |||
| 409 | static void auo_pixcir_input_close(struct input_dev *dev) | ||
| 410 | { | ||
| 411 | struct auo_pixcir_ts *ts = input_get_drvdata(dev); | ||
| 412 | |||
| 413 | auo_pixcir_stop(ts); | ||
| 414 | |||
| 415 | return; | ||
| 416 | } | ||
| 417 | |||
| 418 | #ifdef CONFIG_PM_SLEEP | ||
| 419 | static int auo_pixcir_suspend(struct device *dev) | ||
| 420 | { | ||
| 421 | struct i2c_client *client = to_i2c_client(dev); | ||
| 422 | struct auo_pixcir_ts *ts = i2c_get_clientdata(client); | ||
| 423 | struct input_dev *input = ts->input; | ||
| 424 | int ret = 0; | ||
| 425 | |||
| 426 | mutex_lock(&input->mutex); | ||
| 427 | |||
| 428 | /* when configured as wakeup source, device should always wake system | ||
| 429 | * therefore start device if necessary | ||
| 430 | */ | ||
| 431 | if (device_may_wakeup(&client->dev)) { | ||
| 432 | /* need to start device if not open, to be wakeup source */ | ||
| 433 | if (!input->users) { | ||
| 434 | ret = auo_pixcir_start(ts); | ||
| 435 | if (ret) | ||
| 436 | goto unlock; | ||
| 437 | } | ||
| 438 | |||
| 439 | enable_irq_wake(client->irq); | ||
| 440 | ret = auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_SLEEP); | ||
| 441 | } else if (input->users) { | ||
| 442 | ret = auo_pixcir_stop(ts); | ||
| 443 | } | ||
| 444 | |||
| 445 | unlock: | ||
| 446 | mutex_unlock(&input->mutex); | ||
| 447 | |||
| 448 | return ret; | ||
| 449 | } | ||
| 450 | |||
| 451 | static int auo_pixcir_resume(struct device *dev) | ||
| 452 | { | ||
| 453 | struct i2c_client *client = to_i2c_client(dev); | ||
| 454 | struct auo_pixcir_ts *ts = i2c_get_clientdata(client); | ||
| 455 | struct input_dev *input = ts->input; | ||
| 456 | int ret = 0; | ||
| 457 | |||
| 458 | mutex_lock(&input->mutex); | ||
| 459 | |||
| 460 | if (device_may_wakeup(&client->dev)) { | ||
| 461 | disable_irq_wake(client->irq); | ||
| 462 | |||
| 463 | /* need to stop device if it was not open on suspend */ | ||
| 464 | if (!input->users) { | ||
| 465 | ret = auo_pixcir_stop(ts); | ||
| 466 | if (ret) | ||
| 467 | goto unlock; | ||
| 468 | } | ||
| 469 | |||
| 470 | /* device wakes automatically from SLEEP */ | ||
| 471 | } else if (input->users) { | ||
| 472 | ret = auo_pixcir_start(ts); | ||
| 473 | } | ||
| 474 | |||
| 475 | unlock: | ||
| 476 | mutex_unlock(&input->mutex); | ||
| 477 | |||
| 478 | return ret; | ||
| 479 | } | ||
| 480 | #endif | ||
| 481 | |||
| 482 | static SIMPLE_DEV_PM_OPS(auo_pixcir_pm_ops, auo_pixcir_suspend, | ||
| 483 | auo_pixcir_resume); | ||
| 484 | |||
| 485 | static int __devinit auo_pixcir_probe(struct i2c_client *client, | ||
| 486 | const struct i2c_device_id *id) | ||
| 487 | { | ||
| 488 | const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; | ||
| 489 | struct auo_pixcir_ts *ts; | ||
| 490 | struct input_dev *input_dev; | ||
| 491 | int ret; | ||
| 492 | |||
| 493 | if (!pdata) | ||
| 494 | return -EINVAL; | ||
| 495 | |||
| 496 | ts = kzalloc(sizeof(struct auo_pixcir_ts), GFP_KERNEL); | ||
| 497 | if (!ts) | ||
| 498 | return -ENOMEM; | ||
| 499 | |||
| 500 | ret = gpio_request(pdata->gpio_int, "auo_pixcir_ts_int"); | ||
| 501 | if (ret) { | ||
| 502 | dev_err(&client->dev, "request of gpio %d failed, %d\n", | ||
| 503 | pdata->gpio_int, ret); | ||
| 504 | goto err_gpio_int; | ||
| 505 | } | ||
| 506 | |||
| 507 | if (pdata->init_hw) | ||
| 508 | pdata->init_hw(client); | ||
| 509 | |||
| 510 | ts->client = client; | ||
| 511 | ts->touch_ind_mode = 0; | ||
| 512 | init_waitqueue_head(&ts->wait); | ||
| 513 | |||
| 514 | snprintf(ts->phys, sizeof(ts->phys), | ||
| 515 | "%s/input0", dev_name(&client->dev)); | ||
| 516 | |||
| 517 | input_dev = input_allocate_device(); | ||
| 518 | if (!input_dev) { | ||
| 519 | dev_err(&client->dev, "could not allocate input device\n"); | ||
| 520 | goto err_input_alloc; | ||
| 521 | } | ||
| 522 | |||
| 523 | ts->input = input_dev; | ||
| 524 | |||
| 525 | input_dev->name = "AUO-Pixcir touchscreen"; | ||
| 526 | input_dev->phys = ts->phys; | ||
| 527 | input_dev->id.bustype = BUS_I2C; | ||
| 528 | input_dev->dev.parent = &client->dev; | ||
| 529 | |||
| 530 | input_dev->open = auo_pixcir_input_open; | ||
| 531 | input_dev->close = auo_pixcir_input_close; | ||
| 532 | |||
| 533 | __set_bit(EV_ABS, input_dev->evbit); | ||
| 534 | __set_bit(EV_KEY, input_dev->evbit); | ||
| 535 | |||
| 536 | __set_bit(BTN_TOUCH, input_dev->keybit); | ||
| 537 | |||
| 538 | /* For single touch */ | ||
| 539 | input_set_abs_params(input_dev, ABS_X, 0, pdata->x_max, 0, 0); | ||
| 540 | input_set_abs_params(input_dev, ABS_Y, 0, pdata->y_max, 0, 0); | ||
| 541 | |||
| 542 | /* For multi touch */ | ||
| 543 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, | ||
| 544 | pdata->x_max, 0, 0); | ||
| 545 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, | ||
| 546 | pdata->y_max, 0, 0); | ||
| 547 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, | ||
| 548 | AUO_PIXCIR_MAX_AREA, 0, 0); | ||
| 549 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, | ||
| 550 | AUO_PIXCIR_MAX_AREA, 0, 0); | ||
| 551 | input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0); | ||
| 552 | |||
| 553 | ret = i2c_smbus_read_byte_data(client, AUO_PIXCIR_REG_VERSION); | ||
| 554 | if (ret < 0) | ||
| 555 | goto err_fw_vers; | ||
| 556 | dev_info(&client->dev, "firmware version 0x%X\n", ret); | ||
| 557 | |||
| 558 | ret = auo_pixcir_int_config(ts, pdata->int_setting); | ||
| 559 | if (ret) | ||
| 560 | goto err_fw_vers; | ||
| 561 | |||
| 562 | input_set_drvdata(ts->input, ts); | ||
| 563 | ts->stopped = true; | ||
| 564 | |||
| 565 | ret = request_threaded_irq(client->irq, NULL, auo_pixcir_interrupt, | ||
| 566 | IRQF_TRIGGER_RISING | IRQF_ONESHOT, | ||
| 567 | input_dev->name, ts); | ||
| 568 | if (ret) { | ||
| 569 | dev_err(&client->dev, "irq %d requested failed\n", client->irq); | ||
| 570 | goto err_fw_vers; | ||
| 571 | } | ||
| 572 | |||
| 573 | /* stop device and put it into deep sleep until it is opened */ | ||
| 574 | ret = auo_pixcir_stop(ts); | ||
| 575 | if (ret < 0) | ||
| 576 | goto err_input_register; | ||
| 577 | |||
| 578 | ret = input_register_device(input_dev); | ||
| 579 | if (ret) { | ||
| 580 | dev_err(&client->dev, "could not register input device\n"); | ||
| 581 | goto err_input_register; | ||
| 582 | } | ||
| 583 | |||
| 584 | i2c_set_clientdata(client, ts); | ||
| 585 | |||
| 586 | return 0; | ||
| 587 | |||
| 588 | err_input_register: | ||
| 589 | free_irq(client->irq, ts); | ||
| 590 | err_fw_vers: | ||
| 591 | input_free_device(input_dev); | ||
| 592 | err_input_alloc: | ||
| 593 | if (pdata->exit_hw) | ||
| 594 | pdata->exit_hw(client); | ||
| 595 | gpio_free(pdata->gpio_int); | ||
| 596 | err_gpio_int: | ||
| 597 | kfree(ts); | ||
| 598 | |||
| 599 | return ret; | ||
| 600 | } | ||
| 601 | |||
| 602 | static int __devexit auo_pixcir_remove(struct i2c_client *client) | ||
| 603 | { | ||
| 604 | struct auo_pixcir_ts *ts = i2c_get_clientdata(client); | ||
| 605 | const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; | ||
| 606 | |||
| 607 | free_irq(client->irq, ts); | ||
| 608 | |||
| 609 | input_unregister_device(ts->input); | ||
| 610 | |||
| 611 | if (pdata->exit_hw) | ||
| 612 | pdata->exit_hw(client); | ||
| 613 | |||
| 614 | gpio_free(pdata->gpio_int); | ||
| 615 | |||
| 616 | kfree(ts); | ||
| 617 | |||
| 618 | return 0; | ||
| 619 | } | ||
| 620 | |||
| 621 | static const struct i2c_device_id auo_pixcir_idtable[] = { | ||
| 622 | { "auo_pixcir_ts", 0 }, | ||
| 623 | { } | ||
| 624 | }; | ||
| 625 | MODULE_DEVICE_TABLE(i2c, auo_pixcir_idtable); | ||
| 626 | |||
| 627 | static struct i2c_driver auo_pixcir_driver = { | ||
| 628 | .driver = { | ||
| 629 | .owner = THIS_MODULE, | ||
| 630 | .name = "auo_pixcir_ts", | ||
| 631 | .pm = &auo_pixcir_pm_ops, | ||
| 632 | }, | ||
| 633 | .probe = auo_pixcir_probe, | ||
| 634 | .remove = __devexit_p(auo_pixcir_remove), | ||
| 635 | .id_table = auo_pixcir_idtable, | ||
| 636 | }; | ||
| 637 | |||
| 638 | static int __init auo_pixcir_init(void) | ||
| 639 | { | ||
| 640 | return i2c_add_driver(&auo_pixcir_driver); | ||
| 641 | } | ||
| 642 | module_init(auo_pixcir_init); | ||
| 643 | |||
| 644 | static void __exit auo_pixcir_exit(void) | ||
| 645 | { | ||
| 646 | i2c_del_driver(&auo_pixcir_driver); | ||
| 647 | } | ||
| 648 | module_exit(auo_pixcir_exit); | ||
| 649 | |||
| 650 | MODULE_DESCRIPTION("AUO-PIXCIR touchscreen driver"); | ||
| 651 | MODULE_LICENSE("GPL v2"); | ||
| 652 | MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>"); | ||
diff --git a/drivers/input/touchscreen/da9034-ts.c b/drivers/input/touchscreen/da9034-ts.c index 2b72a5923c16..36b65cf10d7f 100644 --- a/drivers/input/touchscreen/da9034-ts.c +++ b/drivers/input/touchscreen/da9034-ts.c | |||
| @@ -379,18 +379,7 @@ static struct platform_driver da9034_touch_driver = { | |||
| 379 | .probe = da9034_touch_probe, | 379 | .probe = da9034_touch_probe, |
| 380 | .remove = __devexit_p(da9034_touch_remove), | 380 | .remove = __devexit_p(da9034_touch_remove), |
| 381 | }; | 381 | }; |
| 382 | 382 | module_platform_driver(da9034_touch_driver); | |
| 383 | static int __init da9034_touch_init(void) | ||
| 384 | { | ||
| 385 | return platform_driver_register(&da9034_touch_driver); | ||
| 386 | } | ||
| 387 | module_init(da9034_touch_init); | ||
| 388 | |||
| 389 | static void __exit da9034_touch_exit(void) | ||
| 390 | { | ||
| 391 | platform_driver_unregister(&da9034_touch_driver); | ||
| 392 | } | ||
| 393 | module_exit(da9034_touch_exit); | ||
| 394 | 383 | ||
| 395 | MODULE_DESCRIPTION("Touchscreen driver for Dialog Semiconductor DA9034"); | 384 | MODULE_DESCRIPTION("Touchscreen driver for Dialog Semiconductor DA9034"); |
| 396 | MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>, Bin Yang <bin.yang@marvell.com>"); | 385 | MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>, Bin Yang <bin.yang@marvell.com>"); |
diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c new file mode 100644 index 000000000000..eadcc2e83c77 --- /dev/null +++ b/drivers/input/touchscreen/egalax_ts.c | |||
| @@ -0,0 +1,303 @@ | |||
| 1 | /* | ||
| 2 | * Driver for EETI eGalax Multiple Touch Controller | ||
| 3 | * | ||
| 4 | * Copyright (C) 2011 Freescale Semiconductor, Inc. | ||
| 5 | * | ||
| 6 | * based on max11801_ts.c | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | */ | ||
| 12 | |||
| 13 | /* EETI eGalax serial touch screen controller is a I2C based multiple | ||
| 14 | * touch screen controller, it supports 5 point multiple touch. */ | ||
| 15 | |||
| 16 | /* TODO: | ||
| 17 | - auto idle mode support | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include <linux/module.h> | ||
| 21 | #include <linux/init.h> | ||
| 22 | #include <linux/i2c.h> | ||
| 23 | #include <linux/interrupt.h> | ||
| 24 | #include <linux/input.h> | ||
| 25 | #include <linux/irq.h> | ||
| 26 | #include <linux/gpio.h> | ||
| 27 | #include <linux/delay.h> | ||
| 28 | #include <linux/slab.h> | ||
| 29 | #include <linux/bitops.h> | ||
| 30 | #include <linux/input/mt.h> | ||
| 31 | |||
| 32 | /* | ||
| 33 | * Mouse Mode: some panel may configure the controller to mouse mode, | ||
| 34 | * which can only report one point at a given time. | ||
| 35 | * This driver will ignore events in this mode. | ||
| 36 | */ | ||
| 37 | #define REPORT_MODE_MOUSE 0x1 | ||
| 38 | /* | ||
| 39 | * Vendor Mode: this mode is used to transfer some vendor specific | ||
| 40 | * messages. | ||
| 41 | * This driver will ignore events in this mode. | ||
| 42 | */ | ||
| 43 | #define REPORT_MODE_VENDOR 0x3 | ||
| 44 | /* Multiple Touch Mode */ | ||
| 45 | #define REPORT_MODE_MTTOUCH 0x4 | ||
| 46 | |||
| 47 | #define MAX_SUPPORT_POINTS 5 | ||
| 48 | |||
| 49 | #define EVENT_VALID_OFFSET 7 | ||
| 50 | #define EVENT_VALID_MASK (0x1 << EVENT_VALID_OFFSET) | ||
| 51 | #define EVENT_ID_OFFSET 2 | ||
| 52 | #define EVENT_ID_MASK (0xf << EVENT_ID_OFFSET) | ||
| 53 | #define EVENT_IN_RANGE (0x1 << 1) | ||
| 54 | #define EVENT_DOWN_UP (0X1 << 0) | ||
| 55 | |||
| 56 | #define MAX_I2C_DATA_LEN 10 | ||
| 57 | |||
| 58 | #define EGALAX_MAX_X 32760 | ||
| 59 | #define EGALAX_MAX_Y 32760 | ||
| 60 | #define EGALAX_MAX_TRIES 100 | ||
| 61 | |||
| 62 | struct egalax_ts { | ||
| 63 | struct i2c_client *client; | ||
| 64 | struct input_dev *input_dev; | ||
| 65 | }; | ||
| 66 | |||
| 67 | static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id) | ||
| 68 | { | ||
| 69 | struct egalax_ts *ts = dev_id; | ||
| 70 | struct input_dev *input_dev = ts->input_dev; | ||
| 71 | struct i2c_client *client = ts->client; | ||
| 72 | u8 buf[MAX_I2C_DATA_LEN]; | ||
| 73 | int id, ret, x, y, z; | ||
| 74 | int tries = 0; | ||
| 75 | bool down, valid; | ||
| 76 | u8 state; | ||
| 77 | |||
| 78 | do { | ||
| 79 | ret = i2c_master_recv(client, buf, MAX_I2C_DATA_LEN); | ||
| 80 | } while (ret == -EAGAIN && tries++ < EGALAX_MAX_TRIES); | ||
| 81 | |||
| 82 | if (ret < 0) | ||
| 83 | return IRQ_HANDLED; | ||
| 84 | |||
| 85 | if (buf[0] != REPORT_MODE_MTTOUCH) { | ||
| 86 | /* ignore mouse events and vendor events */ | ||
| 87 | return IRQ_HANDLED; | ||
| 88 | } | ||
| 89 | |||
| 90 | state = buf[1]; | ||
| 91 | x = (buf[3] << 8) | buf[2]; | ||
| 92 | y = (buf[5] << 8) | buf[4]; | ||
| 93 | z = (buf[7] << 8) | buf[6]; | ||
| 94 | |||
| 95 | valid = state & EVENT_VALID_MASK; | ||
| 96 | id = (state & EVENT_ID_MASK) >> EVENT_ID_OFFSET; | ||
| 97 | down = state & EVENT_DOWN_UP; | ||
| 98 | |||
| 99 | if (!valid || id > MAX_SUPPORT_POINTS) { | ||
| 100 | dev_dbg(&client->dev, "point invalid\n"); | ||
| 101 | return IRQ_HANDLED; | ||
| 102 | } | ||
| 103 | |||
| 104 | input_mt_slot(input_dev, id); | ||
| 105 | input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, down); | ||
| 106 | |||
| 107 | dev_dbg(&client->dev, "%s id:%d x:%d y:%d z:%d", | ||
| 108 | down ? "down" : "up", id, x, y, z); | ||
| 109 | |||
| 110 | if (down) { | ||
| 111 | input_report_abs(input_dev, ABS_MT_POSITION_X, x); | ||
| 112 | input_report_abs(input_dev, ABS_MT_POSITION_Y, y); | ||
| 113 | input_report_abs(input_dev, ABS_MT_PRESSURE, z); | ||
| 114 | } | ||
| 115 | |||
| 116 | input_mt_report_pointer_emulation(input_dev, true); | ||
| 117 | input_sync(input_dev); | ||
| 118 | |||
| 119 | return IRQ_HANDLED; | ||
| 120 | } | ||
| 121 | |||
| 122 | /* wake up controller by an falling edge of interrupt gpio. */ | ||
| 123 | static int egalax_wake_up_device(struct i2c_client *client) | ||
| 124 | { | ||
| 125 | int gpio = irq_to_gpio(client->irq); | ||
| 126 | int ret; | ||
| 127 | |||
| 128 | ret = gpio_request(gpio, "egalax_irq"); | ||
| 129 | if (ret < 0) { | ||
| 130 | dev_err(&client->dev, | ||
| 131 | "request gpio failed, cannot wake up controller: %d\n", | ||
| 132 | ret); | ||
| 133 | return ret; | ||
| 134 | } | ||
| 135 | |||
| 136 | /* wake up controller via an falling edge on IRQ gpio. */ | ||
| 137 | gpio_direction_output(gpio, 0); | ||
| 138 | gpio_set_value(gpio, 1); | ||
| 139 | |||
| 140 | /* controller should be waken up, return irq. */ | ||
| 141 | gpio_direction_input(gpio); | ||
| 142 | gpio_free(gpio); | ||
| 143 | |||
| 144 | return 0; | ||
| 145 | } | ||
| 146 | |||
| 147 | static int __devinit egalax_firmware_version(struct i2c_client *client) | ||
| 148 | { | ||
| 149 | static const u8 cmd[MAX_I2C_DATA_LEN] = { 0x03, 0x03, 0xa, 0x01, 0x41 }; | ||
| 150 | int ret; | ||
| 151 | |||
| 152 | ret = i2c_master_send(client, cmd, MAX_I2C_DATA_LEN); | ||
| 153 | if (ret < 0) | ||
| 154 | return ret; | ||
| 155 | |||
| 156 | return 0; | ||
| 157 | } | ||
| 158 | |||
| 159 | static int __devinit egalax_ts_probe(struct i2c_client *client, | ||
| 160 | const struct i2c_device_id *id) | ||
| 161 | { | ||
| 162 | struct egalax_ts *ts; | ||
| 163 | struct input_dev *input_dev; | ||
| 164 | int ret; | ||
| 165 | int error; | ||
| 166 | |||
| 167 | ts = kzalloc(sizeof(struct egalax_ts), GFP_KERNEL); | ||
| 168 | if (!ts) { | ||
| 169 | dev_err(&client->dev, "Failed to allocate memory\n"); | ||
| 170 | return -ENOMEM; | ||
| 171 | } | ||
| 172 | |||
| 173 | input_dev = input_allocate_device(); | ||
| 174 | if (!input_dev) { | ||
| 175 | dev_err(&client->dev, "Failed to allocate memory\n"); | ||
| 176 | error = -ENOMEM; | ||
| 177 | goto err_free_ts; | ||
| 178 | } | ||
| 179 | |||
| 180 | ts->client = client; | ||
| 181 | ts->input_dev = input_dev; | ||
| 182 | |||
| 183 | /* controller may be in sleep, wake it up. */ | ||
| 184 | egalax_wake_up_device(client); | ||
| 185 | |||
| 186 | ret = egalax_firmware_version(client); | ||
| 187 | if (ret < 0) { | ||
| 188 | dev_err(&client->dev, "Failed to read firmware version\n"); | ||
| 189 | error = -EIO; | ||
| 190 | goto err_free_dev; | ||
| 191 | } | ||
| 192 | |||
| 193 | input_dev->name = "EETI eGalax Touch Screen"; | ||
| 194 | input_dev->id.bustype = BUS_I2C; | ||
| 195 | input_dev->dev.parent = &client->dev; | ||
| 196 | |||
| 197 | __set_bit(EV_ABS, input_dev->evbit); | ||
| 198 | __set_bit(EV_KEY, input_dev->evbit); | ||
| 199 | __set_bit(BTN_TOUCH, input_dev->keybit); | ||
| 200 | |||
| 201 | input_set_abs_params(input_dev, ABS_X, 0, EGALAX_MAX_X, 0, 0); | ||
| 202 | input_set_abs_params(input_dev, ABS_Y, 0, EGALAX_MAX_Y, 0, 0); | ||
| 203 | input_set_abs_params(input_dev, | ||
| 204 | ABS_MT_POSITION_X, 0, EGALAX_MAX_X, 0, 0); | ||
| 205 | input_set_abs_params(input_dev, | ||
| 206 | ABS_MT_POSITION_X, 0, EGALAX_MAX_Y, 0, 0); | ||
| 207 | input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS); | ||
| 208 | |||
| 209 | input_set_drvdata(input_dev, ts); | ||
| 210 | |||
| 211 | error = request_threaded_irq(client->irq, NULL, egalax_ts_interrupt, | ||
| 212 | IRQF_TRIGGER_LOW | IRQF_ONESHOT, | ||
| 213 | "egalax_ts", ts); | ||
| 214 | if (error < 0) { | ||
| 215 | dev_err(&client->dev, "Failed to register interrupt\n"); | ||
| 216 | goto err_free_dev; | ||
| 217 | } | ||
| 218 | |||
| 219 | error = input_register_device(ts->input_dev); | ||
| 220 | if (error) | ||
| 221 | goto err_free_irq; | ||
| 222 | |||
| 223 | i2c_set_clientdata(client, ts); | ||
| 224 | return 0; | ||
| 225 | |||
| 226 | err_free_irq: | ||
| 227 | free_irq(client->irq, ts); | ||
| 228 | err_free_dev: | ||
| 229 | input_free_device(input_dev); | ||
| 230 | err_free_ts: | ||
| 231 | kfree(ts); | ||
| 232 | |||
| 233 | return error; | ||
| 234 | } | ||
| 235 | |||
| 236 | static __devexit int egalax_ts_remove(struct i2c_client *client) | ||
| 237 | { | ||
| 238 | struct egalax_ts *ts = i2c_get_clientdata(client); | ||
| 239 | |||
| 240 | free_irq(client->irq, ts); | ||
| 241 | |||
| 242 | input_unregister_device(ts->input_dev); | ||
| 243 | kfree(ts); | ||
| 244 | |||
| 245 | return 0; | ||
| 246 | } | ||
| 247 | |||
| 248 | static const struct i2c_device_id egalax_ts_id[] = { | ||
| 249 | { "egalax_ts", 0 }, | ||
| 250 | { } | ||
| 251 | }; | ||
| 252 | MODULE_DEVICE_TABLE(i2c, egalax_ts_id); | ||
| 253 | |||
| 254 | #ifdef CONFIG_PM_SLEEP | ||
| 255 | static int egalax_ts_suspend(struct device *dev) | ||
| 256 | { | ||
| 257 | static const u8 suspend_cmd[MAX_I2C_DATA_LEN] = { | ||
| 258 | 0x3, 0x6, 0xa, 0x3, 0x36, 0x3f, 0x2, 0, 0, 0 | ||
| 259 | }; | ||
| 260 | struct i2c_client *client = to_i2c_client(dev); | ||
| 261 | int ret; | ||
| 262 | |||
| 263 | ret = i2c_master_send(client, suspend_cmd, MAX_I2C_DATA_LEN); | ||
| 264 | return ret > 0 ? 0 : ret; | ||
| 265 | } | ||
| 266 | |||
| 267 | static int egalax_ts_resume(struct device *dev) | ||
| 268 | { | ||
| 269 | struct i2c_client *client = to_i2c_client(dev); | ||
| 270 | |||
| 271 | return egalax_wake_up_device(client); | ||
| 272 | } | ||
| 273 | #endif | ||
| 274 | |||
| 275 | static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume); | ||
| 276 | |||
| 277 | static struct i2c_driver egalax_ts_driver = { | ||
| 278 | .driver = { | ||
| 279 | .name = "egalax_ts", | ||
| 280 | .owner = THIS_MODULE, | ||
| 281 | .pm = &egalax_ts_pm_ops, | ||
| 282 | }, | ||
| 283 | .id_table = egalax_ts_id, | ||
| 284 | .probe = egalax_ts_probe, | ||
| 285 | .remove = __devexit_p(egalax_ts_remove), | ||
| 286 | }; | ||
| 287 | |||
| 288 | static int __init egalax_ts_init(void) | ||
| 289 | { | ||
| 290 | return i2c_add_driver(&egalax_ts_driver); | ||
| 291 | } | ||
| 292 | |||
| 293 | static void __exit egalax_ts_exit(void) | ||
| 294 | { | ||
| 295 | i2c_del_driver(&egalax_ts_driver); | ||
| 296 | } | ||
| 297 | |||
| 298 | module_init(egalax_ts_init); | ||
| 299 | module_exit(egalax_ts_exit); | ||
| 300 | |||
| 301 | MODULE_AUTHOR("Freescale Semiconductor, Inc."); | ||
| 302 | MODULE_DESCRIPTION("Touchscreen driver for EETI eGalax touch controller"); | ||
| 303 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c index 62811de6f18f..81e338623944 100644 --- a/drivers/input/touchscreen/htcpen.c +++ b/drivers/input/touchscreen/htcpen.c | |||
| @@ -47,12 +47,6 @@ static int invert_y; | |||
| 47 | module_param(invert_y, bool, 0644); | 47 | module_param(invert_y, bool, 0644); |
| 48 | MODULE_PARM_DESC(invert_y, "If set, Y axis is inverted"); | 48 | MODULE_PARM_DESC(invert_y, "If set, Y axis is inverted"); |
| 49 | 49 | ||
| 50 | static struct pnp_device_id pnp_ids[] = { | ||
| 51 | { .id = "PNP0cc0" }, | ||
| 52 | { .id = "" } | ||
| 53 | }; | ||
| 54 | MODULE_DEVICE_TABLE(pnp, pnp_ids); | ||
| 55 | |||
| 56 | static irqreturn_t htcpen_interrupt(int irq, void *handle) | 50 | static irqreturn_t htcpen_interrupt(int irq, void *handle) |
| 57 | { | 51 | { |
| 58 | struct input_dev *htcpen_dev = handle; | 52 | struct input_dev *htcpen_dev = handle; |
| @@ -237,6 +231,7 @@ static struct dmi_system_id __initdata htcshift_dmi_table[] = { | |||
| 237 | }, | 231 | }, |
| 238 | { } | 232 | { } |
| 239 | }; | 233 | }; |
| 234 | MODULE_DEVICE_TABLE(dmi, htcshift_dmi_table); | ||
| 240 | 235 | ||
| 241 | static int __init htcpen_isa_init(void) | 236 | static int __init htcpen_isa_init(void) |
| 242 | { | 237 | { |
diff --git a/drivers/input/touchscreen/intel-mid-touch.c b/drivers/input/touchscreen/intel-mid-touch.c index 327695268e06..3cd7a837f82b 100644 --- a/drivers/input/touchscreen/intel-mid-touch.c +++ b/drivers/input/touchscreen/intel-mid-touch.c | |||
| @@ -664,18 +664,7 @@ static struct platform_driver mrstouch_driver = { | |||
| 664 | .probe = mrstouch_probe, | 664 | .probe = mrstouch_probe, |
| 665 | .remove = __devexit_p(mrstouch_remove), | 665 | .remove = __devexit_p(mrstouch_remove), |
| 666 | }; | 666 | }; |
| 667 | 667 | module_platform_driver(mrstouch_driver); | |
| 668 | static int __init mrstouch_init(void) | ||
| 669 | { | ||
| 670 | return platform_driver_register(&mrstouch_driver); | ||
| 671 | } | ||
| 672 | module_init(mrstouch_init); | ||
| 673 | |||
| 674 | static void __exit mrstouch_exit(void) | ||
| 675 | { | ||
| 676 | platform_driver_unregister(&mrstouch_driver); | ||
| 677 | } | ||
| 678 | module_exit(mrstouch_exit); | ||
| 679 | 668 | ||
| 680 | MODULE_AUTHOR("Sreedhara Murthy. D.S, sreedhara.ds@intel.com"); | 669 | MODULE_AUTHOR("Sreedhara Murthy. D.S, sreedhara.ds@intel.com"); |
| 681 | MODULE_DESCRIPTION("Intel Moorestown Resistive Touch Screen Driver"); | 670 | MODULE_DESCRIPTION("Intel Moorestown Resistive Touch Screen Driver"); |
diff --git a/drivers/input/touchscreen/jornada720_ts.c b/drivers/input/touchscreen/jornada720_ts.c index 50076c2d59e2..c3848ad2325b 100644 --- a/drivers/input/touchscreen/jornada720_ts.c +++ b/drivers/input/touchscreen/jornada720_ts.c | |||
| @@ -172,16 +172,4 @@ static struct platform_driver jornada720_ts_driver = { | |||
| 172 | .owner = THIS_MODULE, | 172 | .owner = THIS_MODULE, |
| 173 | }, | 173 | }, |
| 174 | }; | 174 | }; |
| 175 | 175 | module_platform_driver(jornada720_ts_driver); | |
| 176 | static int __init jornada720_ts_init(void) | ||
| 177 | { | ||
| 178 | return platform_driver_register(&jornada720_ts_driver); | ||
| 179 | } | ||
| 180 | |||
| 181 | static void __exit jornada720_ts_exit(void) | ||
| 182 | { | ||
| 183 | platform_driver_unregister(&jornada720_ts_driver); | ||
| 184 | } | ||
| 185 | |||
| 186 | module_init(jornada720_ts_init); | ||
| 187 | module_exit(jornada720_ts_exit); | ||
diff --git a/drivers/input/touchscreen/lpc32xx_ts.c b/drivers/input/touchscreen/lpc32xx_ts.c index 0a484ed5295c..afcd0691ec67 100644 --- a/drivers/input/touchscreen/lpc32xx_ts.c +++ b/drivers/input/touchscreen/lpc32xx_ts.c | |||
| @@ -392,18 +392,7 @@ static struct platform_driver lpc32xx_ts_driver = { | |||
| 392 | .pm = LPC32XX_TS_PM_OPS, | 392 | .pm = LPC32XX_TS_PM_OPS, |
| 393 | }, | 393 | }, |
| 394 | }; | 394 | }; |
| 395 | 395 | module_platform_driver(lpc32xx_ts_driver); | |
| 396 | static int __init lpc32xx_ts_init(void) | ||
| 397 | { | ||
| 398 | return platform_driver_register(&lpc32xx_ts_driver); | ||
| 399 | } | ||
| 400 | module_init(lpc32xx_ts_init); | ||
| 401 | |||
| 402 | static void __exit lpc32xx_ts_exit(void) | ||
| 403 | { | ||
| 404 | platform_driver_unregister(&lpc32xx_ts_driver); | ||
| 405 | } | ||
| 406 | module_exit(lpc32xx_ts_exit); | ||
| 407 | 396 | ||
| 408 | MODULE_AUTHOR("Kevin Wells <kevin.wells@nxp.com"); | 397 | MODULE_AUTHOR("Kevin Wells <kevin.wells@nxp.com"); |
| 409 | MODULE_DESCRIPTION("LPC32XX TSC Driver"); | 398 | MODULE_DESCRIPTION("LPC32XX TSC Driver"); |
diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c index e966c29ff1bb..7d2b2136e5ad 100644 --- a/drivers/input/touchscreen/mainstone-wm97xx.c +++ b/drivers/input/touchscreen/mainstone-wm97xx.c | |||
| @@ -302,19 +302,7 @@ static struct platform_driver mainstone_wm97xx_driver = { | |||
| 302 | .name = "wm97xx-touch", | 302 | .name = "wm97xx-touch", |
| 303 | }, | 303 | }, |
| 304 | }; | 304 | }; |
| 305 | 305 | module_platform_driver(mainstone_wm97xx_driver); | |
| 306 | static int __init mainstone_wm97xx_init(void) | ||
| 307 | { | ||
| 308 | return platform_driver_register(&mainstone_wm97xx_driver); | ||
| 309 | } | ||
| 310 | |||
| 311 | static void __exit mainstone_wm97xx_exit(void) | ||
| 312 | { | ||
| 313 | platform_driver_unregister(&mainstone_wm97xx_driver); | ||
| 314 | } | ||
| 315 | |||
| 316 | module_init(mainstone_wm97xx_init); | ||
| 317 | module_exit(mainstone_wm97xx_exit); | ||
| 318 | 306 | ||
| 319 | /* Module information */ | 307 | /* Module information */ |
| 320 | MODULE_AUTHOR("Liam Girdwood <lrg@slimlogic.co.uk>"); | 308 | MODULE_AUTHOR("Liam Girdwood <lrg@slimlogic.co.uk>"); |
diff --git a/drivers/input/touchscreen/mc13783_ts.c b/drivers/input/touchscreen/mc13783_ts.c index ede02743eac1..68f86f7dabbc 100644 --- a/drivers/input/touchscreen/mc13783_ts.c +++ b/drivers/input/touchscreen/mc13783_ts.c | |||
| @@ -240,18 +240,7 @@ static struct platform_driver mc13783_ts_driver = { | |||
| 240 | .name = MC13783_TS_NAME, | 240 | .name = MC13783_TS_NAME, |
| 241 | }, | 241 | }, |
| 242 | }; | 242 | }; |
| 243 | 243 | module_platform_driver(mc13783_ts_driver); | |
| 244 | static int __init mc13783_ts_init(void) | ||
| 245 | { | ||
| 246 | return platform_driver_probe(&mc13783_ts_driver, &mc13783_ts_probe); | ||
| 247 | } | ||
| 248 | module_init(mc13783_ts_init); | ||
| 249 | |||
| 250 | static void __exit mc13783_ts_exit(void) | ||
| 251 | { | ||
| 252 | platform_driver_unregister(&mc13783_ts_driver); | ||
| 253 | } | ||
| 254 | module_exit(mc13783_ts_exit); | ||
| 255 | 244 | ||
| 256 | MODULE_DESCRIPTION("MC13783 input touchscreen driver"); | 245 | MODULE_DESCRIPTION("MC13783 input touchscreen driver"); |
| 257 | MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>"); | 246 | MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>"); |
diff --git a/drivers/input/touchscreen/migor_ts.c b/drivers/input/touchscreen/migor_ts.c index 5803bd0c1cca..5226194aa78e 100644 --- a/drivers/input/touchscreen/migor_ts.c +++ b/drivers/input/touchscreen/migor_ts.c | |||
| @@ -36,7 +36,6 @@ | |||
| 36 | struct migor_ts_priv { | 36 | struct migor_ts_priv { |
| 37 | struct i2c_client *client; | 37 | struct i2c_client *client; |
| 38 | struct input_dev *input; | 38 | struct input_dev *input; |
| 39 | struct delayed_work work; | ||
| 40 | int irq; | 39 | int irq; |
| 41 | }; | 40 | }; |
| 42 | 41 | ||
| @@ -44,15 +43,24 @@ static const u_int8_t migor_ts_ena_seq[17] = { 0x33, 0x22, 0x11, | |||
| 44 | 0x01, 0x06, 0x07, }; | 43 | 0x01, 0x06, 0x07, }; |
| 45 | static const u_int8_t migor_ts_dis_seq[17] = { }; | 44 | static const u_int8_t migor_ts_dis_seq[17] = { }; |
| 46 | 45 | ||
| 47 | static void migor_ts_poscheck(struct work_struct *work) | 46 | static irqreturn_t migor_ts_isr(int irq, void *dev_id) |
| 48 | { | 47 | { |
| 49 | struct migor_ts_priv *priv = container_of(work, | 48 | struct migor_ts_priv *priv = dev_id; |
| 50 | struct migor_ts_priv, | ||
| 51 | work.work); | ||
| 52 | unsigned short xpos, ypos; | 49 | unsigned short xpos, ypos; |
| 53 | unsigned char event; | 50 | unsigned char event; |
| 54 | u_int8_t buf[16]; | 51 | u_int8_t buf[16]; |
| 55 | 52 | ||
| 53 | /* | ||
| 54 | * The touch screen controller chip is hooked up to the CPU | ||
| 55 | * using I2C and a single interrupt line. The interrupt line | ||
| 56 | * is pulled low whenever someone taps the screen. To deassert | ||
| 57 | * the interrupt line we need to acknowledge the interrupt by | ||
| 58 | * communicating with the controller over the slow i2c bus. | ||
| 59 | * | ||
| 60 | * Since I2C bus controller may sleep we are using threaded | ||
| 61 | * IRQ here. | ||
| 62 | */ | ||
| 63 | |||
| 56 | memset(buf, 0, sizeof(buf)); | 64 | memset(buf, 0, sizeof(buf)); |
| 57 | 65 | ||
| 58 | /* Set Index 0 */ | 66 | /* Set Index 0 */ |
| @@ -72,41 +80,25 @@ static void migor_ts_poscheck(struct work_struct *work) | |||
| 72 | xpos = ((buf[11] & 0x03) << 8 | buf[10]); | 80 | xpos = ((buf[11] & 0x03) << 8 | buf[10]); |
| 73 | event = buf[12]; | 81 | event = buf[12]; |
| 74 | 82 | ||
| 75 | if (event == EVENT_PENDOWN || event == EVENT_REPEAT) { | 83 | switch (event) { |
| 84 | case EVENT_PENDOWN: | ||
| 85 | case EVENT_REPEAT: | ||
| 76 | input_report_key(priv->input, BTN_TOUCH, 1); | 86 | input_report_key(priv->input, BTN_TOUCH, 1); |
| 77 | input_report_abs(priv->input, ABS_X, ypos); /*X-Y swap*/ | 87 | input_report_abs(priv->input, ABS_X, ypos); /*X-Y swap*/ |
| 78 | input_report_abs(priv->input, ABS_Y, xpos); | 88 | input_report_abs(priv->input, ABS_Y, xpos); |
| 79 | input_sync(priv->input); | 89 | input_sync(priv->input); |
| 80 | } else if (event == EVENT_PENUP) { | 90 | break; |
| 91 | |||
| 92 | case EVENT_PENUP: | ||
| 81 | input_report_key(priv->input, BTN_TOUCH, 0); | 93 | input_report_key(priv->input, BTN_TOUCH, 0); |
| 82 | input_sync(priv->input); | 94 | input_sync(priv->input); |
| 95 | break; | ||
| 83 | } | 96 | } |
| 84 | out: | ||
| 85 | enable_irq(priv->irq); | ||
| 86 | } | ||
| 87 | |||
| 88 | static irqreturn_t migor_ts_isr(int irq, void *dev_id) | ||
| 89 | { | ||
| 90 | struct migor_ts_priv *priv = dev_id; | ||
| 91 | |||
| 92 | /* the touch screen controller chip is hooked up to the cpu | ||
| 93 | * using i2c and a single interrupt line. the interrupt line | ||
| 94 | * is pulled low whenever someone taps the screen. to deassert | ||
| 95 | * the interrupt line we need to acknowledge the interrupt by | ||
| 96 | * communicating with the controller over the slow i2c bus. | ||
| 97 | * | ||
| 98 | * we can't acknowledge from interrupt context since the i2c | ||
| 99 | * bus controller may sleep, so we just disable the interrupt | ||
| 100 | * here and handle the acknowledge using delayed work. | ||
| 101 | */ | ||
| 102 | |||
| 103 | disable_irq_nosync(irq); | ||
| 104 | schedule_delayed_work(&priv->work, HZ / 20); | ||
| 105 | 97 | ||
| 98 | out: | ||
| 106 | return IRQ_HANDLED; | 99 | return IRQ_HANDLED; |
| 107 | } | 100 | } |
| 108 | 101 | ||
| 109 | |||
| 110 | static int migor_ts_open(struct input_dev *dev) | 102 | static int migor_ts_open(struct input_dev *dev) |
| 111 | { | 103 | { |
| 112 | struct migor_ts_priv *priv = input_get_drvdata(dev); | 104 | struct migor_ts_priv *priv = input_get_drvdata(dev); |
| @@ -131,15 +123,6 @@ static void migor_ts_close(struct input_dev *dev) | |||
| 131 | 123 | ||
| 132 | disable_irq(priv->irq); | 124 | disable_irq(priv->irq); |
| 133 | 125 | ||
| 134 | /* cancel pending work and wait for migor_ts_poscheck() to finish */ | ||
| 135 | if (cancel_delayed_work_sync(&priv->work)) { | ||
| 136 | /* | ||
| 137 | * if migor_ts_poscheck was canceled we need to enable IRQ | ||
| 138 | * here to balance disable done in migor_ts_isr. | ||
| 139 | */ | ||
| 140 | enable_irq(priv->irq); | ||
| 141 | } | ||
| 142 | |||
| 143 | /* disable controller */ | 126 | /* disable controller */ |
| 144 | i2c_master_send(client, migor_ts_dis_seq, sizeof(migor_ts_dis_seq)); | 127 | i2c_master_send(client, migor_ts_dis_seq, sizeof(migor_ts_dis_seq)); |
| 145 | 128 | ||
| @@ -154,23 +137,20 @@ static int migor_ts_probe(struct i2c_client *client, | |||
| 154 | int error; | 137 | int error; |
| 155 | 138 | ||
| 156 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 139 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| 157 | if (!priv) { | ||
| 158 | dev_err(&client->dev, "failed to allocate driver data\n"); | ||
| 159 | error = -ENOMEM; | ||
| 160 | goto err0; | ||
| 161 | } | ||
| 162 | |||
| 163 | dev_set_drvdata(&client->dev, priv); | ||
| 164 | |||
| 165 | input = input_allocate_device(); | 140 | input = input_allocate_device(); |
| 166 | if (!input) { | 141 | if (!priv || !input) { |
| 167 | dev_err(&client->dev, "Failed to allocate input device.\n"); | 142 | dev_err(&client->dev, "failed to allocate memory\n"); |
| 168 | error = -ENOMEM; | 143 | error = -ENOMEM; |
| 169 | goto err1; | 144 | goto err_free_mem; |
| 170 | } | 145 | } |
| 171 | 146 | ||
| 147 | priv->client = client; | ||
| 148 | priv->input = input; | ||
| 149 | priv->irq = client->irq; | ||
| 150 | |||
| 172 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 151 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
| 173 | input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | 152 | |
| 153 | __set_bit(BTN_TOUCH, input->keybit); | ||
| 174 | 154 | ||
| 175 | input_set_abs_params(input, ABS_X, 95, 955, 0, 0); | 155 | input_set_abs_params(input, ABS_X, 95, 955, 0, 0); |
| 176 | input_set_abs_params(input, ABS_Y, 85, 935, 0, 0); | 156 | input_set_abs_params(input, ABS_Y, 85, 935, 0, 0); |
| @@ -184,39 +164,34 @@ static int migor_ts_probe(struct i2c_client *client, | |||
| 184 | 164 | ||
| 185 | input_set_drvdata(input, priv); | 165 | input_set_drvdata(input, priv); |
| 186 | 166 | ||
| 187 | priv->client = client; | 167 | error = request_threaded_irq(priv->irq, NULL, migor_ts_isr, |
| 188 | priv->input = input; | 168 | IRQF_TRIGGER_LOW | IRQF_ONESHOT, |
| 189 | INIT_DELAYED_WORK(&priv->work, migor_ts_poscheck); | 169 | client->name, priv); |
| 190 | priv->irq = client->irq; | ||
| 191 | |||
| 192 | error = input_register_device(input); | ||
| 193 | if (error) | ||
| 194 | goto err1; | ||
| 195 | |||
| 196 | error = request_irq(priv->irq, migor_ts_isr, IRQF_TRIGGER_LOW, | ||
| 197 | client->name, priv); | ||
| 198 | if (error) { | 170 | if (error) { |
| 199 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); | 171 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); |
| 200 | goto err2; | 172 | goto err_free_mem; |
| 201 | } | 173 | } |
| 202 | 174 | ||
| 175 | error = input_register_device(input); | ||
| 176 | if (error) | ||
| 177 | goto err_free_irq; | ||
| 178 | |||
| 179 | i2c_set_clientdata(client, priv); | ||
| 203 | device_init_wakeup(&client->dev, 1); | 180 | device_init_wakeup(&client->dev, 1); |
| 181 | |||
| 204 | return 0; | 182 | return 0; |
| 205 | 183 | ||
| 206 | err2: | 184 | err_free_irq: |
| 207 | input_unregister_device(input); | 185 | free_irq(priv->irq, priv); |
| 208 | input = NULL; /* so we dont try to free it below */ | 186 | err_free_mem: |
| 209 | err1: | ||
| 210 | input_free_device(input); | 187 | input_free_device(input); |
| 211 | kfree(priv); | 188 | kfree(priv); |
| 212 | err0: | ||
| 213 | dev_set_drvdata(&client->dev, NULL); | ||
| 214 | return error; | 189 | return error; |
| 215 | } | 190 | } |
| 216 | 191 | ||
| 217 | static int migor_ts_remove(struct i2c_client *client) | 192 | static int migor_ts_remove(struct i2c_client *client) |
| 218 | { | 193 | { |
| 219 | struct migor_ts_priv *priv = dev_get_drvdata(&client->dev); | 194 | struct migor_ts_priv *priv = i2c_get_clientdata(client); |
| 220 | 195 | ||
| 221 | free_irq(priv->irq, priv); | 196 | free_irq(priv->irq, priv); |
| 222 | input_unregister_device(priv->input); | 197 | input_unregister_device(priv->input); |
| @@ -230,7 +205,7 @@ static int migor_ts_remove(struct i2c_client *client) | |||
| 230 | static int migor_ts_suspend(struct device *dev) | 205 | static int migor_ts_suspend(struct device *dev) |
| 231 | { | 206 | { |
| 232 | struct i2c_client *client = to_i2c_client(dev); | 207 | struct i2c_client *client = to_i2c_client(dev); |
| 233 | struct migor_ts_priv *priv = dev_get_drvdata(&client->dev); | 208 | struct migor_ts_priv *priv = i2c_get_clientdata(client); |
| 234 | 209 | ||
| 235 | if (device_may_wakeup(&client->dev)) | 210 | if (device_may_wakeup(&client->dev)) |
| 236 | enable_irq_wake(priv->irq); | 211 | enable_irq_wake(priv->irq); |
| @@ -241,7 +216,7 @@ static int migor_ts_suspend(struct device *dev) | |||
| 241 | static int migor_ts_resume(struct device *dev) | 216 | static int migor_ts_resume(struct device *dev) |
| 242 | { | 217 | { |
| 243 | struct i2c_client *client = to_i2c_client(dev); | 218 | struct i2c_client *client = to_i2c_client(dev); |
| 244 | struct migor_ts_priv *priv = dev_get_drvdata(&client->dev); | 219 | struct migor_ts_priv *priv = i2c_get_clientdata(client); |
| 245 | 220 | ||
| 246 | if (device_may_wakeup(&client->dev)) | 221 | if (device_may_wakeup(&client->dev)) |
| 247 | disable_irq_wake(priv->irq); | 222 | disable_irq_wake(priv->irq); |
diff --git a/drivers/input/touchscreen/pcap_ts.c b/drivers/input/touchscreen/pcap_ts.c index ea6ef16e59b4..f57aeb80f7e3 100644 --- a/drivers/input/touchscreen/pcap_ts.c +++ b/drivers/input/touchscreen/pcap_ts.c | |||
| @@ -252,19 +252,7 @@ static struct platform_driver pcap_ts_driver = { | |||
| 252 | .pm = PCAP_TS_PM_OPS, | 252 | .pm = PCAP_TS_PM_OPS, |
| 253 | }, | 253 | }, |
| 254 | }; | 254 | }; |
| 255 | 255 | module_platform_driver(pcap_ts_driver); | |
| 256 | static int __init pcap_ts_init(void) | ||
| 257 | { | ||
| 258 | return platform_driver_register(&pcap_ts_driver); | ||
| 259 | } | ||
| 260 | |||
| 261 | static void __exit pcap_ts_exit(void) | ||
| 262 | { | ||
| 263 | platform_driver_unregister(&pcap_ts_driver); | ||
| 264 | } | ||
| 265 | |||
| 266 | module_init(pcap_ts_init); | ||
| 267 | module_exit(pcap_ts_exit); | ||
| 268 | 256 | ||
| 269 | MODULE_DESCRIPTION("Motorola PCAP2 touchscreen driver"); | 257 | MODULE_DESCRIPTION("Motorola PCAP2 touchscreen driver"); |
| 270 | MODULE_AUTHOR("Daniel Ribeiro / Harald Welte"); | 258 | MODULE_AUTHOR("Daniel Ribeiro / Harald Welte"); |
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c new file mode 100644 index 000000000000..d5ac09a1ee56 --- /dev/null +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c | |||
| @@ -0,0 +1,239 @@ | |||
| 1 | /* | ||
| 2 | * Driver for Pixcir I2C touchscreen controllers. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2010-2011 Pixcir, Inc. | ||
| 5 | * | ||
| 6 | * This software is licensed under the terms of the GNU General Public | ||
| 7 | * License version 2, as published by the Free Software Foundation, and | ||
| 8 | * may be copied, distributed, and modified under those terms. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public | ||
| 16 | * License along with this library; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include <linux/delay.h> | ||
| 21 | #include <linux/module.h> | ||
| 22 | #include <linux/interrupt.h> | ||
| 23 | #include <linux/slab.h> | ||
| 24 | #include <linux/i2c.h> | ||
| 25 | #include <linux/input.h> | ||
| 26 | #include <linux/input/pixcir_ts.h> | ||
| 27 | |||
| 28 | struct pixcir_i2c_ts_data { | ||
| 29 | struct i2c_client *client; | ||
| 30 | struct input_dev *input; | ||
| 31 | const struct pixcir_ts_platform_data *chip; | ||
| 32 | bool exiting; | ||
| 33 | }; | ||
| 34 | |||
| 35 | static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data) | ||
| 36 | { | ||
| 37 | struct pixcir_i2c_ts_data *tsdata = data; | ||
| 38 | u8 rdbuf[10], wrbuf[1] = { 0 }; | ||
| 39 | u8 touch; | ||
| 40 | int ret; | ||
| 41 | |||
| 42 | ret = i2c_master_send(tsdata->client, wrbuf, sizeof(wrbuf)); | ||
| 43 | if (ret != sizeof(wrbuf)) { | ||
| 44 | dev_err(&tsdata->client->dev, | ||
| 45 | "%s: i2c_master_send failed(), ret=%d\n", | ||
| 46 | __func__, ret); | ||
| 47 | return; | ||
| 48 | } | ||
| 49 | |||
| 50 | ret = i2c_master_recv(tsdata->client, rdbuf, sizeof(rdbuf)); | ||
| 51 | if (ret != sizeof(rdbuf)) { | ||
| 52 | dev_err(&tsdata->client->dev, | ||
| 53 | "%s: i2c_master_recv failed(), ret=%d\n", | ||
| 54 | __func__, ret); | ||
| 55 | return; | ||
| 56 | } | ||
| 57 | |||
| 58 | touch = rdbuf[0]; | ||
| 59 | if (touch) { | ||
| 60 | u16 posx1 = (rdbuf[3] << 8) | rdbuf[2]; | ||
| 61 | u16 posy1 = (rdbuf[5] << 8) | rdbuf[4]; | ||
| 62 | u16 posx2 = (rdbuf[7] << 8) | rdbuf[6]; | ||
| 63 | u16 posy2 = (rdbuf[9] << 8) | rdbuf[8]; | ||
| 64 | |||
| 65 | input_report_key(tsdata->input, BTN_TOUCH, 1); | ||
| 66 | input_report_abs(tsdata->input, ABS_X, posx1); | ||
| 67 | input_report_abs(tsdata->input, ABS_Y, posy1); | ||
| 68 | |||
| 69 | input_report_abs(tsdata->input, ABS_MT_POSITION_X, posx1); | ||
| 70 | input_report_abs(tsdata->input, ABS_MT_POSITION_Y, posy1); | ||
| 71 | input_mt_sync(tsdata->input); | ||
| 72 | |||
| 73 | if (touch == 2) { | ||
| 74 | input_report_abs(tsdata->input, | ||
| 75 | ABS_MT_POSITION_X, posx2); | ||
| 76 | input_report_abs(tsdata->input, | ||
| 77 | ABS_MT_POSITION_Y, posy2); | ||
| 78 | input_mt_sync(tsdata->input); | ||
| 79 | } | ||
| 80 | } else { | ||
| 81 | input_report_key(tsdata->input, BTN_TOUCH, 0); | ||
| 82 | } | ||
| 83 | |||
| 84 | input_sync(tsdata->input); | ||
| 85 | } | ||
| 86 | |||
| 87 | static irqreturn_t pixcir_ts_isr(int irq, void *dev_id) | ||
| 88 | { | ||
| 89 | struct pixcir_i2c_ts_data *tsdata = dev_id; | ||
| 90 | |||
| 91 | while (!tsdata->exiting) { | ||
| 92 | pixcir_ts_poscheck(tsdata); | ||
| 93 | |||
| 94 | if (tsdata->chip->attb_read_val()) | ||
| 95 | break; | ||
| 96 | |||
| 97 | msleep(20); | ||
| 98 | } | ||
| 99 | |||
| 100 | return IRQ_HANDLED; | ||
| 101 | } | ||
| 102 | |||
| 103 | #ifdef CONFIG_PM_SLEEP | ||
| 104 | static int pixcir_i2c_ts_suspend(struct device *dev) | ||
| 105 | { | ||
| 106 | struct i2c_client *client = to_i2c_client(dev); | ||
| 107 | |||
| 108 | if (device_may_wakeup(&client->dev)) | ||
| 109 | enable_irq_wake(client->irq); | ||
| 110 | |||
| 111 | return 0; | ||
| 112 | } | ||
| 113 | |||
| 114 | static int pixcir_i2c_ts_resume(struct device *dev) | ||
| 115 | { | ||
| 116 | struct i2c_client *client = to_i2c_client(dev); | ||
| 117 | |||
| 118 | if (device_may_wakeup(&client->dev)) | ||
| 119 | disable_irq_wake(client->irq); | ||
| 120 | |||
| 121 | return 0; | ||
| 122 | } | ||
| 123 | #endif | ||
| 124 | |||
| 125 | static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops, | ||
| 126 | pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume); | ||
| 127 | |||
| 128 | static int __devinit pixcir_i2c_ts_probe(struct i2c_client *client, | ||
| 129 | const struct i2c_device_id *id) | ||
| 130 | { | ||
| 131 | const struct pixcir_ts_platform_data *pdata = client->dev.platform_data; | ||
| 132 | struct pixcir_i2c_ts_data *tsdata; | ||
| 133 | struct input_dev *input; | ||
| 134 | int error; | ||
| 135 | |||
| 136 | if (!pdata) { | ||
| 137 | dev_err(&client->dev, "platform data not defined\n"); | ||
| 138 | return -EINVAL; | ||
| 139 | } | ||
| 140 | |||
| 141 | tsdata = kzalloc(sizeof(*tsdata), GFP_KERNEL); | ||
| 142 | input = input_allocate_device(); | ||
| 143 | if (!tsdata || !input) { | ||
| 144 | dev_err(&client->dev, "Failed to allocate driver data!\n"); | ||
| 145 | error = -ENOMEM; | ||
| 146 | goto err_free_mem; | ||
| 147 | } | ||
| 148 | |||
| 149 | tsdata->client = client; | ||
| 150 | tsdata->input = input; | ||
| 151 | tsdata->chip = pdata; | ||
| 152 | |||
| 153 | input->name = client->name; | ||
| 154 | input->id.bustype = BUS_I2C; | ||
| 155 | input->dev.parent = &client->dev; | ||
| 156 | |||
| 157 | __set_bit(EV_KEY, input->evbit); | ||
| 158 | __set_bit(EV_ABS, input->evbit); | ||
| 159 | __set_bit(BTN_TOUCH, input->keybit); | ||
| 160 | input_set_abs_params(input, ABS_X, 0, pdata->x_max, 0, 0); | ||
| 161 | input_set_abs_params(input, ABS_Y, 0, pdata->y_max, 0, 0); | ||
| 162 | input_set_abs_params(input, ABS_MT_POSITION_X, 0, pdata->x_max, 0, 0); | ||
| 163 | input_set_abs_params(input, ABS_MT_POSITION_Y, 0, pdata->y_max, 0, 0); | ||
| 164 | |||
| 165 | input_set_drvdata(input, tsdata); | ||
| 166 | |||
| 167 | error = request_threaded_irq(client->irq, NULL, pixcir_ts_isr, | ||
| 168 | IRQF_TRIGGER_FALLING, | ||
| 169 | client->name, tsdata); | ||
| 170 | if (error) { | ||
| 171 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); | ||
| 172 | goto err_free_mem; | ||
| 173 | } | ||
| 174 | |||
| 175 | error = input_register_device(input); | ||
| 176 | if (error) | ||
| 177 | goto err_free_irq; | ||
| 178 | |||
| 179 | i2c_set_clientdata(client, tsdata); | ||
| 180 | device_init_wakeup(&client->dev, 1); | ||
| 181 | |||
| 182 | return 0; | ||
| 183 | |||
| 184 | err_free_irq: | ||
| 185 | free_irq(client->irq, tsdata); | ||
| 186 | err_free_mem: | ||
| 187 | input_free_device(input); | ||
| 188 | kfree(tsdata); | ||
| 189 | return error; | ||
| 190 | } | ||
| 191 | |||
| 192 | static int __devexit pixcir_i2c_ts_remove(struct i2c_client *client) | ||
| 193 | { | ||
| 194 | struct pixcir_i2c_ts_data *tsdata = i2c_get_clientdata(client); | ||
| 195 | |||
| 196 | device_init_wakeup(&client->dev, 0); | ||
| 197 | |||
| 198 | tsdata->exiting = true; | ||
| 199 | mb(); | ||
| 200 | free_irq(client->irq, tsdata); | ||
| 201 | |||
| 202 | input_unregister_device(tsdata->input); | ||
| 203 | kfree(tsdata); | ||
| 204 | |||
| 205 | return 0; | ||
| 206 | } | ||
| 207 | |||
| 208 | static const struct i2c_device_id pixcir_i2c_ts_id[] = { | ||
| 209 | { "pixcir_ts", 0 }, | ||
| 210 | { } | ||
| 211 | }; | ||
| 212 | MODULE_DEVICE_TABLE(i2c, pixcir_i2c_ts_id); | ||
| 213 | |||
| 214 | static struct i2c_driver pixcir_i2c_ts_driver = { | ||
| 215 | .driver = { | ||
| 216 | .owner = THIS_MODULE, | ||
| 217 | .name = "pixcir_ts", | ||
| 218 | .pm = &pixcir_dev_pm_ops, | ||
| 219 | }, | ||
| 220 | .probe = pixcir_i2c_ts_probe, | ||
| 221 | .remove = __devexit_p(pixcir_i2c_ts_remove), | ||
| 222 | .id_table = pixcir_i2c_ts_id, | ||
| 223 | }; | ||
| 224 | |||
| 225 | static int __init pixcir_i2c_ts_init(void) | ||
| 226 | { | ||
| 227 | return i2c_add_driver(&pixcir_i2c_ts_driver); | ||
| 228 | } | ||
| 229 | module_init(pixcir_i2c_ts_init); | ||
| 230 | |||
| 231 | static void __exit pixcir_i2c_ts_exit(void) | ||
| 232 | { | ||
| 233 | i2c_del_driver(&pixcir_i2c_ts_driver); | ||
| 234 | } | ||
| 235 | module_exit(pixcir_i2c_ts_exit); | ||
| 236 | |||
| 237 | MODULE_AUTHOR("Jianchun Bian <jcbian@pixcir.com.cn>, Dequan Meng <dqmeng@pixcir.com.cn>"); | ||
| 238 | MODULE_DESCRIPTION("Pixcir I2C Touchscreen Driver"); | ||
| 239 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c index 64ce697a3456..bf1a06400067 100644 --- a/drivers/input/touchscreen/s3c2410_ts.c +++ b/drivers/input/touchscreen/s3c2410_ts.c | |||
| @@ -432,19 +432,7 @@ static struct platform_driver s3c_ts_driver = { | |||
| 432 | .probe = s3c2410ts_probe, | 432 | .probe = s3c2410ts_probe, |
| 433 | .remove = __devexit_p(s3c2410ts_remove), | 433 | .remove = __devexit_p(s3c2410ts_remove), |
| 434 | }; | 434 | }; |
| 435 | 435 | module_platform_driver(s3c_ts_driver); | |
| 436 | static int __init s3c2410ts_init(void) | ||
| 437 | { | ||
| 438 | return platform_driver_register(&s3c_ts_driver); | ||
| 439 | } | ||
| 440 | |||
| 441 | static void __exit s3c2410ts_exit(void) | ||
| 442 | { | ||
| 443 | platform_driver_unregister(&s3c_ts_driver); | ||
| 444 | } | ||
| 445 | |||
| 446 | module_init(s3c2410ts_init); | ||
| 447 | module_exit(s3c2410ts_exit); | ||
| 448 | 436 | ||
| 449 | MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>, " | 437 | MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>, " |
| 450 | "Ben Dooks <ben@simtec.co.uk>, " | 438 | "Ben Dooks <ben@simtec.co.uk>, " |
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index ae88e13c99ff..692b685720ce 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c | |||
| @@ -379,20 +379,7 @@ static struct platform_driver stmpe_ts_driver = { | |||
| 379 | .probe = stmpe_input_probe, | 379 | .probe = stmpe_input_probe, |
| 380 | .remove = __devexit_p(stmpe_ts_remove), | 380 | .remove = __devexit_p(stmpe_ts_remove), |
| 381 | }; | 381 | }; |
| 382 | 382 | module_platform_driver(stmpe_ts_driver); | |
| 383 | static int __init stmpe_ts_init(void) | ||
| 384 | { | ||
| 385 | return platform_driver_register(&stmpe_ts_driver); | ||
| 386 | } | ||
| 387 | |||
| 388 | module_init(stmpe_ts_init); | ||
| 389 | |||
| 390 | static void __exit stmpe_ts_exit(void) | ||
| 391 | { | ||
| 392 | platform_driver_unregister(&stmpe_ts_driver); | ||
| 393 | } | ||
| 394 | |||
| 395 | module_exit(stmpe_ts_exit); | ||
| 396 | 383 | ||
| 397 | MODULE_AUTHOR("Luotao Fu <l.fu@pengutronix.de>"); | 384 | MODULE_AUTHOR("Luotao Fu <l.fu@pengutronix.de>"); |
| 398 | MODULE_DESCRIPTION("STMPEXXX touchscreen driver"); | 385 | MODULE_DESCRIPTION("STMPEXXX touchscreen driver"); |
diff --git a/drivers/input/touchscreen/tnetv107x-ts.c b/drivers/input/touchscreen/tnetv107x-ts.c index 0e8f63e5b36f..7e7488097359 100644 --- a/drivers/input/touchscreen/tnetv107x-ts.c +++ b/drivers/input/touchscreen/tnetv107x-ts.c | |||
| @@ -378,19 +378,7 @@ static struct platform_driver tsc_driver = { | |||
| 378 | .driver.name = "tnetv107x-ts", | 378 | .driver.name = "tnetv107x-ts", |
| 379 | .driver.owner = THIS_MODULE, | 379 | .driver.owner = THIS_MODULE, |
| 380 | }; | 380 | }; |
| 381 | 381 | module_platform_driver(tsc_driver); | |
| 382 | static int __init tsc_init(void) | ||
| 383 | { | ||
| 384 | return platform_driver_register(&tsc_driver); | ||
| 385 | } | ||
| 386 | |||
| 387 | static void __exit tsc_exit(void) | ||
| 388 | { | ||
| 389 | platform_driver_unregister(&tsc_driver); | ||
| 390 | } | ||
| 391 | |||
| 392 | module_init(tsc_init); | ||
| 393 | module_exit(tsc_exit); | ||
| 394 | 382 | ||
| 395 | MODULE_AUTHOR("Cyril Chemparathy"); | 383 | MODULE_AUTHOR("Cyril Chemparathy"); |
| 396 | MODULE_DESCRIPTION("TNETV107X Touchscreen Driver"); | 384 | MODULE_DESCRIPTION("TNETV107X Touchscreen Driver"); |
diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index 43031492d733..6c6f6d8ea9b4 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c | |||
| @@ -371,18 +371,7 @@ static struct platform_driver tps6507x_ts_driver = { | |||
| 371 | .probe = tps6507x_ts_probe, | 371 | .probe = tps6507x_ts_probe, |
| 372 | .remove = __devexit_p(tps6507x_ts_remove), | 372 | .remove = __devexit_p(tps6507x_ts_remove), |
| 373 | }; | 373 | }; |
| 374 | 374 | module_platform_driver(tps6507x_ts_driver); | |
| 375 | static int __init tps6507x_ts_init(void) | ||
| 376 | { | ||
| 377 | return platform_driver_register(&tps6507x_ts_driver); | ||
| 378 | } | ||
| 379 | module_init(tps6507x_ts_init); | ||
| 380 | |||
| 381 | static void __exit tps6507x_ts_exit(void) | ||
| 382 | { | ||
| 383 | platform_driver_unregister(&tps6507x_ts_driver); | ||
| 384 | } | ||
| 385 | module_exit(tps6507x_ts_exit); | ||
| 386 | 375 | ||
| 387 | MODULE_AUTHOR("Todd Fischer <todd.fischer@ridgerun.com>"); | 376 | MODULE_AUTHOR("Todd Fischer <todd.fischer@ridgerun.com>"); |
| 388 | MODULE_DESCRIPTION("TPS6507x - TouchScreen driver"); | 377 | MODULE_DESCRIPTION("TPS6507x - TouchScreen driver"); |
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index 3b5b5df04dd6..d2b57536feea 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c | |||
| @@ -20,24 +20,24 @@ | |||
| 20 | 20 | ||
| 21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
| 23 | #include <linux/completion.h> | ||
| 24 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
| 24 | #include <linux/sched.h> | ||
| 25 | #include <linux/wait.h> | ||
| 25 | #include <linux/input.h> | 26 | #include <linux/input.h> |
| 26 | #include <linux/device.h> | 27 | #include <linux/device.h> |
| 27 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
| 28 | #include <linux/suspend.h> | ||
| 29 | #include <linux/kthread.h> | ||
| 30 | #include <linux/freezer.h> | ||
| 31 | #include <linux/ucb1400.h> | 29 | #include <linux/ucb1400.h> |
| 32 | 30 | ||
| 31 | #define UCB1400_TS_POLL_PERIOD 10 /* ms */ | ||
| 32 | |||
| 33 | static int adcsync; | 33 | static int adcsync; |
| 34 | static int ts_delay = 55; /* us */ | 34 | static int ts_delay = 55; /* us */ |
| 35 | static int ts_delay_pressure; /* us */ | 35 | static int ts_delay_pressure; /* us */ |
| 36 | 36 | ||
| 37 | /* Switch to interrupt mode. */ | 37 | /* Switch to interrupt mode. */ |
| 38 | static inline void ucb1400_ts_mode_int(struct snd_ac97 *ac97) | 38 | static void ucb1400_ts_mode_int(struct ucb1400_ts *ucb) |
| 39 | { | 39 | { |
| 40 | ucb1400_reg_write(ac97, UCB_TS_CR, | 40 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, |
| 41 | UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | | 41 | UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | |
| 42 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | | 42 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | |
| 43 | UCB_TS_CR_MODE_INT); | 43 | UCB_TS_CR_MODE_INT); |
| @@ -47,13 +47,15 @@ static inline void ucb1400_ts_mode_int(struct snd_ac97 *ac97) | |||
| 47 | * Switch to pressure mode, and read pressure. We don't need to wait | 47 | * Switch to pressure mode, and read pressure. We don't need to wait |
| 48 | * here, since both plates are being driven. | 48 | * here, since both plates are being driven. |
| 49 | */ | 49 | */ |
| 50 | static inline unsigned int ucb1400_ts_read_pressure(struct ucb1400_ts *ucb) | 50 | static unsigned int ucb1400_ts_read_pressure(struct ucb1400_ts *ucb) |
| 51 | { | 51 | { |
| 52 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, | 52 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, |
| 53 | UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | | 53 | UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW | |
| 54 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | | 54 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND | |
| 55 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); | 55 | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); |
| 56 | |||
| 56 | udelay(ts_delay_pressure); | 57 | udelay(ts_delay_pressure); |
| 58 | |||
| 57 | return ucb1400_adc_read(ucb->ac97, UCB_ADC_INP_TSPY, adcsync); | 59 | return ucb1400_adc_read(ucb->ac97, UCB_ADC_INP_TSPY, adcsync); |
| 58 | } | 60 | } |
| 59 | 61 | ||
| @@ -63,7 +65,7 @@ static inline unsigned int ucb1400_ts_read_pressure(struct ucb1400_ts *ucb) | |||
| 63 | * gives a faster response time. Even so, we need to wait about 55us | 65 | * gives a faster response time. Even so, we need to wait about 55us |
| 64 | * for things to stabilise. | 66 | * for things to stabilise. |
| 65 | */ | 67 | */ |
| 66 | static inline unsigned int ucb1400_ts_read_xpos(struct ucb1400_ts *ucb) | 68 | static unsigned int ucb1400_ts_read_xpos(struct ucb1400_ts *ucb) |
| 67 | { | 69 | { |
| 68 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, | 70 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, |
| 69 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | | 71 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | |
| @@ -86,7 +88,7 @@ static inline unsigned int ucb1400_ts_read_xpos(struct ucb1400_ts *ucb) | |||
| 86 | * gives a faster response time. Even so, we need to wait about 55us | 88 | * gives a faster response time. Even so, we need to wait about 55us |
| 87 | * for things to stabilise. | 89 | * for things to stabilise. |
| 88 | */ | 90 | */ |
| 89 | static inline unsigned int ucb1400_ts_read_ypos(struct ucb1400_ts *ucb) | 91 | static int ucb1400_ts_read_ypos(struct ucb1400_ts *ucb) |
| 90 | { | 92 | { |
| 91 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, | 93 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, |
| 92 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | | 94 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | |
| @@ -107,7 +109,7 @@ static inline unsigned int ucb1400_ts_read_ypos(struct ucb1400_ts *ucb) | |||
| 107 | * Switch to X plate resistance mode. Set MX to ground, PX to | 109 | * Switch to X plate resistance mode. Set MX to ground, PX to |
| 108 | * supply. Measure current. | 110 | * supply. Measure current. |
| 109 | */ | 111 | */ |
| 110 | static inline unsigned int ucb1400_ts_read_xres(struct ucb1400_ts *ucb) | 112 | static unsigned int ucb1400_ts_read_xres(struct ucb1400_ts *ucb) |
| 111 | { | 113 | { |
| 112 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, | 114 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, |
| 113 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | | 115 | UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | |
| @@ -119,7 +121,7 @@ static inline unsigned int ucb1400_ts_read_xres(struct ucb1400_ts *ucb) | |||
| 119 | * Switch to Y plate resistance mode. Set MY to ground, PY to | 121 | * Switch to Y plate resistance mode. Set MY to ground, PY to |
| 120 | * supply. Measure current. | 122 | * supply. Measure current. |
| 121 | */ | 123 | */ |
| 122 | static inline unsigned int ucb1400_ts_read_yres(struct ucb1400_ts *ucb) | 124 | static unsigned int ucb1400_ts_read_yres(struct ucb1400_ts *ucb) |
| 123 | { | 125 | { |
| 124 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, | 126 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, |
| 125 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | | 127 | UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW | |
| @@ -127,26 +129,26 @@ static inline unsigned int ucb1400_ts_read_yres(struct ucb1400_ts *ucb) | |||
| 127 | return ucb1400_adc_read(ucb->ac97, 0, adcsync); | 129 | return ucb1400_adc_read(ucb->ac97, 0, adcsync); |
| 128 | } | 130 | } |
| 129 | 131 | ||
| 130 | static inline int ucb1400_ts_pen_up(struct snd_ac97 *ac97) | 132 | static int ucb1400_ts_pen_up(struct ucb1400_ts *ucb) |
| 131 | { | 133 | { |
| 132 | unsigned short val = ucb1400_reg_read(ac97, UCB_TS_CR); | 134 | unsigned short val = ucb1400_reg_read(ucb->ac97, UCB_TS_CR); |
| 133 | 135 | ||
| 134 | return val & (UCB_TS_CR_TSPX_LOW | UCB_TS_CR_TSMX_LOW); | 136 | return val & (UCB_TS_CR_TSPX_LOW | UCB_TS_CR_TSMX_LOW); |
| 135 | } | 137 | } |
| 136 | 138 | ||
| 137 | static inline void ucb1400_ts_irq_enable(struct snd_ac97 *ac97) | 139 | static void ucb1400_ts_irq_enable(struct ucb1400_ts *ucb) |
| 138 | { | 140 | { |
| 139 | ucb1400_reg_write(ac97, UCB_IE_CLEAR, UCB_IE_TSPX); | 141 | ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, UCB_IE_TSPX); |
| 140 | ucb1400_reg_write(ac97, UCB_IE_CLEAR, 0); | 142 | ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0); |
| 141 | ucb1400_reg_write(ac97, UCB_IE_FAL, UCB_IE_TSPX); | 143 | ucb1400_reg_write(ucb->ac97, UCB_IE_FAL, UCB_IE_TSPX); |
| 142 | } | 144 | } |
| 143 | 145 | ||
| 144 | static inline void ucb1400_ts_irq_disable(struct snd_ac97 *ac97) | 146 | static void ucb1400_ts_irq_disable(struct ucb1400_ts *ucb) |
| 145 | { | 147 | { |
| 146 | ucb1400_reg_write(ac97, UCB_IE_FAL, 0); | 148 | ucb1400_reg_write(ucb->ac97, UCB_IE_FAL, 0); |
| 147 | } | 149 | } |
| 148 | 150 | ||
| 149 | static void ucb1400_ts_evt_add(struct input_dev *idev, u16 pressure, u16 x, u16 y) | 151 | static void ucb1400_ts_report_event(struct input_dev *idev, u16 pressure, u16 x, u16 y) |
| 150 | { | 152 | { |
| 151 | input_report_abs(idev, ABS_X, x); | 153 | input_report_abs(idev, ABS_X, x); |
| 152 | input_report_abs(idev, ABS_Y, y); | 154 | input_report_abs(idev, ABS_Y, y); |
| @@ -162,7 +164,7 @@ static void ucb1400_ts_event_release(struct input_dev *idev) | |||
| 162 | input_sync(idev); | 164 | input_sync(idev); |
| 163 | } | 165 | } |
| 164 | 166 | ||
| 165 | static void ucb1400_handle_pending_irq(struct ucb1400_ts *ucb) | 167 | static void ucb1400_clear_pending_irq(struct ucb1400_ts *ucb) |
| 166 | { | 168 | { |
| 167 | unsigned int isr; | 169 | unsigned int isr; |
| 168 | 170 | ||
| @@ -171,32 +173,34 @@ static void ucb1400_handle_pending_irq(struct ucb1400_ts *ucb) | |||
| 171 | ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0); | 173 | ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0); |
| 172 | 174 | ||
| 173 | if (isr & UCB_IE_TSPX) | 175 | if (isr & UCB_IE_TSPX) |
| 174 | ucb1400_ts_irq_disable(ucb->ac97); | 176 | ucb1400_ts_irq_disable(ucb); |
| 175 | else | 177 | else |
| 176 | dev_dbg(&ucb->ts_idev->dev, "ucb1400: unexpected IE_STATUS = %#x\n", isr); | 178 | dev_dbg(&ucb->ts_idev->dev, |
| 177 | enable_irq(ucb->irq); | 179 | "ucb1400: unexpected IE_STATUS = %#x\n", isr); |
| 178 | } | 180 | } |
| 179 | 181 | ||
| 180 | static int ucb1400_ts_thread(void *_ucb) | 182 | /* |
| 183 | * A restriction with interrupts exists when using the ucb1400, as | ||
| 184 | * the codec read/write routines may sleep while waiting for codec | ||
| 185 | * access completion and uses semaphores for access control to the | ||
| 186 | * AC97 bus. Therefore the driver is forced to use threaded interrupt | ||
| 187 | * handler. | ||
| 188 | */ | ||
| 189 | static irqreturn_t ucb1400_irq(int irqnr, void *devid) | ||
| 181 | { | 190 | { |
| 182 | struct ucb1400_ts *ucb = _ucb; | 191 | struct ucb1400_ts *ucb = devid; |
| 183 | struct task_struct *tsk = current; | 192 | unsigned int x, y, p; |
| 184 | int valid = 0; | 193 | bool penup; |
| 185 | struct sched_param param = { .sched_priority = 1 }; | ||
| 186 | 194 | ||
| 187 | sched_setscheduler(tsk, SCHED_FIFO, ¶m); | 195 | if (unlikely(irqnr != ucb->irq)) |
| 196 | return IRQ_NONE; | ||
| 188 | 197 | ||
| 189 | set_freezable(); | 198 | ucb1400_clear_pending_irq(ucb); |
| 190 | while (!kthread_should_stop()) { | ||
| 191 | unsigned int x, y, p; | ||
| 192 | long timeout; | ||
| 193 | 199 | ||
| 194 | ucb->ts_restart = 0; | 200 | /* Start with a small delay before checking pendown state */ |
| 201 | msleep(UCB1400_TS_POLL_PERIOD); | ||
| 195 | 202 | ||
| 196 | if (ucb->irq_pending) { | 203 | while (!ucb->stopped && !(penup = ucb1400_ts_pen_up(ucb))) { |
| 197 | ucb->irq_pending = 0; | ||
| 198 | ucb1400_handle_pending_irq(ucb); | ||
| 199 | } | ||
| 200 | 204 | ||
| 201 | ucb1400_adc_enable(ucb->ac97); | 205 | ucb1400_adc_enable(ucb->ac97); |
| 202 | x = ucb1400_ts_read_xpos(ucb); | 206 | x = ucb1400_ts_read_xpos(ucb); |
| @@ -204,91 +208,62 @@ static int ucb1400_ts_thread(void *_ucb) | |||
| 204 | p = ucb1400_ts_read_pressure(ucb); | 208 | p = ucb1400_ts_read_pressure(ucb); |
| 205 | ucb1400_adc_disable(ucb->ac97); | 209 | ucb1400_adc_disable(ucb->ac97); |
| 206 | 210 | ||
| 207 | /* Switch back to interrupt mode. */ | 211 | ucb1400_ts_report_event(ucb->ts_idev, p, x, y); |
| 208 | ucb1400_ts_mode_int(ucb->ac97); | ||
| 209 | |||
| 210 | msleep(10); | ||
| 211 | |||
| 212 | if (ucb1400_ts_pen_up(ucb->ac97)) { | ||
| 213 | ucb1400_ts_irq_enable(ucb->ac97); | ||
| 214 | |||
| 215 | /* | ||
| 216 | * If we spat out a valid sample set last time, | ||
| 217 | * spit out a "pen off" sample here. | ||
| 218 | */ | ||
| 219 | if (valid) { | ||
| 220 | ucb1400_ts_event_release(ucb->ts_idev); | ||
| 221 | valid = 0; | ||
| 222 | } | ||
| 223 | |||
| 224 | timeout = MAX_SCHEDULE_TIMEOUT; | ||
| 225 | } else { | ||
| 226 | valid = 1; | ||
| 227 | ucb1400_ts_evt_add(ucb->ts_idev, p, x, y); | ||
| 228 | timeout = msecs_to_jiffies(10); | ||
| 229 | } | ||
| 230 | 212 | ||
| 231 | wait_event_freezable_timeout(ucb->ts_wait, | 213 | wait_event_timeout(ucb->ts_wait, ucb->stopped, |
| 232 | ucb->irq_pending || ucb->ts_restart || | 214 | msecs_to_jiffies(UCB1400_TS_POLL_PERIOD)); |
| 233 | kthread_should_stop(), timeout); | ||
| 234 | } | 215 | } |
| 235 | 216 | ||
| 236 | /* Send the "pen off" if we are stopping with the pen still active */ | 217 | ucb1400_ts_event_release(ucb->ts_idev); |
| 237 | if (valid) | ||
| 238 | ucb1400_ts_event_release(ucb->ts_idev); | ||
| 239 | 218 | ||
| 240 | ucb->ts_task = NULL; | 219 | if (!ucb->stopped) { |
| 241 | return 0; | 220 | /* Switch back to interrupt mode. */ |
| 221 | ucb1400_ts_mode_int(ucb); | ||
| 222 | ucb1400_ts_irq_enable(ucb); | ||
| 223 | } | ||
| 224 | |||
| 225 | return IRQ_HANDLED; | ||
| 242 | } | 226 | } |
| 243 | 227 | ||
| 244 | /* | 228 | static void ucb1400_ts_stop(struct ucb1400_ts *ucb) |
| 245 | * A restriction with interrupts exists when using the ucb1400, as | ||
| 246 | * the codec read/write routines may sleep while waiting for codec | ||
| 247 | * access completion and uses semaphores for access control to the | ||
| 248 | * AC97 bus. A complete codec read cycle could take anywhere from | ||
| 249 | * 60 to 100uSec so we *definitely* don't want to spin inside the | ||
| 250 | * interrupt handler waiting for codec access. So, we handle the | ||
| 251 | * interrupt by scheduling a RT kernel thread to run in process | ||
| 252 | * context instead of interrupt context. | ||
| 253 | */ | ||
| 254 | static irqreturn_t ucb1400_hard_irq(int irqnr, void *devid) | ||
| 255 | { | 229 | { |
| 256 | struct ucb1400_ts *ucb = devid; | 230 | /* Signal IRQ thread to stop polling and disable the handler. */ |
| 231 | ucb->stopped = true; | ||
| 232 | mb(); | ||
| 233 | wake_up(&ucb->ts_wait); | ||
| 234 | disable_irq(ucb->irq); | ||
| 257 | 235 | ||
| 258 | if (irqnr == ucb->irq) { | 236 | ucb1400_ts_irq_disable(ucb); |
| 259 | disable_irq_nosync(ucb->irq); | 237 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, 0); |
| 260 | ucb->irq_pending = 1; | 238 | } |
| 261 | wake_up(&ucb->ts_wait); | 239 | |
| 262 | return IRQ_HANDLED; | 240 | /* Must be called with ts->lock held */ |
| 263 | } | 241 | static void ucb1400_ts_start(struct ucb1400_ts *ucb) |
| 264 | return IRQ_NONE; | 242 | { |
| 243 | /* Tell IRQ thread that it may poll the device. */ | ||
| 244 | ucb->stopped = false; | ||
| 245 | mb(); | ||
| 246 | |||
| 247 | ucb1400_ts_mode_int(ucb); | ||
| 248 | ucb1400_ts_irq_enable(ucb); | ||
| 249 | |||
| 250 | enable_irq(ucb->irq); | ||
| 265 | } | 251 | } |
| 266 | 252 | ||
| 267 | static int ucb1400_ts_open(struct input_dev *idev) | 253 | static int ucb1400_ts_open(struct input_dev *idev) |
| 268 | { | 254 | { |
| 269 | struct ucb1400_ts *ucb = input_get_drvdata(idev); | 255 | struct ucb1400_ts *ucb = input_get_drvdata(idev); |
| 270 | int ret = 0; | ||
| 271 | 256 | ||
| 272 | BUG_ON(ucb->ts_task); | 257 | ucb1400_ts_start(ucb); |
| 273 | 258 | ||
| 274 | ucb->ts_task = kthread_run(ucb1400_ts_thread, ucb, "UCB1400_ts"); | 259 | return 0; |
| 275 | if (IS_ERR(ucb->ts_task)) { | ||
| 276 | ret = PTR_ERR(ucb->ts_task); | ||
| 277 | ucb->ts_task = NULL; | ||
| 278 | } | ||
| 279 | |||
| 280 | return ret; | ||
| 281 | } | 260 | } |
| 282 | 261 | ||
| 283 | static void ucb1400_ts_close(struct input_dev *idev) | 262 | static void ucb1400_ts_close(struct input_dev *idev) |
| 284 | { | 263 | { |
| 285 | struct ucb1400_ts *ucb = input_get_drvdata(idev); | 264 | struct ucb1400_ts *ucb = input_get_drvdata(idev); |
| 286 | 265 | ||
| 287 | if (ucb->ts_task) | 266 | ucb1400_ts_stop(ucb); |
| 288 | kthread_stop(ucb->ts_task); | ||
| 289 | |||
| 290 | ucb1400_ts_irq_disable(ucb->ac97); | ||
| 291 | ucb1400_reg_write(ucb->ac97, UCB_TS_CR, 0); | ||
| 292 | } | 267 | } |
| 293 | 268 | ||
| 294 | #ifndef NO_IRQ | 269 | #ifndef NO_IRQ |
| @@ -299,7 +274,8 @@ static void ucb1400_ts_close(struct input_dev *idev) | |||
| 299 | * Try to probe our interrupt, rather than relying on lots of | 274 | * Try to probe our interrupt, rather than relying on lots of |
| 300 | * hard-coded machine dependencies. | 275 | * hard-coded machine dependencies. |
| 301 | */ | 276 | */ |
| 302 | static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb) | 277 | static int __devinit ucb1400_ts_detect_irq(struct ucb1400_ts *ucb, |
| 278 | struct platform_device *pdev) | ||
| 303 | { | 279 | { |
| 304 | unsigned long mask, timeout; | 280 | unsigned long mask, timeout; |
| 305 | 281 | ||
| @@ -321,7 +297,7 @@ static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb) | |||
| 321 | UCB_ADC_DAT_VALID)) { | 297 | UCB_ADC_DAT_VALID)) { |
| 322 | cpu_relax(); | 298 | cpu_relax(); |
| 323 | if (time_after(jiffies, timeout)) { | 299 | if (time_after(jiffies, timeout)) { |
| 324 | printk(KERN_ERR "ucb1400: timed out in IRQ probe\n"); | 300 | dev_err(&pdev->dev, "timed out in IRQ probe\n"); |
| 325 | probe_irq_off(mask); | 301 | probe_irq_off(mask); |
| 326 | return -ENODEV; | 302 | return -ENODEV; |
| 327 | } | 303 | } |
| @@ -342,11 +318,11 @@ static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb) | |||
| 342 | return 0; | 318 | return 0; |
| 343 | } | 319 | } |
| 344 | 320 | ||
| 345 | static int ucb1400_ts_probe(struct platform_device *dev) | 321 | static int __devinit ucb1400_ts_probe(struct platform_device *pdev) |
| 346 | { | 322 | { |
| 323 | struct ucb1400_ts *ucb = pdev->dev.platform_data; | ||
| 347 | int error, x_res, y_res; | 324 | int error, x_res, y_res; |
| 348 | u16 fcsr; | 325 | u16 fcsr; |
| 349 | struct ucb1400_ts *ucb = dev->dev.platform_data; | ||
| 350 | 326 | ||
| 351 | ucb->ts_idev = input_allocate_device(); | 327 | ucb->ts_idev = input_allocate_device(); |
| 352 | if (!ucb->ts_idev) { | 328 | if (!ucb->ts_idev) { |
| @@ -356,27 +332,19 @@ static int ucb1400_ts_probe(struct platform_device *dev) | |||
| 356 | 332 | ||
| 357 | /* Only in case the IRQ line wasn't supplied, try detecting it */ | 333 | /* Only in case the IRQ line wasn't supplied, try detecting it */ |
| 358 | if (ucb->irq < 0) { | 334 | if (ucb->irq < 0) { |
| 359 | error = ucb1400_ts_detect_irq(ucb); | 335 | error = ucb1400_ts_detect_irq(ucb, pdev); |
| 360 | if (error) { | 336 | if (error) { |
| 361 | printk(KERN_ERR "UCB1400: IRQ probe failed\n"); | 337 | dev_err(&pdev->dev, "IRQ probe failed\n"); |
| 362 | goto err_free_devs; | 338 | goto err_free_devs; |
| 363 | } | 339 | } |
| 364 | } | 340 | } |
| 341 | dev_dbg(&pdev->dev, "found IRQ %d\n", ucb->irq); | ||
| 365 | 342 | ||
| 366 | init_waitqueue_head(&ucb->ts_wait); | 343 | init_waitqueue_head(&ucb->ts_wait); |
| 367 | 344 | ||
| 368 | error = request_irq(ucb->irq, ucb1400_hard_irq, IRQF_TRIGGER_RISING, | ||
| 369 | "UCB1400", ucb); | ||
| 370 | if (error) { | ||
| 371 | printk(KERN_ERR "ucb1400: unable to grab irq%d: %d\n", | ||
| 372 | ucb->irq, error); | ||
| 373 | goto err_free_devs; | ||
| 374 | } | ||
| 375 | printk(KERN_DEBUG "UCB1400: found IRQ %d\n", ucb->irq); | ||
| 376 | |||
| 377 | input_set_drvdata(ucb->ts_idev, ucb); | 345 | input_set_drvdata(ucb->ts_idev, ucb); |
| 378 | 346 | ||
| 379 | ucb->ts_idev->dev.parent = &dev->dev; | 347 | ucb->ts_idev->dev.parent = &pdev->dev; |
| 380 | ucb->ts_idev->name = "UCB1400 touchscreen interface"; | 348 | ucb->ts_idev->name = "UCB1400 touchscreen interface"; |
| 381 | ucb->ts_idev->id.vendor = ucb1400_reg_read(ucb->ac97, | 349 | ucb->ts_idev->id.vendor = ucb1400_reg_read(ucb->ac97, |
| 382 | AC97_VENDOR_ID1); | 350 | AC97_VENDOR_ID1); |
| @@ -398,12 +366,23 @@ static int ucb1400_ts_probe(struct platform_device *dev) | |||
| 398 | x_res = ucb1400_ts_read_xres(ucb); | 366 | x_res = ucb1400_ts_read_xres(ucb); |
| 399 | y_res = ucb1400_ts_read_yres(ucb); | 367 | y_res = ucb1400_ts_read_yres(ucb); |
| 400 | ucb1400_adc_disable(ucb->ac97); | 368 | ucb1400_adc_disable(ucb->ac97); |
| 401 | printk(KERN_DEBUG "UCB1400: x/y = %d/%d\n", x_res, y_res); | 369 | dev_dbg(&pdev->dev, "x/y = %d/%d\n", x_res, y_res); |
| 402 | 370 | ||
| 403 | input_set_abs_params(ucb->ts_idev, ABS_X, 0, x_res, 0, 0); | 371 | input_set_abs_params(ucb->ts_idev, ABS_X, 0, x_res, 0, 0); |
| 404 | input_set_abs_params(ucb->ts_idev, ABS_Y, 0, y_res, 0, 0); | 372 | input_set_abs_params(ucb->ts_idev, ABS_Y, 0, y_res, 0, 0); |
| 405 | input_set_abs_params(ucb->ts_idev, ABS_PRESSURE, 0, 0, 0, 0); | 373 | input_set_abs_params(ucb->ts_idev, ABS_PRESSURE, 0, 0, 0, 0); |
| 406 | 374 | ||
| 375 | ucb1400_ts_stop(ucb); | ||
| 376 | |||
| 377 | error = request_threaded_irq(ucb->irq, NULL, ucb1400_irq, | ||
| 378 | IRQF_TRIGGER_RISING | IRQF_ONESHOT, | ||
| 379 | "UCB1400", ucb); | ||
| 380 | if (error) { | ||
| 381 | dev_err(&pdev->dev, | ||
| 382 | "unable to grab irq%d: %d\n", ucb->irq, error); | ||
| 383 | goto err_free_devs; | ||
| 384 | } | ||
| 385 | |||
| 407 | error = input_register_device(ucb->ts_idev); | 386 | error = input_register_device(ucb->ts_idev); |
| 408 | if (error) | 387 | if (error) |
| 409 | goto err_free_irq; | 388 | goto err_free_irq; |
| @@ -416,56 +395,61 @@ err_free_devs: | |||
| 416 | input_free_device(ucb->ts_idev); | 395 | input_free_device(ucb->ts_idev); |
| 417 | err: | 396 | err: |
| 418 | return error; | 397 | return error; |
| 419 | |||
| 420 | } | 398 | } |
| 421 | 399 | ||
| 422 | static int ucb1400_ts_remove(struct platform_device *dev) | 400 | static int __devexit ucb1400_ts_remove(struct platform_device *pdev) |
| 423 | { | 401 | { |
| 424 | struct ucb1400_ts *ucb = dev->dev.platform_data; | 402 | struct ucb1400_ts *ucb = pdev->dev.platform_data; |
| 425 | 403 | ||
| 426 | free_irq(ucb->irq, ucb); | 404 | free_irq(ucb->irq, ucb); |
| 427 | input_unregister_device(ucb->ts_idev); | 405 | input_unregister_device(ucb->ts_idev); |
| 406 | |||
| 428 | return 0; | 407 | return 0; |
| 429 | } | 408 | } |
| 430 | 409 | ||
| 431 | #ifdef CONFIG_PM | 410 | #ifdef CONFIG_PM_SLEEP |
| 432 | static int ucb1400_ts_resume(struct platform_device *dev) | 411 | static int ucb1400_ts_suspend(struct device *dev) |
| 433 | { | 412 | { |
| 434 | struct ucb1400_ts *ucb = dev->dev.platform_data; | 413 | struct ucb1400_ts *ucb = dev->platform_data; |
| 435 | 414 | struct input_dev *idev = ucb->ts_idev; | |
| 436 | if (ucb->ts_task) { | 415 | |
| 437 | /* | 416 | mutex_lock(&idev->mutex); |
| 438 | * Restart the TS thread to ensure the | 417 | |
| 439 | * TS interrupt mode is set up again | 418 | if (idev->users) |
| 440 | * after sleep. | 419 | ucb1400_ts_start(ucb); |
| 441 | */ | 420 | |
| 442 | ucb->ts_restart = 1; | 421 | mutex_unlock(&idev->mutex); |
| 443 | wake_up(&ucb->ts_wait); | 422 | return 0; |
| 444 | } | 423 | } |
| 424 | |||
| 425 | static int ucb1400_ts_resume(struct device *dev) | ||
| 426 | { | ||
| 427 | struct ucb1400_ts *ucb = dev->platform_data; | ||
| 428 | struct input_dev *idev = ucb->ts_idev; | ||
| 429 | |||
| 430 | mutex_lock(&idev->mutex); | ||
| 431 | |||
| 432 | if (idev->users) | ||
| 433 | ucb1400_ts_stop(ucb); | ||
| 434 | |||
| 435 | mutex_unlock(&idev->mutex); | ||
| 445 | return 0; | 436 | return 0; |
| 446 | } | 437 | } |
| 447 | #else | ||
| 448 | #define ucb1400_ts_resume NULL | ||
| 449 | #endif | 438 | #endif |
| 450 | 439 | ||
| 440 | static SIMPLE_DEV_PM_OPS(ucb1400_ts_pm_ops, | ||
| 441 | ucb1400_ts_suspend, ucb1400_ts_resume); | ||
| 442 | |||
| 451 | static struct platform_driver ucb1400_ts_driver = { | 443 | static struct platform_driver ucb1400_ts_driver = { |
| 452 | .probe = ucb1400_ts_probe, | 444 | .probe = ucb1400_ts_probe, |
| 453 | .remove = ucb1400_ts_remove, | 445 | .remove = __devexit_p(ucb1400_ts_remove), |
| 454 | .resume = ucb1400_ts_resume, | ||
| 455 | .driver = { | 446 | .driver = { |
| 456 | .name = "ucb1400_ts", | 447 | .name = "ucb1400_ts", |
| 448 | .owner = THIS_MODULE, | ||
| 449 | .pm = &ucb1400_ts_pm_ops, | ||
| 457 | }, | 450 | }, |
| 458 | }; | 451 | }; |
| 459 | 452 | module_platform_driver(ucb1400_ts_driver); | |
| 460 | static int __init ucb1400_ts_init(void) | ||
| 461 | { | ||
| 462 | return platform_driver_register(&ucb1400_ts_driver); | ||
| 463 | } | ||
| 464 | |||
| 465 | static void __exit ucb1400_ts_exit(void) | ||
| 466 | { | ||
| 467 | platform_driver_unregister(&ucb1400_ts_driver); | ||
| 468 | } | ||
| 469 | 453 | ||
| 470 | module_param(adcsync, bool, 0444); | 454 | module_param(adcsync, bool, 0444); |
| 471 | MODULE_PARM_DESC(adcsync, "Synchronize touch readings with ADCSYNC pin."); | 455 | MODULE_PARM_DESC(adcsync, "Synchronize touch readings with ADCSYNC pin."); |
| @@ -479,8 +463,5 @@ MODULE_PARM_DESC(ts_delay_pressure, | |||
| 479 | "delay between panel setup and pressure read." | 463 | "delay between panel setup and pressure read." |
| 480 | " Default = 0us."); | 464 | " Default = 0us."); |
| 481 | 465 | ||
| 482 | module_init(ucb1400_ts_init); | ||
| 483 | module_exit(ucb1400_ts_exit); | ||
| 484 | |||
| 485 | MODULE_DESCRIPTION("Philips UCB1400 touchscreen driver"); | 466 | MODULE_DESCRIPTION("Philips UCB1400 touchscreen driver"); |
| 486 | MODULE_LICENSE("GPL"); | 467 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index e539d92cc626..06cef3ccc63a 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | * - JASTEC USB touch controller/DigiTech DTR-02U | 16 | * - JASTEC USB touch controller/DigiTech DTR-02U |
| 17 | * - Zytronic capacitive touchscreen | 17 | * - Zytronic capacitive touchscreen |
| 18 | * - NEXIO/iNexio | 18 | * - NEXIO/iNexio |
| 19 | * - Elo TouchSystems 2700 IntelliTouch | ||
| 19 | * | 20 | * |
| 20 | * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> | 21 | * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> |
| 21 | * Copyright (C) by Todd E. Johnson (mtouchusb.c) | 22 | * Copyright (C) by Todd E. Johnson (mtouchusb.c) |
| @@ -138,6 +139,7 @@ enum { | |||
| 138 | DEVTYPE_ZYTRONIC, | 139 | DEVTYPE_ZYTRONIC, |
| 139 | DEVTYPE_TC45USB, | 140 | DEVTYPE_TC45USB, |
| 140 | DEVTYPE_NEXIO, | 141 | DEVTYPE_NEXIO, |
| 142 | DEVTYPE_ELO, | ||
| 141 | }; | 143 | }; |
| 142 | 144 | ||
| 143 | #define USB_DEVICE_HID_CLASS(vend, prod) \ | 145 | #define USB_DEVICE_HID_CLASS(vend, prod) \ |
| @@ -239,6 +241,10 @@ static const struct usb_device_id usbtouch_devices[] = { | |||
| 239 | .driver_info = DEVTYPE_NEXIO}, | 241 | .driver_info = DEVTYPE_NEXIO}, |
| 240 | #endif | 242 | #endif |
| 241 | 243 | ||
| 244 | #ifdef CONFIG_TOUCHSCREEN_USB_ELO | ||
| 245 | {USB_DEVICE(0x04e7, 0x0020), .driver_info = DEVTYPE_ELO}, | ||
| 246 | #endif | ||
| 247 | |||
| 242 | {} | 248 | {} |
| 243 | }; | 249 | }; |
| 244 | 250 | ||
| @@ -945,6 +951,24 @@ static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt) | |||
| 945 | 951 | ||
| 946 | 952 | ||
| 947 | /***************************************************************************** | 953 | /***************************************************************************** |
| 954 | * ELO part | ||
| 955 | */ | ||
| 956 | |||
| 957 | #ifdef CONFIG_TOUCHSCREEN_USB_ELO | ||
| 958 | |||
| 959 | static int elo_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | ||
| 960 | { | ||
| 961 | dev->x = (pkt[3] << 8) | pkt[2]; | ||
| 962 | dev->y = (pkt[5] << 8) | pkt[4]; | ||
| 963 | dev->touch = pkt[6] > 0; | ||
| 964 | dev->press = pkt[6]; | ||
| 965 | |||
| 966 | return 1; | ||
| 967 | } | ||
| 968 | #endif | ||
| 969 | |||
| 970 | |||
| 971 | /***************************************************************************** | ||
| 948 | * the different device descriptors | 972 | * the different device descriptors |
| 949 | */ | 973 | */ |
| 950 | #ifdef MULTI_PACKET | 974 | #ifdef MULTI_PACKET |
| @@ -953,6 +977,18 @@ static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, | |||
| 953 | #endif | 977 | #endif |
| 954 | 978 | ||
| 955 | static struct usbtouch_device_info usbtouch_dev_info[] = { | 979 | static struct usbtouch_device_info usbtouch_dev_info[] = { |
| 980 | #ifdef CONFIG_TOUCHSCREEN_USB_ELO | ||
| 981 | [DEVTYPE_ELO] = { | ||
| 982 | .min_xc = 0x0, | ||
| 983 | .max_xc = 0x0fff, | ||
| 984 | .min_yc = 0x0, | ||
| 985 | .max_yc = 0x0fff, | ||
| 986 | .max_press = 0xff, | ||
| 987 | .rept_size = 8, | ||
| 988 | .read_data = elo_read_data, | ||
| 989 | }, | ||
| 990 | #endif | ||
| 991 | |||
| 956 | #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX | 992 | #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX |
| 957 | [DEVTYPE_EGALAX] = { | 993 | [DEVTYPE_EGALAX] = { |
| 958 | .min_xc = 0x0, | 994 | .min_xc = 0x0, |
diff --git a/drivers/input/touchscreen/w90p910_ts.c b/drivers/input/touchscreen/w90p910_ts.c index 217aa51135c5..9396b21d0e8f 100644 --- a/drivers/input/touchscreen/w90p910_ts.c +++ b/drivers/input/touchscreen/w90p910_ts.c | |||
| @@ -331,19 +331,7 @@ static struct platform_driver w90x900ts_driver = { | |||
| 331 | .owner = THIS_MODULE, | 331 | .owner = THIS_MODULE, |
| 332 | }, | 332 | }, |
| 333 | }; | 333 | }; |
| 334 | 334 | module_platform_driver(w90x900ts_driver); | |
| 335 | static int __init w90x900ts_init(void) | ||
| 336 | { | ||
| 337 | return platform_driver_register(&w90x900ts_driver); | ||
| 338 | } | ||
| 339 | |||
| 340 | static void __exit w90x900ts_exit(void) | ||
| 341 | { | ||
| 342 | platform_driver_unregister(&w90x900ts_driver); | ||
| 343 | } | ||
| 344 | |||
| 345 | module_init(w90x900ts_init); | ||
| 346 | module_exit(w90x900ts_exit); | ||
| 347 | 335 | ||
| 348 | MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); | 336 | MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); |
| 349 | MODULE_DESCRIPTION("w90p910 touch screen driver!"); | 337 | MODULE_DESCRIPTION("w90p910 touch screen driver!"); |
diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c index 9175d49d2546..4bc851a9dc3d 100644 --- a/drivers/input/touchscreen/wm831x-ts.c +++ b/drivers/input/touchscreen/wm831x-ts.c | |||
| @@ -401,18 +401,7 @@ static struct platform_driver wm831x_ts_driver = { | |||
| 401 | .probe = wm831x_ts_probe, | 401 | .probe = wm831x_ts_probe, |
| 402 | .remove = __devexit_p(wm831x_ts_remove), | 402 | .remove = __devexit_p(wm831x_ts_remove), |
| 403 | }; | 403 | }; |
| 404 | 404 | module_platform_driver(wm831x_ts_driver); | |
| 405 | static int __init wm831x_ts_init(void) | ||
| 406 | { | ||
| 407 | return platform_driver_register(&wm831x_ts_driver); | ||
| 408 | } | ||
| 409 | module_init(wm831x_ts_init); | ||
| 410 | |||
| 411 | static void __exit wm831x_ts_exit(void) | ||
| 412 | { | ||
| 413 | platform_driver_unregister(&wm831x_ts_driver); | ||
| 414 | } | ||
| 415 | module_exit(wm831x_ts_exit); | ||
| 416 | 405 | ||
| 417 | /* Module information */ | 406 | /* Module information */ |
| 418 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); | 407 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
diff --git a/drivers/input/touchscreen/zylonite-wm97xx.c b/drivers/input/touchscreen/zylonite-wm97xx.c index 0a707bbbbea6..bf0869a7a78e 100644 --- a/drivers/input/touchscreen/zylonite-wm97xx.c +++ b/drivers/input/touchscreen/zylonite-wm97xx.c | |||
| @@ -224,19 +224,7 @@ static struct platform_driver zylonite_wm97xx_driver = { | |||
| 224 | .name = "wm97xx-touch", | 224 | .name = "wm97xx-touch", |
| 225 | }, | 225 | }, |
| 226 | }; | 226 | }; |
| 227 | 227 | module_platform_driver(zylonite_wm97xx_driver); | |
| 228 | static int __init zylonite_wm97xx_init(void) | ||
| 229 | { | ||
| 230 | return platform_driver_register(&zylonite_wm97xx_driver); | ||
| 231 | } | ||
| 232 | |||
| 233 | static void __exit zylonite_wm97xx_exit(void) | ||
| 234 | { | ||
| 235 | platform_driver_unregister(&zylonite_wm97xx_driver); | ||
| 236 | } | ||
| 237 | |||
| 238 | module_init(zylonite_wm97xx_init); | ||
| 239 | module_exit(zylonite_wm97xx_exit); | ||
| 240 | 228 | ||
| 241 | /* Module information */ | 229 | /* Module information */ |
| 242 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); | 230 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
