27 #include <linux/module.h>
29 #include <linux/kernel.h>
30 #include <linux/input.h>
32 #include <linux/i2c.h>
36 #include <linux/slab.h>
54 #define EETI_TS_BITDEPTH (11)
55 #define EETI_MAXVAL ((1 << (EETI_TS_BITDEPTH + 1)) - 1)
57 #define REPORT_BIT_PRESSED (1 << 0)
58 #define REPORT_BIT_AD0 (1 << 1)
59 #define REPORT_BIT_AD1 (1 << 2)
60 #define REPORT_BIT_HAS_PRESSURE (1 << 6)
61 #define REPORT_RES_BITS(v) (((v) >> 1) + EETI_TS_BITDEPTH)
71 unsigned int x,
y,
res, pressed, to = 100;
77 while (eeti_ts_irq_active(priv) && --to)
82 "unable to clear IRQ - line stuck?\n");
92 x = buf[2] | (buf[1] << 8);
93 y = buf[4] | (buf[3] << 8);
111 input_sync(priv->
input);
132 eeti_ts_read(&priv->
work);
141 static int eeti_ts_open(
struct input_dev *
dev)
150 static void eeti_ts_close(
struct input_dev *
dev)
162 struct input_dev *
input;
163 unsigned int irq_flags;
175 dev_err(&client->
dev,
"failed to allocate driver data\n");
180 input = input_allocate_device();
183 dev_err(&client->
dev,
"Failed to allocate input device.\n");
192 input_set_abs_params(input,
ABS_PRESSURE, 0, 0xff, 0, 0);
194 input->name = client->
name;
196 input->dev.parent = &client->
dev;
197 input->open = eeti_ts_open;
198 input->close = eeti_ts_close;
216 i2c_set_clientdata(client, priv);
217 input_set_drvdata(input, priv);
219 err = input_register_device(input);
226 dev_err(&client->
dev,
"Unable to request touchscreen IRQ.\n");
240 input_unregister_device(input);
245 input_free_device(input);
262 input_unregister_device(priv->
input);
269 static int eeti_ts_suspend(
struct device *
dev)
273 struct input_dev *input_dev = priv->
input;
277 if (input_dev->users)
282 if (device_may_wakeup(&client->
dev))
283 enable_irq_wake(priv->
irq);
288 static int eeti_ts_resume(
struct device *dev)
292 struct input_dev *input_dev = priv->
input;
294 if (device_may_wakeup(&client->
dev))
295 disable_irq_wake(priv->
irq);
299 if (input_dev->users)
323 .probe = eeti_ts_probe,
325 .id_table = eeti_ts_id,