summaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen/mxc_ts.c
diff options
context:
space:
mode:
authorJustin Waters <justin.waters@timesys.com>2008-09-15 16:48:31 -0400
committerJustin Waters <justin.waters@timesys.com>2008-09-16 10:22:17 -0400
commit39917c7cc0c971909a2023d5960bd7abbbb67e4b (patch)
tree116df826e3b25b6810ce8839bfe532f688b2ba9a /drivers/input/touchscreen/mxc_ts.c
parent7dfe8145a9788da7dd0fc055f4fe0b22511eb357 (diff)
Cleanup mxc touchscreen driver
The mxc touchscreen driver, based on the Freescale Atlas Chip and i.MX chips, is a mess. This is my attempt to clean it up quite a bit, and I think it's a definite improvement. There are still issues on large displays near the higher X coordinates, but I believe this is a hardware issue. Signed-off-by: Justin Waters <justin.waters@timesys.com>
Diffstat (limited to 'drivers/input/touchscreen/mxc_ts.c')
-rw-r--r--drivers/input/touchscreen/mxc_ts.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/input/touchscreen/mxc_ts.c b/drivers/input/touchscreen/mxc_ts.c
index b346c21eec99..dce4c8c63ccd 100644
--- a/drivers/input/touchscreen/mxc_ts.c
+++ b/drivers/input/touchscreen/mxc_ts.c
@@ -49,14 +49,16 @@ static int ts_thread(void *arg)
while (input_ts_installed) {
try_to_freeze();
memset(&ts_sample, 0, sizeof(t_touch_screen));
- pmic_adc_get_touch_sample(&ts_sample, !wait);
-
- input_report_abs(mxc_inputdev, ABS_X, ts_sample.x_position);
- input_report_abs(mxc_inputdev, ABS_Y, ts_sample.y_position);
- input_report_abs(mxc_inputdev, ABS_PRESSURE,
- ts_sample.contact_resistance);
- input_sync(mxc_inputdev);
-
+ if (pmic_adc_get_touch_sample(&ts_sample, !wait) ==
+ PMIC_SUCCESS) {
+ input_report_abs(mxc_inputdev, ABS_X,
+ ts_sample.x_position);
+ input_report_abs(mxc_inputdev, ABS_Y,
+ ts_sample.y_position);
+ input_report_abs(mxc_inputdev, ABS_PRESSURE,
+ ts_sample.contact_resistance);
+ input_sync(mxc_inputdev);
+ }
wait = ts_sample.contact_resistance;
msleep(20);
}
@@ -76,7 +78,17 @@ static int __init mxc_ts_init(void)
mxc_inputdev->name = MXC_TS_NAME;
mxc_inputdev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
mxc_inputdev->keybit[BIT_WORD(BTN_TOUCH)] |= BIT(BTN_TOUCH);
- mxc_inputdev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);
+ input_set_abs_params(mxc_inputdev, ABS_X,
+ 0,
+ (1<<12)-1,
+ 0, 0);
+ input_set_abs_params(mxc_inputdev, ABS_Y,
+ 0,
+ (1<<12)-1,
+ 0, 0);
+ input_set_abs_params(mxc_inputdev, ABS_PRESSURE,
+ 0, 1, 0, 0);
+
input_register_device(mxc_inputdev);
input_ts_installed = 1;