Lines Matching +full:fn +full:- +full:keymap
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright (C) 2011-2014 Atmel Corporation
30 #include <media/v4l2-device.h>
31 #include <media/v4l2-ioctl.h>
32 #include <media/videobuf2-v4l2.h>
33 #include <media/videobuf2-vmalloc.h>
34 #include <dt-bindings/input/atmel-maxtouch.h>
359 return obj->size_minus_one + 1; in mxt_obj_size()
364 return obj->instances_minus_one + 1; in mxt_obj_instances()
404 dev_dbg(&data->client->dev, "message: %*ph\n", in mxt_dump_message()
405 data->T5_msg_size, message); in mxt_dump_message()
412 struct device *dev = &data->client->dev; in mxt_wait_for_completion()
421 return -ETIMEDOUT; in mxt_wait_for_completion()
432 msg.addr = data->bootloader_addr; in mxt_bootloader_read()
433 msg.flags = data->client->flags & I2C_M_TEN; in mxt_bootloader_read()
438 ret = i2c_transfer(data->client->adapter, &msg, 1); in mxt_bootloader_read()
442 ret = ret < 0 ? ret : -EIO; in mxt_bootloader_read()
443 dev_err(&data->client->dev, "%s: i2c recv failed (%d)\n", in mxt_bootloader_read()
456 msg.addr = data->bootloader_addr; in mxt_bootloader_write()
457 msg.flags = data->client->flags & I2C_M_TEN; in mxt_bootloader_write()
461 ret = i2c_transfer(data->client->adapter, &msg, 1); in mxt_bootloader_write()
465 ret = ret < 0 ? ret : -EIO; in mxt_bootloader_write()
466 dev_err(&data->client->dev, "%s: i2c send failed (%d)\n", in mxt_bootloader_write()
475 u8 appmode = data->client->addr; in mxt_lookup_bootloader_address()
477 u8 family_id = data->info ? data->info->family_id : 0; in mxt_lookup_bootloader_address()
484 bootloader = appmode - 0x24; in mxt_lookup_bootloader_address()
492 bootloader = appmode - 0x26; in mxt_lookup_bootloader_address()
496 dev_err(&data->client->dev, in mxt_lookup_bootloader_address()
499 return -EINVAL; in mxt_lookup_bootloader_address()
502 data->bootloader_addr = bootloader; in mxt_lookup_bootloader_address()
508 struct device *dev = &data->client->dev; in mxt_probe_bootloader()
532 struct device *dev = &data->client->dev; in mxt_get_bootloader_version()
554 struct device *dev = &data->client->dev; in mxt_check_bootloader()
566 ret = mxt_wait_for_completion(data, &data->bl_completion, in mxt_check_bootloader()
570 * TODO: handle -ERESTARTSYS better by terminating in mxt_check_bootloader()
598 return -EINVAL; in mxt_check_bootloader()
602 return -EINVAL; in mxt_check_bootloader()
608 return -EINVAL; in mxt_check_bootloader()
634 switch (data->wakeup_method) { in mxt_wakeup_toggle()
644 gpiod_set_value(data->wake_gpio, wake_up); in mxt_wakeup_toggle()
652 dev_dbg(&client->dev, "waking up controller\n"); in mxt_wakeup_toggle()
672 xfer[0].addr = client->addr; in __mxt_read_reg()
678 xfer[1].addr = client->addr; in __mxt_read_reg()
684 ret = i2c_transfer(client->adapter, xfer, 2); in __mxt_read_reg()
692 ret = -EIO; in __mxt_read_reg()
693 dev_err(&client->dev, "%s: i2c transfer failed (%d)\n", in __mxt_read_reg()
711 return -ENOMEM; in __mxt_write_reg()
726 ret = -EIO; in __mxt_write_reg()
727 dev_err(&client->dev, "%s: i2c send failed (%d)\n", in __mxt_write_reg()
746 for (i = 0; i < data->info->object_num; i++) { in mxt_get_object()
747 object = data->object_table + i; in mxt_get_object()
748 if (object->type == type) in mxt_get_object()
752 dev_warn(&data->client->dev, "Invalid object type T%u\n", type); in mxt_get_object()
758 struct device *dev = &data->client->dev; in mxt_proc_t6_messages()
762 if (crc != data->config_crc) { in mxt_proc_t6_messages()
763 data->config_crc = crc; in mxt_proc_t6_messages()
767 complete(&data->crc_completion); in mxt_proc_t6_messages()
771 complete(&data->reset_completion); in mxt_proc_t6_messages()
774 if (status != data->t6_status) in mxt_proc_t6_messages()
786 data->t6_status = status; in mxt_proc_t6_messages()
797 return -EINVAL; in mxt_write_object()
799 reg = object->start_address; in mxt_write_object()
800 return mxt_write_reg(data->client, reg + offset, val); in mxt_write_object()
805 struct input_dev *input = data->input_dev; in mxt_input_button()
808 for (i = 0; i < data->t19_num_keys; i++) { in mxt_input_button()
809 if (data->t19_keymap[i] == KEY_RESERVED) in mxt_input_button()
812 /* Active-low switch */ in mxt_input_button()
813 input_report_key(input, data->t19_keymap[i], in mxt_input_button()
820 input_mt_report_pointer_emulation(data->input_dev, in mxt_input_sync()
821 data->t19_num_keys); in mxt_input_sync()
822 input_sync(data->input_dev); in mxt_input_sync()
827 struct device *dev = &data->client->dev; in mxt_proc_t9_message()
828 struct input_dev *input_dev = data->input_dev; in mxt_proc_t9_message()
836 id = message[0] - data->T9_reportid_min; in mxt_proc_t9_message()
842 if (data->max_x < 1024) in mxt_proc_t9_message()
844 if (data->max_y < 1024) in mxt_proc_t9_message()
876 /* if active, pressure must be non-zero */ in mxt_proc_t9_message()
891 data->update_input = true; in mxt_proc_t9_message()
896 struct device *dev = &data->client->dev; in mxt_proc_t100_message()
897 struct input_dev *input_dev = data->input_dev; in mxt_proc_t100_message()
909 id = message[0] - data->T100_reportid_min - 2; in mxt_proc_t100_message()
927 if (data->t100_aux_vect) in mxt_proc_t100_message()
928 orientation = message[data->t100_aux_vect]; in mxt_proc_t100_message()
937 if (data->t100_aux_area) in mxt_proc_t100_message()
938 major = message[data->t100_aux_area]; in mxt_proc_t100_message()
940 if (data->t100_aux_ampl) in mxt_proc_t100_message()
941 pressure = message[data->t100_aux_ampl]; in mxt_proc_t100_message()
943 if (data->t100_aux_vect) in mxt_proc_t100_message()
944 orientation = message[data->t100_aux_vect]; in mxt_proc_t100_message()
957 if (data->t100_aux_ampl) in mxt_proc_t100_message()
958 pressure = message[data->t100_aux_ampl]; in mxt_proc_t100_message()
973 * Values reported should be non-zero if tool is touching the in mxt_proc_t100_message()
999 data->update_input = true; in mxt_proc_t100_message()
1009 if (report_id == data->T6_reportid) { in mxt_proc_message()
1011 } else if (!data->input_dev) { in mxt_proc_message()
1017 } else if (report_id >= data->T9_reportid_min && in mxt_proc_message()
1018 report_id <= data->T9_reportid_max) { in mxt_proc_message()
1020 } else if (report_id >= data->T100_reportid_min && in mxt_proc_message()
1021 report_id <= data->T100_reportid_max) { in mxt_proc_message()
1023 } else if (report_id == data->T19_reportid) { in mxt_proc_message()
1025 data->update_input = true; in mxt_proc_message()
1035 struct device *dev = &data->client->dev; in mxt_read_and_process_messages()
1041 if (count > data->max_reportid) in mxt_read_and_process_messages()
1042 return -EINVAL; in mxt_read_and_process_messages()
1045 ret = __mxt_read_reg(data->client, data->T5_address, in mxt_read_and_process_messages()
1046 data->T5_msg_size * count, data->msg_buf); in mxt_read_and_process_messages()
1054 data->msg_buf + data->T5_msg_size * i); in mxt_read_and_process_messages()
1066 struct device *dev = &data->client->dev; in mxt_process_messages_t44()
1071 ret = __mxt_read_reg(data->client, data->T44_address, in mxt_process_messages_t44()
1072 data->T5_msg_size + 1, data->msg_buf); in mxt_process_messages_t44()
1078 count = data->msg_buf[0]; in mxt_process_messages_t44()
1087 if (count > data->max_reportid) { in mxt_process_messages_t44()
1089 count = data->max_reportid; in mxt_process_messages_t44()
1093 ret = mxt_proc_message(data, data->msg_buf + 1); in mxt_process_messages_t44()
1099 num_left = count - 1; in mxt_process_messages_t44()
1111 if (data->update_input) { in mxt_process_messages_t44()
1113 data->update_input = false; in mxt_process_messages_t44()
1121 struct device *dev = &data->client->dev; in mxt_process_messages_until_invalid()
1125 count = data->max_reportid; in mxt_process_messages_until_invalid()
1132 } while (--tries); in mxt_process_messages_until_invalid()
1134 if (data->update_input) { in mxt_process_messages_until_invalid()
1136 data->update_input = false; in mxt_process_messages_until_invalid()
1140 return -EBUSY; in mxt_process_messages_until_invalid()
1146 u8 count = data->last_message_count; in mxt_process_messages()
1148 if (count < 1 || count > data->max_reportid) in mxt_process_messages()
1169 } while (total_handled < data->num_touchids); in mxt_process_messages()
1172 data->last_message_count = total_handled; in mxt_process_messages()
1174 if (data->update_input) { in mxt_process_messages()
1176 data->update_input = false; in mxt_process_messages()
1186 if (data->in_bootloader) { in mxt_interrupt()
1188 complete(&data->bl_completion); in mxt_interrupt()
1192 if (!data->object_table) in mxt_interrupt()
1195 if (data->T44_address) { in mxt_interrupt()
1210 reg = data->T6_address + cmd_offset; in mxt_t6_command()
1212 ret = mxt_write_reg(data->client, reg, value); in mxt_t6_command()
1221 ret = __mxt_read_reg(data->client, reg, 1, &command_register); in mxt_t6_command()
1227 dev_err(&data->client->dev, "Command failed!\n"); in mxt_t6_command()
1228 return -EIO; in mxt_t6_command()
1238 enable_irq(data->irq); in mxt_acquire_irq()
1240 if (data->use_retrigen_workaround) { in mxt_acquire_irq()
1251 struct device *dev = &data->client->dev; in mxt_soft_reset()
1256 disable_irq(data->irq); in mxt_soft_reset()
1258 reinit_completion(&data->reset_completion); in mxt_soft_reset()
1269 ret = mxt_wait_for_completion(data, &data->reset_completion, in mxt_soft_reset()
1283 data->config_crc = 0; in mxt_update_crc()
1284 reinit_completion(&data->crc_completion); in mxt_update_crc()
1292 mxt_wait_for_completion(data, &data->crc_completion, MXT_CRC_TIMEOUT); in mxt_update_crc()
1314 u8 *last_val = base + end_off - 1; in mxt_calculate_crc()
1317 return -EINVAL; in mxt_calculate_crc()
1328 /* Mask to 24-bit */ in mxt_calculate_crc()
1336 struct i2c_client *client = data->client; in mxt_check_retrigen()
1341 data->use_retrigen_workaround = false; in mxt_check_retrigen()
1343 irqd = irq_get_irq_data(data->irq); in mxt_check_retrigen()
1345 return -EINVAL; in mxt_check_retrigen()
1350 if (data->T18_address) { in mxt_check_retrigen()
1352 data->T18_address + MXT_COMMS_CTRL, in mxt_check_retrigen()
1361 dev_warn(&client->dev, "Enabling RETRIGEN workaround\n"); in mxt_check_retrigen()
1362 data->use_retrigen_workaround = true; in mxt_check_retrigen()
1368 struct device *dev = &data->client->dev; in mxt_prepare_cfg_mem()
1377 while (cfg->raw_pos < cfg->raw_size) { in mxt_prepare_cfg_mem()
1379 ret = sscanf(cfg->raw + cfg->raw_pos, "%x %x %x%n", in mxt_prepare_cfg_mem()
1386 return -EINVAL; in mxt_prepare_cfg_mem()
1388 cfg->raw_pos += offset; in mxt_prepare_cfg_mem()
1394 ret = sscanf(cfg->raw + cfg->raw_pos, "%hhx%n", in mxt_prepare_cfg_mem()
1399 return -EINVAL; in mxt_prepare_cfg_mem()
1401 cfg->raw_pos += offset; in mxt_prepare_cfg_mem()
1410 * or the file is corrupt or hand-edited. in mxt_prepare_cfg_mem()
1413 size - mxt_obj_size(object), type); in mxt_prepare_cfg_mem()
1418 * to zero these bytes - previous behaviour will be in mxt_prepare_cfg_mem()
1421 * updated. We warn here but do nothing else - the in mxt_prepare_cfg_mem()
1425 mxt_obj_size(object) - size, type); in mxt_prepare_cfg_mem()
1430 return -EINVAL; in mxt_prepare_cfg_mem()
1433 reg = object->start_address + mxt_obj_size(object) * instance; in mxt_prepare_cfg_mem()
1436 ret = sscanf(cfg->raw + cfg->raw_pos, "%hhx%n", in mxt_prepare_cfg_mem()
1442 return -EINVAL; in mxt_prepare_cfg_mem()
1444 cfg->raw_pos += offset; in mxt_prepare_cfg_mem()
1449 byte_offset = reg + i - cfg->start_ofs; in mxt_prepare_cfg_mem()
1451 if (byte_offset >= 0 && byte_offset < cfg->mem_size) { in mxt_prepare_cfg_mem()
1452 *(cfg->mem + byte_offset) = val; in mxt_prepare_cfg_mem()
1455 reg, object->type, byte_offset); in mxt_prepare_cfg_mem()
1456 return -EINVAL; in mxt_prepare_cfg_mem()
1470 while (byte_offset < cfg->mem_size) { in mxt_upload_cfg_mem()
1471 unsigned int size = cfg->mem_size - byte_offset; in mxt_upload_cfg_mem()
1476 error = __mxt_write_reg(data->client, in mxt_upload_cfg_mem()
1477 cfg->start_ofs + byte_offset, in mxt_upload_cfg_mem()
1478 size, cfg->mem + byte_offset); in mxt_upload_cfg_mem()
1480 dev_err(&data->client->dev, in mxt_upload_cfg_mem()
1494 * mxt_update_cfg - download configuration to chip
1501 * 3) Chip Information Block 24-bit CRC Checksum
1502 * 4) Chip Configuration 24-bit CRC Checksum
1507 * <TYPE> - 2-byte object type as hex
1508 * <INSTANCE> - 2-byte object instance number as hex
1509 * <SIZE> - 2-byte object size as hex
1510 * <CONTENTS> - array of <SIZE> 1-byte hex values
1514 struct device *dev = &data->client->dev; in mxt_update_cfg()
1523 cfg.raw = kmemdup_nul(fw->data, fw->size, GFP_KERNEL); in mxt_update_cfg()
1525 return -ENOMEM; in mxt_update_cfg()
1527 cfg.raw_size = fw->size; in mxt_update_cfg()
1533 ret = -EINVAL; in mxt_update_cfg()
1546 ret = -EINVAL; in mxt_update_cfg()
1553 if (cfg.info.family_id != data->info->family_id) { in mxt_update_cfg()
1555 ret = -EINVAL; in mxt_update_cfg()
1559 if (cfg.info.variant_id != data->info->variant_id) { in mxt_update_cfg()
1561 ret = -EINVAL; in mxt_update_cfg()
1569 ret = -EINVAL; in mxt_update_cfg()
1577 ret = -EINVAL; in mxt_update_cfg()
1588 if (info_crc == data->info_crc) { in mxt_update_cfg()
1589 if (config_crc == 0 || data->config_crc == 0) { in mxt_update_cfg()
1591 } else if (config_crc == data->config_crc) { in mxt_update_cfg()
1593 data->config_crc); in mxt_update_cfg()
1598 data->config_crc, config_crc); in mxt_update_cfg()
1602 "Warning: Info CRC error - device=0x%06X file=0x%06X\n", in mxt_update_cfg()
1603 data->info_crc, info_crc); in mxt_update_cfg()
1608 data->info->object_num * sizeof(struct mxt_object) + in mxt_update_cfg()
1610 cfg.mem_size = data->mem_size - cfg.start_ofs; in mxt_update_cfg()
1613 ret = -ENOMEM; in mxt_update_cfg()
1622 if (data->T71_address) in mxt_update_cfg()
1623 crc_start = data->T71_address; in mxt_update_cfg()
1624 else if (data->T7_address) in mxt_update_cfg()
1625 crc_start = data->T7_address; in mxt_update_cfg()
1631 crc_start - cfg.start_ofs, in mxt_update_cfg()
1667 if (data->input_dev) { in mxt_free_input_device()
1668 input_unregister_device(data->input_dev); in mxt_free_input_device()
1669 data->input_dev = NULL; in mxt_free_input_device()
1676 video_unregister_device(&data->dbg.vdev); in mxt_free_object_table()
1677 v4l2_device_unregister(&data->dbg.v4l2); in mxt_free_object_table()
1679 data->object_table = NULL; in mxt_free_object_table()
1680 data->info = NULL; in mxt_free_object_table()
1681 kfree(data->raw_info_block); in mxt_free_object_table()
1682 data->raw_info_block = NULL; in mxt_free_object_table()
1683 kfree(data->msg_buf); in mxt_free_object_table()
1684 data->msg_buf = NULL; in mxt_free_object_table()
1685 data->T5_address = 0; in mxt_free_object_table()
1686 data->T5_msg_size = 0; in mxt_free_object_table()
1687 data->T6_reportid = 0; in mxt_free_object_table()
1688 data->T7_address = 0; in mxt_free_object_table()
1689 data->T71_address = 0; in mxt_free_object_table()
1690 data->T9_reportid_min = 0; in mxt_free_object_table()
1691 data->T9_reportid_max = 0; in mxt_free_object_table()
1692 data->T18_address = 0; in mxt_free_object_table()
1693 data->T19_reportid = 0; in mxt_free_object_table()
1694 data->T44_address = 0; in mxt_free_object_table()
1695 data->T100_reportid_min = 0; in mxt_free_object_table()
1696 data->T100_reportid_max = 0; in mxt_free_object_table()
1697 data->max_reportid = 0; in mxt_free_object_table()
1703 struct i2c_client *client = data->client; in mxt_parse_object_table()
1710 data->mem_size = 0; in mxt_parse_object_table()
1711 for (i = 0; i < data->info->object_num; i++) { in mxt_parse_object_table()
1715 le16_to_cpus(&object->start_address); in mxt_parse_object_table()
1717 if (object->num_report_ids) { in mxt_parse_object_table()
1719 reportid += object->num_report_ids * in mxt_parse_object_table()
1721 max_id = reportid - 1; in mxt_parse_object_table()
1727 dev_dbg(&data->client->dev, in mxt_parse_object_table()
1728 "T%u Start:%u Size:%zu Instances:%zu Report IDs:%u-%u\n", in mxt_parse_object_table()
1729 object->type, object->start_address, in mxt_parse_object_table()
1733 switch (object->type) { in mxt_parse_object_table()
1735 if (data->info->family_id == 0x80 && in mxt_parse_object_table()
1736 data->info->version < 0x20) { in mxt_parse_object_table()
1742 data->T5_msg_size = mxt_obj_size(object); in mxt_parse_object_table()
1745 data->T5_msg_size = mxt_obj_size(object) - 1; in mxt_parse_object_table()
1747 data->T5_address = object->start_address; in mxt_parse_object_table()
1750 data->T6_reportid = min_id; in mxt_parse_object_table()
1751 data->T6_address = object->start_address; in mxt_parse_object_table()
1754 data->T7_address = object->start_address; in mxt_parse_object_table()
1757 data->T71_address = object->start_address; in mxt_parse_object_table()
1760 data->multitouch = MXT_TOUCH_MULTI_T9; in mxt_parse_object_table()
1762 data->T9_reportid_min = min_id; in mxt_parse_object_table()
1763 data->T9_reportid_max = min_id + in mxt_parse_object_table()
1764 object->num_report_ids - 1; in mxt_parse_object_table()
1765 data->num_touchids = object->num_report_ids; in mxt_parse_object_table()
1768 data->T18_address = object->start_address; in mxt_parse_object_table()
1771 data->T44_address = object->start_address; in mxt_parse_object_table()
1774 data->T19_reportid = min_id; in mxt_parse_object_table()
1777 data->multitouch = MXT_TOUCH_MULTITOUCHSCREEN_T100; in mxt_parse_object_table()
1778 data->T100_reportid_min = min_id; in mxt_parse_object_table()
1779 data->T100_reportid_max = max_id; in mxt_parse_object_table()
1781 data->num_touchids = object->num_report_ids - 2; in mxt_parse_object_table()
1785 end_address = object->start_address in mxt_parse_object_table()
1786 + mxt_obj_size(object) * mxt_obj_instances(object) - 1; in mxt_parse_object_table()
1788 if (end_address >= data->mem_size) in mxt_parse_object_table()
1789 data->mem_size = end_address + 1; in mxt_parse_object_table()
1793 data->max_reportid = reportid; in mxt_parse_object_table()
1796 if (data->T44_address && (data->T5_address != data->T44_address + 1)) { in mxt_parse_object_table()
1797 dev_err(&client->dev, "Invalid T44 position\n"); in mxt_parse_object_table()
1798 return -EINVAL; in mxt_parse_object_table()
1801 data->msg_buf = kcalloc(data->max_reportid, in mxt_parse_object_table()
1802 data->T5_msg_size, GFP_KERNEL); in mxt_parse_object_table()
1803 if (!data->msg_buf) in mxt_parse_object_table()
1804 return -ENOMEM; in mxt_parse_object_table()
1811 struct i2c_client *client = data->client; in mxt_read_info_block()
1820 if (data->raw_info_block) in mxt_read_info_block()
1823 /* Read 7-byte ID information block starting at address 0 */ in mxt_read_info_block()
1827 return -ENOMEM; in mxt_read_info_block()
1834 num_objects = ((struct mxt_info *)id_buf)->object_num; in mxt_read_info_block()
1840 error = -ENOMEM; in mxt_read_info_block()
1847 size - MXT_OBJECT_START, in mxt_read_info_block()
1853 crc_ptr = id_buf + size - MXT_INFO_CHECKSUM_SIZE; in mxt_read_info_block()
1854 data->info_crc = crc_ptr[0] | (crc_ptr[1] << 8) | (crc_ptr[2] << 16); in mxt_read_info_block()
1857 size - MXT_INFO_CHECKSUM_SIZE); in mxt_read_info_block()
1861 * issue or else device is not using Object Based Protocol (eg i2c-hid) in mxt_read_info_block()
1863 if ((data->info_crc == 0) || (data->info_crc != calculated_crc)) { in mxt_read_info_block()
1864 dev_err(&client->dev, in mxt_read_info_block()
1866 calculated_crc, data->info_crc); in mxt_read_info_block()
1867 error = -EIO; in mxt_read_info_block()
1871 data->raw_info_block = id_buf; in mxt_read_info_block()
1872 data->info = (struct mxt_info *)id_buf; in mxt_read_info_block()
1874 dev_info(&client->dev, in mxt_read_info_block()
1876 data->info->family_id, data->info->variant_id, in mxt_read_info_block()
1877 data->info->version >> 4, data->info->version & 0xf, in mxt_read_info_block()
1878 data->info->build, data->info->object_num); in mxt_read_info_block()
1883 dev_err(&client->dev, "Error %d parsing object table\n", error); in mxt_read_info_block()
1888 data->object_table = (struct mxt_object *)(id_buf + MXT_OBJECT_START); in mxt_read_info_block()
1899 struct i2c_client *client = data->client; in mxt_read_t9_resolution()
1907 return -EINVAL; in mxt_read_t9_resolution()
1910 object->start_address + MXT_T9_XSIZE, in mxt_read_t9_resolution()
1911 sizeof(data->xsize), &data->xsize); in mxt_read_t9_resolution()
1916 object->start_address + MXT_T9_YSIZE, in mxt_read_t9_resolution()
1917 sizeof(data->ysize), &data->ysize); in mxt_read_t9_resolution()
1922 object->start_address + MXT_T9_RANGE, in mxt_read_t9_resolution()
1927 data->max_x = get_unaligned_le16(&range.x); in mxt_read_t9_resolution()
1928 data->max_y = get_unaligned_le16(&range.y); in mxt_read_t9_resolution()
1931 object->start_address + MXT_T9_ORIENT, in mxt_read_t9_resolution()
1936 data->xy_switch = orient & MXT_T9_ORIENT_SWITCH; in mxt_read_t9_resolution()
1937 data->invertx = orient & MXT_T9_ORIENT_INVERTX; in mxt_read_t9_resolution()
1938 data->inverty = orient & MXT_T9_ORIENT_INVERTY; in mxt_read_t9_resolution()
1945 struct i2c_client *client = data->client; in mxt_read_t100_config()
1954 return -EINVAL; in mxt_read_t100_config()
1958 object->start_address + MXT_T100_XRANGE, in mxt_read_t100_config()
1963 data->max_x = get_unaligned_le16(&range_x); in mxt_read_t100_config()
1966 object->start_address + MXT_T100_YRANGE, in mxt_read_t100_config()
1971 data->max_y = get_unaligned_le16(&range_y); in mxt_read_t100_config()
1974 object->start_address + MXT_T100_XSIZE, in mxt_read_t100_config()
1975 sizeof(data->xsize), &data->xsize); in mxt_read_t100_config()
1980 object->start_address + MXT_T100_YSIZE, in mxt_read_t100_config()
1981 sizeof(data->ysize), &data->ysize); in mxt_read_t100_config()
1987 object->start_address + MXT_T100_CFG1, in mxt_read_t100_config()
1992 data->xy_switch = cfg & MXT_T100_CFG_SWITCHXY; in mxt_read_t100_config()
1993 data->invertx = cfg & MXT_T100_CFG_INVERTX; in mxt_read_t100_config()
1994 data->inverty = cfg & MXT_T100_CFG_INVERTY; in mxt_read_t100_config()
1998 object->start_address + MXT_T100_TCHAUX, in mxt_read_t100_config()
2006 data->t100_aux_vect = aux++; in mxt_read_t100_config()
2009 data->t100_aux_ampl = aux++; in mxt_read_t100_config()
2012 data->t100_aux_area = aux++; in mxt_read_t100_config()
2014 dev_dbg(&client->dev, in mxt_read_t100_config()
2016 data->t100_aux_vect, data->t100_aux_ampl, data->t100_aux_area); in mxt_read_t100_config()
2029 input_dev->name = "Atmel maXTouch Touchpad"; in mxt_set_up_as_touchpad()
2031 __set_bit(INPUT_PROP_BUTTONPAD, input_dev->propbit); in mxt_set_up_as_touchpad()
2040 for (i = 0; i < data->t19_num_keys; i++) in mxt_set_up_as_touchpad()
2041 if (data->t19_keymap[i] != KEY_RESERVED) in mxt_set_up_as_touchpad()
2043 data->t19_keymap[i]); in mxt_set_up_as_touchpad()
2048 struct device *dev = &data->client->dev; in mxt_initialize_input_device()
2054 switch (data->multitouch) { in mxt_initialize_input_device()
2056 num_mt_slots = data->T9_reportid_max - data->T9_reportid_min + 1; in mxt_initialize_input_device()
2063 num_mt_slots = data->num_touchids; in mxt_initialize_input_device()
2071 return -EINVAL; in mxt_initialize_input_device()
2075 if (data->max_x == 0) in mxt_initialize_input_device()
2076 data->max_x = 1023; in mxt_initialize_input_device()
2078 if (data->max_y == 0) in mxt_initialize_input_device()
2079 data->max_y = 1023; in mxt_initialize_input_device()
2081 if (data->xy_switch) in mxt_initialize_input_device()
2082 swap(data->max_x, data->max_y); in mxt_initialize_input_device()
2084 dev_info(dev, "Touchscreen size X%uY%u\n", data->max_x, data->max_y); in mxt_initialize_input_device()
2089 return -ENOMEM; in mxt_initialize_input_device()
2091 input_dev->name = "Atmel maXTouch Touchscreen"; in mxt_initialize_input_device()
2092 input_dev->phys = data->phys; in mxt_initialize_input_device()
2093 input_dev->id.bustype = BUS_I2C; in mxt_initialize_input_device()
2094 input_dev->dev.parent = dev; in mxt_initialize_input_device()
2095 input_dev->open = mxt_input_open; in mxt_initialize_input_device()
2096 input_dev->close = mxt_input_close; in mxt_initialize_input_device()
2101 input_set_abs_params(input_dev, ABS_X, 0, data->max_x, 0, 0); in mxt_initialize_input_device()
2102 input_set_abs_params(input_dev, ABS_Y, 0, data->max_y, 0, 0); in mxt_initialize_input_device()
2104 if (data->multitouch == MXT_TOUCH_MULTI_T9 || in mxt_initialize_input_device()
2105 (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 && in mxt_initialize_input_device()
2106 data->t100_aux_ampl)) { in mxt_initialize_input_device()
2111 if (data->t19_num_keys) { in mxt_initialize_input_device()
2125 if (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100) { in mxt_initialize_input_device()
2135 0, data->max_x, 0, 0); in mxt_initialize_input_device()
2137 0, data->max_y, 0, 0); in mxt_initialize_input_device()
2139 if (data->multitouch == MXT_TOUCH_MULTI_T9 || in mxt_initialize_input_device()
2140 (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 && in mxt_initialize_input_device()
2141 data->t100_aux_area)) { in mxt_initialize_input_device()
2146 if (data->multitouch == MXT_TOUCH_MULTI_T9 || in mxt_initialize_input_device()
2147 (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 && in mxt_initialize_input_device()
2148 data->t100_aux_ampl)) { in mxt_initialize_input_device()
2153 if (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 && in mxt_initialize_input_device()
2154 data->t100_aux_vect) { in mxt_initialize_input_device()
2159 if (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 && in mxt_initialize_input_device()
2160 data->t100_aux_vect) { in mxt_initialize_input_device()
2173 data->input_dev = input_dev; in mxt_initialize_input_device()
2193 struct i2c_client *client = data->client; in mxt_initialize()
2205 dev_info(&client->dev, "Trying alternate bootloader address\n"); in mxt_initialize()
2215 dev_err(&client->dev, "Could not recover from bootloader mode\n"); in mxt_initialize()
2220 data->in_bootloader = true; in mxt_initialize()
2238 &client->dev, GFP_KERNEL, data, in mxt_initialize()
2241 dev_err(&client->dev, "Failed to invoke firmware loader: %d\n", in mxt_initialize()
2251 struct device *dev = &data->client->dev; in mxt_set_t7_power_cfg()
2259 new_config = &data->t7_cfg; in mxt_set_t7_power_cfg()
2261 error = __mxt_write_reg(data->client, data->T7_address, in mxt_set_t7_power_cfg()
2262 sizeof(data->t7_cfg), new_config); in mxt_set_t7_power_cfg()
2267 new_config->active, new_config->idle); in mxt_set_t7_power_cfg()
2274 struct device *dev = &data->client->dev; in mxt_init_t7_power_cfg()
2279 error = __mxt_read_reg(data->client, data->T7_address, in mxt_init_t7_power_cfg()
2280 sizeof(data->t7_cfg), &data->t7_cfg); in mxt_init_t7_power_cfg()
2284 if (data->t7_cfg.active == 0 || data->t7_cfg.idle == 0) { in mxt_init_t7_power_cfg()
2292 data->t7_cfg.active = 20; in mxt_init_t7_power_cfg()
2293 data->t7_cfg.idle = 100; in mxt_init_t7_power_cfg()
2299 data->t7_cfg.active, data->t7_cfg.idle); in mxt_init_t7_power_cfg()
2317 struct mxt_info *info = data->info; in mxt_get_debug_value()
2318 struct mxt_dbg *dbg = &data->dbg; in mxt_get_debug_value()
2323 if (info->family_id == MXT_FAMILY_1386) { in mxt_get_debug_value()
2324 col_width = info->matrix_ysize / MXT1386_COLUMNS; in mxt_get_debug_value()
2328 col_width = info->matrix_ysize; in mxt_get_debug_value()
2335 if (info->family_id == MXT_FAMILY_1386) in mxt_get_debug_value()
2338 return get_unaligned_le16(&dbg->t37_buf[page].data[ofs]); in mxt_get_debug_value()
2343 struct mxt_dbg *dbg = &data->dbg; in mxt_convert_debug_pages()
2348 for (i = 0; i < dbg->t37_nodes; i++) { in mxt_convert_debug_pages()
2350 rx = data->xy_switch ? y : x; in mxt_convert_debug_pages()
2351 ry = data->xy_switch ? x : y; in mxt_convert_debug_pages()
2352 rx = data->invertx ? (data->xsize - 1 - rx) : rx; in mxt_convert_debug_pages()
2353 ry = data->inverty ? (data->ysize - 1 - ry) : ry; in mxt_convert_debug_pages()
2358 if (++x >= (data->xy_switch ? data->ysize : data->xsize)) { in mxt_convert_debug_pages()
2370 struct mxt_dbg *dbg = &data->dbg; in mxt_read_diagnostic_debug()
2378 for (page = 0; page < dbg->t37_pages; page++) { in mxt_read_diagnostic_debug()
2379 p = dbg->t37_buf + page; in mxt_read_diagnostic_debug()
2381 ret = mxt_write_reg(data->client, dbg->diag_cmd_address, in mxt_read_diagnostic_debug()
2390 ret = __mxt_read_reg(data->client, dbg->diag_cmd_address, in mxt_read_diagnostic_debug()
2398 return -EINVAL; in mxt_read_diagnostic_debug()
2405 ret = __mxt_read_reg(data->client, dbg->t37_address, in mxt_read_diagnostic_debug()
2410 if (p->mode != mode || p->page != page) { in mxt_read_diagnostic_debug()
2411 dev_err(&data->client->dev, "T37 page mismatch\n"); in mxt_read_diagnostic_debug()
2412 return -EINVAL; in mxt_read_diagnostic_debug()
2415 dev_dbg(&data->client->dev, "%s page:%d retries:%d\n", in mxt_read_diagnostic_debug()
2429 struct mxt_data *data = q->drv_priv; in mxt_queue_setup()
2430 size_t size = data->dbg.t37_nodes * sizeof(u16); in mxt_queue_setup()
2433 return sizes[0] < size ? -EINVAL : 0; in mxt_queue_setup()
2443 struct mxt_data *data = vb2_get_drv_priv(vb->vb2_queue); in mxt_buffer_queue()
2450 dev_err(&data->client->dev, "Error acquiring frame ptr\n"); in mxt_buffer_queue()
2454 switch (data->dbg.input) { in mxt_buffer_queue()
2469 vb2_set_plane_payload(vb, 0, data->dbg.t37_nodes * sizeof(u16)); in mxt_buffer_queue()
2500 strscpy(cap->driver, "atmel_mxt_ts", sizeof(cap->driver)); in mxt_vidioc_querycap()
2501 strscpy(cap->card, "atmel_mxt_ts touch", sizeof(cap->card)); in mxt_vidioc_querycap()
2502 snprintf(cap->bus_info, sizeof(cap->bus_info), in mxt_vidioc_querycap()
2503 "I2C:%s", dev_name(&data->client->dev)); in mxt_vidioc_querycap()
2510 if (i->index >= MXT_V4L_INPUT_MAX) in mxt_vidioc_enum_input()
2511 return -EINVAL; in mxt_vidioc_enum_input()
2513 i->type = V4L2_INPUT_TYPE_TOUCH; in mxt_vidioc_enum_input()
2515 switch (i->index) { in mxt_vidioc_enum_input()
2517 strscpy(i->name, "Mutual Capacitance References", in mxt_vidioc_enum_input()
2518 sizeof(i->name)); in mxt_vidioc_enum_input()
2521 strscpy(i->name, "Mutual Capacitance Deltas", sizeof(i->name)); in mxt_vidioc_enum_input()
2530 struct v4l2_pix_format *f = &data->dbg.format; in mxt_set_input()
2533 return -EINVAL; in mxt_set_input()
2536 f->pixelformat = V4L2_TCH_FMT_DELTA_TD16; in mxt_set_input()
2538 f->pixelformat = V4L2_TCH_FMT_TU16; in mxt_set_input()
2540 f->width = data->xy_switch ? data->ysize : data->xsize; in mxt_set_input()
2541 f->height = data->xy_switch ? data->xsize : data->ysize; in mxt_set_input()
2542 f->field = V4L2_FIELD_NONE; in mxt_set_input()
2543 f->colorspace = V4L2_COLORSPACE_RAW; in mxt_set_input()
2544 f->bytesperline = f->width * sizeof(u16); in mxt_set_input()
2545 f->sizeimage = f->width * f->height * sizeof(u16); in mxt_set_input()
2547 data->dbg.input = i; in mxt_set_input()
2561 *i = data->dbg.input; in mxt_vidioc_g_input()
2570 f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in mxt_vidioc_fmt()
2571 f->fmt.pix = data->dbg.format; in mxt_vidioc_fmt()
2579 if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) in mxt_vidioc_enum_fmt()
2580 return -EINVAL; in mxt_vidioc_enum_fmt()
2582 switch (fmt->index) { in mxt_vidioc_enum_fmt()
2584 fmt->pixelformat = V4L2_TCH_FMT_TU16; in mxt_vidioc_enum_fmt()
2588 fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD16; in mxt_vidioc_enum_fmt()
2592 return -EINVAL; in mxt_vidioc_enum_fmt()
2601 if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) in mxt_vidioc_g_parm()
2602 return -EINVAL; in mxt_vidioc_g_parm()
2604 a->parm.capture.readbuffers = 1; in mxt_vidioc_g_parm()
2605 a->parm.capture.timeperframe.numerator = 1; in mxt_vidioc_g_parm()
2606 a->parm.capture.timeperframe.denominator = 10; in mxt_vidioc_g_parm()
2645 struct mxt_info *info = data->info; in mxt_debug_init()
2646 struct mxt_dbg *dbg = &data->dbg; in mxt_debug_init()
2654 dbg->diag_cmd_address = object->start_address + MXT_COMMAND_DIAGNOSTIC; in mxt_debug_init()
2661 dev_warn(&data->client->dev, "Bad T37 size"); in mxt_debug_init()
2665 dbg->t37_address = object->start_address; in mxt_debug_init()
2668 dbg->t37_nodes = data->xsize * data->ysize; in mxt_debug_init()
2670 if (info->family_id == MXT_FAMILY_1386) in mxt_debug_init()
2671 dbg->t37_pages = MXT1386_COLUMNS * MXT1386_PAGES_PER_COLUMN; in mxt_debug_init()
2673 dbg->t37_pages = DIV_ROUND_UP(data->xsize * in mxt_debug_init()
2674 info->matrix_ysize * in mxt_debug_init()
2676 sizeof(dbg->t37_buf->data)); in mxt_debug_init()
2678 dbg->t37_buf = devm_kmalloc_array(&data->client->dev, dbg->t37_pages, in mxt_debug_init()
2680 if (!dbg->t37_buf) in mxt_debug_init()
2687 snprintf(dbg->v4l2.name, sizeof(dbg->v4l2.name), "%s", "atmel_mxt_ts"); in mxt_debug_init()
2688 error = v4l2_device_register(&data->client->dev, &dbg->v4l2); in mxt_debug_init()
2693 mutex_init(&dbg->lock); in mxt_debug_init()
2694 dbg->queue = mxt_queue; in mxt_debug_init()
2695 dbg->queue.drv_priv = data; in mxt_debug_init()
2696 dbg->queue.lock = &dbg->lock; in mxt_debug_init()
2697 dbg->queue.dev = &data->client->dev; in mxt_debug_init()
2699 error = vb2_queue_init(&dbg->queue); in mxt_debug_init()
2703 dbg->vdev = mxt_video_device; in mxt_debug_init()
2704 dbg->vdev.v4l2_dev = &dbg->v4l2; in mxt_debug_init()
2705 dbg->vdev.lock = &dbg->lock; in mxt_debug_init()
2706 dbg->vdev.vfl_dir = VFL_DIR_RX; in mxt_debug_init()
2707 dbg->vdev.queue = &dbg->queue; in mxt_debug_init()
2708 video_set_drvdata(&dbg->vdev, data); in mxt_debug_init()
2710 error = video_register_device(&dbg->vdev, VFL_TYPE_TOUCH, -1); in mxt_debug_init()
2717 v4l2_device_unregister(&dbg->v4l2); in mxt_debug_init()
2719 dev_warn(&data->client->dev, "Error initializing T37\n"); in mxt_debug_init()
2730 struct device *dev = &data->client->dev; in mxt_configure_objects()
2745 if (data->multitouch) { in mxt_configure_objects()
2763 struct mxt_info *info = data->info; in mxt_fw_version_show()
2765 info->version >> 4, info->version & 0xf, info->build); in mxt_fw_version_show()
2773 struct mxt_info *info = data->info; in mxt_hw_version_show()
2775 info->family_id, info->variant_id); in mxt_hw_version_show()
2785 count += scnprintf(buf + count, PAGE_SIZE - count, in mxt_show_instance()
2789 count += scnprintf(buf + count, PAGE_SIZE - count, in mxt_show_instance()
2791 count += scnprintf(buf + count, PAGE_SIZE - count, "\n"); in mxt_show_instance()
2806 /* Pre-allocate buffer large enough to hold max sized object. */ in mxt_object_show()
2809 return -ENOMEM; in mxt_object_show()
2812 for (i = 0; i < data->info->object_num; i++) { in mxt_object_show()
2813 object = data->object_table + i; in mxt_object_show()
2815 if (!mxt_object_readable(object->type)) in mxt_object_show()
2818 count += scnprintf(buf + count, PAGE_SIZE - count, in mxt_object_show()
2819 "T%u:\n", object->type); in mxt_object_show()
2823 u16 addr = object->start_address + j * size; in mxt_object_show()
2825 error = __mxt_read_reg(data->client, addr, size, obuf); in mxt_object_show()
2844 while (pos < fw->size) { in mxt_check_firmware_format()
2845 c = *(fw->data + pos); in mxt_check_firmware_format()
2855 * xxd -r -p mXTXXX__APP_VX-X-XX.enc > maxtouch.fw in mxt_check_firmware_format()
2859 return -EINVAL; in mxt_check_firmware_format()
2862 static int mxt_load_fw(struct device *dev, const char *fn) in mxt_load_fw() argument
2872 ret = request_firmware(&fw, fn, dev); in mxt_load_fw()
2874 dev_err(dev, "Unable to open firmware %s\n", fn); in mxt_load_fw()
2883 if (!data->in_bootloader) { in mxt_load_fw()
2885 data->in_bootloader = true; in mxt_load_fw()
2902 enable_irq(data->irq); in mxt_load_fw()
2905 reinit_completion(&data->bl_completion); in mxt_load_fw()
2922 while (pos < fw->size) { in mxt_load_fw()
2927 frame_size = ((*(fw->data + pos) << 8) | *(fw->data + pos + 1)); in mxt_load_fw()
2933 ret = mxt_bootloader_write(data, fw->data + pos, frame_size); in mxt_load_fw()
2956 frame, pos, fw->size); in mxt_load_fw()
2960 ret = mxt_wait_for_completion(data, &data->bl_completion, in mxt_load_fw()
2972 mxt_wait_for_completion(data, &data->bl_completion, MXT_FW_RESET_TIME); in mxt_load_fw()
2974 data->in_bootloader = false; in mxt_load_fw()
2977 disable_irq(data->irq); in mxt_load_fw()
3024 mxt_wakeup_toggle(data->client, true, false); in mxt_start()
3026 switch (data->suspend_mode) { in mxt_start()
3048 switch (data->suspend_mode) { in mxt_stop()
3061 mxt_wakeup_toggle(data->client, false, false); in mxt_stop()
3082 static const char keymap_property[] = "linux,gpio-keymap"; in mxt_parse_device_properties()
3083 struct device *dev = &data->client->dev; in mxt_parse_device_properties()
3084 u32 *keymap; in mxt_parse_device_properties() local
3091 error = n_keys < 0 ? n_keys : -EINVAL; in mxt_parse_device_properties()
3097 keymap = devm_kmalloc_array(dev, n_keys, sizeof(*keymap), in mxt_parse_device_properties()
3099 if (!keymap) in mxt_parse_device_properties()
3100 return -ENOMEM; in mxt_parse_device_properties()
3103 keymap, n_keys); in mxt_parse_device_properties()
3110 data->t19_keymap = keymap; in mxt_parse_device_properties()
3111 data->t19_num_keys = n_keys; in mxt_parse_device_properties()
3146 if (!device_property_present(&client->dev, "compatible")) in mxt_probe()
3147 return -ENXIO; in mxt_probe()
3159 if (ACPI_COMPANION(&client->dev) && client->addr < 0x40) in mxt_probe()
3160 return -ENXIO; in mxt_probe()
3162 data = devm_kzalloc(&client->dev, sizeof(struct mxt_data), GFP_KERNEL); in mxt_probe()
3164 return -ENOMEM; in mxt_probe()
3166 snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0", in mxt_probe()
3167 client->adapter->nr, client->addr); in mxt_probe()
3169 data->client = client; in mxt_probe()
3170 data->irq = client->irq; in mxt_probe()
3173 init_completion(&data->bl_completion); in mxt_probe()
3174 init_completion(&data->reset_completion); in mxt_probe()
3175 init_completion(&data->crc_completion); in mxt_probe()
3177 data->suspend_mode = dmi_check_system(chromebook_T9_suspend_dmi) ? in mxt_probe()
3188 data->regulators[0].supply = "vdda"; in mxt_probe()
3189 data->regulators[1].supply = "vdd"; in mxt_probe()
3190 error = devm_regulator_bulk_get(&client->dev, ARRAY_SIZE(data->regulators), in mxt_probe()
3191 data->regulators); in mxt_probe()
3193 if (error != -EPROBE_DEFER) in mxt_probe()
3194 dev_err(&client->dev, "Failed to get regulators %d\n", in mxt_probe()
3200 data->reset_gpio = devm_gpiod_get_optional(&client->dev, in mxt_probe()
3202 if (IS_ERR(data->reset_gpio)) { in mxt_probe()
3203 error = PTR_ERR(data->reset_gpio); in mxt_probe()
3204 dev_err(&client->dev, "Failed to get reset gpio: %d\n", error); in mxt_probe()
3209 data->wake_gpio = devm_gpiod_get_optional(&client->dev, in mxt_probe()
3211 if (IS_ERR(data->wake_gpio)) { in mxt_probe()
3212 error = PTR_ERR(data->wake_gpio); in mxt_probe()
3213 dev_err(&client->dev, "Failed to get wake gpio: %d\n", error); in mxt_probe()
3217 error = devm_request_threaded_irq(&client->dev, client->irq, in mxt_probe()
3220 client->name, data); in mxt_probe()
3222 dev_err(&client->dev, "Failed to register interrupt\n"); in mxt_probe()
3226 error = regulator_bulk_enable(ARRAY_SIZE(data->regulators), in mxt_probe()
3227 data->regulators); in mxt_probe()
3229 dev_err(&client->dev, "failed to enable regulators: %d\n", in mxt_probe()
3234 * The device takes 40ms to come up after power-on according in mxt_probe()
3239 if (data->reset_gpio) { in mxt_probe()
3240 /* Wait a while and then de-assert the RESET GPIO line */ in mxt_probe()
3242 gpiod_set_value(data->reset_gpio, 0); in mxt_probe()
3250 * This WAKE line is used for waking controller from a deep-sleep and in mxt_probe()
3252 * could be accepted by controller if it was in a deep-sleep mode. in mxt_probe()
3262 device_property_read_u32(&client->dev, "atmel,wakeup-method", in mxt_probe()
3263 &data->wakeup_method); in mxt_probe()
3269 error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group); in mxt_probe()
3271 dev_err(&client->dev, "Failure %d creating sysfs group\n", in mxt_probe()
3282 regulator_bulk_disable(ARRAY_SIZE(data->regulators), in mxt_probe()
3283 data->regulators); in mxt_probe()
3291 disable_irq(data->irq); in mxt_remove()
3292 sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); in mxt_remove()
3295 regulator_bulk_disable(ARRAY_SIZE(data->regulators), in mxt_remove()
3296 data->regulators); in mxt_remove()
3303 struct input_dev *input_dev = data->input_dev; in mxt_suspend()
3308 mutex_lock(&input_dev->mutex); in mxt_suspend()
3313 mutex_unlock(&input_dev->mutex); in mxt_suspend()
3315 disable_irq(data->irq); in mxt_suspend()
3324 struct input_dev *input_dev = data->input_dev; in mxt_resume()
3329 enable_irq(data->irq); in mxt_resume()
3331 mutex_lock(&input_dev->mutex); in mxt_resume()
3336 mutex_unlock(&input_dev->mutex); in mxt_resume()