Lines Matching refs:ts

60 static int goodix_check_cfg_8(struct goodix_ts_data *ts,
62 static int goodix_check_cfg_16(struct goodix_ts_data *ts,
64 static void goodix_calc_cfg_checksum_8(struct goodix_ts_data *ts);
65 static void goodix_calc_cfg_checksum_16(struct goodix_ts_data *ts);
241 static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data) in goodix_ts_read_input_report() argument
252 const int header_contact_keycode_size = 1 + ts->contact_size + 1; in goodix_ts_read_input_report()
261 error = goodix_i2c_read(ts->client, addr, data, in goodix_ts_read_input_report()
268 if (touch_num > ts->max_touch_num) in goodix_ts_read_input_report()
274 error = goodix_i2c_read(ts->client, in goodix_ts_read_input_report()
276 ts->contact_size * in goodix_ts_read_input_report()
285 if (data[0] == 0 && ts->firmware_name) { in goodix_ts_read_input_report()
286 if (goodix_handle_fw_request(ts)) in goodix_ts_read_input_report()
300 static void goodix_ts_report_touch_8b(struct goodix_ts_data *ts, u8 *coor_data) in goodix_ts_report_touch_8b() argument
307 input_mt_slot(ts->input_dev, id); in goodix_ts_report_touch_8b()
308 input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); in goodix_ts_report_touch_8b()
309 touchscreen_report_pos(ts->input_dev, &ts->prop, in goodix_ts_report_touch_8b()
311 input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, input_w); in goodix_ts_report_touch_8b()
312 input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, input_w); in goodix_ts_report_touch_8b()
315 static void goodix_ts_report_touch_9b(struct goodix_ts_data *ts, u8 *coor_data) in goodix_ts_report_touch_9b() argument
322 input_mt_slot(ts->input_dev, id); in goodix_ts_report_touch_9b()
323 input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); in goodix_ts_report_touch_9b()
324 touchscreen_report_pos(ts->input_dev, &ts->prop, in goodix_ts_report_touch_9b()
326 input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, input_w); in goodix_ts_report_touch_9b()
327 input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, input_w); in goodix_ts_report_touch_9b()
330 static void goodix_ts_report_key(struct goodix_ts_data *ts, u8 *data) in goodix_ts_report_key() argument
338 key_value = data[1 + ts->contact_size * touch_num]; in goodix_ts_report_key()
341 input_report_key(ts->input_dev, in goodix_ts_report_key()
342 ts->keymap[i], 1); in goodix_ts_report_key()
345 input_report_key(ts->input_dev, ts->keymap[i], 0); in goodix_ts_report_key()
357 static void goodix_process_events(struct goodix_ts_data *ts) in goodix_process_events() argument
363 touch_num = goodix_ts_read_input_report(ts, point_data); in goodix_process_events()
367 goodix_ts_report_key(ts, point_data); in goodix_process_events()
370 if (ts->contact_size == 9) in goodix_process_events()
371 goodix_ts_report_touch_9b(ts, in goodix_process_events()
372 &point_data[1 + ts->contact_size * i]); in goodix_process_events()
374 goodix_ts_report_touch_8b(ts, in goodix_process_events()
375 &point_data[1 + ts->contact_size * i]); in goodix_process_events()
377 input_mt_sync_frame(ts->input_dev); in goodix_process_events()
378 input_sync(ts->input_dev); in goodix_process_events()
389 struct goodix_ts_data *ts = dev_id; in goodix_ts_irq_handler() local
391 goodix_process_events(ts); in goodix_ts_irq_handler()
392 goodix_i2c_write_u8(ts->client, GOODIX_READ_COOR_ADDR, 0); in goodix_ts_irq_handler()
397 static void goodix_free_irq(struct goodix_ts_data *ts) in goodix_free_irq() argument
399 devm_free_irq(&ts->client->dev, ts->client->irq, ts); in goodix_free_irq()
402 static int goodix_request_irq(struct goodix_ts_data *ts) in goodix_request_irq() argument
404 return devm_request_threaded_irq(&ts->client->dev, ts->client->irq, in goodix_request_irq()
406 ts->irq_flags, ts->client->name, ts); in goodix_request_irq()
409 static int goodix_check_cfg_8(struct goodix_ts_data *ts, const u8 *cfg, int len) in goodix_check_cfg_8() argument
418 dev_err(&ts->client->dev, in goodix_check_cfg_8()
424 dev_err(&ts->client->dev, in goodix_check_cfg_8()
432 static void goodix_calc_cfg_checksum_8(struct goodix_ts_data *ts) in goodix_calc_cfg_checksum_8() argument
434 int i, raw_cfg_len = ts->chip->config_len - 2; in goodix_calc_cfg_checksum_8()
438 check_sum += ts->config[i]; in goodix_calc_cfg_checksum_8()
441 ts->config[raw_cfg_len] = check_sum; in goodix_calc_cfg_checksum_8()
442 ts->config[raw_cfg_len + 1] = 1; /* Set "config_fresh" bit */ in goodix_calc_cfg_checksum_8()
445 static int goodix_check_cfg_16(struct goodix_ts_data *ts, const u8 *cfg, in goodix_check_cfg_16() argument
455 dev_err(&ts->client->dev, in goodix_check_cfg_16()
461 dev_err(&ts->client->dev, in goodix_check_cfg_16()
469 static void goodix_calc_cfg_checksum_16(struct goodix_ts_data *ts) in goodix_calc_cfg_checksum_16() argument
471 int i, raw_cfg_len = ts->chip->config_len - 3; in goodix_calc_cfg_checksum_16()
475 check_sum += get_unaligned_be16(&ts->config[i]); in goodix_calc_cfg_checksum_16()
478 put_unaligned_be16(check_sum, &ts->config[raw_cfg_len]); in goodix_calc_cfg_checksum_16()
479 ts->config[raw_cfg_len + 2] = 1; /* Set "config_fresh" bit */ in goodix_calc_cfg_checksum_16()
489 static int goodix_check_cfg(struct goodix_ts_data *ts, const u8 *cfg, int len) in goodix_check_cfg() argument
493 dev_err(&ts->client->dev, in goodix_check_cfg()
498 return ts->chip->check_config(ts, cfg, len); in goodix_check_cfg()
508 int goodix_send_cfg(struct goodix_ts_data *ts, const u8 *cfg, int len) in goodix_send_cfg() argument
512 error = goodix_check_cfg(ts, cfg, len); in goodix_send_cfg()
516 error = goodix_i2c_write(ts->client, ts->chip->config_addr, cfg, len); in goodix_send_cfg()
520 dev_dbg(&ts->client->dev, "Config sent successfully."); in goodix_send_cfg()
529 static int goodix_pin_acpi_direction_input(struct goodix_ts_data *ts) in goodix_pin_acpi_direction_input() argument
531 acpi_handle handle = ACPI_HANDLE(&ts->client->dev); in goodix_pin_acpi_direction_input()
538 static int goodix_pin_acpi_output_method(struct goodix_ts_data *ts, int value) in goodix_pin_acpi_output_method() argument
540 acpi_handle handle = ACPI_HANDLE(&ts->client->dev); in goodix_pin_acpi_output_method()
547 static int goodix_pin_acpi_direction_input(struct goodix_ts_data *ts) in goodix_pin_acpi_direction_input() argument
549 dev_err(&ts->client->dev, in goodix_pin_acpi_direction_input()
554 static int goodix_pin_acpi_output_method(struct goodix_ts_data *ts, int value) in goodix_pin_acpi_output_method() argument
556 dev_err(&ts->client->dev, in goodix_pin_acpi_output_method()
562 static int goodix_irq_direction_output(struct goodix_ts_data *ts, int value) in goodix_irq_direction_output() argument
564 switch (ts->irq_pin_access_method) { in goodix_irq_direction_output()
566 dev_err(&ts->client->dev, in goodix_irq_direction_output()
571 return gpiod_direction_output(ts->gpiod_int, value); in goodix_irq_direction_output()
577 return gpiod_direction_output_raw(ts->gpiod_int, value); in goodix_irq_direction_output()
579 return goodix_pin_acpi_output_method(ts, value); in goodix_irq_direction_output()
585 static int goodix_irq_direction_input(struct goodix_ts_data *ts) in goodix_irq_direction_input() argument
587 switch (ts->irq_pin_access_method) { in goodix_irq_direction_input()
589 dev_err(&ts->client->dev, in goodix_irq_direction_input()
594 return gpiod_direction_input(ts->gpiod_int); in goodix_irq_direction_input()
596 return gpiod_direction_input(ts->gpiod_int); in goodix_irq_direction_input()
598 return goodix_pin_acpi_direction_input(ts); in goodix_irq_direction_input()
604 int goodix_int_sync(struct goodix_ts_data *ts) in goodix_int_sync() argument
608 error = goodix_irq_direction_output(ts, 0); in goodix_int_sync()
614 error = goodix_irq_direction_input(ts); in goodix_int_sync()
621 dev_err(&ts->client->dev, "Controller irq sync failed.\n"); in goodix_int_sync()
630 int goodix_reset_no_int_sync(struct goodix_ts_data *ts) in goodix_reset_no_int_sync() argument
635 error = gpiod_direction_output(ts->gpiod_rst, 0); in goodix_reset_no_int_sync()
642 error = goodix_irq_direction_output(ts, ts->client->addr == 0x14); in goodix_reset_no_int_sync()
648 error = gpiod_direction_output(ts->gpiod_rst, 1); in goodix_reset_no_int_sync()
659 if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_GPIO) { in goodix_reset_no_int_sync()
660 error = gpiod_direction_input(ts->gpiod_rst); in goodix_reset_no_int_sync()
668 dev_err(&ts->client->dev, "Controller reset failed.\n"); in goodix_reset_no_int_sync()
677 static int goodix_reset(struct goodix_ts_data *ts) in goodix_reset() argument
681 error = goodix_reset_no_int_sync(ts); in goodix_reset()
685 return goodix_int_sync(ts); in goodix_reset()
726 struct goodix_ts_data *ts = data; in goodix_resource() local
727 struct device *dev = &ts->client->dev; in goodix_resource()
734 if (ts->gpio_int_idx == -1) { in goodix_resource()
735 ts->gpio_int_idx = ts->gpio_count; in goodix_resource()
738 ts->gpio_int_idx = -2; in goodix_resource()
741 ts->gpio_count++; in goodix_resource()
757 static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts) in goodix_add_acpi_gpio_mappings() argument
760 struct device *dev = &ts->client->dev; in goodix_add_acpi_gpio_mappings()
764 ts->gpio_count = 0; in goodix_add_acpi_gpio_mappings()
765 ts->gpio_int_idx = -1; in goodix_add_acpi_gpio_mappings()
767 goodix_resource, ts); in goodix_add_acpi_gpio_mappings()
775 if (ts->gpio_count == 2 && ts->gpio_int_idx == 0) { in goodix_add_acpi_gpio_mappings()
776 ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO; in goodix_add_acpi_gpio_mappings()
778 } else if (ts->gpio_count == 2 && ts->gpio_int_idx == 1) { in goodix_add_acpi_gpio_mappings()
779 ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO; in goodix_add_acpi_gpio_mappings()
781 } else if (ts->gpio_count == 1 && ts->gpio_int_idx == -1 && in goodix_add_acpi_gpio_mappings()
785 ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_METHOD; in goodix_add_acpi_gpio_mappings()
787 } else if (is_byt() && ts->gpio_count == 2 && ts->gpio_int_idx == -1) { in goodix_add_acpi_gpio_mappings()
789 ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO; in goodix_add_acpi_gpio_mappings()
793 ts->gpio_count, ts->gpio_int_idx); in goodix_add_acpi_gpio_mappings()
803 ts->gpiod_rst_flags = GPIOD_ASIS; in goodix_add_acpi_gpio_mappings()
808 static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts) in goodix_add_acpi_gpio_mappings() argument
819 static int goodix_get_gpio_config(struct goodix_ts_data *ts) in goodix_get_gpio_config() argument
826 if (!ts->client) in goodix_get_gpio_config()
828 dev = &ts->client->dev; in goodix_get_gpio_config()
834 ts->gpiod_rst_flags = GPIOD_IN; in goodix_get_gpio_config()
836 ts->avdd28 = devm_regulator_get(dev, "AVDD28"); in goodix_get_gpio_config()
837 if (IS_ERR(ts->avdd28)) { in goodix_get_gpio_config()
838 error = PTR_ERR(ts->avdd28); in goodix_get_gpio_config()
845 ts->vddio = devm_regulator_get(dev, "VDDIO"); in goodix_get_gpio_config()
846 if (IS_ERR(ts->vddio)) { in goodix_get_gpio_config()
847 error = PTR_ERR(ts->vddio); in goodix_get_gpio_config()
866 if (goodix_add_acpi_gpio_mappings(ts) == 0) in goodix_get_gpio_config()
870 ts->gpiod_int = gpiod; in goodix_get_gpio_config()
873 gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_RST_NAME, ts->gpiod_rst_flags); in goodix_get_gpio_config()
882 ts->gpiod_rst = gpiod; in goodix_get_gpio_config()
884 switch (ts->irq_pin_access_method) { in goodix_get_gpio_config()
894 if (!ts->gpiod_int || !ts->gpiod_rst) in goodix_get_gpio_config()
895 ts->irq_pin_access_method = IRQ_PIN_ACCESS_NONE; in goodix_get_gpio_config()
898 if (!ts->gpiod_rst) in goodix_get_gpio_config()
899 ts->irq_pin_access_method = IRQ_PIN_ACCESS_NONE; in goodix_get_gpio_config()
902 if (ts->gpiod_int && ts->gpiod_rst) { in goodix_get_gpio_config()
903 ts->reset_controller_at_probe = true; in goodix_get_gpio_config()
904 ts->load_cfg_from_disk = true; in goodix_get_gpio_config()
905 ts->irq_pin_access_method = IRQ_PIN_ACCESS_GPIO; in goodix_get_gpio_config()
919 static void goodix_read_config(struct goodix_ts_data *ts) in goodix_read_config() argument
929 if (!ts->firmware_name) { in goodix_read_config()
930 error = goodix_i2c_read(ts->client, ts->chip->config_addr, in goodix_read_config()
931 ts->config, ts->chip->config_len); in goodix_read_config()
933 ts->int_trigger_type = GOODIX_INT_TRIGGER; in goodix_read_config()
934 ts->max_touch_num = GOODIX_MAX_CONTACTS; in goodix_read_config()
939 ts->int_trigger_type = ts->config[TRIGGER_LOC] & 0x03; in goodix_read_config()
940 ts->max_touch_num = ts->config[MAX_CONTACTS_LOC] & 0x0f; in goodix_read_config()
942 x_max = get_unaligned_le16(&ts->config[RESOLUTION_LOC]); in goodix_read_config()
943 y_max = get_unaligned_le16(&ts->config[RESOLUTION_LOC + 2]); in goodix_read_config()
945 input_abs_set_max(ts->input_dev, ABS_MT_POSITION_X, x_max - 1); in goodix_read_config()
946 input_abs_set_max(ts->input_dev, ABS_MT_POSITION_Y, y_max - 1); in goodix_read_config()
949 ts->chip->calc_config_checksum(ts); in goodix_read_config()
957 static int goodix_read_version(struct goodix_ts_data *ts) in goodix_read_version() argument
963 error = goodix_i2c_read(ts->client, GOODIX_REG_ID, buf, sizeof(buf)); in goodix_read_version()
969 strscpy(ts->id, id_str, GOODIX_ID_MAX_LEN + 1); in goodix_read_version()
971 ts->version = get_unaligned_le16(&buf[4]); in goodix_read_version()
973 dev_info(&ts->client->dev, "ID %s, version: %04x\n", ts->id, in goodix_read_version()
974 ts->version); in goodix_read_version()
1011 static int goodix_configure_dev(struct goodix_ts_data *ts) in goodix_configure_dev() argument
1016 ts->int_trigger_type = GOODIX_INT_TRIGGER; in goodix_configure_dev()
1017 ts->max_touch_num = GOODIX_MAX_CONTACTS; in goodix_configure_dev()
1019 ts->input_dev = devm_input_allocate_device(&ts->client->dev); in goodix_configure_dev()
1020 if (!ts->input_dev) { in goodix_configure_dev()
1021 dev_err(&ts->client->dev, "Failed to allocate input device."); in goodix_configure_dev()
1025 ts->input_dev->name = "Goodix Capacitive TouchScreen"; in goodix_configure_dev()
1026 ts->input_dev->phys = "input/ts"; in goodix_configure_dev()
1027 ts->input_dev->id.bustype = BUS_I2C; in goodix_configure_dev()
1028 ts->input_dev->id.vendor = 0x0416; in goodix_configure_dev()
1029 if (kstrtou16(ts->id, 10, &ts->input_dev->id.product)) in goodix_configure_dev()
1030 ts->input_dev->id.product = 0x1001; in goodix_configure_dev()
1031 ts->input_dev->id.version = ts->version; in goodix_configure_dev()
1033 ts->input_dev->keycode = ts->keymap; in goodix_configure_dev()
1034 ts->input_dev->keycodesize = sizeof(ts->keymap[0]); in goodix_configure_dev()
1035 ts->input_dev->keycodemax = GOODIX_MAX_KEYS; in goodix_configure_dev()
1040 ts->keymap[i] = KEY_LEFTMETA; in goodix_configure_dev()
1042 ts->keymap[i] = KEY_F1 + (i - 1); in goodix_configure_dev()
1044 input_set_capability(ts->input_dev, EV_KEY, ts->keymap[i]); in goodix_configure_dev()
1047 input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_X); in goodix_configure_dev()
1048 input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_Y); in goodix_configure_dev()
1049 input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0); in goodix_configure_dev()
1050 input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); in goodix_configure_dev()
1053 goodix_read_config(ts); in goodix_configure_dev()
1056 touchscreen_parse_properties(ts->input_dev, true, &ts->prop); in goodix_configure_dev()
1058 if (!ts->prop.max_x || !ts->prop.max_y || !ts->max_touch_num) { in goodix_configure_dev()
1059 dev_err(&ts->client->dev, in goodix_configure_dev()
1061 ts->prop.max_x, ts->prop.max_y, ts->max_touch_num); in goodix_configure_dev()
1062 ts->prop.max_x = GOODIX_MAX_WIDTH - 1; in goodix_configure_dev()
1063 ts->prop.max_y = GOODIX_MAX_HEIGHT - 1; in goodix_configure_dev()
1064 ts->max_touch_num = GOODIX_MAX_CONTACTS; in goodix_configure_dev()
1065 input_abs_set_max(ts->input_dev, in goodix_configure_dev()
1066 ABS_MT_POSITION_X, ts->prop.max_x); in goodix_configure_dev()
1067 input_abs_set_max(ts->input_dev, in goodix_configure_dev()
1068 ABS_MT_POSITION_Y, ts->prop.max_y); in goodix_configure_dev()
1072 ts->contact_size = 9; in goodix_configure_dev()
1074 dev_dbg(&ts->client->dev, in goodix_configure_dev()
1079 ts->prop.invert_x = true; in goodix_configure_dev()
1080 dev_dbg(&ts->client->dev, in goodix_configure_dev()
1084 error = input_mt_init_slots(ts->input_dev, ts->max_touch_num, in goodix_configure_dev()
1087 dev_err(&ts->client->dev, in goodix_configure_dev()
1092 error = input_register_device(ts->input_dev); in goodix_configure_dev()
1094 dev_err(&ts->client->dev, in goodix_configure_dev()
1099 ts->irq_flags = goodix_irq_flags[ts->int_trigger_type] | IRQF_ONESHOT; in goodix_configure_dev()
1100 error = goodix_request_irq(ts); in goodix_configure_dev()
1102 dev_err(&ts->client->dev, "request IRQ failed: %d\n", error); in goodix_configure_dev()
1120 struct goodix_ts_data *ts = ctx; in goodix_config_cb() local
1123 if (ts->firmware_name) { in goodix_config_cb()
1127 error = goodix_check_cfg(ts, cfg->data, cfg->size); in goodix_config_cb()
1131 memcpy(ts->config, cfg->data, cfg->size); in goodix_config_cb()
1134 error = goodix_send_cfg(ts, cfg->data, cfg->size); in goodix_config_cb()
1139 goodix_configure_dev(ts); in goodix_config_cb()
1143 complete_all(&ts->firmware_loading_complete); in goodix_config_cb()
1148 struct goodix_ts_data *ts = arg; in goodix_disable_regulators() local
1150 regulator_disable(ts->vddio); in goodix_disable_regulators()
1151 regulator_disable(ts->avdd28); in goodix_disable_regulators()
1157 struct goodix_ts_data *ts; in goodix_ts_probe() local
1168 ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL); in goodix_ts_probe()
1169 if (!ts) in goodix_ts_probe()
1172 ts->client = client; in goodix_ts_probe()
1173 i2c_set_clientdata(client, ts); in goodix_ts_probe()
1174 init_completion(&ts->firmware_loading_complete); in goodix_ts_probe()
1175 ts->contact_size = GOODIX_CONTACT_SIZE; in goodix_ts_probe()
1177 error = goodix_get_gpio_config(ts); in goodix_ts_probe()
1182 error = regulator_enable(ts->avdd28); in goodix_ts_probe()
1190 error = regulator_enable(ts->vddio); in goodix_ts_probe()
1195 regulator_disable(ts->avdd28); in goodix_ts_probe()
1200 goodix_disable_regulators, ts); in goodix_ts_probe()
1205 if (ts->reset_controller_at_probe) { in goodix_ts_probe()
1207 error = goodix_reset(ts); in goodix_ts_probe()
1214 if (!ts->reset_controller_at_probe && in goodix_ts_probe()
1215 ts->irq_pin_access_method != IRQ_PIN_ACCESS_NONE) { in goodix_ts_probe()
1217 ts->reset_controller_at_probe = true; in goodix_ts_probe()
1224 error = goodix_firmware_check(ts); in goodix_ts_probe()
1228 error = goodix_read_version(ts); in goodix_ts_probe()
1232 ts->chip = goodix_get_chip_data(ts->id); in goodix_ts_probe()
1234 if (ts->load_cfg_from_disk) { in goodix_ts_probe()
1240 snprintf(ts->cfg_name, sizeof(ts->cfg_name), in goodix_ts_probe()
1243 snprintf(ts->cfg_name, sizeof(ts->cfg_name), in goodix_ts_probe()
1244 "goodix_%s_cfg.bin", ts->id); in goodix_ts_probe()
1246 error = request_firmware_nowait(THIS_MODULE, true, ts->cfg_name, in goodix_ts_probe()
1247 &client->dev, GFP_KERNEL, ts, in goodix_ts_probe()
1258 error = goodix_configure_dev(ts); in goodix_ts_probe()
1268 struct goodix_ts_data *ts = i2c_get_clientdata(client); in goodix_ts_remove() local
1270 if (ts->load_cfg_from_disk) in goodix_ts_remove()
1271 wait_for_completion(&ts->firmware_loading_complete); in goodix_ts_remove()
1279 struct goodix_ts_data *ts = i2c_get_clientdata(client); in goodix_suspend() local
1282 if (ts->load_cfg_from_disk) in goodix_suspend()
1283 wait_for_completion(&ts->firmware_loading_complete); in goodix_suspend()
1286 if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_NONE) { in goodix_suspend()
1292 goodix_free_irq(ts); in goodix_suspend()
1295 goodix_save_bak_ref(ts); in goodix_suspend()
1298 error = goodix_irq_direction_output(ts, 0); in goodix_suspend()
1300 goodix_request_irq(ts); in goodix_suspend()
1306 error = goodix_i2c_write_u8(ts->client, GOODIX_REG_COMMAND, in goodix_suspend()
1309 goodix_irq_direction_input(ts); in goodix_suspend()
1310 goodix_request_irq(ts); in goodix_suspend()
1326 struct goodix_ts_data *ts = i2c_get_clientdata(client); in goodix_resume() local
1330 if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_NONE) { in goodix_resume()
1339 error = goodix_irq_direction_output(ts, 1); in goodix_resume()
1345 error = goodix_int_sync(ts); in goodix_resume()
1349 error = goodix_i2c_read(ts->client, ts->chip->config_addr, in goodix_resume()
1351 if (!error && config_ver != ts->config[0]) in goodix_resume()
1353 config_ver, ts->config[0]); in goodix_resume()
1355 if (error != 0 || config_ver != ts->config[0]) { in goodix_resume()
1356 error = goodix_reset(ts); in goodix_resume()
1360 error = goodix_send_cfg(ts, ts->config, ts->chip->config_len); in goodix_resume()
1365 error = goodix_request_irq(ts); in goodix_resume()