Lines Matching refs:psmouse

85 			(void *) offsetof(struct psmouse, rate),
88 (void *) offsetof(struct psmouse, resolution),
91 (void *) offsetof(struct psmouse, resetafter),
94 (void *) offsetof(struct psmouse, resync_time),
149 psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse) in psmouse_process_byte() argument
151 struct input_dev *dev = psmouse->dev; in psmouse_process_byte()
152 u8 *packet = psmouse->packet; in psmouse_process_byte()
155 if (psmouse->pktcnt < psmouse->pktsize) in psmouse_process_byte()
160 switch (psmouse->protocol->type) { in psmouse_process_byte()
231 packet[0] |= psmouse->extra_buttons; in psmouse_process_byte()
239 void psmouse_queue_work(struct psmouse *psmouse, struct delayed_work *work, in psmouse_queue_work() argument
248 static inline void __psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state) in __psmouse_set_state() argument
250 psmouse->state = new_state; in __psmouse_set_state()
251 psmouse->pktcnt = psmouse->out_of_sync_cnt = 0; in __psmouse_set_state()
252 psmouse->ps2dev.flags = 0; in __psmouse_set_state()
253 psmouse->last = jiffies; in __psmouse_set_state()
261 void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state) in psmouse_set_state() argument
263 serio_pause_rx(psmouse->ps2dev.serio); in psmouse_set_state()
264 __psmouse_set_state(psmouse, new_state); in psmouse_set_state()
265 serio_continue_rx(psmouse->ps2dev.serio); in psmouse_set_state()
272 static int psmouse_handle_byte(struct psmouse *psmouse) in psmouse_handle_byte() argument
274 psmouse_ret_t rc = psmouse->protocol_handler(psmouse); in psmouse_handle_byte()
278 if (psmouse->state == PSMOUSE_ACTIVATED) { in psmouse_handle_byte()
279 psmouse_warn(psmouse, in psmouse_handle_byte()
281 psmouse->name, psmouse->phys, in psmouse_handle_byte()
282 psmouse->pktcnt); in psmouse_handle_byte()
283 if (++psmouse->out_of_sync_cnt == psmouse->resetafter) { in psmouse_handle_byte()
284 __psmouse_set_state(psmouse, PSMOUSE_IGNORE); in psmouse_handle_byte()
285 psmouse_notice(psmouse, in psmouse_handle_byte()
287 serio_reconnect(psmouse->ps2dev.serio); in psmouse_handle_byte()
291 psmouse->pktcnt = 0; in psmouse_handle_byte()
295 psmouse->pktcnt = 0; in psmouse_handle_byte()
296 if (psmouse->out_of_sync_cnt) { in psmouse_handle_byte()
297 psmouse->out_of_sync_cnt = 0; in psmouse_handle_byte()
298 psmouse_notice(psmouse, in psmouse_handle_byte()
300 psmouse->name, psmouse->phys); in psmouse_handle_byte()
310 static void psmouse_handle_oob_data(struct psmouse *psmouse, u8 data) in psmouse_handle_oob_data() argument
312 switch (psmouse->oob_data_type) { in psmouse_handle_oob_data()
314 psmouse->oob_data_type = data; in psmouse_handle_oob_data()
318 psmouse_report_standard_buttons(psmouse->dev, data); in psmouse_handle_oob_data()
319 input_sync(psmouse->dev); in psmouse_handle_oob_data()
321 psmouse->extra_buttons = data; in psmouse_handle_oob_data()
322 psmouse->oob_data_type = PSMOUSE_OOB_NONE; in psmouse_handle_oob_data()
326 psmouse_warn(psmouse, in psmouse_handle_oob_data()
328 psmouse->oob_data_type); in psmouse_handle_oob_data()
329 psmouse->oob_data_type = PSMOUSE_OOB_NONE; in psmouse_handle_oob_data()
341 struct psmouse *psmouse = serio_get_drvdata(serio); in psmouse_interrupt() local
343 if (psmouse->state == PSMOUSE_IGNORE) in psmouse_interrupt()
348 !psmouse->protocol->ignore_parity))) { in psmouse_interrupt()
350 if (psmouse->state == PSMOUSE_ACTIVATED) in psmouse_interrupt()
351 psmouse_warn(psmouse, in psmouse_interrupt()
355 ps2_cmd_aborted(&psmouse->ps2dev); in psmouse_interrupt()
360 psmouse_handle_oob_data(psmouse, data); in psmouse_interrupt()
364 if (unlikely(psmouse->ps2dev.flags & PS2_FLAG_ACK)) in psmouse_interrupt()
365 if (ps2_handle_ack(&psmouse->ps2dev, data)) in psmouse_interrupt()
368 if (unlikely(psmouse->ps2dev.flags & PS2_FLAG_CMD)) in psmouse_interrupt()
369 if (ps2_handle_response(&psmouse->ps2dev, data)) in psmouse_interrupt()
374 if (psmouse->state <= PSMOUSE_RESYNCING) in psmouse_interrupt()
377 if (psmouse->state == PSMOUSE_ACTIVATED && in psmouse_interrupt()
378 psmouse->pktcnt && time_after(jiffies, psmouse->last + HZ/2)) { in psmouse_interrupt()
379 psmouse_info(psmouse, "%s at %s lost synchronization, throwing %d bytes away.\n", in psmouse_interrupt()
380 psmouse->name, psmouse->phys, psmouse->pktcnt); in psmouse_interrupt()
381 psmouse->badbyte = psmouse->packet[0]; in psmouse_interrupt()
382 __psmouse_set_state(psmouse, PSMOUSE_RESYNCING); in psmouse_interrupt()
383 psmouse_queue_work(psmouse, &psmouse->resync_work, 0); in psmouse_interrupt()
387 psmouse->packet[psmouse->pktcnt++] = data; in psmouse_interrupt()
390 if (unlikely(psmouse->packet[0] == PSMOUSE_RET_BAT && psmouse->pktcnt <= 2)) { in psmouse_interrupt()
391 if (psmouse->pktcnt == 1) { in psmouse_interrupt()
392 psmouse->last = jiffies; in psmouse_interrupt()
396 if (psmouse->packet[1] == PSMOUSE_RET_ID || in psmouse_interrupt()
397 (psmouse->protocol->type == PSMOUSE_HGPK && in psmouse_interrupt()
398 psmouse->packet[1] == PSMOUSE_RET_BAT)) { in psmouse_interrupt()
399 __psmouse_set_state(psmouse, PSMOUSE_IGNORE); in psmouse_interrupt()
405 psmouse->pktcnt = 1; in psmouse_interrupt()
406 if (psmouse_handle_byte(psmouse)) in psmouse_interrupt()
409 psmouse->packet[psmouse->pktcnt++] = data; in psmouse_interrupt()
416 if (psmouse->state == PSMOUSE_ACTIVATED && in psmouse_interrupt()
417 psmouse->pktcnt == 1 && psmouse->resync_time && in psmouse_interrupt()
418 time_after(jiffies, psmouse->last + psmouse->resync_time * HZ)) { in psmouse_interrupt()
419 psmouse->badbyte = psmouse->packet[0]; in psmouse_interrupt()
420 __psmouse_set_state(psmouse, PSMOUSE_RESYNCING); in psmouse_interrupt()
421 psmouse_queue_work(psmouse, &psmouse->resync_work, 0); in psmouse_interrupt()
425 psmouse->last = jiffies; in psmouse_interrupt()
426 psmouse_handle_byte(psmouse); in psmouse_interrupt()
435 int psmouse_reset(struct psmouse *psmouse) in psmouse_reset() argument
440 error = ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_RESET_BAT); in psmouse_reset()
453 void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution) in psmouse_set_resolution() argument
462 ps2_command(&psmouse->ps2dev, &p, PSMOUSE_CMD_SETRES); in psmouse_set_resolution()
463 psmouse->resolution = 25 << p; in psmouse_set_resolution()
469 static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate) in psmouse_set_rate() argument
478 ps2_command(&psmouse->ps2dev, &r, PSMOUSE_CMD_SETRATE); in psmouse_set_rate()
479 psmouse->rate = r; in psmouse_set_rate()
485 static void psmouse_set_scale(struct psmouse *psmouse, enum psmouse_scale scale) in psmouse_set_scale() argument
487 ps2_command(&psmouse->ps2dev, NULL, in psmouse_set_scale()
495 static int psmouse_poll(struct psmouse *psmouse) in psmouse_poll() argument
497 return ps2_command(&psmouse->ps2dev, psmouse->packet, in psmouse_poll()
498 PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)); in psmouse_poll()
515 bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[]) in psmouse_matches_pnp_id() argument
517 struct serio *serio = psmouse->ps2dev.serio; in psmouse_matches_pnp_id()
545 static int genius_detect(struct psmouse *psmouse, bool set_properties) in genius_detect() argument
547 struct ps2dev *ps2dev = &psmouse->ps2dev; in genius_detect()
561 __set_bit(BTN_MIDDLE, psmouse->dev->keybit); in genius_detect()
562 __set_bit(BTN_EXTRA, psmouse->dev->keybit); in genius_detect()
563 __set_bit(BTN_SIDE, psmouse->dev->keybit); in genius_detect()
564 __set_bit(REL_WHEEL, psmouse->dev->relbit); in genius_detect()
566 psmouse->vendor = "Genius"; in genius_detect()
567 psmouse->name = "Mouse"; in genius_detect()
568 psmouse->pktsize = 4; in genius_detect()
577 static int intellimouse_detect(struct psmouse *psmouse, bool set_properties) in intellimouse_detect() argument
579 struct ps2dev *ps2dev = &psmouse->ps2dev; in intellimouse_detect()
594 __set_bit(BTN_MIDDLE, psmouse->dev->keybit); in intellimouse_detect()
595 __set_bit(REL_WHEEL, psmouse->dev->relbit); in intellimouse_detect()
597 if (!psmouse->vendor) in intellimouse_detect()
598 psmouse->vendor = "Generic"; in intellimouse_detect()
599 if (!psmouse->name) in intellimouse_detect()
600 psmouse->name = "Wheel Mouse"; in intellimouse_detect()
601 psmouse->pktsize = 4; in intellimouse_detect()
610 static int im_explorer_detect(struct psmouse *psmouse, bool set_properties) in im_explorer_detect() argument
612 struct ps2dev *ps2dev = &psmouse->ps2dev; in im_explorer_detect()
615 intellimouse_detect(psmouse, 0); in im_explorer_detect()
637 __set_bit(BTN_MIDDLE, psmouse->dev->keybit); in im_explorer_detect()
638 __set_bit(REL_WHEEL, psmouse->dev->relbit); in im_explorer_detect()
639 __set_bit(REL_HWHEEL, psmouse->dev->relbit); in im_explorer_detect()
640 __set_bit(BTN_SIDE, psmouse->dev->keybit); in im_explorer_detect()
641 __set_bit(BTN_EXTRA, psmouse->dev->keybit); in im_explorer_detect()
643 if (!psmouse->vendor) in im_explorer_detect()
644 psmouse->vendor = "Generic"; in im_explorer_detect()
645 if (!psmouse->name) in im_explorer_detect()
646 psmouse->name = "Explorer Mouse"; in im_explorer_detect()
647 psmouse->pktsize = 4; in im_explorer_detect()
656 static int thinking_detect(struct psmouse *psmouse, bool set_properties) in thinking_detect() argument
658 struct ps2dev *ps2dev = &psmouse->ps2dev; in thinking_detect()
677 __set_bit(BTN_MIDDLE, psmouse->dev->keybit); in thinking_detect()
678 __set_bit(BTN_EXTRA, psmouse->dev->keybit); in thinking_detect()
680 psmouse->vendor = "Kensington"; in thinking_detect()
681 psmouse->name = "ThinkingMouse"; in thinking_detect()
690 static int ps2bare_detect(struct psmouse *psmouse, bool set_properties) in ps2bare_detect() argument
693 if (!psmouse->vendor) in ps2bare_detect()
694 psmouse->vendor = "Generic"; in ps2bare_detect()
695 if (!psmouse->name) in ps2bare_detect()
696 psmouse->name = "Mouse"; in ps2bare_detect()
702 input_set_capability(psmouse->dev, EV_KEY, BTN_MIDDLE); in ps2bare_detect()
712 static int cortron_detect(struct psmouse *psmouse, bool set_properties) in cortron_detect() argument
715 psmouse->vendor = "Cortron"; in cortron_detect()
716 psmouse->name = "PS/2 Trackball"; in cortron_detect()
718 __set_bit(BTN_MIDDLE, psmouse->dev->keybit); in cortron_detect()
719 __set_bit(BTN_SIDE, psmouse->dev->keybit); in cortron_detect()
963 static void psmouse_apply_defaults(struct psmouse *psmouse) in psmouse_apply_defaults() argument
965 struct input_dev *input_dev = psmouse->dev; in psmouse_apply_defaults()
981 psmouse->protocol = &psmouse_protocols[0]; in psmouse_apply_defaults()
983 psmouse->set_rate = psmouse_set_rate; in psmouse_apply_defaults()
984 psmouse->set_resolution = psmouse_set_resolution; in psmouse_apply_defaults()
985 psmouse->set_scale = psmouse_set_scale; in psmouse_apply_defaults()
986 psmouse->poll = psmouse_poll; in psmouse_apply_defaults()
987 psmouse->protocol_handler = psmouse_process_byte; in psmouse_apply_defaults()
988 psmouse->pktsize = 3; in psmouse_apply_defaults()
989 psmouse->reconnect = NULL; in psmouse_apply_defaults()
990 psmouse->fast_reconnect = NULL; in psmouse_apply_defaults()
991 psmouse->disconnect = NULL; in psmouse_apply_defaults()
992 psmouse->cleanup = NULL; in psmouse_apply_defaults()
993 psmouse->pt_activate = NULL; in psmouse_apply_defaults()
994 psmouse->pt_deactivate = NULL; in psmouse_apply_defaults()
997 static bool psmouse_do_detect(int (*detect)(struct psmouse *, bool), in psmouse_do_detect() argument
998 struct psmouse *psmouse, bool allow_passthrough, in psmouse_do_detect() argument
1001 if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU && in psmouse_do_detect()
1007 psmouse_apply_defaults(psmouse); in psmouse_do_detect()
1009 return detect(psmouse, set_properties) == 0; in psmouse_do_detect()
1012 static bool psmouse_try_protocol(struct psmouse *psmouse, in psmouse_try_protocol() argument
1023 if (!psmouse_do_detect(proto->detect, psmouse, proto->try_passthru, in psmouse_try_protocol()
1028 if (proto->init(psmouse) != 0) { in psmouse_try_protocol()
1047 static int psmouse_extensions(struct psmouse *psmouse, in psmouse_extensions() argument
1058 psmouse, false, set_properties)) { in psmouse_extensions()
1061 (!set_properties || focaltech_init(psmouse) == 0)) { in psmouse_extensions()
1079 if (psmouse_try_protocol(psmouse, PSMOUSE_LIFEBOOK, &max_proto, in psmouse_extensions()
1083 if (psmouse_try_protocol(psmouse, PSMOUSE_VMMOUSE, &max_proto, in psmouse_extensions()
1092 psmouse_try_protocol(psmouse, PSMOUSE_THINKPS, &max_proto, in psmouse_extensions()
1105 psmouse, false, set_properties)) { in psmouse_extensions()
1119 ret = synaptics_init(psmouse); in psmouse_extensions()
1137 synaptics_reset(psmouse); in psmouse_extensions()
1146 psmouse_try_protocol(psmouse, PSMOUSE_CYPRESS, &max_proto, in psmouse_extensions()
1153 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); in psmouse_extensions()
1154 if (psmouse_try_protocol(psmouse, PSMOUSE_ALPS, in psmouse_extensions()
1161 psmouse_try_protocol(psmouse, PSMOUSE_HGPK, &max_proto, in psmouse_extensions()
1168 psmouse_try_protocol(psmouse, PSMOUSE_ELANTECH, in psmouse_extensions()
1173 ret = elantech_init(psmouse); in psmouse_extensions()
1179 if (psmouse_try_protocol(psmouse, PSMOUSE_GENPS, in psmouse_extensions()
1183 if (psmouse_try_protocol(psmouse, PSMOUSE_PS2PP, in psmouse_extensions()
1187 if (psmouse_try_protocol(psmouse, PSMOUSE_TRACKPOINT, in psmouse_extensions()
1191 if (psmouse_try_protocol(psmouse, PSMOUSE_TOUCHKIT_PS2, in psmouse_extensions()
1201 psmouse_try_protocol(psmouse, PSMOUSE_FSP, in psmouse_extensions()
1211 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); in psmouse_extensions()
1212 psmouse_reset(psmouse); in psmouse_extensions()
1215 psmouse_try_protocol(psmouse, PSMOUSE_IMEX, in psmouse_extensions()
1221 psmouse_try_protocol(psmouse, PSMOUSE_IMPS, in psmouse_extensions()
1230 psmouse_try_protocol(psmouse, PSMOUSE_PS2, in psmouse_extensions()
1240 psmouse_reset(psmouse); in psmouse_extensions()
1249 static int psmouse_probe(struct psmouse *psmouse) in psmouse_probe() argument
1251 struct ps2dev *ps2dev = &psmouse->ps2dev; in psmouse_probe()
1276 psmouse_warn(psmouse, "Failed to reset mouse on %s: %d\n", in psmouse_probe()
1285 static void psmouse_initialize(struct psmouse *psmouse) in psmouse_initialize() argument
1291 psmouse->set_rate(psmouse, psmouse->rate); in psmouse_initialize()
1292 psmouse->set_resolution(psmouse, psmouse->resolution); in psmouse_initialize()
1293 psmouse->set_scale(psmouse, PSMOUSE_SCALE11); in psmouse_initialize()
1300 int psmouse_activate(struct psmouse *psmouse) in psmouse_activate() argument
1302 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE)) { in psmouse_activate()
1303 psmouse_warn(psmouse, "Failed to enable mouse on %s\n", in psmouse_activate()
1304 psmouse->ps2dev.serio->phys); in psmouse_activate()
1308 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); in psmouse_activate()
1316 int psmouse_deactivate(struct psmouse *psmouse) in psmouse_deactivate() argument
1320 error = ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE); in psmouse_deactivate()
1322 psmouse_warn(psmouse, "Failed to deactivate mouse on %s: %d\n", in psmouse_deactivate()
1323 psmouse->ps2dev.serio->phys, error); in psmouse_deactivate()
1327 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); in psmouse_deactivate()
1336 struct psmouse *parent = NULL, *psmouse = in psmouse_resync() local
1337 container_of(work, struct psmouse, resync_work.work); in psmouse_resync()
1338 struct serio *serio = psmouse->ps2dev.serio; in psmouse_resync()
1345 if (psmouse->state != PSMOUSE_RESYNCING) in psmouse_resync()
1363 psmouse->num_resyncs++; in psmouse_resync()
1365 if (ps2_sendbyte(&psmouse->ps2dev, PSMOUSE_CMD_DISABLE, 20)) { in psmouse_resync()
1366 if (psmouse->num_resyncs < 3 || psmouse->acks_disable_command) in psmouse_resync()
1369 psmouse->acks_disable_command = true; in psmouse_resync()
1379 if (psmouse->poll(psmouse)) in psmouse_resync()
1382 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); in psmouse_resync()
1383 for (i = 0; i < psmouse->pktsize; i++) { in psmouse_resync()
1384 psmouse->pktcnt++; in psmouse_resync()
1385 rc = psmouse->protocol_handler(psmouse); in psmouse_resync()
1391 psmouse_set_state(psmouse, PSMOUSE_RESYNCING); in psmouse_resync()
1401 if (!ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE)) { in psmouse_resync()
1409 psmouse_warn(psmouse, "failed to re-enable mouse on %s\n", in psmouse_resync()
1410 psmouse->ps2dev.serio->phys); in psmouse_resync()
1415 psmouse_set_state(psmouse, PSMOUSE_IGNORE); in psmouse_resync()
1416 psmouse_info(psmouse, in psmouse_resync()
1420 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); in psmouse_resync()
1433 struct psmouse *psmouse = serio_get_drvdata(serio); in psmouse_cleanup() local
1434 struct psmouse *parent = NULL; in psmouse_cleanup()
1443 psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); in psmouse_cleanup()
1448 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE)) in psmouse_cleanup()
1449 psmouse_warn(psmouse, "Failed to disable mouse on %s\n", in psmouse_cleanup()
1450 psmouse->ps2dev.serio->phys); in psmouse_cleanup()
1452 if (psmouse->cleanup) in psmouse_cleanup()
1453 psmouse->cleanup(psmouse); in psmouse_cleanup()
1458 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); in psmouse_cleanup()
1464 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE); in psmouse_cleanup()
1481 struct psmouse *psmouse = serio_get_drvdata(serio); in psmouse_disconnect() local
1482 struct psmouse *parent = NULL; in psmouse_disconnect()
1488 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); in psmouse_disconnect()
1500 if (psmouse->disconnect) in psmouse_disconnect()
1501 psmouse->disconnect(psmouse); in psmouse_disconnect()
1506 psmouse_set_state(psmouse, PSMOUSE_IGNORE); in psmouse_disconnect()
1511 if (psmouse->dev) in psmouse_disconnect()
1512 input_unregister_device(psmouse->dev); in psmouse_disconnect()
1514 kfree(psmouse); in psmouse_disconnect()
1522 static int psmouse_switch_protocol(struct psmouse *psmouse, in psmouse_switch_protocol() argument
1526 struct input_dev *input_dev = psmouse->dev; in psmouse_switch_protocol()
1529 input_dev->dev.parent = &psmouse->ps2dev.serio->dev; in psmouse_switch_protocol()
1532 psmouse_apply_defaults(psmouse); in psmouse_switch_protocol()
1534 if (proto->detect && proto->detect(psmouse, true) < 0) in psmouse_switch_protocol()
1537 if (proto->init && proto->init(psmouse) < 0) in psmouse_switch_protocol()
1542 type = psmouse_extensions(psmouse, psmouse_max_proto, true); in psmouse_switch_protocol()
1546 psmouse->protocol = selected_proto; in psmouse_switch_protocol()
1553 if (psmouse->pktsize == 3) in psmouse_switch_protocol()
1554 psmouse->resync_time = 0; in psmouse_switch_protocol()
1562 if (psmouse->resync_time && psmouse->poll(psmouse)) in psmouse_switch_protocol()
1563 psmouse->resync_time = 0; in psmouse_switch_protocol()
1565 snprintf(psmouse->devname, sizeof(psmouse->devname), "%s %s %s", in psmouse_switch_protocol()
1566 selected_proto->name, psmouse->vendor, psmouse->name); in psmouse_switch_protocol()
1568 input_dev->name = psmouse->devname; in psmouse_switch_protocol()
1569 input_dev->phys = psmouse->phys; in psmouse_switch_protocol()
1572 input_dev->id.product = psmouse->protocol->type; in psmouse_switch_protocol()
1573 input_dev->id.version = psmouse->model; in psmouse_switch_protocol()
1584 struct psmouse *psmouse, *parent = NULL; in psmouse_connect() local
1599 psmouse = kzalloc(sizeof(struct psmouse), GFP_KERNEL); in psmouse_connect()
1601 if (!psmouse || !input_dev) in psmouse_connect()
1604 ps2_init(&psmouse->ps2dev, serio); in psmouse_connect()
1605 INIT_DELAYED_WORK(&psmouse->resync_work, psmouse_resync); in psmouse_connect()
1606 psmouse->dev = input_dev; in psmouse_connect()
1607 snprintf(psmouse->phys, sizeof(psmouse->phys), "%s/input0", serio->phys); in psmouse_connect()
1609 psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); in psmouse_connect()
1611 serio_set_drvdata(serio, psmouse); in psmouse_connect()
1621 if (psmouse_probe(psmouse) < 0) { in psmouse_connect()
1626 psmouse->rate = psmouse_rate; in psmouse_connect()
1627 psmouse->resolution = psmouse_resolution; in psmouse_connect()
1628 psmouse->resetafter = psmouse_resetafter; in psmouse_connect()
1629 psmouse->resync_time = parent ? 0 : psmouse_resync_time; in psmouse_connect()
1630 psmouse->smartscroll = psmouse_smartscroll; in psmouse_connect()
1632 psmouse_switch_protocol(psmouse, NULL); in psmouse_connect()
1634 if (!psmouse->protocol->smbus_companion) { in psmouse_connect()
1635 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); in psmouse_connect()
1636 psmouse_initialize(psmouse); in psmouse_connect()
1644 psmouse->dev = input_dev = NULL; in psmouse_connect()
1658 if (!psmouse->protocol->smbus_companion) in psmouse_connect()
1659 psmouse_activate(psmouse); in psmouse_connect()
1677 if (psmouse->disconnect) in psmouse_connect()
1678 psmouse->disconnect(psmouse); in psmouse_connect()
1679 psmouse_set_state(psmouse, PSMOUSE_IGNORE); in psmouse_connect()
1686 kfree(psmouse); in psmouse_connect()
1694 struct psmouse *psmouse = serio_get_drvdata(serio); in __psmouse_reconnect() local
1695 struct psmouse *parent = NULL; in __psmouse_reconnect()
1696 int (*reconnect_handler)(struct psmouse *); in __psmouse_reconnect()
1703 reconnect_handler = psmouse->fast_reconnect; in __psmouse_reconnect()
1709 reconnect_handler = psmouse->reconnect; in __psmouse_reconnect()
1717 psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); in __psmouse_reconnect()
1720 if (reconnect_handler(psmouse)) in __psmouse_reconnect()
1723 psmouse_reset(psmouse); in __psmouse_reconnect()
1725 if (psmouse_probe(psmouse) < 0) in __psmouse_reconnect()
1728 type = psmouse_extensions(psmouse, psmouse_max_proto, false); in __psmouse_reconnect()
1729 if (psmouse->protocol->type != type) in __psmouse_reconnect()
1737 if (!psmouse->protocol->smbus_companion) { in __psmouse_reconnect()
1738 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); in __psmouse_reconnect()
1739 psmouse_initialize(psmouse); in __psmouse_reconnect()
1749 if (!psmouse->protocol->smbus_companion) in __psmouse_reconnect()
1750 psmouse_activate(psmouse); in __psmouse_reconnect()
1811 struct psmouse *psmouse = serio_get_drvdata(serio); in psmouse_attr_show_helper() local
1813 if (psmouse->protocol->smbus_companion && in psmouse_attr_show_helper()
1817 return attr->show(psmouse, attr->data, buf); in psmouse_attr_show_helper()
1825 struct psmouse *psmouse, *parent = NULL; in psmouse_attr_set_helper() local
1832 psmouse = serio_get_drvdata(serio); in psmouse_attr_set_helper()
1834 if (psmouse->protocol->smbus_companion && in psmouse_attr_set_helper()
1841 if (psmouse->state == PSMOUSE_IGNORE) { in psmouse_attr_set_helper()
1851 if (!psmouse->protocol->smbus_companion) in psmouse_attr_set_helper()
1852 psmouse_deactivate(psmouse); in psmouse_attr_set_helper()
1855 retval = attr->set(psmouse, attr->data, buf, count); in psmouse_attr_set_helper()
1858 if (retval != -ENODEV && !psmouse->protocol->smbus_companion) in psmouse_attr_set_helper()
1859 psmouse_activate(psmouse); in psmouse_attr_set_helper()
1871 static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char *buf) in psmouse_show_int_attr() argument
1873 unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset); in psmouse_show_int_attr()
1878 static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t … in psmouse_set_int_attr() argument
1880 unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset); in psmouse_set_int_attr()
1893 static ssize_t psmouse_attr_show_protocol(struct psmouse *psmouse, void *data, char *buf) in psmouse_attr_show_protocol() argument
1895 return sprintf(buf, "%s\n", psmouse->protocol->name); in psmouse_attr_show_protocol()
1898 static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, const char *buf, size… in psmouse_attr_set_protocol() argument
1900 struct serio *serio = psmouse->ps2dev.serio; in psmouse_attr_set_protocol()
1901 struct psmouse *parent = NULL; in psmouse_attr_set_protocol()
1911 if (psmouse->protocol == proto) in psmouse_attr_set_protocol()
1920 psmouse_warn(psmouse, in psmouse_attr_set_protocol()
1935 if (psmouse->protocol == proto) { in psmouse_attr_set_protocol()
1947 old_dev = psmouse->dev; in psmouse_attr_set_protocol()
1948 old_proto = psmouse->protocol; in psmouse_attr_set_protocol()
1950 if (psmouse->disconnect) in psmouse_attr_set_protocol()
1951 psmouse->disconnect(psmouse); in psmouse_attr_set_protocol()
1953 psmouse_set_state(psmouse, PSMOUSE_IGNORE); in psmouse_attr_set_protocol()
1955 psmouse->dev = new_dev; in psmouse_attr_set_protocol()
1956 psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); in psmouse_attr_set_protocol()
1958 if (psmouse_switch_protocol(psmouse, proto) < 0) { in psmouse_attr_set_protocol()
1959 psmouse_reset(psmouse); in psmouse_attr_set_protocol()
1961 psmouse_switch_protocol(psmouse, &psmouse_protocols[0]); in psmouse_attr_set_protocol()
1964 psmouse_initialize(psmouse); in psmouse_attr_set_protocol()
1965 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); in psmouse_attr_set_protocol()
1967 if (psmouse->protocol->smbus_companion) { in psmouse_attr_set_protocol()
1968 input_free_device(psmouse->dev); in psmouse_attr_set_protocol()
1969 psmouse->dev = NULL; in psmouse_attr_set_protocol()
1971 error = input_register_device(psmouse->dev); in psmouse_attr_set_protocol()
1973 if (psmouse->disconnect) in psmouse_attr_set_protocol()
1974 psmouse->disconnect(psmouse); in psmouse_attr_set_protocol()
1976 psmouse_set_state(psmouse, PSMOUSE_IGNORE); in psmouse_attr_set_protocol()
1978 psmouse->dev = old_dev; in psmouse_attr_set_protocol()
1979 psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); in psmouse_attr_set_protocol()
1980 psmouse_switch_protocol(psmouse, old_proto); in psmouse_attr_set_protocol()
1981 psmouse_initialize(psmouse); in psmouse_attr_set_protocol()
1982 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); in psmouse_attr_set_protocol()
1997 static ssize_t psmouse_attr_set_rate(struct psmouse *psmouse, void *data, const char *buf, size_t c… in psmouse_attr_set_rate() argument
2006 psmouse->set_rate(psmouse, value); in psmouse_attr_set_rate()
2010 static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, void *data, const char *buf, si… in psmouse_attr_set_resolution() argument
2019 psmouse->set_resolution(psmouse, value); in psmouse_attr_set_resolution()