Lines Matching refs:bd
33 static inline void cyttsp5_btn_key_action(struct cyttsp5_btn_data *bd, in cyttsp5_btn_key_action() argument
36 struct device *dev = bd->dev; in cyttsp5_btn_key_action()
37 struct cyttsp5_sysinfo *si = bd->si; in cyttsp5_btn_key_action()
44 input_report_key(bd->input, si->btn[btn_no].key_code, btn_state); in cyttsp5_btn_key_action()
45 input_sync(bd->input); in cyttsp5_btn_key_action()
53 static void cyttsp5_get_btn_touches(struct cyttsp5_btn_data *bd) in cyttsp5_get_btn_touches() argument
55 struct cyttsp5_sysinfo *si = bd->si; in cyttsp5_get_btn_touches()
65 cyttsp5_btn_key_action(bd, cur_btn, cur_btn_state); in cyttsp5_get_btn_touches()
69 static void cyttsp5_btn_lift_all(struct cyttsp5_btn_data *bd) in cyttsp5_btn_lift_all() argument
71 struct cyttsp5_sysinfo *si = bd->si; in cyttsp5_btn_lift_all()
78 cyttsp5_btn_key_action(bd, i, CY_BTN_RELEASED); in cyttsp5_btn_lift_all()
82 static void cyttsp5_log_btn_data(struct cyttsp5_btn_data *bd) in cyttsp5_log_btn_data() argument
84 struct device *dev = bd->dev; in cyttsp5_log_btn_data()
87 struct cyttsp5_sysinfo *si = bd->si; in cyttsp5_log_btn_data()
108 static int cyttsp5_xy_worker(struct cyttsp5_btn_data *bd) in cyttsp5_xy_worker() argument
110 struct cyttsp5_sysinfo *si = bd->si; in cyttsp5_xy_worker()
114 cyttsp5_get_btn_touches(bd); in cyttsp5_xy_worker()
117 cyttsp5_log_btn_data(bd); in cyttsp5_xy_worker()
127 struct cyttsp5_btn_data *bd = &cd->bd; in cyttsp5_btn_attention() local
130 if (bd->si->xy_mode[2] != bd->si->desc.btn_report_id) in cyttsp5_btn_attention()
134 mutex_lock(&bd->btn_lock); in cyttsp5_btn_attention()
135 rc = cyttsp5_xy_worker(bd); in cyttsp5_btn_attention()
136 mutex_unlock(&bd->btn_lock); in cyttsp5_btn_attention()
146 struct cyttsp5_btn_data *bd = &cd->bd; in cyttsp5_startup_attention() local
148 mutex_lock(&bd->btn_lock); in cyttsp5_startup_attention()
149 cyttsp5_btn_lift_all(bd); in cyttsp5_startup_attention()
150 mutex_unlock(&bd->btn_lock); in cyttsp5_startup_attention()
158 struct cyttsp5_btn_data *bd = &cd->bd; in cyttsp5_btn_suspend_attention() local
160 mutex_lock(&bd->btn_lock); in cyttsp5_btn_suspend_attention()
161 cyttsp5_btn_lift_all(bd); in cyttsp5_btn_suspend_attention()
162 bd->is_suspended = true; in cyttsp5_btn_suspend_attention()
163 mutex_unlock(&bd->btn_lock); in cyttsp5_btn_suspend_attention()
173 struct cyttsp5_btn_data *bd = &cd->bd; in cyttsp5_btn_resume_attention() local
177 mutex_lock(&bd->btn_lock); in cyttsp5_btn_resume_attention()
178 bd->is_suspended = false; in cyttsp5_btn_resume_attention()
179 mutex_unlock(&bd->btn_lock); in cyttsp5_btn_resume_attention()
188 struct cyttsp5_btn_data *bd = &cd->bd; in cyttsp5_btn_open() local
192 mutex_lock(&bd->btn_lock); in cyttsp5_btn_open()
193 bd->is_suspended = false; in cyttsp5_btn_open()
194 mutex_unlock(&bd->btn_lock); in cyttsp5_btn_open()
221 struct cyttsp5_btn_data *bd = &cd->bd; in cyttsp5_btn_close() local
235 mutex_lock(&bd->btn_lock); in cyttsp5_btn_close()
236 if (!bd->is_suspended) { in cyttsp5_btn_close()
238 bd->is_suspended = true; in cyttsp5_btn_close()
240 mutex_unlock(&bd->btn_lock); in cyttsp5_btn_close()
246 struct cyttsp5_btn_data *bd = &cd->bd; in cyttsp5_setup_input_device() local
252 __set_bit(EV_KEY, bd->input->evbit); in cyttsp5_setup_input_device()
254 __func__, bd->si->num_btns); in cyttsp5_setup_input_device()
255 for (i = 0; i < bd->si->num_btns; i++) { in cyttsp5_setup_input_device()
257 __func__, i, bd->si->btn[i].key_code); in cyttsp5_setup_input_device()
258 __set_bit(bd->si->btn[i].key_code, bd->input->keybit); in cyttsp5_setup_input_device()
261 rc = input_register_device(bd->input); in cyttsp5_setup_input_device()
266 bd->input_device_registered = true; in cyttsp5_setup_input_device()
274 struct cyttsp5_btn_data *bd = &cd->bd; in cyttsp5_setup_input_attention() local
277 bd->si = _cyttsp5_request_sysinfo(dev); in cyttsp5_setup_input_attention()
278 if (!bd->si) in cyttsp5_setup_input_attention()
292 struct cyttsp5_btn_data *bd = &cd->bd; in cyttsp5_btn_probe() local
304 mutex_init(&bd->btn_lock); in cyttsp5_btn_probe()
305 bd->dev = dev; in cyttsp5_btn_probe()
306 bd->pdata = btn_pdata; in cyttsp5_btn_probe()
311 bd->input = input_allocate_device(); in cyttsp5_btn_probe()
312 if (!bd->input) { in cyttsp5_btn_probe()
319 if (bd->pdata->inp_dev_name) in cyttsp5_btn_probe()
320 bd->input->name = bd->pdata->inp_dev_name; in cyttsp5_btn_probe()
322 bd->input->name = CYTTSP5_BTN_NAME; in cyttsp5_btn_probe()
323 scnprintf(bd->phys, sizeof(bd->phys), "%s/input%d", dev_name(dev), in cyttsp5_btn_probe()
325 bd->input->phys = bd->phys; in cyttsp5_btn_probe()
326 bd->input->dev.parent = bd->dev; in cyttsp5_btn_probe()
327 bd->input->open = cyttsp5_btn_open; in cyttsp5_btn_probe()
328 bd->input->close = cyttsp5_btn_close; in cyttsp5_btn_probe()
329 input_set_drvdata(bd->input, bd); in cyttsp5_btn_probe()
332 bd->si = _cyttsp5_request_sysinfo(dev); in cyttsp5_btn_probe()
334 if (bd->si) { in cyttsp5_btn_probe()
340 __func__, bd->si); in cyttsp5_btn_probe()
348 input_free_device(bd->input); in cyttsp5_btn_probe()
358 struct cyttsp5_btn_data *bd = &cd->bd; in cyttsp5_btn_release() local
360 if (bd->input_device_registered) { in cyttsp5_btn_release()
361 input_unregister_device(bd->input); in cyttsp5_btn_release()
363 input_free_device(bd->input); in cyttsp5_btn_release()