Lines Matching refs:ts

55 static void cy8ctma140_report(struct cy8ctma140 *ts, u8 *data, int n_fingers)
74 slot = input_mt_get_slot_by_key(ts->input, id);
82 dev_dbg(ts->dev, "finger %d: ID %02x (%d, %d) w: %d\n",
85 input_mt_slot(ts->input, slot);
86 input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, true);
87 touchscreen_report_pos(ts->input, &ts->props, x, y, true);
88 input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, w);
91 input_mt_sync_frame(ts->input);
92 input_sync(ts->input);
97 struct cy8ctma140 *ts = d;
102 .addr = ts->client->addr,
107 .addr = ts->client->addr,
116 ret = i2c_transfer(ts->client->adapter, msg, ARRAY_SIZE(msg));
119 dev_err(ts->dev, "error reading message: %d\n", ret);
121 dev_err(ts->dev, "wrong number of messages\n");
126 dev_dbg(ts->dev, "invalid event\n");
132 dev_err(ts->dev, "unexpected number of fingers: %d\n",
137 cy8ctma140_report(ts, buf, n_fingers);
143 static int cy8ctma140_init(struct cy8ctma140 *ts)
150 ret = i2c_master_send(ts->client, addr, 1);
152 dev_err(ts->dev, "error sending FW info message\n");
155 ret = i2c_master_recv(ts->client, buf, 5);
157 dev_err(ts->dev, "error receiving FW info message\n");
161 dev_err(ts->dev, "got only %d bytes\n", ret);
165 dev_dbg(ts->dev, "vendor %c%c, HW ID %.2d, FW ver %.4d\n",
171 static int cy8ctma140_power_up(struct cy8ctma140 *ts)
175 error = regulator_bulk_enable(ARRAY_SIZE(ts->regulators),
176 ts->regulators);
178 dev_err(ts->dev, "failed to enable regulators\n");
187 static void cy8ctma140_power_down(struct cy8ctma140 *ts)
189 regulator_bulk_disable(ARRAY_SIZE(ts->regulators),
190 ts->regulators);
196 struct cy8ctma140 *ts = d;
198 cy8ctma140_power_down(ts);
203 struct cy8ctma140 *ts;
208 ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL);
209 if (!ts)
216 ts->dev = dev;
217 ts->client = client;
218 ts->input = input;
237 touchscreen_parse_properties(input, true, &ts->props);
248 input_set_drvdata(input, ts);
257 ts->regulators[0].supply = "vcpin";
258 ts->regulators[1].supply = "vdd";
259 error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->regulators),
260 ts->regulators);
264 error = cy8ctma140_power_up(ts);
268 error = devm_add_action_or_reset(dev, cy8ctma140_power_off_action, ts);
276 IRQF_ONESHOT, CY8CTMA140_NAME, ts);
282 error = cy8ctma140_init(ts);
290 i2c_set_clientdata(client, ts);
298 struct cy8ctma140 *ts = i2c_get_clientdata(client);
301 cy8ctma140_power_down(ts);
309 struct cy8ctma140 *ts = i2c_get_clientdata(client);
313 error = cy8ctma140_power_up(ts);