18 #include <linux/input.h>
20 #include <linux/module.h>
21 #include <linux/slab.h>
24 #include <mach/hardware.h>
26 #include <mach/irqs.h>
33 struct input_dev *
dev;
58 static int jornada720_ts_average(
int coords[4])
60 int coord, high_bits = coords[3];
62 coord = coords[0] | ((high_bits & 0x03) << 8);
63 coord += coords[1] | ((high_bits & 0x0c) << 6);
64 coord += coords[2] | ((high_bits & 0x30) << 4);
73 struct input_dev *
input = jornada_ts->
dev;
85 jornada720_ts_collect_data(jornada_ts);
87 x = jornada720_ts_average(jornada_ts->
x_data);
88 y = jornada720_ts_average(jornada_ts->
y_data);
91 input_report_abs(input,
ABS_X, x);
92 input_report_abs(input,
ABS_Y, y);
104 struct jornada_ts *jornada_ts;
105 struct input_dev *input_dev;
108 jornada_ts = kzalloc(
sizeof(
struct jornada_ts),
GFP_KERNEL);
109 input_dev = input_allocate_device();
111 if (!jornada_ts || !input_dev) {
116 platform_set_drvdata(pdev, jornada_ts);
118 jornada_ts->
dev = input_dev;
120 input_dev->name =
"HP Jornada 7xx Touchscreen";
121 input_dev->phys =
"jornadats/input0";
123 input_dev->dev.parent = &pdev->
dev;
127 input_set_abs_params(input_dev,
ABS_X, 270, 3900, 0, 0);
128 input_set_abs_params(input_dev,
ABS_Y, 180, 3700, 0, 0);
131 jornada720_ts_interrupt,
133 "HP7XX Touchscreen driver", pdev);
139 error = input_register_device(jornada_ts->
dev);
148 platform_set_drvdata(pdev,
NULL);
149 input_free_device(input_dev);
156 struct jornada_ts *jornada_ts = platform_get_drvdata(pdev);
159 platform_set_drvdata(pdev,
NULL);
160 input_unregister_device(jornada_ts->
dev);
170 .probe = jornada720_ts_probe,
173 .name =
"jornada_ts",