Lines Matching +full:poll +full:- +full:rate +full:- +full:ms

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (c) 1999-2002 Vojtech Pavlik
6 * Copyright (c) 2003-2004 Dmitry Torokhov
62 module_param_named(rate, psmouse_rate, uint, 0644);
63 MODULE_PARM_DESC(rate, "Report rate, in reports per second.");
84 PSMOUSE_DEFINE_ATTR(rate, S_IWUSR | S_IRUGO,
85 (void *) offsetof(struct psmouse, rate),
110 * (connecting, disconnecting, changing rate or resolution via
111 * sysfs). We could use a per-device semaphore but since there
137 x = packet[1] ? packet[1] - ((packet[0] << 4) & 0x100) : 0; in psmouse_report_standard_motion()
138 y = packet[2] ? packet[2] - ((packet[0] << 3) & 0x100) : 0; in psmouse_report_standard_motion()
141 input_report_rel(dev, REL_Y, -y); in psmouse_report_standard_motion()
156 struct input_dev *dev = psmouse->dev; in psmouse_process_byte()
157 u8 *packet = psmouse->packet; in psmouse_process_byte()
160 if (psmouse->pktcnt < psmouse->pktsize) in psmouse_process_byte()
165 switch (psmouse->protocol->type) { in psmouse_process_byte()
168 input_report_rel(dev, REL_WHEEL, -(s8) packet[3]); in psmouse_process_byte()
176 -sign_extend32(packet[3], 5)); in psmouse_process_byte()
180 -sign_extend32(packet[3], 5)); in psmouse_process_byte()
188 * one reporting +/-1 in the lower nibble, and second in psmouse_process_byte()
189 * one reporting +/-2. in psmouse_process_byte()
194 input_report_rel(dev, REL_WHEEL, -wheel); in psmouse_process_byte()
204 input_report_rel(dev, REL_WHEEL, -(s8) packet[3]); in psmouse_process_byte()
236 packet[0] |= psmouse->extra_buttons; in psmouse_process_byte()
255 psmouse->state = new_state; in __psmouse_set_state()
256 psmouse->pktcnt = psmouse->out_of_sync_cnt = 0; in __psmouse_set_state()
257 psmouse->ps2dev.flags = 0; in __psmouse_set_state()
258 psmouse->last = jiffies; in __psmouse_set_state()
268 serio_pause_rx(psmouse->ps2dev.serio); in psmouse_set_state()
270 serio_continue_rx(psmouse->ps2dev.serio); in psmouse_set_state()
279 psmouse_ret_t rc = psmouse->protocol_handler(psmouse); in psmouse_handle_byte()
283 if (psmouse->state == PSMOUSE_ACTIVATED) { in psmouse_handle_byte()
286 psmouse->name, psmouse->phys, in psmouse_handle_byte()
287 psmouse->pktcnt); in psmouse_handle_byte()
288 if (++psmouse->out_of_sync_cnt == psmouse->resetafter) { in psmouse_handle_byte()
292 serio_reconnect(psmouse->ps2dev.serio); in psmouse_handle_byte()
293 return -EIO; in psmouse_handle_byte()
296 psmouse->pktcnt = 0; in psmouse_handle_byte()
300 psmouse->pktcnt = 0; in psmouse_handle_byte()
301 if (psmouse->out_of_sync_cnt) { in psmouse_handle_byte()
302 psmouse->out_of_sync_cnt = 0; in psmouse_handle_byte()
304 "%s at %s - driver resynced.\n", in psmouse_handle_byte()
305 psmouse->name, psmouse->phys); in psmouse_handle_byte()
317 switch (psmouse->oob_data_type) { in psmouse_handle_oob_data()
319 psmouse->oob_data_type = data; in psmouse_handle_oob_data()
323 psmouse_report_standard_buttons(psmouse->dev, data); in psmouse_handle_oob_data()
324 input_sync(psmouse->dev); in psmouse_handle_oob_data()
326 psmouse->extra_buttons = data; in psmouse_handle_oob_data()
327 psmouse->oob_data_type = PSMOUSE_OOB_NONE; in psmouse_handle_oob_data()
333 psmouse->oob_data_type); in psmouse_handle_oob_data()
334 psmouse->oob_data_type = PSMOUSE_OOB_NONE; in psmouse_handle_oob_data()
345 if (psmouse->state == PSMOUSE_IGNORE) in psmouse_pre_receive_byte()
350 !psmouse->protocol->ignore_parity))) { in psmouse_pre_receive_byte()
352 if (psmouse->state == PSMOUSE_ACTIVATED) in psmouse_pre_receive_byte()
354 "bad data from KBC -%s%s\n", in psmouse_pre_receive_byte()
372 pm_wakeup_event(&ps2dev->serio->dev, 0); in psmouse_receive_byte()
374 if (psmouse->state <= PSMOUSE_RESYNCING) in psmouse_receive_byte()
377 if (psmouse->state == PSMOUSE_ACTIVATED && in psmouse_receive_byte()
378 psmouse->pktcnt && time_after(jiffies, psmouse->last + HZ/2)) { in psmouse_receive_byte()
380 psmouse->name, psmouse->phys, psmouse->pktcnt); in psmouse_receive_byte()
381 psmouse->badbyte = psmouse->packet[0]; in psmouse_receive_byte()
383 psmouse_queue_work(psmouse, &psmouse->resync_work, 0); in psmouse_receive_byte()
387 psmouse->packet[psmouse->pktcnt++] = data; in psmouse_receive_byte()
390 if (unlikely(psmouse->packet[0] == PSMOUSE_RET_BAT && psmouse->pktcnt <= 2)) { in psmouse_receive_byte()
391 if (psmouse->pktcnt == 1) { in psmouse_receive_byte()
392 psmouse->last = jiffies; in psmouse_receive_byte()
396 if (psmouse->packet[1] == PSMOUSE_RET_ID || in psmouse_receive_byte()
397 (psmouse->protocol->type == PSMOUSE_HGPK && in psmouse_receive_byte()
398 psmouse->packet[1] == PSMOUSE_RET_BAT)) { in psmouse_receive_byte()
400 serio_reconnect(ps2dev->serio); in psmouse_receive_byte()
405 psmouse->pktcnt = 1; in psmouse_receive_byte()
409 psmouse->packet[psmouse->pktcnt++] = data; in psmouse_receive_byte()
416 if (psmouse->state == PSMOUSE_ACTIVATED && in psmouse_receive_byte()
417 psmouse->pktcnt == 1 && psmouse->resync_time && in psmouse_receive_byte()
418 time_after(jiffies, psmouse->last + psmouse->resync_time * HZ)) { in psmouse_receive_byte()
419 psmouse->badbyte = psmouse->packet[0]; in psmouse_receive_byte()
421 psmouse_queue_work(psmouse, &psmouse->resync_work, 0); in psmouse_receive_byte()
425 psmouse->last = jiffies; in psmouse_receive_byte()
430 * psmouse_reset() resets the mouse into power-on state.
437 error = ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_RESET_BAT); in psmouse_reset()
442 return -EIO; in psmouse_reset()
459 ps2_command(&psmouse->ps2dev, &p, PSMOUSE_CMD_SETRES); in psmouse_set_resolution()
460 psmouse->resolution = 25 << p; in psmouse_set_resolution()
464 * Here we set the mouse report rate.
466 static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate) in psmouse_set_rate() argument
472 while (rates[i] > rate) in psmouse_set_rate()
475 ps2_command(&psmouse->ps2dev, &r, PSMOUSE_CMD_SETRATE); in psmouse_set_rate()
476 psmouse->rate = r; in psmouse_set_rate()
484 ps2_command(&psmouse->ps2dev, NULL, in psmouse_set_scale()
490 * psmouse_poll() - default poll handler. Everyone except for ALPS uses it.
494 return ps2_command(&psmouse->ps2dev, psmouse->packet, in psmouse_poll()
495 PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)); in psmouse_poll()
510 * psmouse_matches_pnp_id - check if psmouse matches one of the passed in ids.
514 struct serio *serio = psmouse->ps2dev.serio; in psmouse_matches_pnp_id()
518 if (strncmp(serio->firmware_id, "PNP: ", 5)) in psmouse_matches_pnp_id()
521 fw_id_copy = kstrndup(&serio->firmware_id[5], in psmouse_matches_pnp_id()
522 sizeof(serio->firmware_id) - 5, in psmouse_matches_pnp_id()
544 struct ps2dev *ps2dev = &psmouse->ps2dev; in genius_detect()
555 return -ENODEV; in genius_detect()
558 __set_bit(BTN_MIDDLE, psmouse->dev->keybit); in genius_detect()
559 __set_bit(BTN_EXTRA, psmouse->dev->keybit); in genius_detect()
560 __set_bit(BTN_SIDE, psmouse->dev->keybit); in genius_detect()
561 __set_bit(REL_WHEEL, psmouse->dev->relbit); in genius_detect()
563 psmouse->vendor = "Genius"; in genius_detect()
564 psmouse->name = "Mouse"; in genius_detect()
565 psmouse->pktsize = 4; in genius_detect()
576 struct ps2dev *ps2dev = &psmouse->ps2dev; in intellimouse_detect()
588 return -ENODEV; in intellimouse_detect()
591 __set_bit(BTN_MIDDLE, psmouse->dev->keybit); in intellimouse_detect()
592 __set_bit(REL_WHEEL, psmouse->dev->relbit); in intellimouse_detect()
594 if (!psmouse->vendor) in intellimouse_detect()
595 psmouse->vendor = "Generic"; in intellimouse_detect()
596 if (!psmouse->name) in intellimouse_detect()
597 psmouse->name = "Wheel Mouse"; in intellimouse_detect()
598 psmouse->pktsize = 4; in intellimouse_detect()
609 struct ps2dev *ps2dev = &psmouse->ps2dev; in im_explorer_detect()
623 return -ENODEV; in im_explorer_detect()
634 __set_bit(BTN_MIDDLE, psmouse->dev->keybit); in im_explorer_detect()
635 __set_bit(REL_WHEEL, psmouse->dev->relbit); in im_explorer_detect()
636 __set_bit(REL_HWHEEL, psmouse->dev->relbit); in im_explorer_detect()
637 __set_bit(BTN_SIDE, psmouse->dev->keybit); in im_explorer_detect()
638 __set_bit(BTN_EXTRA, psmouse->dev->keybit); in im_explorer_detect()
640 if (!psmouse->vendor) in im_explorer_detect()
641 psmouse->vendor = "Generic"; in im_explorer_detect()
642 if (!psmouse->name) in im_explorer_detect()
643 psmouse->name = "Explorer Mouse"; in im_explorer_detect()
644 psmouse->pktsize = 4; in im_explorer_detect()
655 struct ps2dev *ps2dev = &psmouse->ps2dev; in thinking_detect()
671 return -ENODEV; in thinking_detect()
674 __set_bit(BTN_MIDDLE, psmouse->dev->keybit); in thinking_detect()
675 __set_bit(BTN_EXTRA, psmouse->dev->keybit); in thinking_detect()
677 psmouse->vendor = "Kensington"; in thinking_detect()
678 psmouse->name = "ThinkingMouse"; in thinking_detect()
690 if (!psmouse->vendor) in ps2bare_detect()
691 psmouse->vendor = "Generic"; in ps2bare_detect()
692 if (!psmouse->name) in ps2bare_detect()
693 psmouse->name = "Mouse"; in ps2bare_detect()
699 input_set_capability(psmouse->dev, EV_KEY, BTN_MIDDLE); in ps2bare_detect()
712 psmouse->vendor = "Cortron"; in cortron_detect()
713 psmouse->name = "PS/2 Trackball"; in cortron_detect()
715 __set_bit(BTN_MIDDLE, psmouse->dev->keybit); in cortron_detect()
716 __set_bit(BTN_SIDE, psmouse->dev->keybit); in cortron_detect()
790 .alias = "synaptics-relative",
799 .alias = "synaptics-smbus",
861 .alias = "elantech-smbus",
948 if ((strlen(p->name) == len && !strncmp(p->name, name, len)) || in psmouse_protocol_by_name()
949 (strlen(p->alias) == len && !strncmp(p->alias, name, len))) in psmouse_protocol_by_name()
962 struct input_dev *input_dev = psmouse->dev; in psmouse_apply_defaults()
964 bitmap_zero(input_dev->evbit, EV_CNT); in psmouse_apply_defaults()
965 bitmap_zero(input_dev->keybit, KEY_CNT); in psmouse_apply_defaults()
966 bitmap_zero(input_dev->relbit, REL_CNT); in psmouse_apply_defaults()
967 bitmap_zero(input_dev->absbit, ABS_CNT); in psmouse_apply_defaults()
968 bitmap_zero(input_dev->mscbit, MSC_CNT); in psmouse_apply_defaults()
976 __set_bit(INPUT_PROP_POINTER, input_dev->propbit); in psmouse_apply_defaults()
978 psmouse->protocol = &psmouse_protocols[0]; in psmouse_apply_defaults()
980 psmouse->set_rate = psmouse_set_rate; in psmouse_apply_defaults()
981 psmouse->set_resolution = psmouse_set_resolution; in psmouse_apply_defaults()
982 psmouse->set_scale = psmouse_set_scale; in psmouse_apply_defaults()
983 psmouse->poll = psmouse_poll; in psmouse_apply_defaults()
984 psmouse->protocol_handler = psmouse_process_byte; in psmouse_apply_defaults()
985 psmouse->pktsize = 3; in psmouse_apply_defaults()
986 psmouse->reconnect = NULL; in psmouse_apply_defaults()
987 psmouse->fast_reconnect = NULL; in psmouse_apply_defaults()
988 psmouse->disconnect = NULL; in psmouse_apply_defaults()
989 psmouse->cleanup = NULL; in psmouse_apply_defaults()
990 psmouse->pt_activate = NULL; in psmouse_apply_defaults()
991 psmouse->pt_deactivate = NULL; in psmouse_apply_defaults()
998 if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU && in psmouse_do_detect()
1020 if (!psmouse_do_detect(proto->detect, psmouse, proto->try_passthru, in psmouse_try_protocol()
1024 if (set_properties && proto->init && init_allowed) { in psmouse_try_protocol()
1025 if (proto->init(psmouse) != 0) { in psmouse_try_protocol()
1051 * Always check for focaltech, this is safe as it uses pnp-id in psmouse_extensions()
1063 * does not try to reset rate and resolution, because even in psmouse_extensions()
1096 * Synaptics protocol support is disabled in config - we need to in psmouse_extensions()
1150 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); in psmouse_extensions()
1208 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); in psmouse_extensions()
1248 struct ps2dev *ps2dev = &psmouse->ps2dev; in psmouse_probe()
1254 * case of an IntelliMouse in 4-byte mode or 0x04 for IM Explorer. in psmouse_probe()
1265 return -ENODEV; in psmouse_probe()
1274 ps2dev->serio->phys, error); in psmouse_probe()
1285 * We set the mouse report rate, resolution and scaling. in psmouse_initialize()
1288 psmouse->set_rate(psmouse, psmouse->rate); in psmouse_initialize()
1289 psmouse->set_resolution(psmouse, psmouse->resolution); in psmouse_initialize()
1290 psmouse->set_scale(psmouse, PSMOUSE_SCALE11); in psmouse_initialize()
1299 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE)) { in psmouse_activate()
1301 psmouse->ps2dev.serio->phys); in psmouse_activate()
1302 return -1; in psmouse_activate()
1310 * psmouse_deactivate() puts the mouse into poll mode so that we don't get
1317 error = ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE); in psmouse_deactivate()
1320 psmouse->ps2dev.serio->phys, error); in psmouse_deactivate()
1329 * psmouse_resync() attempts to re-validate current protocol.
1335 struct serio *serio = psmouse->ps2dev.serio; in psmouse_resync()
1342 if (psmouse->state != PSMOUSE_RESYNCING) in psmouse_resync()
1345 if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { in psmouse_resync()
1346 parent = psmouse_from_serio(serio->parent); in psmouse_resync()
1353 * instead of ps2_command() which would wait for 200ms for an ACK in psmouse_resync()
1360 psmouse->num_resyncs++; in psmouse_resync()
1362 if (ps2_sendbyte(&psmouse->ps2dev, PSMOUSE_CMD_DISABLE, 20)) { in psmouse_resync()
1363 if (psmouse->num_resyncs < 3 || psmouse->acks_disable_command) in psmouse_resync()
1366 psmouse->acks_disable_command = true; in psmouse_resync()
1369 * Poll the mouse. If it was reset the packet will be shorter than in psmouse_resync()
1370 * psmouse->pktsize and ps2_command will fail. We do not expect and in psmouse_resync()
1376 if (psmouse->poll(psmouse)) in psmouse_resync()
1380 for (i = 0; i < psmouse->pktsize; i++) { in psmouse_resync()
1381 psmouse->pktcnt++; in psmouse_resync()
1382 rc = psmouse->protocol_handler(psmouse); in psmouse_resync()
1393 * Now try to enable mouse. We try to do that even if poll failed in psmouse_resync()
1398 if (!ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE)) { in psmouse_resync()
1406 psmouse_warn(psmouse, "failed to re-enable mouse on %s\n", in psmouse_resync()
1407 psmouse->ps2dev.serio->phys); in psmouse_resync()
1426 * psmouse_cleanup() resets the mouse into power-on state.
1435 if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { in psmouse_cleanup()
1436 parent = psmouse_from_serio(serio->parent); in psmouse_cleanup()
1445 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE)) in psmouse_cleanup()
1447 psmouse->ps2dev.serio->phys); in psmouse_cleanup()
1449 if (psmouse->cleanup) in psmouse_cleanup()
1450 psmouse->cleanup(psmouse); in psmouse_cleanup()
1455 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); in psmouse_cleanup()
1461 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE); in psmouse_cleanup()
1464 if (parent->pt_deactivate) in psmouse_cleanup()
1465 parent->pt_deactivate(parent); in psmouse_cleanup()
1490 if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { in psmouse_disconnect()
1491 parent = psmouse_from_serio(serio->parent); in psmouse_disconnect()
1495 if (psmouse->disconnect) in psmouse_disconnect()
1496 psmouse->disconnect(psmouse); in psmouse_disconnect()
1498 if (parent && parent->pt_deactivate) in psmouse_disconnect()
1499 parent->pt_deactivate(parent); in psmouse_disconnect()
1506 if (psmouse->dev) in psmouse_disconnect()
1507 input_unregister_device(psmouse->dev); in psmouse_disconnect()
1521 struct input_dev *input_dev = psmouse->dev; in psmouse_switch_protocol()
1524 input_dev->dev.parent = &psmouse->ps2dev.serio->dev; in psmouse_switch_protocol()
1526 if (proto && (proto->detect || proto->init)) { in psmouse_switch_protocol()
1529 if (proto->detect && proto->detect(psmouse, true) < 0) in psmouse_switch_protocol()
1530 return -1; in psmouse_switch_protocol()
1532 if (proto->init && proto->init(psmouse) < 0) in psmouse_switch_protocol()
1533 return -1; in psmouse_switch_protocol()
1541 psmouse->protocol = selected_proto; in psmouse_switch_protocol()
1545 * device in hopes to detect protocol reset - we won't get less in psmouse_switch_protocol()
1548 if (psmouse->pktsize == 3) in psmouse_switch_protocol()
1549 psmouse->resync_time = 0; in psmouse_switch_protocol()
1552 * Some smart KVMs fake response to POLL command returning just in psmouse_switch_protocol()
1553 * 3 bytes and messing up our resync logic, so if initial poll in psmouse_switch_protocol()
1557 if (psmouse->resync_time && psmouse->poll(psmouse)) in psmouse_switch_protocol()
1558 psmouse->resync_time = 0; in psmouse_switch_protocol()
1560 snprintf(psmouse->devname, sizeof(psmouse->devname), "%s %s %s", in psmouse_switch_protocol()
1561 selected_proto->name, psmouse->vendor, psmouse->name); in psmouse_switch_protocol()
1563 input_dev->name = psmouse->devname; in psmouse_switch_protocol()
1564 input_dev->phys = psmouse->phys; in psmouse_switch_protocol()
1565 input_dev->id.bustype = BUS_I8042; in psmouse_switch_protocol()
1566 input_dev->id.vendor = 0x0002; in psmouse_switch_protocol()
1567 input_dev->id.product = psmouse->protocol->type; in psmouse_switch_protocol()
1568 input_dev->id.version = psmouse->model; in psmouse_switch_protocol()
1581 int retval = 0, error = -ENOMEM; in psmouse_connect()
1586 * If this is a pass-through port deactivate parent so the device in psmouse_connect()
1589 if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { in psmouse_connect()
1590 parent = psmouse_from_serio(serio->parent); in psmouse_connect()
1599 ps2_init(&psmouse->ps2dev, serio, in psmouse_connect()
1601 INIT_DELAYED_WORK(&psmouse->resync_work, psmouse_resync); in psmouse_connect()
1602 psmouse->dev = input_dev; in psmouse_connect()
1603 snprintf(psmouse->phys, sizeof(psmouse->phys), "%s/input0", serio->phys); in psmouse_connect()
1612 if (serio->id.type == SERIO_PS_PSTHRU) in psmouse_connect()
1616 error = -ENODEV; in psmouse_connect()
1620 psmouse->rate = psmouse_rate; in psmouse_connect()
1621 psmouse->resolution = psmouse_resolution; in psmouse_connect()
1622 psmouse->resetafter = psmouse_resetafter; in psmouse_connect()
1623 psmouse->resync_time = parent ? 0 : psmouse_resync_time; in psmouse_connect()
1624 psmouse->smartscroll = psmouse_smartscroll; in psmouse_connect()
1628 if (!psmouse->protocol->smbus_companion) { in psmouse_connect()
1638 psmouse->dev = input_dev = NULL; in psmouse_connect()
1641 if (parent && parent->pt_activate) in psmouse_connect()
1642 parent->pt_activate(parent); in psmouse_connect()
1648 if (!psmouse->protocol->smbus_companion) in psmouse_connect()
1652 /* If this is a pass-through port the parent needs to be re-activated */ in psmouse_connect()
1660 if (psmouse->disconnect) in psmouse_connect()
1661 psmouse->disconnect(psmouse); in psmouse_connect()
1681 int rc = -1; in __psmouse_reconnect()
1686 reconnect_handler = psmouse->fast_reconnect; in __psmouse_reconnect()
1688 rc = -ENOENT; in __psmouse_reconnect()
1692 reconnect_handler = psmouse->reconnect; in __psmouse_reconnect()
1695 if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { in __psmouse_reconnect()
1696 parent = psmouse_from_serio(serio->parent); in __psmouse_reconnect()
1712 if (psmouse->protocol->type != type) in __psmouse_reconnect()
1720 if (!psmouse->protocol->smbus_companion) { in __psmouse_reconnect()
1725 if (parent && parent->pt_activate) in __psmouse_reconnect()
1726 parent->pt_activate(parent); in __psmouse_reconnect()
1732 if (!psmouse->protocol->smbus_companion) in __psmouse_reconnect()
1738 /* If this is a pass-through port the parent waits to be activated */ in __psmouse_reconnect()
1797 if (psmouse->protocol->smbus_companion && in psmouse_attr_show_helper()
1799 return -ENOENT; in psmouse_attr_show_helper()
1801 return attr->show(psmouse, attr->data, buf); in psmouse_attr_show_helper()
1818 if (psmouse->protocol->smbus_companion && in psmouse_attr_set_helper()
1820 retval = -ENOENT; in psmouse_attr_set_helper()
1824 if (attr->protect) { in psmouse_attr_set_helper()
1825 if (psmouse->state == PSMOUSE_IGNORE) { in psmouse_attr_set_helper()
1826 retval = -ENODEV; in psmouse_attr_set_helper()
1830 if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { in psmouse_attr_set_helper()
1831 parent = psmouse_from_serio(serio->parent); in psmouse_attr_set_helper()
1835 if (!psmouse->protocol->smbus_companion) in psmouse_attr_set_helper()
1839 retval = attr->set(psmouse, attr->data, buf, count); in psmouse_attr_set_helper()
1841 if (attr->protect) { in psmouse_attr_set_helper()
1842 if (retval != -ENODEV && !psmouse->protocol->smbus_companion) in psmouse_attr_set_helper()
1879 return sprintf(buf, "%s\n", psmouse->protocol->name); in psmouse_attr_show_protocol()
1884 struct serio *serio = psmouse->ps2dev.serio; in psmouse_attr_set_protocol()
1893 return -EINVAL; in psmouse_attr_set_protocol()
1895 if (psmouse->protocol == proto) in psmouse_attr_set_protocol()
1900 return -ENOMEM; in psmouse_attr_set_protocol()
1902 while (!list_empty(&serio->children)) { in psmouse_attr_set_protocol()
1907 return -EIO; in psmouse_attr_set_protocol()
1914 if (serio->drv != &psmouse_drv) { in psmouse_attr_set_protocol()
1916 return -ENODEV; in psmouse_attr_set_protocol()
1919 if (psmouse->protocol == proto) { in psmouse_attr_set_protocol()
1925 if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { in psmouse_attr_set_protocol()
1926 parent = psmouse_from_serio(serio->parent); in psmouse_attr_set_protocol()
1927 if (parent->pt_deactivate) in psmouse_attr_set_protocol()
1928 parent->pt_deactivate(parent); in psmouse_attr_set_protocol()
1931 old_dev = psmouse->dev; in psmouse_attr_set_protocol()
1932 old_proto = psmouse->protocol; in psmouse_attr_set_protocol()
1934 if (psmouse->disconnect) in psmouse_attr_set_protocol()
1935 psmouse->disconnect(psmouse); in psmouse_attr_set_protocol()
1939 psmouse->dev = new_dev; in psmouse_attr_set_protocol()
1951 if (psmouse->protocol->smbus_companion) { in psmouse_attr_set_protocol()
1952 input_free_device(psmouse->dev); in psmouse_attr_set_protocol()
1953 psmouse->dev = NULL; in psmouse_attr_set_protocol()
1955 error = input_register_device(psmouse->dev); in psmouse_attr_set_protocol()
1957 if (psmouse->disconnect) in psmouse_attr_set_protocol()
1958 psmouse->disconnect(psmouse); in psmouse_attr_set_protocol()
1962 psmouse->dev = old_dev; in psmouse_attr_set_protocol()
1975 if (parent && parent->pt_activate) in psmouse_attr_set_protocol()
1976 parent->pt_activate(parent); in psmouse_attr_set_protocol()
1990 psmouse->set_rate(psmouse, value); in psmouse_attr_set_rate()
2003 psmouse->set_resolution(psmouse, value); in psmouse_attr_set_resolution()
2013 return -EINVAL; in psmouse_set_maxproto()
2017 if (!proto || !proto->maxproto) in psmouse_set_maxproto()
2018 return -EINVAL; in psmouse_set_maxproto()
2020 *((unsigned int *)kp->arg) = proto->type; in psmouse_set_maxproto()
2027 int type = *((unsigned int *)kp->arg); in psmouse_get_maxproto()
2029 return sprintf(buffer, "%s\n", psmouse_protocol_by_type(type)->name); in psmouse_get_maxproto()
2047 err = -ENOMEM; in psmouse_init()