diff options
Diffstat (limited to 'drivers/input/touchscreen/s3c2410_ts.c')
-rw-r--r-- | drivers/input/touchscreen/s3c2410_ts.c | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c index 98a7d1279486..e0b7c834111d 100644 --- a/drivers/input/touchscreen/s3c2410_ts.c +++ b/drivers/input/touchscreen/s3c2410_ts.c | |||
@@ -37,9 +37,7 @@ | |||
37 | 37 | ||
38 | #include <plat/adc.h> | 38 | #include <plat/adc.h> |
39 | #include <plat/regs-adc.h> | 39 | #include <plat/regs-adc.h> |
40 | 40 | #include <plat/ts.h> | |
41 | #include <mach/regs-gpio.h> | ||
42 | #include <mach/ts.h> | ||
43 | 41 | ||
44 | #define TSC_SLEEP (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0)) | 42 | #define TSC_SLEEP (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0)) |
45 | 43 | ||
@@ -57,6 +55,8 @@ | |||
57 | S3C2410_ADCTSC_AUTO_PST | \ | 55 | S3C2410_ADCTSC_AUTO_PST | \ |
58 | S3C2410_ADCTSC_XY_PST(0)) | 56 | S3C2410_ADCTSC_XY_PST(0)) |
59 | 57 | ||
58 | #define FEAT_PEN_IRQ (1 << 0) /* HAS ADCCLRINTPNDNUP */ | ||
59 | |||
60 | /* Per-touchscreen data. */ | 60 | /* Per-touchscreen data. */ |
61 | 61 | ||
62 | /** | 62 | /** |
@@ -71,6 +71,7 @@ | |||
71 | * @irq_tc: The interrupt number for pen up/down interrupt | 71 | * @irq_tc: The interrupt number for pen up/down interrupt |
72 | * @count: The number of samples collected. | 72 | * @count: The number of samples collected. |
73 | * @shift: The log2 of the maximum count to read in one go. | 73 | * @shift: The log2 of the maximum count to read in one go. |
74 | * @features: The features supported by the TSADC MOdule. | ||
74 | */ | 75 | */ |
75 | struct s3c2410ts { | 76 | struct s3c2410ts { |
76 | struct s3c_adc_client *client; | 77 | struct s3c_adc_client *client; |
@@ -83,26 +84,12 @@ struct s3c2410ts { | |||
83 | int irq_tc; | 84 | int irq_tc; |
84 | int count; | 85 | int count; |
85 | int shift; | 86 | int shift; |
87 | int features; | ||
86 | }; | 88 | }; |
87 | 89 | ||
88 | static struct s3c2410ts ts; | 90 | static struct s3c2410ts ts; |
89 | 91 | ||
90 | /** | 92 | /** |
91 | * s3c2410_ts_connect - configure gpio for s3c2410 systems | ||
92 | * | ||
93 | * Configure the GPIO for the S3C2410 system, where we have external FETs | ||
94 | * connected to the device (later systems such as the S3C2440 integrate | ||
95 | * these into the device). | ||
96 | */ | ||
97 | static inline void s3c2410_ts_connect(void) | ||
98 | { | ||
99 | s3c2410_gpio_cfgpin(S3C2410_GPG(12), S3C2410_GPG12_XMON); | ||
100 | s3c2410_gpio_cfgpin(S3C2410_GPG(13), S3C2410_GPG13_nXPON); | ||
101 | s3c2410_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPG14_YMON); | ||
102 | s3c2410_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPG15_nYPON); | ||
103 | } | ||
104 | |||
105 | /** | ||
106 | * get_down - return the down state of the pen | 93 | * get_down - return the down state of the pen |
107 | * @data0: The data read from ADCDAT0 register. | 94 | * @data0: The data read from ADCDAT0 register. |
108 | * @data1: The data read from ADCDAT1 register. | 95 | * @data1: The data read from ADCDAT1 register. |
@@ -188,6 +175,11 @@ static irqreturn_t stylus_irq(int irq, void *dev_id) | |||
188 | else | 175 | else |
189 | dev_info(ts.dev, "%s: count=%d\n", __func__, ts.count); | 176 | dev_info(ts.dev, "%s: count=%d\n", __func__, ts.count); |
190 | 177 | ||
178 | if (ts.features & FEAT_PEN_IRQ) { | ||
179 | /* Clear pen down/up interrupt */ | ||
180 | writel(0x0, ts.io + S3C64XX_ADCCLRINTPNDNUP); | ||
181 | } | ||
182 | |||
191 | return IRQ_HANDLED; | 183 | return IRQ_HANDLED; |
192 | } | 184 | } |
193 | 185 | ||
@@ -296,9 +288,9 @@ static int __devinit s3c2410ts_probe(struct platform_device *pdev) | |||
296 | goto err_clk; | 288 | goto err_clk; |
297 | } | 289 | } |
298 | 290 | ||
299 | /* Configure the touchscreen external FETs on the S3C2410 */ | 291 | /* inititalise the gpio */ |
300 | if (!platform_get_device_id(pdev)->driver_data) | 292 | if (info->cfg_gpio) |
301 | s3c2410_ts_connect(); | 293 | info->cfg_gpio(to_platform_device(ts.dev)); |
302 | 294 | ||
303 | ts.client = s3c_adc_register(pdev, s3c24xx_ts_select, | 295 | ts.client = s3c_adc_register(pdev, s3c24xx_ts_select, |
304 | s3c24xx_ts_conversion, 1); | 296 | s3c24xx_ts_conversion, 1); |
@@ -334,6 +326,7 @@ static int __devinit s3c2410ts_probe(struct platform_device *pdev) | |||
334 | ts.input->id.version = 0x0102; | 326 | ts.input->id.version = 0x0102; |
335 | 327 | ||
336 | ts.shift = info->oversampling_shift; | 328 | ts.shift = info->oversampling_shift; |
329 | ts.features = platform_get_device_id(pdev)->driver_data; | ||
337 | 330 | ||
338 | ret = request_irq(ts.irq_tc, stylus_irq, IRQF_DISABLED, | 331 | ret = request_irq(ts.irq_tc, stylus_irq, IRQF_DISABLED, |
339 | "s3c2410_ts_pen", ts.input); | 332 | "s3c2410_ts_pen", ts.input); |
@@ -420,15 +413,14 @@ static struct dev_pm_ops s3c_ts_pmops = { | |||
420 | #endif | 413 | #endif |
421 | 414 | ||
422 | static struct platform_device_id s3cts_driver_ids[] = { | 415 | static struct platform_device_id s3cts_driver_ids[] = { |
423 | { "s3c2410-ts", 0 }, | 416 | { "s3c64xx-ts", FEAT_PEN_IRQ }, |
424 | { "s3c2440-ts", 1 }, | ||
425 | { } | 417 | { } |
426 | }; | 418 | }; |
427 | MODULE_DEVICE_TABLE(platform, s3cts_driver_ids); | 419 | MODULE_DEVICE_TABLE(platform, s3cts_driver_ids); |
428 | 420 | ||
429 | static struct platform_driver s3c_ts_driver = { | 421 | static struct platform_driver s3c_ts_driver = { |
430 | .driver = { | 422 | .driver = { |
431 | .name = "s3c24xx-ts", | 423 | .name = "samsung-ts", |
432 | .owner = THIS_MODULE, | 424 | .owner = THIS_MODULE, |
433 | #ifdef CONFIG_PM | 425 | #ifdef CONFIG_PM |
434 | .pm = &s3c_ts_pmops, | 426 | .pm = &s3c_ts_pmops, |