22 #include <linux/i2c.h>
23 #include <linux/input.h>
25 #include <linux/module.h>
27 #include <linux/slab.h>
28 #include <linux/types.h>
30 #define ST1232_TS_NAME "st1232-ts"
66 msg[0].buf = &start_reg;
83 if (finger[0].is_valid) {
84 finger[0].
x = ((buf[2] & 0x0070) << 4) | buf[3];
85 finger[0].
y = ((buf[2] & 0x0007) << 8) | buf[4];
89 if (finger[1].is_valid) {
90 finger[1].
x = ((buf[5] & 0x0070) << 4) | buf[6];
91 finger[1].
y = ((buf[5] & 0x0007) << 8) | buf[7];
102 struct input_dev *input_dev = ts->
input_dev;
106 ret = st1232_ts_read_data(ts);
112 if (!finger[i].is_valid)
118 input_mt_sync(input_dev);
124 input_mt_sync(input_dev);
136 input_sync(input_dev);
146 struct input_dev *input_dev;
161 input_dev = input_allocate_device();
162 if (!ts || !input_dev) {
170 input_dev->name =
"st1232-touchscreen";
171 input_dev->id.bustype =
BUS_I2C;
172 input_dev->dev.parent = &client->
dev;
185 dev_err(&client->
dev,
"Failed to register interrupt\n");
189 error = input_register_device(ts->
input_dev);
191 dev_err(&client->
dev,
"Unable to register %s input device\n",
196 i2c_set_clientdata(client, ts);
204 input_free_device(input_dev);
221 #ifdef CONFIG_PM_SLEEP
222 static int st1232_ts_suspend(
struct device *
dev)
226 if (device_may_wakeup(&client->
dev))
227 enable_irq_wake(client->
irq);
234 static int st1232_ts_resume(
struct device *dev)
238 if (device_may_wakeup(&client->
dev))
239 disable_irq_wake(client->
irq);
249 st1232_ts_suspend, st1232_ts_resume);
259 { .compatible =
"sitronix,st1232", },
266 .probe = st1232_ts_probe,
268 .id_table = st1232_ts_id,
273 .pm = &st1232_ts_pm_ops,