/* read xy_data for all touches for debug */ static int cyttsp4_xy_worker(struct cyttsp4_debug_data *dd) { struct device *dev = &dd->ttsp->dev; struct cyttsp4_sysinfo *si = dd->si; u8 tt_stat = si->xy_mode[si->si_ofs.tt_stat_ofs]; u8 num_cur_tch = GET_NUM_TOUCHES(tt_stat); uint32_t formated_output; int rc; mutex_lock(&dd->sysfs_lock); dd->interrupt_count++; formated_output = dd->formated_output; mutex_unlock(&dd->sysfs_lock); if (si->si_ofs.num_btns > 0) { /* read button diff data */ rc = cyttsp4_read(dd->ttsp, CY_MODE_OPERATIONAL, /* replace with btn_diff_ofs when that field * becomes supported in the firmware */ si->si_ofs.tt_stat_ofs + 1 + si->si_ofs.max_tchs * si->si_ofs.tch_rec_size, si->btn_rec_data, si->si_ofs.num_btns * si->si_ofs.btn_rec_size); if (rc < 0) { dev_err(dev, "%s: read fail on button regs r=%d\n", __func__, rc); } } /* Interrupt */ pr_info("Interrupt(%u)\n", dd->interrupt_count); if (formated_output) cyttsp4_debug_formated(dev, dd->pr_buf, si, num_cur_tch); else /* print data for TTHE */ cyttsp4_pr_buf_op_mode(dev, dd->pr_buf, si, num_cur_tch); #ifdef SHOK_SENSOR_DATA_MODE /* print data for the sensor monitor */ if (si->monitor.mntr_status == CY_MNTR_STARTED) { cyttsp4_debug_print(dev, dd->pr_buf, si->monitor.sensor_data, 150, "cyttsp4_sensor_monitor"); } #endif pr_info("\n"); dev_vdbg(dev, "%s: done\n", __func__); return 0; }
static void cyttsp4_debug_formated(struct device *dev, u8 *pr_buf, struct cyttsp4_sysinfo *si, u8 num_cur_tch) { u8 mode_size = si->si_ofs.mode_size; u8 rep_len = si->xy_mode[si->si_ofs.rep_ofs]; u8 tch_rec_size = si->si_ofs.tch_rec_size; u8 num_btns = si->si_ofs.num_btns; u8 num_btn_regs = (num_btns + CY_NUM_BTN_PER_REG - 1) / CY_NUM_BTN_PER_REG; u8 num_btn_tch; u8 data_name[] = "touch[99]"; int max_print_length = 18; int i; /* xy_mode */ cyttsp4_debug_print(dev, pr_buf, si->xy_mode, mode_size, "xy_mode"); /* xy_data */ if (rep_len > max_print_length) { pr_info("xy_data[0..%d]:\n", rep_len); for (i = 0; i < rep_len - max_print_length; i += max_print_length) { cyttsp4_debug_print(dev, pr_buf, si->xy_data + i, max_print_length, " "); } if (rep_len - i) cyttsp4_debug_print(dev, pr_buf, si->xy_data + i, rep_len - i, " "); } else { cyttsp4_debug_print(dev, pr_buf, si->xy_data, rep_len, "xy_data"); } /* touches */ for (i = 0; i < num_cur_tch; i++) { scnprintf(data_name, sizeof(data_name) - 1, "touch[%u]", i); cyttsp4_debug_print(dev, pr_buf, si->xy_data + (i * tch_rec_size), tch_rec_size, data_name); } /* buttons */ if (num_btns) { num_btn_tch = 0; for (i = 0; i < num_btn_regs; i++) { if (si->xy_mode[si->si_ofs.rep_ofs + 2 + i]) { num_btn_tch++; break; } } if (num_btn_tch) cyttsp4_debug_print(dev, pr_buf, &si->xy_mode[si->si_ofs.rep_ofs + 2], num_btn_regs, "button"); } }
/* read xy_data for all touches for debug */ static int cyttsp4_xy_worker(struct cyttsp4_debug_data *dd) { struct device *dev = &dd->ttsp->dev; struct cyttsp4_sysinfo *si = dd->si; u8 tt_stat = si->xy_mode[si->si_ofs.tt_stat_ofs]; u8 num_cur_rec = GET_NUM_TOUCH_RECORDS(tt_stat); uint32_t formated_output; int rc; mutex_lock(&dd->sysfs_lock); dd->interrupt_count++; formated_output = dd->formated_output; mutex_unlock(&dd->sysfs_lock); /* Read command parameters */ rc = cyttsp4_read(dd->ttsp, CY_MODE_OPERATIONAL, si->si_ofs.cmd_ofs + 1, &si->xy_mode[si->si_ofs.cmd_ofs + 1], si->si_ofs.rep_ofs - si->si_ofs.cmd_ofs - 1); if (rc < 0) { tp_log_err( "%s: read fail on command parameter regs r=%d\n", __func__, rc); } if (si->si_ofs.num_btns > 0) { /* read button diff data */ rc = cyttsp4_read(dd->ttsp, CY_MODE_OPERATIONAL, /* replace with btn_diff_ofs when that field * becomes supported in the firmware */ si->si_ofs.tt_stat_ofs + 1 + si->si_ofs.max_tchs * si->si_ofs.tch_rec_size, si->btn_rec_data, si->si_ofs.num_btns * si->si_ofs.btn_rec_size); if (rc < 0) { tp_log_err( "%s: read fail on button regs r=%d\n", __func__, rc); } } /* Interrupt */ #if 0//huawei 0701 tp_log_info("Interrupt(%u)\n", dd->interrupt_count); #endif //huawei 0701 if (formated_output) cyttsp4_debug_formated(dev, dd->pr_buf, si, num_cur_rec); else /* print data for TTHE */ cyttsp4_pr_buf_op_mode(dev, dd->pr_buf, si, num_cur_rec); if (dd->monitor.mntr_status == CY_MNTR_ENABLED) { int offset = (si->si_ofs.max_tchs * si->si_ofs.tch_rec_size) + (si->si_ofs.num_btns * si->si_ofs.btn_rec_size) + (si->si_ofs.tt_stat_ofs + 1); rc = cyttsp4_read(dd->ttsp, CY_MODE_OPERATIONAL, offset, &(dd->monitor.sensor_data[0]), 150); if (rc < 0) tp_log_err( "%s: read fail on sensor monitor regs r=%d\n", __func__, rc); /* print data for the sensor monitor */ cyttsp4_debug_print(dev, dd->pr_buf, dd->monitor.sensor_data, 150, "cyttsp4_sensor_monitor"); } #if 0//huawei 0701 tp_log_info("\n"); #endif //huawei 0701 tp_log_debug( "%s: done\n", __func__); return 0; }