Lines Matching full:ir
14 * Initial port from lirc driver to ir-core drivery by Jarod, based
15 * partially on a port to an earlier proposed IR infrastructure by
17 * incoming IR buffer parsing routines.
22 * Windows-Media-Center-RC-IR-Collection-Green-Button-Specification-03-08-2011-V2.pdf
45 #define MCE_IRBUF_SIZE 128 /* TX IR buffer length */
50 #define MCE_IRDATA_TRAILER 0x80 /* End of IR data */
58 * The interface between the host and the IR hardware is command-response
76 #define MCE_CMD_PORT_IR 0x9f /* IR-related cmd/rsp */
77 #define MCE_CMD_PORT_SYS 0xff /* System (non-IR) device cmd/rsp */
138 * then we're looking at a raw IR data sample */
195 * 2nd IR receiver (short-range, wideband) for learning mode:
198 * 2, rx2 which under counts IR carrier cycles
249 .name = "Conexant Hybrid TV (cx231xx) MCE IR",
254 .name = "Conexant Hybrid TV (cx231xx) MCE IR",
258 .name = "Conexant Hybrid TV (cx231xx) MCE IR no TX",
283 /* Original Microsoft MCE IR Transceiver (often HP-branded) */
299 /* Philips/Spinel plus IR transceiver for ASUS */
301 /* Philips/Spinel plus IR transceiver for ASUS */
303 /* Philips IR transceiver (Dell branded) */
306 /* Realtek MCE IR Receiver and card reader */
391 /* Elitegroup Computer Systems IR */
401 /* TiVo PC IR Receiver */
453 /* ir-core bits */
483 u8 cmd, rem; /* Remaining IR data bytes in packet */
509 u32 pulse_tunit; /* IR pulse "on" cumulative time units */
595 static void mceusb_dev_printdata(struct mceusb_dev *ir, u8 *buf, int buf_len, in mceusb_dev_printdata() argument
601 struct device *dev = ir->dev; in mceusb_dev_printdata()
618 if (ir->flags.microsoft_gen1 && !out && !offset) { in mceusb_dev_printdata()
623 /* Trace IR data header or trailer */ in mceusb_dev_printdata()
627 dev_dbg(dev, "End of raw IR data"); in mceusb_dev_printdata()
629 dev_dbg(dev, "Raw IR data, %d pulse/space samples", in mceusb_dev_printdata()
760 dev_dbg(dev, "IR TX timeout (TX buffer underrun)"); in mceusb_dev_printdata()
780 static void mceusb_defer_kevent(struct mceusb_dev *ir, int kevent) in mceusb_defer_kevent() argument
782 set_bit(kevent, &ir->kevent_flags); in mceusb_defer_kevent()
784 if (test_bit(EVENT_RST_PEND, &ir->kevent_flags)) { in mceusb_defer_kevent()
785 dev_dbg(ir->dev, "kevent %d dropped pending USB Reset Device", in mceusb_defer_kevent()
790 if (!schedule_work(&ir->kevent)) in mceusb_defer_kevent()
791 dev_dbg(ir->dev, "kevent %d already scheduled", kevent); in mceusb_defer_kevent()
793 dev_dbg(ir->dev, "kevent %d scheduled", kevent); in mceusb_defer_kevent()
806 * Used for IR blaster TX and MCE device commands.
810 static int mce_write(struct mceusb_dev *ir, u8 *data, int size) in mce_write() argument
814 struct device *dev = ir->dev; in mce_write()
820 mceusb_dev_printdata(ir, data, size, 0, size, true); in mce_write()
837 if (usb_endpoint_xfer_int(ir->usb_ep_out)) in mce_write()
838 usb_fill_int_urb(urb, ir->usbdev, ir->pipe_out, in mce_write()
840 ir->usb_ep_out->bInterval); in mce_write()
842 usb_fill_bulk_urb(urb, ir->usbdev, ir->pipe_out, in mce_write()
879 dev_err(ir->dev, "Error: mce write urb status = %d (TX HALT)", in mce_write()
881 mceusb_defer_kevent(ir, EVENT_TX_HALT); in mce_write()
885 dev_err(ir->dev, "Error: mce write urb status = %d", in mce_write()
900 static void mce_command_out(struct mceusb_dev *ir, u8 *data, int size) in mce_command_out() argument
904 if (ir->need_reset) { in mce_command_out()
905 ir->need_reset = false; in mce_command_out()
906 mce_write(ir, DEVICE_RESUME, rsize); in mce_command_out()
910 mce_write(ir, data, size); in mce_command_out()
915 * Transmit IR out the MCE device IR blaster port(s).
917 * Convert IR pulse/space sequence from LIRC to MCE format.
918 * Break up a long IR sequence into multiple parts (MCE IR data packets).
920 * u32 txbuf[] consists of IR pulse, space, ..., and pulse times in usec.
922 * The first IR sample, txbuf[0], is always a pulse.
924 * u8 irbuf[] consists of multiple IR data packets for the MCE device.
925 * A packet is 1 u8 MCE_IRDATA_HEADER and up to 30 u8 IR samples.
926 * An IR sample is 1-bit pulse/space flag with 7-bit time
929 * Return: The number of IR samples sent (> 0) or errno (< 0).
933 struct mceusb_dev *ir = dev->priv; in mceusb_tx_ir() local
941 cmdbuf[2] = ir->tx_mask; in mceusb_tx_ir()
942 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_tx_ir()
944 /* Generate mce IR data packet */ in mceusb_tx_ir()
950 /* Insert IR header every 30th entry */ in mceusb_tx_ir()
952 /* Room for IR header and one IR sample? */ in mceusb_tx_ir()
955 ret = mce_write(ir, irbuf, ircount); in mceusb_tx_ir()
963 /* Insert IR sample */ in mceusb_tx_ir()
972 * Even i = IR pulse in mceusb_tx_ir()
973 * Odd i = IR space in mceusb_tx_ir()
978 /* IR buffer full? */ in mceusb_tx_ir()
986 ret = mce_write(ir, irbuf, ircount); in mceusb_tx_ir()
999 /* Append IR trailer (0x80) to final partial (or empty) IR buffer */ in mceusb_tx_ir()
1003 ret = mce_write(ir, irbuf, ircount); in mceusb_tx_ir()
1010 /* Sets active IR outputs -- mce devices typically have two */
1013 struct mceusb_dev *ir = dev->priv; in mceusb_set_tx_mask() local
1016 int emitters = ir->num_txports ? ir->num_txports : 2; in mceusb_set_tx_mask()
1021 if (ir->flags.tx_mask_normal) in mceusb_set_tx_mask()
1022 ir->tx_mask = mask; in mceusb_set_tx_mask()
1024 ir->tx_mask = (mask != MCE_DEFAULT_TX_MASK ? in mceusb_set_tx_mask()
1033 struct mceusb_dev *ir = dev->priv; in mceusb_set_tx_carrier() local
1040 if (ir->carrier != carrier) { in mceusb_set_tx_carrier()
1043 ir->carrier = carrier; in mceusb_set_tx_carrier()
1046 dev_dbg(ir->dev, "disabling carrier modulation"); in mceusb_set_tx_carrier()
1047 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_set_tx_carrier()
1054 ir->carrier = carrier; in mceusb_set_tx_carrier()
1057 dev_dbg(ir->dev, "requesting %u HZ carrier", in mceusb_set_tx_carrier()
1061 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_set_tx_carrier()
1076 struct mceusb_dev *ir = dev->priv; in mceusb_set_timeout() local
1084 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_set_timeout()
1087 mce_command_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT)); in mceusb_set_timeout()
1099 struct mceusb_dev *ir = dev->priv; in mceusb_set_rx_wideband() local
1103 dev_dbg(ir->dev, "select %s-range receive sensor", in mceusb_set_rx_wideband()
1106 ir->wideband_rx_enabled = true; in mceusb_set_rx_wideband()
1109 ir->wideband_rx_enabled = false; in mceusb_set_rx_wideband()
1112 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_set_rx_wideband()
1113 /* response from device sets ir->learning_active */ in mceusb_set_rx_wideband()
1125 struct mceusb_dev *ir = dev->priv; in mceusb_set_rx_carrier_report() local
1129 dev_dbg(ir->dev, "%s short-range receiver carrier reporting", in mceusb_set_rx_carrier_report()
1132 ir->carrier_report_enabled = true; in mceusb_set_rx_carrier_report()
1133 if (!ir->learning_active) { in mceusb_set_rx_carrier_report()
1135 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_set_rx_carrier_report()
1138 ir->carrier_report_enabled = false; in mceusb_set_rx_carrier_report()
1144 if (ir->learning_active && !ir->wideband_rx_enabled) { in mceusb_set_rx_carrier_report()
1146 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_set_rx_carrier_report()
1154 * Handle PORT_SYS/IR command response received from the MCE device.
1164 static void mceusb_handle_command(struct mceusb_dev *ir, u8 *buf_in) in mceusb_handle_command() argument
1179 ir->txports_cabled |= 1 << *hi; in mceusb_handle_command()
1184 ir->emver = *hi; in mceusb_handle_command()
1189 ir->need_reset = true; in mceusb_handle_command()
1205 ir->rc->timeout = (*hi << 8 | *lo) * MCE_TIME_UNIT; in mceusb_handle_command()
1208 ir->num_txports = *hi; in mceusb_handle_command()
1209 ir->num_rxports = *lo; in mceusb_handle_command()
1215 * will be inaccurate with long duration IR. in mceusb_handle_command()
1220 if (ir->carrier_report_enabled && ir->learning_active && in mceusb_handle_command()
1221 ir->pulse_tunit > 0) { in mceusb_handle_command()
1227 cycles_fix = ir->flags.rx2 == 2 ? ir->pulse_count : 0; in mceusb_handle_command()
1231 ir->pulse_tunit; in mceusb_handle_command()
1232 …dev_dbg(ir->dev, "RX carrier frequency %u Hz (pulse count = %u, cycles = %u, duration = %u, rx2 = … in mceusb_handle_command()
1233 rawir.carrier, ir->pulse_count, carrier_cycles, in mceusb_handle_command()
1234 ir->pulse_tunit, ir->flags.rx2); in mceusb_handle_command()
1235 ir_raw_event_store(ir->rc, &rawir); in mceusb_handle_command()
1241 ir->tx_mask = *hi; in mceusb_handle_command()
1244 ir->learning_active = ((*hi & 0x02) == 0x02); in mceusb_handle_command()
1245 if (ir->rxports_active != *hi) { in mceusb_handle_command()
1246 dev_info(ir->dev, "%s-range (0x%x) receiver active", in mceusb_handle_command()
1247 ir->learning_active ? "short" : "long", *hi); in mceusb_handle_command()
1248 ir->rxports_active = *hi; in mceusb_handle_command()
1255 ir->need_reset = true; in mceusb_handle_command()
1263 static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) in mceusb_process_ir_data() argument
1270 if (ir->flags.microsoft_gen1) in mceusb_process_ir_data()
1278 switch (ir->parser_state) { in mceusb_process_ir_data()
1280 ir->rem = mceusb_cmd_datasize(ir->cmd, ir->buf_in[i]); in mceusb_process_ir_data()
1281 mceusb_dev_printdata(ir, ir->buf_in, buf_len, i - 1, in mceusb_process_ir_data()
1282 ir->rem + 2, false); in mceusb_process_ir_data()
1283 if (i + ir->rem < buf_len) in mceusb_process_ir_data()
1284 mceusb_handle_command(ir, &ir->buf_in[i - 1]); in mceusb_process_ir_data()
1285 ir->parser_state = CMD_DATA; in mceusb_process_ir_data()
1288 ir->rem--; in mceusb_process_ir_data()
1289 rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); in mceusb_process_ir_data()
1290 rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK); in mceusb_process_ir_data()
1292 dev_dbg(ir->dev, "nonsensical irdata %02x with duration 0", in mceusb_process_ir_data()
1293 ir->buf_in[i]); in mceusb_process_ir_data()
1297 ir->pulse_tunit += rawir.duration; in mceusb_process_ir_data()
1298 ir->pulse_count++; in mceusb_process_ir_data()
1302 dev_dbg(ir->dev, "Storing %s %u us (%02x)", in mceusb_process_ir_data()
1304 rawir.duration, ir->buf_in[i]); in mceusb_process_ir_data()
1306 if (ir_raw_event_store_with_filter(ir->rc, &rawir)) in mceusb_process_ir_data()
1310 ir->rem--; in mceusb_process_ir_data()
1313 ir->cmd = ir->buf_in[i]; in mceusb_process_ir_data()
1314 if ((ir->cmd == MCE_CMD_PORT_IR) || in mceusb_process_ir_data()
1315 ((ir->cmd & MCE_PORT_MASK) != in mceusb_process_ir_data()
1321 ir->parser_state = SUBCMD; in mceusb_process_ir_data()
1325 * got IR data prefix (0x80 + num_bytes) in mceusb_process_ir_data()
1327 * IR data packets can span USB messages in mceusb_process_ir_data()
1329 ir->rem = (ir->cmd & MCE_PACKET_LENGTH_MASK); in mceusb_process_ir_data()
1330 mceusb_dev_printdata(ir, ir->buf_in, buf_len, in mceusb_process_ir_data()
1331 i, ir->rem + 1, false); in mceusb_process_ir_data()
1332 if (ir->rem) { in mceusb_process_ir_data()
1333 ir->parser_state = PARSE_IRDATA; in mceusb_process_ir_data()
1337 .duration = ir->rc->timeout in mceusb_process_ir_data()
1340 if (ir_raw_event_store_with_filter(ir->rc, in mceusb_process_ir_data()
1343 ir->pulse_tunit = 0; in mceusb_process_ir_data()
1344 ir->pulse_count = 0; in mceusb_process_ir_data()
1349 if (ir->parser_state != CMD_HEADER && !ir->rem) in mceusb_process_ir_data()
1350 ir->parser_state = CMD_HEADER; in mceusb_process_ir_data()
1354 * Accept IR data spanning multiple rx buffers. in mceusb_process_ir_data()
1357 if (ir->parser_state != PARSE_IRDATA || !ir->rem) in mceusb_process_ir_data()
1358 ir->parser_state = CMD_HEADER; in mceusb_process_ir_data()
1361 dev_dbg(ir->dev, "processed IR data"); in mceusb_process_ir_data()
1362 ir_raw_event_handle(ir->rc); in mceusb_process_ir_data()
1368 struct mceusb_dev *ir; in mceusb_dev_recv() local
1373 ir = urb->context; in mceusb_dev_recv()
1374 if (!ir) { in mceusb_dev_recv()
1382 mceusb_process_ir_data(ir, urb->actual_length); in mceusb_dev_recv()
1394 dev_err(ir->dev, "Error: urb status = %d (RX HALT)", in mceusb_dev_recv()
1396 mceusb_defer_kevent(ir, EVENT_RX_HALT); in mceusb_dev_recv()
1400 dev_err(ir->dev, "Error: urb status = %d", urb->status); in mceusb_dev_recv()
1407 static void mceusb_get_emulator_version(struct mceusb_dev *ir) in mceusb_get_emulator_version() argument
1410 ir->emver = 1; in mceusb_get_emulator_version()
1411 mce_command_out(ir, GET_EMVER, sizeof(GET_EMVER)); in mceusb_get_emulator_version()
1414 static void mceusb_gen1_init(struct mceusb_dev *ir) in mceusb_gen1_init() argument
1417 struct device *dev = ir->dev; in mceusb_gen1_init()
1424 ret = usb_control_msg_recv(ir->usbdev, 0, USB_REQ_SET_ADDRESS, in mceusb_gen1_init()
1433 ret = usb_control_msg_send(ir->usbdev, 0, in mceusb_gen1_init()
1440 ret = usb_control_msg_send(ir->usbdev, 0, in mceusb_gen1_init()
1446 ret = usb_control_msg_send(ir->usbdev, 0, in mceusb_gen1_init()
1452 mce_command_out(ir, DEVICE_RESUME, sizeof(DEVICE_RESUME)); in mceusb_gen1_init()
1455 mce_command_out(ir, GET_REVISION, sizeof(GET_REVISION)); in mceusb_gen1_init()
1458 static void mceusb_gen2_init(struct mceusb_dev *ir) in mceusb_gen2_init() argument
1461 mce_command_out(ir, DEVICE_RESUME, sizeof(DEVICE_RESUME)); in mceusb_gen2_init()
1464 mce_command_out(ir, GET_WAKEVERSION, sizeof(GET_WAKEVERSION)); in mceusb_gen2_init()
1467 mce_command_out(ir, GET_UNKNOWN2, sizeof(GET_UNKNOWN2)); in mceusb_gen2_init()
1470 static void mceusb_get_parameters(struct mceusb_dev *ir) in mceusb_get_parameters() argument
1477 ir->num_txports = 2; in mceusb_get_parameters()
1478 ir->num_rxports = 2; in mceusb_get_parameters()
1481 mce_command_out(ir, GET_NUM_PORTS, sizeof(GET_NUM_PORTS)); in mceusb_get_parameters()
1484 mce_command_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ)); in mceusb_get_parameters()
1486 if (ir->num_txports && !ir->flags.no_tx) in mceusb_get_parameters()
1488 mce_command_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK)); in mceusb_get_parameters()
1491 mce_command_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT)); in mceusb_get_parameters()
1494 mce_command_out(ir, GET_RX_SENSOR, sizeof(GET_RX_SENSOR)); in mceusb_get_parameters()
1496 for (i = 0; i < ir->num_txports; i++) { in mceusb_get_parameters()
1498 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_get_parameters()
1502 static void mceusb_flash_led(struct mceusb_dev *ir) in mceusb_flash_led() argument
1504 if (ir->emver < 2) in mceusb_flash_led()
1507 mce_command_out(ir, FLASH_LED, sizeof(FLASH_LED)); in mceusb_flash_led()
1513 * specified in ir->kevent bit field.
1519 struct mceusb_dev *ir = in mceusb_deferred_kevent() local
1523 dev_err(ir->dev, "kevent handler called (flags 0x%lx)", in mceusb_deferred_kevent()
1524 ir->kevent_flags); in mceusb_deferred_kevent()
1526 if (test_bit(EVENT_RST_PEND, &ir->kevent_flags)) { in mceusb_deferred_kevent()
1527 dev_err(ir->dev, "kevent handler canceled pending USB Reset Device"); in mceusb_deferred_kevent()
1531 if (test_bit(EVENT_RX_HALT, &ir->kevent_flags)) { in mceusb_deferred_kevent()
1532 usb_unlink_urb(ir->urb_in); in mceusb_deferred_kevent()
1533 status = usb_clear_halt(ir->usbdev, ir->pipe_in); in mceusb_deferred_kevent()
1534 dev_err(ir->dev, "rx clear halt status = %d", status); in mceusb_deferred_kevent()
1540 dev_err(ir->dev, in mceusb_deferred_kevent()
1542 usb_queue_reset_device(ir->usbintf); in mceusb_deferred_kevent()
1543 set_bit(EVENT_RST_PEND, &ir->kevent_flags); in mceusb_deferred_kevent()
1544 clear_bit(EVENT_RX_HALT, &ir->kevent_flags); in mceusb_deferred_kevent()
1547 clear_bit(EVENT_TX_HALT, &ir->kevent_flags); in mceusb_deferred_kevent()
1550 clear_bit(EVENT_RX_HALT, &ir->kevent_flags); in mceusb_deferred_kevent()
1551 status = usb_submit_urb(ir->urb_in, GFP_KERNEL); in mceusb_deferred_kevent()
1553 dev_err(ir->dev, "rx unhalt submit urb error = %d", in mceusb_deferred_kevent()
1558 if (test_bit(EVENT_TX_HALT, &ir->kevent_flags)) { in mceusb_deferred_kevent()
1559 status = usb_clear_halt(ir->usbdev, ir->pipe_out); in mceusb_deferred_kevent()
1560 dev_err(ir->dev, "tx clear halt status = %d", status); in mceusb_deferred_kevent()
1566 dev_err(ir->dev, in mceusb_deferred_kevent()
1568 usb_queue_reset_device(ir->usbintf); in mceusb_deferred_kevent()
1569 set_bit(EVENT_RST_PEND, &ir->kevent_flags); in mceusb_deferred_kevent()
1570 clear_bit(EVENT_TX_HALT, &ir->kevent_flags); in mceusb_deferred_kevent()
1573 clear_bit(EVENT_RX_HALT, &ir->kevent_flags); in mceusb_deferred_kevent()
1576 clear_bit(EVENT_TX_HALT, &ir->kevent_flags); in mceusb_deferred_kevent()
1580 static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) in mceusb_init_rc_dev() argument
1582 struct usb_device *udev = ir->usbdev; in mceusb_init_rc_dev()
1583 struct device *dev = ir->dev; in mceusb_init_rc_dev()
1593 usb_make_path(ir->usbdev, ir->phys, sizeof(ir->phys)); in mceusb_init_rc_dev()
1595 rc->device_name = mceusb_model[ir->model].name ? : in mceusb_init_rc_dev()
1597 rc->input_phys = ir->phys; in mceusb_init_rc_dev()
1598 usb_to_input_id(ir->usbdev, &rc->input_id); in mceusb_init_rc_dev()
1600 rc->priv = ir; in mceusb_init_rc_dev()
1605 if (!mceusb_model[ir->model].broken_irtimeout) { in mceusb_init_rc_dev()
1615 if (!ir->flags.no_tx) { in mceusb_init_rc_dev()
1620 if (ir->flags.rx2 > 0) { in mceusb_init_rc_dev()
1636 if (mceusb_model[ir->model].rc_map) in mceusb_init_rc_dev()
1637 rc->map_name = mceusb_model[ir->model].rc_map; in mceusb_init_rc_dev()
1660 struct mceusb_dev *ir = NULL; in mceusb_dev_probe() local
1678 /* There are multi-function devices with non-IR interfaces */ in mceusb_dev_probe()
1719 ir = kzalloc(sizeof(struct mceusb_dev), GFP_KERNEL); in mceusb_dev_probe()
1720 if (!ir) in mceusb_dev_probe()
1723 ir->pipe_in = pipe; in mceusb_dev_probe()
1724 ir->buf_in = usb_alloc_coherent(dev, maxp, GFP_KERNEL, &ir->dma_in); in mceusb_dev_probe()
1725 if (!ir->buf_in) in mceusb_dev_probe()
1728 ir->urb_in = usb_alloc_urb(0, GFP_KERNEL); in mceusb_dev_probe()
1729 if (!ir->urb_in) in mceusb_dev_probe()
1732 ir->usbintf = intf; in mceusb_dev_probe()
1733 ir->usbdev = usb_get_dev(dev); in mceusb_dev_probe()
1734 ir->dev = &intf->dev; in mceusb_dev_probe()
1735 ir->len_in = maxp; in mceusb_dev_probe()
1736 ir->flags.microsoft_gen1 = is_microsoft_gen1; in mceusb_dev_probe()
1737 ir->flags.tx_mask_normal = tx_mask_normal; in mceusb_dev_probe()
1738 ir->flags.no_tx = mceusb_model[model].no_tx; in mceusb_dev_probe()
1739 ir->flags.rx2 = mceusb_model[model].rx2; in mceusb_dev_probe()
1740 ir->model = model; in mceusb_dev_probe()
1743 ir->usb_ep_out = ep_out; in mceusb_dev_probe()
1745 ir->pipe_out = usb_sndintpipe(ir->usbdev, in mceusb_dev_probe()
1748 ir->pipe_out = usb_sndbulkpipe(ir->usbdev, in mceusb_dev_probe()
1765 INIT_WORK(&ir->kevent, mceusb_deferred_kevent); in mceusb_dev_probe()
1767 ir->rc = mceusb_init_rc_dev(ir); in mceusb_dev_probe()
1768 if (!ir->rc) in mceusb_dev_probe()
1773 usb_fill_int_urb(ir->urb_in, dev, pipe, ir->buf_in, maxp, in mceusb_dev_probe()
1774 mceusb_dev_recv, ir, ep_in->bInterval); in mceusb_dev_probe()
1776 usb_fill_bulk_urb(ir->urb_in, dev, pipe, ir->buf_in, maxp, in mceusb_dev_probe()
1777 mceusb_dev_recv, ir); in mceusb_dev_probe()
1779 ir->urb_in->transfer_dma = ir->dma_in; in mceusb_dev_probe()
1780 ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in mceusb_dev_probe()
1784 res = usb_submit_urb(ir->urb_in, GFP_KERNEL); in mceusb_dev_probe()
1789 mceusb_get_emulator_version(ir); in mceusb_dev_probe()
1792 if (ir->flags.microsoft_gen1) in mceusb_dev_probe()
1793 mceusb_gen1_init(ir); in mceusb_dev_probe()
1795 mceusb_gen2_init(ir); in mceusb_dev_probe()
1797 mceusb_get_parameters(ir); in mceusb_dev_probe()
1799 mceusb_flash_led(ir); in mceusb_dev_probe()
1801 if (!ir->flags.no_tx) in mceusb_dev_probe()
1802 mceusb_set_tx_mask(ir->rc, MCE_DEFAULT_TX_MASK); in mceusb_dev_probe()
1804 usb_set_intfdata(intf, ir); in mceusb_dev_probe()
1807 device_set_wakeup_capable(ir->dev, true); in mceusb_dev_probe()
1808 device_set_wakeup_enable(ir->dev, true); in mceusb_dev_probe()
1811 name, ir->emver); in mceusb_dev_probe()
1813 ir->num_txports, ir->txports_cabled, in mceusb_dev_probe()
1814 ir->num_rxports, ir->rxports_active); in mceusb_dev_probe()
1820 cancel_work_sync(&ir->kevent); in mceusb_dev_probe()
1821 usb_put_dev(ir->usbdev); in mceusb_dev_probe()
1822 usb_kill_urb(ir->urb_in); in mceusb_dev_probe()
1823 usb_free_urb(ir->urb_in); in mceusb_dev_probe()
1825 usb_free_coherent(dev, maxp, ir->buf_in, ir->dma_in); in mceusb_dev_probe()
1827 kfree(ir); in mceusb_dev_probe()
1838 struct mceusb_dev *ir = usb_get_intfdata(intf); in mceusb_dev_disconnect() local
1844 if (!ir) in mceusb_dev_disconnect()
1847 ir->usbdev = NULL; in mceusb_dev_disconnect()
1848 cancel_work_sync(&ir->kevent); in mceusb_dev_disconnect()
1849 rc_unregister_device(ir->rc); in mceusb_dev_disconnect()
1850 usb_kill_urb(ir->urb_in); in mceusb_dev_disconnect()
1851 usb_free_urb(ir->urb_in); in mceusb_dev_disconnect()
1852 usb_free_coherent(dev, ir->len_in, ir->buf_in, ir->dma_in); in mceusb_dev_disconnect()
1855 kfree(ir); in mceusb_dev_disconnect()
1860 struct mceusb_dev *ir = usb_get_intfdata(intf); in mceusb_dev_suspend() local
1861 dev_info(ir->dev, "suspend"); in mceusb_dev_suspend()
1862 usb_kill_urb(ir->urb_in); in mceusb_dev_suspend()
1868 struct mceusb_dev *ir = usb_get_intfdata(intf); in mceusb_dev_resume() local
1869 dev_info(ir->dev, "resume"); in mceusb_dev_resume()
1870 if (usb_submit_urb(ir->urb_in, GFP_ATOMIC)) in mceusb_dev_resume()