Lines Matching refs:cyapa
345 static int cyapa_pip_event_process(struct cyapa *cyapa,
348 int cyapa_pip_cmd_state_initialize(struct cyapa *cyapa) in cyapa_pip_cmd_state_initialize() argument
350 struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; in cyapa_pip_cmd_state_initialize()
364 cyapa->dev_pwr_mode = UNINIT_PWR_MODE; in cyapa_pip_cmd_state_initialize()
365 cyapa->dev_sleep_time = UNINIT_SLEEP_TIME; in cyapa_pip_cmd_state_initialize()
371 ssize_t cyapa_i2c_pip_read(struct cyapa *cyapa, u8 *buf, size_t size) in cyapa_i2c_pip_read() argument
381 ret = i2c_master_recv(cyapa->client, buf, size); in cyapa_i2c_pip_read()
391 ssize_t cyapa_i2c_pip_write(struct cyapa *cyapa, u8 *buf, size_t size) in cyapa_i2c_pip_write() argument
398 ret = i2c_master_send(cyapa->client, buf, size); in cyapa_i2c_pip_write()
406 static void cyapa_set_pip_pm_state(struct cyapa *cyapa, in cyapa_set_pip_pm_state() argument
409 struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; in cyapa_set_pip_pm_state()
416 static void cyapa_reset_pip_pm_state(struct cyapa *cyapa) in cyapa_reset_pip_pm_state() argument
418 struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; in cyapa_reset_pip_pm_state()
426 static enum cyapa_pm_stage cyapa_get_pip_pm_state(struct cyapa *cyapa) in cyapa_get_pip_pm_state() argument
428 struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; in cyapa_get_pip_pm_state()
442 int cyapa_empty_pip_output_data(struct cyapa *cyapa, in cyapa_empty_pip_output_data() argument
445 struct input_dev *input = cyapa->input; in cyapa_empty_pip_output_data()
446 struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; in cyapa_empty_pip_output_data()
447 enum cyapa_pm_stage pm_stage = cyapa_get_pip_pm_state(cyapa); in cyapa_empty_pip_output_data()
479 error = cyapa_i2c_pip_read(cyapa, pip->empty_buf, in cyapa_empty_pip_output_data()
495 func(cyapa, pip->empty_buf, length)) { in cyapa_empty_pip_output_data()
505 error = cyapa_i2c_pip_read(cyapa, pip->empty_buf, length); in cyapa_empty_pip_output_data()
515 func(cyapa, pip->empty_buf, length)) { in cyapa_empty_pip_output_data()
521 } else if (cyapa->operational && in cyapa_empty_pip_output_data()
526 cyapa_pip_event_process(cyapa, in cyapa_empty_pip_output_data()
537 struct cyapa *cyapa, in cyapa_do_i2c_pip_cmd_irq_sync() argument
541 struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; in cyapa_do_i2c_pip_cmd_irq_sync()
548 error = cyapa_i2c_pip_write(cyapa, cmd, cmd_len); in cyapa_do_i2c_pip_cmd_irq_sync()
566 struct cyapa *cyapa, in cyapa_do_i2c_pip_cmd_polling() argument
572 struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; in cyapa_do_i2c_pip_cmd_polling()
578 error = cyapa_i2c_pip_write(cyapa, cmd, cmd_len); in cyapa_do_i2c_pip_cmd_polling()
590 error = cyapa_empty_pip_output_data(cyapa, in cyapa_do_i2c_pip_cmd_polling()
606 struct cyapa *cyapa, in cyapa_i2c_pip_cmd_irq_sync() argument
613 struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; in cyapa_i2c_pip_cmd_irq_sync()
641 error = cyapa_do_i2c_pip_cmd_irq_sync(cyapa, cmd, cmd_len, in cyapa_i2c_pip_cmd_irq_sync()
650 error = cyapa_empty_pip_output_data(cyapa, in cyapa_i2c_pip_cmd_irq_sync()
657 error = cyapa_do_i2c_pip_cmd_polling(cyapa, cmd, cmd_len, in cyapa_i2c_pip_cmd_irq_sync()
670 bool cyapa_sort_tsg_pip_bl_resp_data(struct cyapa *cyapa, in cyapa_sort_tsg_pip_bl_resp_data() argument
685 bool cyapa_sort_tsg_pip_app_resp_data(struct cyapa *cyapa, in cyapa_sort_tsg_pip_app_resp_data() argument
688 struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; in cyapa_sort_tsg_pip_app_resp_data()
712 static bool cyapa_sort_pip_application_launch_data(struct cyapa *cyapa, in cyapa_sort_pip_application_launch_data() argument
728 static bool cyapa_sort_gen5_hid_descriptor_data(struct cyapa *cyapa, in cyapa_sort_gen5_hid_descriptor_data() argument
756 static bool cyapa_sort_pip_deep_sleep_data(struct cyapa *cyapa, in cyapa_sort_pip_deep_sleep_data() argument
768 static int gen5_idle_state_parse(struct cyapa *cyapa) in gen5_idle_state_parse() argument
781 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL); in gen5_idle_state_parse()
784 ret = cyapa_i2c_pip_read(cyapa, resp_data, 3); in gen5_idle_state_parse()
791 cyapa->gen = CYAPA_GEN5; in gen5_idle_state_parse()
793 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL); in gen5_idle_state_parse()
799 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in gen5_idle_state_parse()
817 cyapa->state = CYAPA_STATE_GEN5_BL; in gen5_idle_state_parse()
824 cyapa->state = CYAPA_STATE_GEN5_APP; in gen5_idle_state_parse()
827 cyapa->state = CYAPA_STATE_NO_DEVICE; in gen5_idle_state_parse()
834 static int gen5_hid_description_header_parse(struct cyapa *cyapa, u8 *reg_data) in gen5_hid_description_header_parse() argument
848 ret = cyapa_i2c_pip_read(cyapa, resp_data, in gen5_hid_description_header_parse()
861 cyapa->gen = CYAPA_GEN5; in gen5_hid_description_header_parse()
862 cyapa->state = CYAPA_STATE_GEN5_BL; in gen5_hid_description_header_parse()
868 cyapa->gen = CYAPA_GEN5; in gen5_hid_description_header_parse()
869 cyapa->state = CYAPA_STATE_GEN5_APP; in gen5_hid_description_header_parse()
875 cyapa->gen = CYAPA_GEN5; in gen5_hid_description_header_parse()
876 cyapa->state = CYAPA_STATE_GEN5_BL; in gen5_hid_description_header_parse()
882 cyapa->gen = CYAPA_GEN5; in gen5_hid_description_header_parse()
883 cyapa->state = CYAPA_STATE_GEN5_APP; in gen5_hid_description_header_parse()
886 cyapa->state = CYAPA_STATE_NO_DEVICE; in gen5_hid_description_header_parse()
892 static int gen5_report_data_header_parse(struct cyapa *cyapa, u8 *reg_data) in gen5_report_data_header_parse() argument
918 cyapa->gen = CYAPA_GEN5; in gen5_report_data_header_parse()
919 cyapa->state = CYAPA_STATE_GEN5_APP; in gen5_report_data_header_parse()
923 static int gen5_cmd_resp_header_parse(struct cyapa *cyapa, u8 *reg_data) in gen5_cmd_resp_header_parse() argument
925 struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; in gen5_cmd_resp_header_parse()
935 ret = cyapa_i2c_pip_read(cyapa, pip->empty_buf, length); in gen5_cmd_resp_header_parse()
944 cyapa->gen = CYAPA_GEN5; in gen5_cmd_resp_header_parse()
945 cyapa->state = CYAPA_STATE_GEN5_BL; in gen5_cmd_resp_header_parse()
948 cyapa->gen = CYAPA_GEN5; in gen5_cmd_resp_header_parse()
949 cyapa->state = CYAPA_STATE_GEN5_APP; in gen5_cmd_resp_header_parse()
960 cyapa->gen = CYAPA_GEN5; in gen5_cmd_resp_header_parse()
961 cyapa->state = CYAPA_STATE_GEN5_BL; in gen5_cmd_resp_header_parse()
967 cyapa->gen = CYAPA_GEN5; in gen5_cmd_resp_header_parse()
968 cyapa->state = CYAPA_STATE_GEN5_APP; in gen5_cmd_resp_header_parse()
971 cyapa->state = CYAPA_STATE_NO_DEVICE; in gen5_cmd_resp_header_parse()
977 static int cyapa_gen5_state_parse(struct cyapa *cyapa, u8 *reg_data, int len) in cyapa_gen5_state_parse() argument
984 cyapa->state = CYAPA_STATE_NO_DEVICE; in cyapa_gen5_state_parse()
989 gen5_idle_state_parse(cyapa); in cyapa_gen5_state_parse()
993 gen5_hid_description_header_parse(cyapa, reg_data); in cyapa_gen5_state_parse()
998 cyapa->gen = CYAPA_GEN5; in cyapa_gen5_state_parse()
999 cyapa->state = CYAPA_STATE_GEN5_APP; in cyapa_gen5_state_parse()
1003 cyapa->gen = CYAPA_GEN5; in cyapa_gen5_state_parse()
1004 cyapa->state = CYAPA_STATE_GEN5_BL; in cyapa_gen5_state_parse()
1010 gen5_report_data_header_parse(cyapa, reg_data); in cyapa_gen5_state_parse()
1013 gen5_cmd_resp_header_parse(cyapa, reg_data); in cyapa_gen5_state_parse()
1016 if (cyapa->gen == CYAPA_GEN5) { in cyapa_gen5_state_parse()
1023 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL); in cyapa_gen5_state_parse()
1025 if (cyapa->state == CYAPA_STATE_GEN5_APP || in cyapa_gen5_state_parse()
1026 cyapa->state == CYAPA_STATE_GEN5_BL) in cyapa_gen5_state_parse()
1045 int cyapa_pip_bl_initiate(struct cyapa *cyapa, const struct firmware *fw) in cyapa_pip_bl_initiate() argument
1064 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL); in cyapa_pip_bl_initiate()
1104 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_pip_bl_initiate()
1116 static bool cyapa_sort_pip_bl_exit_data(struct cyapa *cyapa, u8 *buf, int len) in cyapa_sort_pip_bl_exit_data() argument
1136 int cyapa_pip_bl_exit(struct cyapa *cyapa) in cyapa_pip_bl_exit() argument
1148 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_pip_bl_exit()
1166 int cyapa_pip_bl_enter(struct cyapa *cyapa) in cyapa_pip_bl_enter() argument
1173 error = cyapa_poll_state(cyapa, 500); in cyapa_pip_bl_enter()
1178 if (cyapa_is_pip_bl_mode(cyapa)) in cyapa_pip_bl_enter()
1180 else if (!cyapa_is_pip_app_mode(cyapa)) in cyapa_pip_bl_enter()
1184 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL); in cyapa_pip_bl_enter()
1192 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_pip_bl_enter()
1200 cyapa->operational = false; in cyapa_pip_bl_enter()
1201 if (cyapa->gen == CYAPA_GEN5) in cyapa_pip_bl_enter()
1202 cyapa->state = CYAPA_STATE_GEN5_BL; in cyapa_pip_bl_enter()
1203 else if (cyapa->gen == CYAPA_GEN6) in cyapa_pip_bl_enter()
1204 cyapa->state = CYAPA_STATE_GEN6_BL; in cyapa_pip_bl_enter()
1208 static int cyapa_pip_fw_head_check(struct cyapa *cyapa, in cyapa_pip_fw_head_check() argument
1214 switch (cyapa->gen) { in cyapa_pip_fw_head_check()
1222 if (cyapa->platform_ver < 2) { in cyapa_pip_fw_head_check()
1239 int cyapa_pip_check_fw(struct cyapa *cyapa, const struct firmware *fw) in cyapa_pip_check_fw() argument
1241 struct device *dev = &cyapa->client->dev; in cyapa_pip_check_fw()
1253 if (cyapa_pip_fw_head_check(cyapa, in cyapa_pip_check_fw()
1314 static int cyapa_pip_write_fw_block(struct cyapa *cyapa, in cyapa_pip_write_fw_block() argument
1370 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, cmd, cmd_len, in cyapa_pip_write_fw_block()
1381 int cyapa_pip_do_fw_update(struct cyapa *cyapa, in cyapa_pip_do_fw_update() argument
1384 struct device *dev = &cyapa->client->dev; in cyapa_pip_do_fw_update()
1390 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL); in cyapa_pip_do_fw_update()
1400 error = cyapa_pip_write_fw_block(cyapa, &image_records[i]); in cyapa_pip_do_fw_update()
1411 static int cyapa_gen5_change_power_state(struct cyapa *cyapa, u8 power_state) in cyapa_gen5_change_power_state() argument
1420 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, cmd, sizeof(cmd), in cyapa_gen5_change_power_state()
1430 static int cyapa_gen5_set_interval_time(struct cyapa *cyapa, in cyapa_gen5_set_interval_time() argument
1476 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, cmd, cmd_len, in cyapa_gen5_set_interval_time()
1487 static int cyapa_gen5_get_interval_time(struct cyapa *cyapa, in cyapa_gen5_get_interval_time() argument
1530 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, cmd, cmd_len, in cyapa_gen5_get_interval_time()
1545 static int cyapa_gen5_disable_pip_report(struct cyapa *cyapa) in cyapa_gen5_disable_pip_report() argument
1564 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, cmd, sizeof(cmd), in cyapa_gen5_disable_pip_report()
1575 int cyapa_pip_set_proximity(struct cyapa *cyapa, bool enable) in cyapa_pip_set_proximity() argument
1585 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, cmd, sizeof(cmd), in cyapa_pip_set_proximity()
1597 int cyapa_pip_deep_sleep(struct cyapa *cyapa, u8 state) in cyapa_pip_deep_sleep() argument
1606 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, cmd, sizeof(cmd), in cyapa_pip_deep_sleep()
1615 static int cyapa_gen5_set_power_mode(struct cyapa *cyapa, in cyapa_gen5_set_power_mode() argument
1618 struct device *dev = &cyapa->client->dev; in cyapa_gen5_set_power_mode()
1622 if (cyapa->state != CYAPA_STATE_GEN5_APP) in cyapa_gen5_set_power_mode()
1625 cyapa_set_pip_pm_state(cyapa, pm_stage); in cyapa_gen5_set_power_mode()
1627 if (PIP_DEV_GET_PWR_STATE(cyapa) == UNINIT_PWR_MODE) { in cyapa_gen5_set_power_mode()
1633 PIP_DEV_SET_PWR_STATE(cyapa, PWR_MODE_OFF); in cyapa_gen5_set_power_mode()
1636 if (PIP_DEV_UNINIT_SLEEP_TIME(cyapa) && in cyapa_gen5_set_power_mode()
1637 PIP_DEV_GET_PWR_STATE(cyapa) != PWR_MODE_OFF) in cyapa_gen5_set_power_mode()
1638 if (cyapa_gen5_get_interval_time(cyapa, in cyapa_gen5_set_power_mode()
1640 &cyapa->dev_sleep_time) != 0) in cyapa_gen5_set_power_mode()
1641 PIP_DEV_SET_SLEEP_TIME(cyapa, UNINIT_SLEEP_TIME); in cyapa_gen5_set_power_mode()
1643 if (PIP_DEV_GET_PWR_STATE(cyapa) == power_mode) { in cyapa_gen5_set_power_mode()
1647 PIP_DEV_GET_SLEEP_TIME(cyapa) == sleep_time) { in cyapa_gen5_set_power_mode()
1654 error = cyapa_pip_deep_sleep(cyapa, PIP_DEEP_SLEEP_STATE_OFF); in cyapa_gen5_set_power_mode()
1660 PIP_DEV_SET_PWR_STATE(cyapa, PWR_MODE_OFF); in cyapa_gen5_set_power_mode()
1669 if (PIP_DEV_GET_PWR_STATE(cyapa) == PWR_MODE_OFF) { in cyapa_gen5_set_power_mode()
1670 error = cyapa_pip_deep_sleep(cyapa, PIP_DEEP_SLEEP_STATE_ON); in cyapa_gen5_set_power_mode()
1678 error = cyapa_gen5_change_power_state(cyapa, in cyapa_gen5_set_power_mode()
1685 PIP_DEV_SET_PWR_STATE(cyapa, PWR_MODE_FULL_ACTIVE); in cyapa_gen5_set_power_mode()
1687 error = cyapa_gen5_change_power_state(cyapa, in cyapa_gen5_set_power_mode()
1694 PIP_DEV_SET_PWR_STATE(cyapa, PWR_MODE_BTN_ONLY); in cyapa_gen5_set_power_mode()
1701 if (PIP_DEV_UNINIT_SLEEP_TIME(cyapa) || in cyapa_gen5_set_power_mode()
1702 sleep_time != PIP_DEV_GET_SLEEP_TIME(cyapa)) in cyapa_gen5_set_power_mode()
1703 if (cyapa_gen5_set_interval_time(cyapa, in cyapa_gen5_set_power_mode()
1706 PIP_DEV_SET_SLEEP_TIME(cyapa, sleep_time); in cyapa_gen5_set_power_mode()
1712 error = cyapa_gen5_change_power_state(cyapa, power_state); in cyapa_gen5_set_power_mode()
1730 cyapa_gen5_disable_pip_report(cyapa); in cyapa_gen5_set_power_mode()
1732 PIP_DEV_SET_PWR_STATE(cyapa, in cyapa_gen5_set_power_mode()
1737 cyapa_reset_pip_pm_state(cyapa); in cyapa_gen5_set_power_mode()
1741 int cyapa_pip_resume_scanning(struct cyapa *cyapa) in cyapa_pip_resume_scanning() argument
1749 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL); in cyapa_pip_resume_scanning()
1752 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_pip_resume_scanning()
1760 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL); in cyapa_pip_resume_scanning()
1765 int cyapa_pip_suspend_scanning(struct cyapa *cyapa) in cyapa_pip_suspend_scanning() argument
1773 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL); in cyapa_pip_suspend_scanning()
1776 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_pip_suspend_scanning()
1784 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL); in cyapa_pip_suspend_scanning()
1789 static int cyapa_pip_calibrate_pwcs(struct cyapa *cyapa, in cyapa_pip_calibrate_pwcs() argument
1799 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL); in cyapa_pip_calibrate_pwcs()
1809 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_pip_calibrate_pwcs()
1824 struct cyapa *cyapa = dev_get_drvdata(dev); in cyapa_pip_do_calibrate() local
1828 error = cyapa_pip_suspend_scanning(cyapa); in cyapa_pip_do_calibrate()
1833 calibrate_error = cyapa_pip_calibrate_pwcs(cyapa, in cyapa_pip_do_calibrate()
1839 calibrate_error = cyapa_pip_calibrate_pwcs(cyapa, in cyapa_pip_do_calibrate()
1846 error = cyapa_pip_resume_scanning(cyapa); in cyapa_pip_do_calibrate()
1902 static void cyapa_gen5_guess_electrodes(struct cyapa *cyapa, in cyapa_gen5_guess_electrodes() argument
1905 if (cyapa->electrodes_rx != 0) { in cyapa_gen5_guess_electrodes()
1906 *electrodes_rx = cyapa->electrodes_rx; in cyapa_gen5_guess_electrodes()
1907 *electrodes_tx = (cyapa->electrodes_x == *electrodes_rx) ? in cyapa_gen5_guess_electrodes()
1908 cyapa->electrodes_y : cyapa->electrodes_x; in cyapa_gen5_guess_electrodes()
1910 *electrodes_tx = min(cyapa->electrodes_x, cyapa->electrodes_y); in cyapa_gen5_guess_electrodes()
1911 *electrodes_rx = max(cyapa->electrodes_x, cyapa->electrodes_y); in cyapa_gen5_guess_electrodes()
1933 static int cyapa_gen5_read_idac_data(struct cyapa *cyapa, in cyapa_gen5_read_idac_data() argument
1975 if (cyapa->aligned_electrodes_rx == 0) { in cyapa_gen5_read_idac_data()
1976 cyapa_gen5_guess_electrodes(cyapa, in cyapa_gen5_read_idac_data()
1978 cyapa->aligned_electrodes_rx = in cyapa_gen5_read_idac_data()
1982 (cyapa->aligned_electrodes_rx + 7) & ~7u; in cyapa_gen5_read_idac_data()
1992 offset = cyapa->aligned_electrodes_rx * (*data_size); in cyapa_gen5_read_idac_data()
1993 if (cyapa->electrodes_rx == cyapa->electrodes_x) in cyapa_gen5_read_idac_data()
1994 electrodes_tx = cyapa->electrodes_y; in cyapa_gen5_read_idac_data()
1996 electrodes_tx = cyapa->electrodes_x; in cyapa_gen5_read_idac_data()
1997 max_element_cnt = ((cyapa->aligned_electrodes_rx + 7) & in cyapa_gen5_read_idac_data()
2001 max_element_cnt = cyapa->electrodes_x + in cyapa_gen5_read_idac_data()
2002 cyapa->electrodes_y; in cyapa_gen5_read_idac_data()
2023 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_gen5_read_idac_data()
2067 tmp_count < cyapa->aligned_electrodes_rx && in cyapa_gen5_read_idac_data()
2101 if (tmp_count == cyapa->aligned_electrodes_rx) { in cyapa_gen5_read_idac_data()
2102 cyapa->electrodes_rx = cyapa->electrodes_rx ? in cyapa_gen5_read_idac_data()
2103 cyapa->electrodes_rx : electrodes_rx; in cyapa_gen5_read_idac_data()
2105 cyapa->electrodes_rx = cyapa->electrodes_rx ? in cyapa_gen5_read_idac_data()
2106 cyapa->electrodes_rx : electrodes_rx; in cyapa_gen5_read_idac_data()
2107 cyapa->aligned_electrodes_rx = electrodes_rx; in cyapa_gen5_read_idac_data()
2109 cyapa->electrodes_rx = cyapa->electrodes_rx ? in cyapa_gen5_read_idac_data()
2110 cyapa->electrodes_rx : electrodes_tx; in cyapa_gen5_read_idac_data()
2111 cyapa->aligned_electrodes_rx = tmp_count; in cyapa_gen5_read_idac_data()
2122 static int cyapa_gen5_read_mutual_idac_data(struct cyapa *cyapa, in cyapa_gen5_read_mutual_idac_data() argument
2133 error = cyapa_gen5_read_idac_data(cyapa, in cyapa_gen5_read_mutual_idac_data()
2141 error = cyapa_gen5_read_idac_data(cyapa, in cyapa_gen5_read_mutual_idac_data()
2149 static int cyapa_gen5_read_self_idac_data(struct cyapa *cyapa, in cyapa_gen5_read_self_idac_data() argument
2160 error = cyapa_gen5_read_idac_data(cyapa, in cyapa_gen5_read_self_idac_data()
2170 error = cyapa_gen5_read_idac_data(cyapa, in cyapa_gen5_read_self_idac_data()
2178 static ssize_t cyapa_gen5_execute_panel_scan(struct cyapa *cyapa) in cyapa_gen5_execute_panel_scan() argument
2193 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_gen5_execute_panel_scan()
2206 static int cyapa_gen5_read_panel_scan_raw_data(struct cyapa *cyapa, in cyapa_gen5_read_panel_scan_raw_data() argument
2253 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_gen5_read_panel_scan_raw_data()
2304 struct cyapa *cyapa = dev_get_drvdata(dev); in cyapa_gen5_show_baseline() local
2318 if (!cyapa_is_pip_app_mode(cyapa)) in cyapa_gen5_show_baseline()
2322 error = cyapa_pip_suspend_scanning(cyapa); in cyapa_gen5_show_baseline()
2328 error = cyapa_gen5_read_mutual_idac_data(cyapa, in cyapa_gen5_show_baseline()
2336 error = cyapa_gen5_read_self_idac_data(cyapa, in cyapa_gen5_show_baseline()
2344 error = cyapa_gen5_execute_panel_scan(cyapa); in cyapa_gen5_show_baseline()
2349 error = cyapa_gen5_read_panel_scan_raw_data(cyapa, in cyapa_gen5_show_baseline()
2352 cyapa->electrodes_x * cyapa->electrodes_y, in cyapa_gen5_show_baseline()
2360 error = cyapa_gen5_read_panel_scan_raw_data(cyapa, in cyapa_gen5_show_baseline()
2363 cyapa->electrodes_x + cyapa->electrodes_y, in cyapa_gen5_show_baseline()
2371 error = cyapa_gen5_read_panel_scan_raw_data(cyapa, in cyapa_gen5_show_baseline()
2374 cyapa->electrodes_x * cyapa->electrodes_y, in cyapa_gen5_show_baseline()
2382 error = cyapa_gen5_read_panel_scan_raw_data(cyapa, in cyapa_gen5_show_baseline()
2385 cyapa->electrodes_x + cyapa->electrodes_y, in cyapa_gen5_show_baseline()
2393 error = cyapa_gen5_read_panel_scan_raw_data(cyapa, in cyapa_gen5_show_baseline()
2396 cyapa->electrodes_x * cyapa->electrodes_y, in cyapa_gen5_show_baseline()
2404 error = cyapa_gen5_read_panel_scan_raw_data(cyapa, in cyapa_gen5_show_baseline()
2407 cyapa->electrodes_x + cyapa->electrodes_y, in cyapa_gen5_show_baseline()
2416 resume_error = cyapa_pip_resume_scanning(cyapa); in cyapa_gen5_show_baseline()
2437 bool cyapa_pip_sort_system_info_data(struct cyapa *cyapa, in cyapa_pip_sort_system_info_data() argument
2447 static int cyapa_gen5_bl_query_data(struct cyapa *cyapa) in cyapa_gen5_bl_query_data() argument
2454 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_gen5_bl_query_data()
2462 memcpy(&cyapa->product_id[0], &resp_data[8], 5); in cyapa_gen5_bl_query_data()
2463 cyapa->product_id[5] = '-'; in cyapa_gen5_bl_query_data()
2464 memcpy(&cyapa->product_id[6], &resp_data[13], 6); in cyapa_gen5_bl_query_data()
2465 cyapa->product_id[12] = '-'; in cyapa_gen5_bl_query_data()
2466 memcpy(&cyapa->product_id[13], &resp_data[19], 2); in cyapa_gen5_bl_query_data()
2467 cyapa->product_id[15] = '\0'; in cyapa_gen5_bl_query_data()
2469 cyapa->fw_maj_ver = resp_data[22]; in cyapa_gen5_bl_query_data()
2470 cyapa->fw_min_ver = resp_data[23]; in cyapa_gen5_bl_query_data()
2472 cyapa->platform_ver = (resp_data[26] >> PIP_BL_PLATFORM_VER_SHIFT) & in cyapa_gen5_bl_query_data()
2478 static int cyapa_gen5_get_query_data(struct cyapa *cyapa) in cyapa_gen5_get_query_data() argument
2486 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_gen5_get_query_data()
2498 cyapa->platform_ver = (resp_data[49] >> PIP_BL_PLATFORM_VER_SHIFT) & in cyapa_gen5_get_query_data()
2500 if (cyapa->gen == CYAPA_GEN5 && cyapa->platform_ver < 2) { in cyapa_gen5_get_query_data()
2502 cyapa->fw_maj_ver = resp_data[15]; in cyapa_gen5_get_query_data()
2503 cyapa->fw_min_ver = resp_data[16]; in cyapa_gen5_get_query_data()
2505 cyapa->fw_maj_ver = resp_data[9]; in cyapa_gen5_get_query_data()
2506 cyapa->fw_min_ver = resp_data[10]; in cyapa_gen5_get_query_data()
2509 cyapa->electrodes_x = resp_data[52]; in cyapa_gen5_get_query_data()
2510 cyapa->electrodes_y = resp_data[53]; in cyapa_gen5_get_query_data()
2512 cyapa->physical_size_x = get_unaligned_le16(&resp_data[54]) / 100; in cyapa_gen5_get_query_data()
2513 cyapa->physical_size_y = get_unaligned_le16(&resp_data[56]) / 100; in cyapa_gen5_get_query_data()
2515 cyapa->max_abs_x = get_unaligned_le16(&resp_data[58]); in cyapa_gen5_get_query_data()
2516 cyapa->max_abs_y = get_unaligned_le16(&resp_data[60]); in cyapa_gen5_get_query_data()
2518 cyapa->max_z = get_unaligned_le16(&resp_data[62]); in cyapa_gen5_get_query_data()
2520 cyapa->x_origin = resp_data[64] & 0x01; in cyapa_gen5_get_query_data()
2521 cyapa->y_origin = resp_data[65] & 0x01; in cyapa_gen5_get_query_data()
2523 cyapa->btn_capability = (resp_data[70] << 3) & CAPABILITY_BTN_MASK; in cyapa_gen5_get_query_data()
2525 memcpy(&cyapa->product_id[0], &resp_data[33], 5); in cyapa_gen5_get_query_data()
2526 cyapa->product_id[5] = '-'; in cyapa_gen5_get_query_data()
2527 memcpy(&cyapa->product_id[6], &resp_data[38], 6); in cyapa_gen5_get_query_data()
2528 cyapa->product_id[12] = '-'; in cyapa_gen5_get_query_data()
2529 memcpy(&cyapa->product_id[13], &resp_data[44], 2); in cyapa_gen5_get_query_data()
2530 cyapa->product_id[15] = '\0'; in cyapa_gen5_get_query_data()
2532 if (!cyapa->electrodes_x || !cyapa->electrodes_y || in cyapa_gen5_get_query_data()
2533 !cyapa->physical_size_x || !cyapa->physical_size_y || in cyapa_gen5_get_query_data()
2534 !cyapa->max_abs_x || !cyapa->max_abs_y || !cyapa->max_z) in cyapa_gen5_get_query_data()
2540 static int cyapa_gen5_do_operational_check(struct cyapa *cyapa) in cyapa_gen5_do_operational_check() argument
2542 struct device *dev = &cyapa->client->dev; in cyapa_gen5_do_operational_check()
2545 if (cyapa->gen != CYAPA_GEN5) in cyapa_gen5_do_operational_check()
2548 switch (cyapa->state) { in cyapa_gen5_do_operational_check()
2550 error = cyapa_pip_bl_exit(cyapa); in cyapa_gen5_do_operational_check()
2553 cyapa_gen5_bl_query_data(cyapa); in cyapa_gen5_do_operational_check()
2557 cyapa->state = CYAPA_STATE_GEN5_APP; in cyapa_gen5_do_operational_check()
2567 error = cyapa_gen5_set_power_mode(cyapa, in cyapa_gen5_do_operational_check()
2574 if (cyapa->platform_ver >= 2) { in cyapa_gen5_do_operational_check()
2575 error = cyapa_pip_set_proximity(cyapa, true); in cyapa_gen5_do_operational_check()
2583 error = cyapa_gen5_get_query_data(cyapa); in cyapa_gen5_do_operational_check()
2587 if (memcmp(cyapa->product_id, product_id, in cyapa_gen5_do_operational_check()
2590 __func__, cyapa->product_id); in cyapa_gen5_do_operational_check()
2606 bool cyapa_pip_irq_cmd_handler(struct cyapa *cyapa) in cyapa_pip_irq_cmd_handler() argument
2608 struct cyapa_pip_cmd_states *pip = &cyapa->cmd_states.pip; in cyapa_pip_irq_cmd_handler()
2621 cyapa_i2c_pip_read(cyapa, pip->irq_cmd_buf, in cyapa_pip_irq_cmd_handler()
2627 cyapa_i2c_pip_read(cyapa, in cyapa_pip_irq_cmd_handler()
2630 pip->resp_sort_func(cyapa, in cyapa_pip_irq_cmd_handler()
2648 cyapa_empty_pip_output_data(cyapa, in cyapa_pip_irq_cmd_handler()
2674 static void cyapa_pip_report_buttons(struct cyapa *cyapa, in cyapa_pip_report_buttons() argument
2677 struct input_dev *input = cyapa->input; in cyapa_pip_report_buttons()
2682 if (cyapa->btn_capability & CAPABILITY_LEFT_BTN_MASK) { in cyapa_pip_report_buttons()
2686 if (cyapa->btn_capability & CAPABILITY_MIDDLE_BTN_MASK) { in cyapa_pip_report_buttons()
2690 if (cyapa->btn_capability & CAPABILITY_RIGHT_BTN_MASK) { in cyapa_pip_report_buttons()
2698 static void cyapa_pip_report_proximity(struct cyapa *cyapa, in cyapa_pip_report_proximity() argument
2701 struct input_dev *input = cyapa->input; in cyapa_pip_report_proximity()
2709 static void cyapa_pip_report_slot_data(struct cyapa *cyapa, in cyapa_pip_report_slot_data() argument
2712 struct input_dev *input = cyapa->input; in cyapa_pip_report_slot_data()
2723 if (cyapa->x_origin) in cyapa_pip_report_slot_data()
2724 x = cyapa->max_abs_x - x; in cyapa_pip_report_slot_data()
2726 if (cyapa->y_origin) in cyapa_pip_report_slot_data()
2727 y = cyapa->max_abs_y - y; in cyapa_pip_report_slot_data()
2747 static void cyapa_pip_report_touches(struct cyapa *cyapa, in cyapa_pip_report_touches() argument
2750 struct input_dev *input = cyapa->input; in cyapa_pip_report_touches()
2758 cyapa_pip_report_slot_data(cyapa, in cyapa_pip_report_touches()
2765 int cyapa_pip_irq_handler(struct cyapa *cyapa) in cyapa_pip_irq_handler() argument
2767 struct device *dev = &cyapa->client->dev; in cyapa_pip_irq_handler()
2772 if (!cyapa_is_pip_app_mode(cyapa)) { in cyapa_pip_irq_handler()
2774 cyapa->gen, cyapa->state); in cyapa_pip_irq_handler()
2778 ret = cyapa_i2c_pip_read(cyapa, (u8 *)&report_data, in cyapa_pip_irq_handler()
2799 ret = cyapa_i2c_pip_read(cyapa, (u8 *)&report_data, report_len); in cyapa_pip_irq_handler()
2806 return cyapa_pip_event_process(cyapa, &report_data); in cyapa_pip_irq_handler()
2809 static int cyapa_pip_event_process(struct cyapa *cyapa, in cyapa_pip_event_process() argument
2812 struct device *dev = &cyapa->client->dev; in cyapa_pip_event_process()
2875 cyapa_pip_report_touches(cyapa, report_data); in cyapa_pip_event_process()
2877 cyapa_pip_report_proximity(cyapa, report_data); in cyapa_pip_event_process()
2879 cyapa_pip_report_buttons(cyapa, report_data); in cyapa_pip_event_process()
2884 int cyapa_pip_bl_activate(struct cyapa *cyapa) { return 0; } in cyapa_pip_bl_activate() argument
2885 int cyapa_pip_bl_deactivate(struct cyapa *cyapa) { return 0; } in cyapa_pip_bl_deactivate() argument