Lines Matching refs:ts

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