static int cyttsp4_startup_attention(struct device *dev) { struct cyttsp4_core_data *cd = dev_get_drvdata(dev); struct cyttsp4_mt_data *md = &cd->md; int rc = 0; mutex_lock(&md->mt_lock); cyttsp4_lift_all(md); mutex_unlock(&md->mt_lock); return rc; }
static int cyttsp4_mt_rt_suspend(struct device *dev) { struct cyttsp4_mt_data *md = dev_get_drvdata(dev); dev_dbg(dev, "%s\n", __func__); mutex_lock(&md->report_lock); md->is_suspended = true; cyttsp4_lift_all(md); mutex_unlock(&md->report_lock); return 0; }
static int cyttsp4_startup_attention(struct cyttsp4_device *ttsp) { struct device *dev = &ttsp->dev; struct cyttsp4_mt_data *md = dev_get_drvdata(dev); int rc = 0; dev_vdbg(dev, "%s\n", __func__); mutex_lock(&md->report_lock); cyttsp4_lift_all(md); mutex_unlock(&md->report_lock); return rc; }
static int cyttsp4_mt_suspend(struct device *dev) { #ifndef CONFIG_PM_RUNTIME struct cyttsp4_mt_data *md = dev_get_drvdata(dev); #endif dev_dbg(dev, "%s\n", __func__); #ifndef CONFIG_PM_RUNTIME mutex_lock(&md->report_lock); md->is_suspended = true; cyttsp4_lift_all(md); mutex_unlock(&md->report_lock); #endif pm_runtime_put(dev); return 0; }
/* read xy_data for all current touches */ static int cyttsp4_xy_worker(struct cyttsp4_mt_data *md) { struct device *dev = md->dev; struct cyttsp4_sysinfo *si = md->si; u8 num_cur_rec; u8 rep_len; u8 rep_stat; u8 tt_stat; int rc = 0; /* * Get event data from cyttsp4 device. * The event data includes all data * for all active touches. * Event data also includes button data */ rep_len = si->xy_mode[si->si_ofs.rep_ofs]; rep_stat = si->xy_mode[si->si_ofs.rep_ofs + 1]; tt_stat = si->xy_mode[si->si_ofs.tt_stat_ofs]; num_cur_rec = GET_NUM_TOUCH_RECORDS(tt_stat); if (rep_len == 0 && num_cur_rec > 0) { dev_err(dev, "%s: report length error rep_len=%d num_tch=%d\n", __func__, rep_len, num_cur_rec); goto cyttsp4_xy_worker_exit; } /* check any error conditions */ if (IS_BAD_PKT(rep_stat)) { dev_dbg(dev, "%s: Invalid buffer detected\n", __func__); rc = 0; goto cyttsp4_xy_worker_exit; } if (IS_LARGE_AREA(tt_stat)) { dev_dbg(dev, "%s: Large area detected\n", __func__); /* Do not report touch if configured so */ if (md->pdata->flags & CY_MT_FLAG_NO_TOUCH_ON_LO) num_cur_rec = 0; } if (num_cur_rec > si->si_ofs.max_tchs) { dev_err(dev, "%s: %s (n=%d c=%d)\n", __func__, "too many tch; set to max tch", num_cur_rec, si->si_ofs.max_tchs); num_cur_rec = si->si_ofs.max_tchs; } /* extract xy_data for all currently reported touches */ dev_vdbg(dev, "%s: extract data num_cur_rec=%d\n", __func__, num_cur_rec); if (num_cur_rec) cyttsp4_get_mt_touches(md, num_cur_rec); else cyttsp4_lift_all(md); dev_vdbg(dev, "%s: done\n", __func__); rc = 0; cyttsp4_xy_worker_exit: return rc; }
/* read xy_data for all current touches */ static int cyttsp4_xy_worker(struct cyttsp4_mt_data *md) { struct device *dev = &md->ttsp->dev; struct cyttsp4_sysinfo *si = md->si; u8 num_cur_rec; u8 rep_len; u8 rep_stat; u8 tt_stat; int rc = 0; #if ZTEMT_CYPRESS_WAKEUP_GESTURE_DEBUG #else unsigned long ids = 0; //Added by luochangyang, 2013/09/25 #endif /* * Get event data from cyttsp4 device. * The event data includes all data * for all active touches. * Event data also includes button data */ rep_len = si->xy_mode[si->si_ofs.rep_ofs]; rep_stat = si->xy_mode[si->si_ofs.rep_ofs + 1]; tt_stat = si->xy_mode[si->si_ofs.tt_stat_ofs]; num_cur_rec = GET_NUM_TOUCH_RECORDS(tt_stat); if (rep_len == 0 && num_cur_rec > 0) { dev_err(dev, "%s: report length error rep_len=%d num_tch=%d\n", __func__, rep_len, num_cur_rec); goto cyttsp4_xy_worker_exit; } /* check any error conditions */ if (IS_BAD_PKT(rep_stat)) { dev_dbg(dev, "%s: Invalid buffer detected\n", __func__); rc = 0; goto cyttsp4_xy_worker_exit; } if (IS_LARGE_AREA(tt_stat)) { dev_dbg(dev, "%s: Large area detected\n", __func__); /*** ZTEMT Added by luochangyang, 2013/09/25 ***/ /* For large area event */ #if ZTEMT_CYPRESS_WAKEUP_GESTURE_DEBUG input_report_key(md->input, KEY_POWER, 1); input_sync(md->input); input_report_key(md->input, KEY_POWER, 0); input_sync(md->input); #else if (md->mt_function.input_report) md->mt_function.input_report(md->input, ABS_MT_TRACKING_ID, 0, CY_OBJ_STANDARD_FINGER); input_report_abs(md->input, ABS_MT_PRESSURE, 1000); if (md->mt_function.input_sync) md->mt_function.input_sync(md->input); if (md->mt_function.final_sync) md->mt_function.final_sync(md->input, 0, 1, &ids); if (md->mt_function.report_slot_liftoff) md->mt_function.report_slot_liftoff(md, 1); if (md->mt_function.final_sync) md->mt_function.final_sync(md->input, 1, 1, &ids); #endif cyttsp4_lift_all(md); /***ZTEMT END***/ /* Do not report touch if configured so */ if (md->pdata->flags & CY_MT_FLAG_NO_TOUCH_ON_LO) num_cur_rec = 0; } if (num_cur_rec > si->si_ofs.max_tchs) { dev_err(dev, "%s: %s (n=%d c=%d)\n", __func__, "too many tch; set to max tch", num_cur_rec, si->si_ofs.max_tchs); num_cur_rec = si->si_ofs.max_tchs; } /* extract xy_data for all currently reported touches */ dev_vdbg(dev, "%s: extract data num_cur_rec=%d\n", __func__, num_cur_rec); if (num_cur_rec) cyttsp4_get_mt_touches(md, num_cur_rec); else cyttsp4_lift_all(md); dev_vdbg(dev, "%s: done\n", __func__); rc = 0; cyttsp4_xy_worker_exit: return rc; }