22 #include <linux/module.h>
23 #include <linux/kernel.h>
24 #include <linux/input.h>
27 #include <linux/slab.h>
29 #include <linux/i2c.h>
32 #define EVENT_PENDOWN 1
33 #define EVENT_REPEAT 2
42 static const u_int8_t migor_ts_ena_seq[17] = { 0x33, 0x22, 0x11,
44 static const u_int8_t migor_ts_dis_seq[17] = { };
49 unsigned short xpos, ypos;
64 memset(buf, 0,
sizeof(buf));
79 ypos = ((buf[9] & 0x03) << 8 | buf[8]);
80 xpos = ((buf[11] & 0x03) << 8 | buf[10]);
89 input_sync(priv->
input);
94 input_sync(priv->
input);
102 static int migor_ts_open(
struct input_dev *
dev)
110 sizeof(migor_ts_ena_seq));
111 if (count !=
sizeof(migor_ts_ena_seq)) {
112 dev_err(&client->
dev,
"Unable to enable touchscreen.\n");
119 static void migor_ts_close(
struct input_dev *dev)
132 static int migor_ts_probe(
struct i2c_client *client,
136 struct input_dev *
input;
140 input = input_allocate_device();
141 if (!priv || !input) {
142 dev_err(&client->
dev,
"failed to allocate memory\n");
155 input_set_abs_params(input,
ABS_X, 95, 955, 0, 0);
156 input_set_abs_params(input,
ABS_Y, 85, 935, 0, 0);
158 input->name = client->
name;
160 input->dev.parent = &client->
dev;
162 input->open = migor_ts_open;
163 input->close = migor_ts_close;
165 input_set_drvdata(input, priv);
171 dev_err(&client->
dev,
"Unable to request touchscreen IRQ.\n");
175 error = input_register_device(input);
179 i2c_set_clientdata(client, priv);
187 input_free_device(input);
192 static int migor_ts_remove(
struct i2c_client *client)
197 input_unregister_device(priv->
input);
205 static int migor_ts_suspend(
struct device *dev)
210 if (device_may_wakeup(&client->
dev))
211 enable_irq_wake(priv->
irq);
216 static int migor_ts_resume(
struct device *dev)
221 if (device_may_wakeup(&client->
dev))
222 disable_irq_wake(priv->
irq);
240 .probe = migor_ts_probe,
241 .remove = migor_ts_remove,
242 .id_table = migor_ts_id,