• Home
  • Raw
  • Download

Lines Matching refs:cyapa

75 static bool cyapa_sort_pip_hid_descriptor_data(struct cyapa *cyapa,  in cyapa_sort_pip_hid_descriptor_data()  argument
88 static int cyapa_get_pip_fixed_info(struct cyapa *cyapa, in cyapa_get_pip_fixed_info() argument
99 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_get_pip_fixed_info()
116 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_get_pip_fixed_info()
136 int cyapa_pip_state_parse(struct cyapa *cyapa, u8 *reg_data, int len) in cyapa_pip_state_parse() argument
145 cyapa->state = CYAPA_STATE_NO_DEVICE; in cyapa_pip_state_parse()
148 cyapa_pip_deep_sleep(cyapa, PIP_DEEP_SLEEP_STATE_ON); in cyapa_pip_state_parse()
151 cyapa_empty_pip_output_data(cyapa, NULL, NULL, NULL); in cyapa_pip_state_parse()
158 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_pip_state_parse()
176 error = cyapa_get_pip_fixed_info(cyapa, &pip_info, is_bootloader); in cyapa_pip_state_parse()
181 cyapa->gen = CYAPA_GEN6; in cyapa_pip_state_parse()
182 cyapa->state = is_bootloader ? CYAPA_STATE_GEN6_BL in cyapa_pip_state_parse()
186 cyapa->gen = CYAPA_GEN5; in cyapa_pip_state_parse()
187 cyapa->state = is_bootloader ? CYAPA_STATE_GEN5_BL in cyapa_pip_state_parse()
194 static int cyapa_gen6_read_sys_info(struct cyapa *cyapa) in cyapa_gen6_read_sys_info() argument
204 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_gen6_read_sys_info()
216 cyapa->platform_ver = (resp_data[67] >> PIP_BL_PLATFORM_VER_SHIFT) & in cyapa_gen6_read_sys_info()
218 cyapa->fw_maj_ver = resp_data[9]; in cyapa_gen6_read_sys_info()
219 cyapa->fw_min_ver = resp_data[10]; in cyapa_gen6_read_sys_info()
221 cyapa->electrodes_x = resp_data[33]; in cyapa_gen6_read_sys_info()
222 cyapa->electrodes_y = resp_data[34]; in cyapa_gen6_read_sys_info()
224 cyapa->physical_size_x = get_unaligned_le16(&resp_data[35]) / 100; in cyapa_gen6_read_sys_info()
225 cyapa->physical_size_y = get_unaligned_le16(&resp_data[37]) / 100; in cyapa_gen6_read_sys_info()
227 cyapa->max_abs_x = get_unaligned_le16(&resp_data[39]); in cyapa_gen6_read_sys_info()
228 cyapa->max_abs_y = get_unaligned_le16(&resp_data[41]); in cyapa_gen6_read_sys_info()
230 cyapa->max_z = get_unaligned_le16(&resp_data[43]); in cyapa_gen6_read_sys_info()
232 cyapa->x_origin = resp_data[45] & 0x01; in cyapa_gen6_read_sys_info()
233 cyapa->y_origin = resp_data[46] & 0x01; in cyapa_gen6_read_sys_info()
235 cyapa->btn_capability = (resp_data[70] << 3) & CAPABILITY_BTN_MASK; in cyapa_gen6_read_sys_info()
237 memcpy(&cyapa->product_id[0], &resp_data[51], 5); in cyapa_gen6_read_sys_info()
238 cyapa->product_id[5] = '-'; in cyapa_gen6_read_sys_info()
239 memcpy(&cyapa->product_id[6], &resp_data[56], 6); in cyapa_gen6_read_sys_info()
240 cyapa->product_id[12] = '-'; in cyapa_gen6_read_sys_info()
241 memcpy(&cyapa->product_id[13], &resp_data[62], 2); in cyapa_gen6_read_sys_info()
242 cyapa->product_id[15] = '\0'; in cyapa_gen6_read_sys_info()
246 cyapa->electrodes_rx = in cyapa_gen6_read_sys_info()
247 rotat_align ? cyapa->electrodes_y : cyapa->electrodes_x; in cyapa_gen6_read_sys_info()
248 cyapa->aligned_electrodes_rx = (cyapa->electrodes_rx + 3) & ~3u; in cyapa_gen6_read_sys_info()
250 if (!cyapa->electrodes_x || !cyapa->electrodes_y || in cyapa_gen6_read_sys_info()
251 !cyapa->physical_size_x || !cyapa->physical_size_y || in cyapa_gen6_read_sys_info()
252 !cyapa->max_abs_x || !cyapa->max_abs_y || !cyapa->max_z) in cyapa_gen6_read_sys_info()
258 static int cyapa_gen6_bl_read_app_info(struct cyapa *cyapa) in cyapa_gen6_bl_read_app_info() argument
265 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_gen6_bl_read_app_info()
273 cyapa->fw_maj_ver = resp_data[8]; in cyapa_gen6_bl_read_app_info()
274 cyapa->fw_min_ver = resp_data[9]; in cyapa_gen6_bl_read_app_info()
276 cyapa->platform_ver = (resp_data[12] >> PIP_BL_PLATFORM_VER_SHIFT) & in cyapa_gen6_bl_read_app_info()
279 memcpy(&cyapa->product_id[0], &resp_data[13], 5); in cyapa_gen6_bl_read_app_info()
280 cyapa->product_id[5] = '-'; in cyapa_gen6_bl_read_app_info()
281 memcpy(&cyapa->product_id[6], &resp_data[18], 6); in cyapa_gen6_bl_read_app_info()
282 cyapa->product_id[12] = '-'; in cyapa_gen6_bl_read_app_info()
283 memcpy(&cyapa->product_id[13], &resp_data[24], 2); in cyapa_gen6_bl_read_app_info()
284 cyapa->product_id[15] = '\0'; in cyapa_gen6_bl_read_app_info()
290 static int cyapa_gen6_config_dev_irq(struct cyapa *cyapa, u8 cmd_code) in cyapa_gen6_config_dev_irq() argument
298 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, cmd, sizeof(cmd), in cyapa_gen6_config_dev_irq()
309 static int cyapa_gen6_set_proximity(struct cyapa *cyapa, bool enable) in cyapa_gen6_set_proximity() argument
313 cyapa_gen6_config_dev_irq(cyapa, GEN6_DISABLE_CMD_IRQ); in cyapa_gen6_set_proximity()
314 error = cyapa_pip_set_proximity(cyapa, enable); in cyapa_gen6_set_proximity()
315 cyapa_gen6_config_dev_irq(cyapa, GEN6_ENABLE_CMD_IRQ); in cyapa_gen6_set_proximity()
320 static int cyapa_gen6_change_power_state(struct cyapa *cyapa, u8 power_mode) in cyapa_gen6_change_power_state() argument
328 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, cmd, sizeof(cmd), in cyapa_gen6_change_power_state()
341 static int cyapa_gen6_set_interval_setting(struct cyapa *cyapa, in cyapa_gen6_set_interval_setting() argument
372 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_gen6_set_interval_setting()
388 static int cyapa_gen6_get_interval_setting(struct cyapa *cyapa, in cyapa_gen6_get_interval_setting() argument
398 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, cmd, sizeof(cmd), in cyapa_gen6_get_interval_setting()
412 static int cyapa_gen6_deep_sleep(struct cyapa *cyapa, u8 state) in cyapa_gen6_deep_sleep() argument
422 cyapa_i2c_pip_write(cyapa, ping, sizeof(ping)); in cyapa_gen6_deep_sleep()
424 return cyapa_pip_deep_sleep(cyapa, state); in cyapa_gen6_deep_sleep()
427 static int cyapa_gen6_set_power_mode(struct cyapa *cyapa, in cyapa_gen6_set_power_mode() argument
430 struct device *dev = &cyapa->client->dev; in cyapa_gen6_set_power_mode()
432 &cyapa->gen6_interval_setting; in cyapa_gen6_set_power_mode()
436 if (cyapa->state != CYAPA_STATE_GEN6_APP) in cyapa_gen6_set_power_mode()
439 if (PIP_DEV_GET_PWR_STATE(cyapa) == UNINIT_PWR_MODE) { in cyapa_gen6_set_power_mode()
445 PIP_DEV_SET_PWR_STATE(cyapa, PWR_MODE_OFF); in cyapa_gen6_set_power_mode()
448 if (PIP_DEV_UNINIT_SLEEP_TIME(cyapa) && in cyapa_gen6_set_power_mode()
449 PIP_DEV_GET_PWR_STATE(cyapa) != PWR_MODE_OFF) in cyapa_gen6_set_power_mode()
450 PIP_DEV_SET_SLEEP_TIME(cyapa, UNINIT_SLEEP_TIME); in cyapa_gen6_set_power_mode()
452 if (PIP_DEV_GET_PWR_STATE(cyapa) == power_mode) { in cyapa_gen6_set_power_mode()
456 PIP_DEV_GET_SLEEP_TIME(cyapa) == sleep_time) { in cyapa_gen6_set_power_mode()
463 cyapa_gen6_config_dev_irq(cyapa, GEN6_DISABLE_CMD_IRQ); in cyapa_gen6_set_power_mode()
465 error = cyapa_gen6_deep_sleep(cyapa, PIP_DEEP_SLEEP_STATE_OFF); in cyapa_gen6_set_power_mode()
471 PIP_DEV_SET_PWR_STATE(cyapa, PWR_MODE_OFF); in cyapa_gen6_set_power_mode()
480 if (PIP_DEV_GET_PWR_STATE(cyapa) == PWR_MODE_OFF) { in cyapa_gen6_set_power_mode()
481 error = cyapa_gen6_deep_sleep(cyapa, PIP_DEEP_SLEEP_STATE_ON); in cyapa_gen6_set_power_mode()
492 cyapa_gen6_config_dev_irq(cyapa, GEN6_DISABLE_CMD_IRQ); in cyapa_gen6_set_power_mode()
495 error = cyapa_gen6_change_power_state(cyapa, in cyapa_gen6_set_power_mode()
502 PIP_DEV_SET_PWR_STATE(cyapa, PWR_MODE_FULL_ACTIVE); in cyapa_gen6_set_power_mode()
505 cyapa_gen6_get_interval_setting(cyapa, interval_setting); in cyapa_gen6_set_power_mode()
508 error = cyapa_gen6_change_power_state(cyapa, in cyapa_gen6_set_power_mode()
515 PIP_DEV_SET_PWR_STATE(cyapa, PWR_MODE_BTN_ONLY); in cyapa_gen6_set_power_mode()
534 cyapa_gen6_set_interval_setting(cyapa, in cyapa_gen6_set_power_mode()
538 error = cyapa_gen6_change_power_state(cyapa, lp_mode); in cyapa_gen6_set_power_mode()
545 PIP_DEV_SET_SLEEP_TIME(cyapa, sleep_time); in cyapa_gen6_set_power_mode()
546 PIP_DEV_SET_PWR_STATE(cyapa, in cyapa_gen6_set_power_mode()
551 cyapa_gen6_config_dev_irq(cyapa, GEN6_ENABLE_CMD_IRQ); in cyapa_gen6_set_power_mode()
555 static int cyapa_gen6_initialize(struct cyapa *cyapa) in cyapa_gen6_initialize() argument
560 static int cyapa_pip_retrieve_data_structure(struct cyapa *cyapa, in cyapa_pip_retrieve_data_structure() argument
584 error = cyapa_i2c_pip_cmd_irq_sync(cyapa, in cyapa_pip_retrieve_data_structure()
608 struct cyapa *cyapa = dev_get_drvdata(dev); in cyapa_gen6_show_baseline() local
616 if (!cyapa_is_pip_app_mode(cyapa)) in cyapa_gen6_show_baseline()
620 error = cyapa_pip_suspend_scanning(cyapa); in cyapa_gen6_show_baseline()
626 error = cyapa_pip_retrieve_data_structure(cyapa, 0, data_len, in cyapa_gen6_show_baseline()
643 error = cyapa_pip_retrieve_data_structure(cyapa, 0, data_len, in cyapa_gen6_show_baseline()
656 resume_error = cyapa_pip_resume_scanning(cyapa); in cyapa_gen6_show_baseline()
665 static int cyapa_gen6_operational_check(struct cyapa *cyapa) in cyapa_gen6_operational_check() argument
667 struct device *dev = &cyapa->client->dev; in cyapa_gen6_operational_check()
670 if (cyapa->gen != CYAPA_GEN6) in cyapa_gen6_operational_check()
673 switch (cyapa->state) { in cyapa_gen6_operational_check()
675 error = cyapa_pip_bl_exit(cyapa); in cyapa_gen6_operational_check()
678 cyapa_gen6_bl_read_app_info(cyapa); in cyapa_gen6_operational_check()
682 cyapa->state = CYAPA_STATE_GEN6_APP; in cyapa_gen6_operational_check()
692 error = cyapa_gen6_set_power_mode(cyapa, in cyapa_gen6_operational_check()
699 error = cyapa_pip_set_proximity(cyapa, true); in cyapa_gen6_operational_check()
705 error = cyapa_gen6_read_sys_info(cyapa); in cyapa_gen6_operational_check()
709 if (memcmp(cyapa->product_id, product_id, in cyapa_gen6_operational_check()
712 __func__, cyapa->product_id); in cyapa_gen6_operational_check()