Lines Matching refs:ts

138 static int auo_pixcir_collect_data(struct auo_pixcir_ts *ts,
141 struct i2c_client *client = ts->client;
168 if (point[i].coord_x > ts->x_max ||
169 point[i].coord_y > ts->y_max) {
186 struct auo_pixcir_ts *ts = dev_id;
193 while (!ts->stopped) {
196 if (ts->touch_ind_mode) {
197 if (gpiod_get_value_cansleep(ts->gpio_int) == 0) {
198 input_mt_sync(ts->input);
199 input_report_key(ts->input, BTN_TOUCH, 0);
200 input_sync(ts->input);
205 ret = auo_pixcir_collect_data(ts, point);
208 if (!ts->touch_ind_mode)
211 wait_event_timeout(ts->wait, ts->stopped,
218 input_report_abs(ts->input, ABS_MT_POSITION_X,
220 input_report_abs(ts->input, ABS_MT_POSITION_Y,
222 input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR,
224 input_report_abs(ts->input, ABS_MT_TOUCH_MINOR,
226 input_report_abs(ts->input, ABS_MT_ORIENTATION,
228 input_mt_sync(ts->input);
241 input_report_key(ts->input, BTN_TOUCH, fingers > 0);
244 input_report_abs(ts->input, ABS_X, point[abs].coord_x);
245 input_report_abs(ts->input, ABS_Y, point[abs].coord_y);
248 input_sync(ts->input);
251 if (!ts->touch_ind_mode)
254 wait_event_timeout(ts->wait, ts->stopped,
268 static int auo_pixcir_power_mode(struct auo_pixcir_ts *ts, int mode)
270 struct i2c_client *client = ts->client;
293 static int auo_pixcir_int_config(struct auo_pixcir_ts *ts, int int_setting)
295 struct i2c_client *client = ts->client;
317 ts->touch_ind_mode = int_setting == AUO_PIXCIR_INT_TOUCH_IND;
323 static int auo_pixcir_int_toggle(struct auo_pixcir_ts *ts, bool enable)
325 struct i2c_client *client = ts->client;
351 static int auo_pixcir_start(struct auo_pixcir_ts *ts)
353 struct i2c_client *client = ts->client;
356 ret = auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_ACTIVE);
363 ts->stopped = false;
367 ret = auo_pixcir_int_toggle(ts, 1);
378 static int auo_pixcir_stop(struct auo_pixcir_ts *ts)
380 struct i2c_client *client = ts->client;
383 ret = auo_pixcir_int_toggle(ts, 0);
392 ts->stopped = true;
394 wake_up(&ts->wait);
396 return auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_DEEP_SLEEP);
401 struct auo_pixcir_ts *ts = input_get_drvdata(dev);
403 return auo_pixcir_start(ts);
408 struct auo_pixcir_ts *ts = input_get_drvdata(dev);
410 auo_pixcir_stop(ts);
416 struct auo_pixcir_ts *ts = i2c_get_clientdata(client);
417 struct input_dev *input = ts->input;
428 ret = auo_pixcir_start(ts);
434 ret = auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_SLEEP);
436 ret = auo_pixcir_stop(ts);
448 struct auo_pixcir_ts *ts = i2c_get_clientdata(client);
449 struct input_dev *input = ts->input;
459 ret = auo_pixcir_stop(ts);
466 ret = auo_pixcir_start(ts);
480 struct auo_pixcir_ts *ts = data;
482 gpiod_set_value_cansleep(ts->gpio_rst, 1);
487 struct auo_pixcir_ts *ts;
492 ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL);
493 if (!ts)
502 ts->client = client;
503 ts->input = input_dev;
504 ts->touch_ind_mode = 0;
505 ts->stopped = true;
506 init_waitqueue_head(&ts->wait);
508 snprintf(ts->phys, sizeof(ts->phys),
511 if (device_property_read_u32(&client->dev, "x-size", &ts->x_max)) {
516 if (device_property_read_u32(&client->dev, "y-size", &ts->y_max)) {
522 input_dev->phys = ts->phys;
534 input_set_abs_params(input_dev, ABS_X, 0, ts->x_max, 0, 0);
535 input_set_abs_params(input_dev, ABS_Y, 0, ts->y_max, 0, 0);
538 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, ts->x_max, 0, 0);
539 input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, ts->y_max, 0, 0);
546 input_set_drvdata(ts->input, ts);
548 ts->gpio_int = devm_gpiod_get_index(&client->dev, NULL, 0, GPIOD_IN);
549 error = PTR_ERR_OR_ZERO(ts->gpio_int);
556 gpiod_set_consumer_name(ts->gpio_int, "auo_pixcir_ts_int");
559 ts->gpio_rst = devm_gpiod_get_index(&client->dev, NULL, 1,
561 error = PTR_ERR_OR_ZERO(ts->gpio_rst);
568 gpiod_set_consumer_name(ts->gpio_rst, "auo_pixcir_ts_rst");
570 error = devm_add_action_or_reset(&client->dev, auo_pixcir_reset, ts);
588 error = auo_pixcir_int_config(ts, AUO_PIXCIR_INT_TOUCH_IND);
595 input_dev->name, ts);
603 error = auo_pixcir_stop(ts);
614 i2c_set_clientdata(client, ts);