20 #include <linux/module.h>
24 #include <linux/sched.h>
28 #include <linux/string.h>
29 #include <linux/input.h>
30 #include <linux/device.h>
32 #include <linux/slab.h>
61 input_report_abs(idev,
ABS_X, x);
62 input_report_abs(idev,
ABS_Y, y);
68 static inline void ucb1x00_ts_event_release(
struct ucb1x00_ts *
ts)
80 static inline void ucb1x00_ts_mode_int(
struct ucb1x00_ts *
ts)
92 static inline unsigned int ucb1x00_ts_read_pressure(
struct ucb1x00_ts *
ts)
94 if (machine_is_collie()) {
119 static inline unsigned int ucb1x00_ts_read_xpos(
struct ucb1x00_ts *ts)
121 if (machine_is_collie())
146 static inline unsigned int ucb1x00_ts_read_ypos(
struct ucb1x00_ts *ts)
148 if (machine_is_collie())
172 static inline unsigned int ucb1x00_ts_read_xres(
struct ucb1x00_ts *ts)
184 static inline unsigned int ucb1x00_ts_read_yres(
struct ucb1x00_ts *ts)
192 static inline int ucb1x00_ts_pen_down(
struct ucb1x00_ts *ts)
196 if (machine_is_collie())
207 static int ucb1x00_thread(
void *_ts)
211 bool frozen, ignore =
false;
217 unsigned int x,
y,
p;
225 x = ucb1x00_ts_read_xpos(ts);
226 y = ucb1x00_ts_read_ypos(ts);
227 p = ucb1x00_ts_read_pressure(ts);
232 ucb1x00_ts_mode_int(ts);
237 ucb1x00_enable(ts->
ucb);
240 if (ucb1x00_ts_pen_down(ts)) {
249 ucb1x00_disable(ts->
ucb);
256 ucb1x00_ts_event_release(ts);
262 ucb1x00_disable(ts->
ucb);
270 ucb1x00_ts_evt_add(ts, p, x, y);
291 static irqreturn_t ucb1x00_ts_irq(
int irq,
void *
id)
304 static int ucb1x00_ts_open(
struct input_dev *
idev)
306 struct ucb1x00_ts *ts = input_get_drvdata(idev);
307 unsigned long flags = 0;
312 if (machine_is_collie())
321 flags,
"ucb1x00-ts", ts);
330 ts->
x_res = ucb1x00_ts_read_xres(ts);
331 ts->
y_res = ucb1x00_ts_read_yres(ts);
335 if (!IS_ERR(ts->
rtask)) {
350 static void ucb1x00_ts_close(
struct input_dev *idev)
352 struct ucb1x00_ts *ts = input_get_drvdata(idev);
357 ucb1x00_enable(ts->
ucb);
360 ucb1x00_disable(ts->
ucb);
370 struct input_dev *
idev;
374 idev = input_allocate_device();
385 idev->name =
"Touchscreen panel";
386 idev->id.product = ts->
ucb->id;
387 idev->open = ucb1x00_ts_open;
388 idev->close = ucb1x00_ts_close;
389 idev->dev.parent = &ts->
ucb->dev;
394 input_set_drvdata(idev, ts);
397 ts->
x_res = ucb1x00_ts_read_xres(ts);
398 ts->
y_res = ucb1x00_ts_read_yres(ts);
401 input_set_abs_params(idev,
ABS_X, 0, ts->
x_res, 0, 0);
402 input_set_abs_params(idev,
ABS_Y, 0, ts->
y_res, 0, 0);
405 err = input_register_device(idev);
414 input_free_device(idev);
419 static void ucb1x00_ts_remove(
struct ucb1x00_dev *dev)
423 input_unregister_device(ts->
idev);
428 .add = ucb1x00_ts_add,
429 .remove = ucb1x00_ts_remove,
432 static int __init ucb1x00_ts_init(
void)
437 static void __exit ucb1x00_ts_exit(
void)