Lines Matching defs:ts

28 #define ST1232_TS_NAME	"st1232-ts"
29 #define ST1633_TS_NAME "st1633-ts"
100 static int st1232_ts_read_data(struct st1232_ts_data *ts, u8 reg,
103 struct i2c_client *client = ts->client;
114 .buf = ts->read_buf,
126 static int st1232_ts_wait_ready(struct st1232_ts_data *ts)
132 error = st1232_ts_read_data(ts, REG_STATUS, 1);
134 switch (ts->read_buf[0]) {
147 static int st1232_ts_read_fw_version(struct st1232_ts_data *ts,
153 error = st1232_ts_read_data(ts, REG_FIRMWARE_VERSION, 1);
156 *fw_version = ts->read_buf[0];
159 error = st1232_ts_read_data(ts, REG_FIRMWARE_REVISION_3, 4);
162 *fw_revision = le32_to_cpup((__le32 *)ts->read_buf);
167 static int st1232_ts_read_resolution(struct st1232_ts_data *ts, u16 *max_x,
174 error = st1232_ts_read_data(ts, REG_XY_RESOLUTION, 3);
178 buf = ts->read_buf;
186 static int st1232_ts_parse_and_report(struct st1232_ts_data *ts)
188 struct input_dev *input = ts->input_dev;
195 for (i = 0; i < ts->chip_info->max_fingers; i++) {
196 u8 *buf = &ts->read_buf[i * 4];
203 &ts->prop, x, y);
206 if (ts->chip_info->have_z)
207 z[n_contacts] = ts->read_buf[i + 6];
215 if (touch_overlay_process_contact(&ts->touch_overlay_list,
223 if (ts->chip_info->have_z)
227 touch_overlay_sync_frame(&ts->touch_overlay_list, input);
236 struct st1232_ts_data *ts = dev_id;
240 error = st1232_ts_read_data(ts, REG_XY_COORDINATES, ts->read_buf_len);
244 count = st1232_ts_parse_and_report(ts);
246 if (ts->low_latency_req.dev) {
247 dev_pm_qos_remove_request(&ts->low_latency_req);
248 ts->low_latency_req.dev = NULL;
250 } else if (!ts->low_latency_req.dev) {
252 dev_pm_qos_add_ancestor_request(&ts->client->dev,
253 &ts->low_latency_req,
261 static void st1232_ts_power(struct st1232_ts_data *ts, bool poweron)
263 if (ts->reset_gpio)
264 gpiod_set_value_cansleep(ts->reset_gpio, !poweron);
288 struct st1232_ts_data *ts;
311 ts = devm_kzalloc_obj(&client->dev, *ts);
312 if (!ts)
315 ts->chip_info = match;
318 ts->read_buf_len = ts->chip_info->max_fingers * 4;
319 ts->read_buf = devm_kzalloc(&client->dev, ts->read_buf_len, GFP_KERNEL);
320 if (!ts->read_buf)
327 ts->client = client;
328 ts->input_dev = input_dev;
330 ts->reset_gpio = devm_gpiod_get_optional(&client->dev, NULL,
332 if (IS_ERR(ts->reset_gpio)) {
333 error = PTR_ERR(ts->reset_gpio);
339 st1232_ts_power(ts, true);
341 error = devm_add_action_or_reset(&client->dev, st1232_ts_power_off, ts);
352 error = st1232_ts_wait_ready(ts);
357 error = st1232_ts_read_fw_version(ts, &ts->fw_version, &ts->fw_revision);
364 ts->fw_version, ts->fw_revision);
366 if (ts->chip_info->have_z)
368 ts->chip_info->max_area, 0, 0);
371 INIT_LIST_HEAD(&ts->touch_overlay_list);
372 error = touch_overlay_map(&ts->touch_overlay_list, input_dev);
376 if (touch_overlay_mapped_touchscreen(&ts->touch_overlay_list)) {
378 touch_overlay_get_touchscreen_abs(&ts->touch_overlay_list,
382 error = st1232_ts_read_resolution(ts, &max_x, &max_y);
395 touchscreen_parse_properties(input_dev, true, &ts->prop);
397 error = input_mt_init_slots(input_dev, ts->chip_info->max_fingers,
408 client->name, ts);
414 error = input_register_device(ts->input_dev);
421 i2c_set_clientdata(client, ts);
429 struct st1232_ts_data *ts = i2c_get_clientdata(client);
434 st1232_ts_power(ts, false);
442 struct st1232_ts_data *ts = i2c_get_clientdata(client);
445 st1232_ts_power(ts, true);