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 */
510 u32 pulse_tunit; /* IR pulse "on" cumulative time units */
596 static void mceusb_dev_printdata(struct mceusb_dev *ir, u8 *buf, int buf_len, in mceusb_dev_printdata() argument
602 struct device *dev = ir->dev; in mceusb_dev_printdata()
619 if (ir->flags.microsoft_gen1 && !out && !offset) { in mceusb_dev_printdata()
624 /* Trace IR data header or trailer */ in mceusb_dev_printdata()
628 dev_dbg(dev, "End of raw IR data"); in mceusb_dev_printdata()
630 dev_dbg(dev, "Raw IR data, %d pulse/space samples", in mceusb_dev_printdata()
754 dev_dbg(dev, "IR TX timeout (TX buffer underrun)"); in mceusb_dev_printdata()
774 static void mceusb_defer_kevent(struct mceusb_dev *ir, int kevent) in mceusb_defer_kevent() argument
776 set_bit(kevent, &ir->kevent_flags); in mceusb_defer_kevent()
778 if (test_bit(EVENT_RST_PEND, &ir->kevent_flags)) { in mceusb_defer_kevent()
779 dev_dbg(ir->dev, "kevent %d dropped pending USB Reset Device", in mceusb_defer_kevent()
784 if (!schedule_work(&ir->kevent)) in mceusb_defer_kevent()
785 dev_dbg(ir->dev, "kevent %d already scheduled", kevent); in mceusb_defer_kevent()
787 dev_dbg(ir->dev, "kevent %d scheduled", kevent); in mceusb_defer_kevent()
800 * Used for IR blaster TX and MCE device commands.
804 static int mce_write(struct mceusb_dev *ir, u8 *data, int size) in mce_write() argument
808 struct device *dev = ir->dev; in mce_write()
814 mceusb_dev_printdata(ir, data, size, 0, size, true); in mce_write()
831 if (usb_endpoint_xfer_int(ir->usb_ep_out)) in mce_write()
832 usb_fill_int_urb(urb, ir->usbdev, ir->pipe_out, in mce_write()
834 ir->usb_ep_out->bInterval); in mce_write()
836 usb_fill_bulk_urb(urb, ir->usbdev, ir->pipe_out, in mce_write()
873 dev_err(ir->dev, "Error: mce write urb status = %d (TX HALT)", in mce_write()
875 mceusb_defer_kevent(ir, EVENT_TX_HALT); in mce_write()
879 dev_err(ir->dev, "Error: mce write urb status = %d", in mce_write()
894 static void mce_command_out(struct mceusb_dev *ir, u8 *data, int size) in mce_command_out() argument
898 if (ir->need_reset) { in mce_command_out()
899 ir->need_reset = false; in mce_command_out()
900 mce_write(ir, DEVICE_RESUME, rsize); in mce_command_out()
904 mce_write(ir, data, size); in mce_command_out()
909 * Transmit IR out the MCE device IR blaster port(s).
911 * Convert IR pulse/space sequence from LIRC to MCE format.
912 * Break up a long IR sequence into multiple parts (MCE IR data packets).
914 * u32 txbuf[] consists of IR pulse, space, ..., and pulse times in usec.
916 * The first IR sample, txbuf[0], is always a pulse.
918 * u8 irbuf[] consists of multiple IR data packets for the MCE device.
919 * A packet is 1 u8 MCE_IRDATA_HEADER and up to 30 u8 IR samples.
920 * An IR sample is 1-bit pulse/space flag with 7-bit time
923 * Return: The number of IR samples sent (> 0) or errno (< 0).
927 struct mceusb_dev *ir = dev->priv; in mceusb_tx_ir() local
935 cmdbuf[2] = ir->tx_mask; in mceusb_tx_ir()
936 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_tx_ir()
938 /* Generate mce IR data packet */ in mceusb_tx_ir()
944 /* Insert IR header every 30th entry */ in mceusb_tx_ir()
946 /* Room for IR header and one IR sample? */ in mceusb_tx_ir()
949 ret = mce_write(ir, irbuf, ircount); in mceusb_tx_ir()
957 /* Insert IR sample */ in mceusb_tx_ir()
966 * Even i = IR pulse in mceusb_tx_ir()
967 * Odd i = IR space in mceusb_tx_ir()
972 /* IR buffer full? */ in mceusb_tx_ir()
980 ret = mce_write(ir, irbuf, ircount); in mceusb_tx_ir()
993 /* Append IR trailer (0x80) to final partial (or empty) IR buffer */ in mceusb_tx_ir()
997 ret = mce_write(ir, irbuf, ircount); in mceusb_tx_ir()
1004 /* Sets active IR outputs -- mce devices typically have two */
1007 struct mceusb_dev *ir = dev->priv; in mceusb_set_tx_mask() local
1010 int emitters = ir->num_txports ? ir->num_txports : 2; in mceusb_set_tx_mask()
1015 if (ir->flags.tx_mask_normal) in mceusb_set_tx_mask()
1016 ir->tx_mask = mask; in mceusb_set_tx_mask()
1018 ir->tx_mask = (mask != MCE_DEFAULT_TX_MASK ? in mceusb_set_tx_mask()
1027 struct mceusb_dev *ir = dev->priv; in mceusb_set_tx_carrier() local
1034 if (ir->carrier != carrier) { in mceusb_set_tx_carrier()
1037 ir->carrier = carrier; in mceusb_set_tx_carrier()
1040 dev_dbg(ir->dev, "disabling carrier modulation"); in mceusb_set_tx_carrier()
1041 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_set_tx_carrier()
1048 ir->carrier = carrier; in mceusb_set_tx_carrier()
1051 dev_dbg(ir->dev, "requesting %u HZ carrier", in mceusb_set_tx_carrier()
1055 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_set_tx_carrier()
1070 struct mceusb_dev *ir = dev->priv; in mceusb_set_timeout() local
1078 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_set_timeout()
1081 mce_command_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT)); in mceusb_set_timeout()
1093 struct mceusb_dev *ir = dev->priv; in mceusb_set_rx_wideband() local
1097 dev_dbg(ir->dev, "select %s-range receive sensor", in mceusb_set_rx_wideband()
1100 ir->wideband_rx_enabled = true; in mceusb_set_rx_wideband()
1103 ir->wideband_rx_enabled = false; in mceusb_set_rx_wideband()
1106 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_set_rx_wideband()
1107 /* response from device sets ir->learning_active */ in mceusb_set_rx_wideband()
1119 struct mceusb_dev *ir = dev->priv; in mceusb_set_rx_carrier_report() local
1123 dev_dbg(ir->dev, "%s short-range receiver carrier reporting", in mceusb_set_rx_carrier_report()
1126 ir->carrier_report_enabled = true; in mceusb_set_rx_carrier_report()
1127 if (!ir->learning_active) { in mceusb_set_rx_carrier_report()
1129 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_set_rx_carrier_report()
1132 ir->carrier_report_enabled = false; in mceusb_set_rx_carrier_report()
1138 if (ir->learning_active && !ir->wideband_rx_enabled) { in mceusb_set_rx_carrier_report()
1140 mce_command_out(ir, cmdbuf, sizeof(cmdbuf)); in mceusb_set_rx_carrier_report()
1148 * Handle PORT_SYS/IR command response received from the MCE device.
1158 static void mceusb_handle_command(struct mceusb_dev *ir, u8 *buf_in) in mceusb_handle_command() argument
1173 ir->txports_cabled |= 1 << *hi; in mceusb_handle_command()
1178 ir->emver = *hi; in mceusb_handle_command()
1183 ir->need_reset = true; in mceusb_handle_command()
1199 ir->rc->timeout = (*hi << 8 | *lo) * MCE_TIME_UNIT; in mceusb_handle_command()
1202 ir->num_txports = *hi; in mceusb_handle_command()
1203 ir->num_rxports = *lo; in mceusb_handle_command()
1209 * will be inaccurate with long duration IR. in mceusb_handle_command()
1214 if (ir->carrier_report_enabled && ir->learning_active && in mceusb_handle_command()
1215 ir->pulse_tunit > 0) { in mceusb_handle_command()
1221 cycles_fix = ir->flags.rx2 == 2 ? ir->pulse_count : 0; in mceusb_handle_command()
1225 ir->pulse_tunit; in mceusb_handle_command()
1226 …dev_dbg(ir->dev, "RX carrier frequency %u Hz (pulse count = %u, cycles = %u, duration = %u, rx2 = … in mceusb_handle_command()
1227 rawir.carrier, ir->pulse_count, carrier_cycles, in mceusb_handle_command()
1228 ir->pulse_tunit, ir->flags.rx2); in mceusb_handle_command()
1229 ir_raw_event_store(ir->rc, &rawir); in mceusb_handle_command()
1235 ir->tx_mask = *hi; in mceusb_handle_command()
1238 ir->learning_active = ((*hi & 0x02) == 0x02); in mceusb_handle_command()
1239 if (ir->rxports_active != *hi) { in mceusb_handle_command()
1240 dev_info(ir->dev, "%s-range (0x%x) receiver active", in mceusb_handle_command()
1241 ir->learning_active ? "short" : "long", *hi); in mceusb_handle_command()
1242 ir->rxports_active = *hi; in mceusb_handle_command()
1249 ir->need_reset = true; in mceusb_handle_command()
1257 static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) in mceusb_process_ir_data() argument
1264 if (ir->flags.microsoft_gen1) in mceusb_process_ir_data()
1272 switch (ir->parser_state) { in mceusb_process_ir_data()
1274 ir->rem = mceusb_cmd_datasize(ir->cmd, ir->buf_in[i]); in mceusb_process_ir_data()
1275 mceusb_dev_printdata(ir, ir->buf_in, buf_len, i - 1, in mceusb_process_ir_data()
1276 ir->rem + 2, false); in mceusb_process_ir_data()
1277 if (i + ir->rem < buf_len) in mceusb_process_ir_data()
1278 mceusb_handle_command(ir, &ir->buf_in[i - 1]); in mceusb_process_ir_data()
1279 ir->parser_state = CMD_DATA; in mceusb_process_ir_data()
1282 ir->rem--; in mceusb_process_ir_data()
1283 rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); in mceusb_process_ir_data()
1284 rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK); in mceusb_process_ir_data()
1286 dev_dbg(ir->dev, "nonsensical irdata %02x with duration 0", in mceusb_process_ir_data()
1287 ir->buf_in[i]); in mceusb_process_ir_data()
1291 ir->pulse_tunit += rawir.duration; in mceusb_process_ir_data()
1292 ir->pulse_count++; in mceusb_process_ir_data()
1296 dev_dbg(ir->dev, "Storing %s %u us (%02x)", in mceusb_process_ir_data()
1298 rawir.duration, ir->buf_in[i]); in mceusb_process_ir_data()
1300 if (ir_raw_event_store_with_filter(ir->rc, &rawir)) in mceusb_process_ir_data()
1304 ir->rem--; in mceusb_process_ir_data()
1307 ir->cmd = ir->buf_in[i]; in mceusb_process_ir_data()
1308 if ((ir->cmd == MCE_CMD_PORT_IR) || in mceusb_process_ir_data()
1309 ((ir->cmd & MCE_PORT_MASK) != in mceusb_process_ir_data()
1315 ir->parser_state = SUBCMD; in mceusb_process_ir_data()
1319 * got IR data prefix (0x80 + num_bytes) in mceusb_process_ir_data()
1321 * IR data packets can span USB messages in mceusb_process_ir_data()
1323 ir->rem = (ir->cmd & MCE_PACKET_LENGTH_MASK); in mceusb_process_ir_data()
1324 mceusb_dev_printdata(ir, ir->buf_in, buf_len, in mceusb_process_ir_data()
1325 i, ir->rem + 1, false); in mceusb_process_ir_data()
1326 if (ir->rem) { in mceusb_process_ir_data()
1327 ir->parser_state = PARSE_IRDATA; in mceusb_process_ir_data()
1331 .duration = ir->rc->timeout in mceusb_process_ir_data()
1334 if (ir_raw_event_store_with_filter(ir->rc, in mceusb_process_ir_data()
1337 ir->pulse_tunit = 0; in mceusb_process_ir_data()
1338 ir->pulse_count = 0; in mceusb_process_ir_data()
1343 if (ir->parser_state != CMD_HEADER && !ir->rem) in mceusb_process_ir_data()
1344 ir->parser_state = CMD_HEADER; in mceusb_process_ir_data()
1348 * Accept IR data spanning multiple rx buffers. in mceusb_process_ir_data()
1351 if (ir->parser_state != PARSE_IRDATA || !ir->rem) in mceusb_process_ir_data()
1352 ir->parser_state = CMD_HEADER; in mceusb_process_ir_data()
1355 dev_dbg(ir->dev, "processed IR data"); in mceusb_process_ir_data()
1356 ir_raw_event_handle(ir->rc); in mceusb_process_ir_data()
1362 struct mceusb_dev *ir; in mceusb_dev_recv() local
1367 ir = urb->context; in mceusb_dev_recv()
1368 if (!ir) { in mceusb_dev_recv()
1376 mceusb_process_ir_data(ir, urb->actual_length); in mceusb_dev_recv()
1387 dev_err(ir->dev, "Error: urb status = %d (RX HALT)", in mceusb_dev_recv()
1389 mceusb_defer_kevent(ir, EVENT_RX_HALT); in mceusb_dev_recv()
1393 dev_err(ir->dev, "Error: urb status = %d", urb->status); in mceusb_dev_recv()
1400 static void mceusb_get_emulator_version(struct mceusb_dev *ir) in mceusb_get_emulator_version() argument
1403 ir->emver = 1; in mceusb_get_emulator_version()
1404 mce_command_out(ir, GET_EMVER, sizeof(GET_EMVER)); in mceusb_get_emulator_version()
1407 static void mceusb_gen1_init(struct mceusb_dev *ir) in mceusb_gen1_init() argument
1410 struct device *dev = ir->dev; in mceusb_gen1_init()
1423 ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), in mceusb_gen1_init()
1431 ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), in mceusb_gen1_init()
1438 ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), in mceusb_gen1_init()
1444 ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), in mceusb_gen1_init()
1450 mce_command_out(ir, DEVICE_RESUME, sizeof(DEVICE_RESUME)); in mceusb_gen1_init()
1453 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 snprintf(ir->name, sizeof(ir->name), "%s (%04x:%04x)", in mceusb_init_rc_dev()
1594 mceusb_model[ir->model].name ? in mceusb_init_rc_dev()
1595 mceusb_model[ir->model].name : in mceusb_init_rc_dev()
1597 le16_to_cpu(ir->usbdev->descriptor.idVendor), in mceusb_init_rc_dev()
1598 le16_to_cpu(ir->usbdev->descriptor.idProduct)); in mceusb_init_rc_dev()
1600 usb_make_path(ir->usbdev, ir->phys, sizeof(ir->phys)); in mceusb_init_rc_dev()
1602 rc->device_name = ir->name; in mceusb_init_rc_dev()
1603 rc->input_phys = ir->phys; in mceusb_init_rc_dev()
1604 usb_to_input_id(ir->usbdev, &rc->input_id); in mceusb_init_rc_dev()
1606 rc->priv = ir; in mceusb_init_rc_dev()
1610 if (!mceusb_model[ir->model].broken_irtimeout) { in mceusb_init_rc_dev()
1620 if (!ir->flags.no_tx) { in mceusb_init_rc_dev()
1625 if (ir->flags.rx2 > 0) { in mceusb_init_rc_dev()
1641 if (mceusb_model[ir->model].rc_map) in mceusb_init_rc_dev()
1642 rc->map_name = mceusb_model[ir->model].rc_map; in mceusb_init_rc_dev()
1665 struct mceusb_dev *ir = NULL; in mceusb_dev_probe() local
1683 /* There are multi-function devices with non-IR interfaces */ in mceusb_dev_probe()
1724 ir = kzalloc(sizeof(struct mceusb_dev), GFP_KERNEL); in mceusb_dev_probe()
1725 if (!ir) in mceusb_dev_probe()
1728 ir->pipe_in = pipe; in mceusb_dev_probe()
1729 ir->buf_in = usb_alloc_coherent(dev, maxp, GFP_KERNEL, &ir->dma_in); in mceusb_dev_probe()
1730 if (!ir->buf_in) in mceusb_dev_probe()
1733 ir->urb_in = usb_alloc_urb(0, GFP_KERNEL); in mceusb_dev_probe()
1734 if (!ir->urb_in) in mceusb_dev_probe()
1737 ir->usbintf = intf; in mceusb_dev_probe()
1738 ir->usbdev = usb_get_dev(dev); in mceusb_dev_probe()
1739 ir->dev = &intf->dev; in mceusb_dev_probe()
1740 ir->len_in = maxp; in mceusb_dev_probe()
1741 ir->flags.microsoft_gen1 = is_microsoft_gen1; in mceusb_dev_probe()
1742 ir->flags.tx_mask_normal = tx_mask_normal; in mceusb_dev_probe()
1743 ir->flags.no_tx = mceusb_model[model].no_tx; in mceusb_dev_probe()
1744 ir->flags.rx2 = mceusb_model[model].rx2; in mceusb_dev_probe()
1745 ir->model = model; in mceusb_dev_probe()
1748 ir->usb_ep_out = ep_out; in mceusb_dev_probe()
1750 ir->pipe_out = usb_sndintpipe(ir->usbdev, in mceusb_dev_probe()
1753 ir->pipe_out = usb_sndbulkpipe(ir->usbdev, in mceusb_dev_probe()
1770 INIT_WORK(&ir->kevent, mceusb_deferred_kevent); in mceusb_dev_probe()
1772 ir->rc = mceusb_init_rc_dev(ir); in mceusb_dev_probe()
1773 if (!ir->rc) in mceusb_dev_probe()
1778 usb_fill_int_urb(ir->urb_in, dev, pipe, ir->buf_in, maxp, in mceusb_dev_probe()
1779 mceusb_dev_recv, ir, ep_in->bInterval); in mceusb_dev_probe()
1781 usb_fill_bulk_urb(ir->urb_in, dev, pipe, ir->buf_in, maxp, in mceusb_dev_probe()
1782 mceusb_dev_recv, ir); in mceusb_dev_probe()
1784 ir->urb_in->transfer_dma = ir->dma_in; in mceusb_dev_probe()
1785 ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in mceusb_dev_probe()
1789 res = usb_submit_urb(ir->urb_in, GFP_KERNEL); in mceusb_dev_probe()
1794 mceusb_get_emulator_version(ir); in mceusb_dev_probe()
1797 if (ir->flags.microsoft_gen1) in mceusb_dev_probe()
1798 mceusb_gen1_init(ir); in mceusb_dev_probe()
1800 mceusb_gen2_init(ir); in mceusb_dev_probe()
1802 mceusb_get_parameters(ir); in mceusb_dev_probe()
1804 mceusb_flash_led(ir); in mceusb_dev_probe()
1806 if (!ir->flags.no_tx) in mceusb_dev_probe()
1807 mceusb_set_tx_mask(ir->rc, MCE_DEFAULT_TX_MASK); in mceusb_dev_probe()
1809 usb_set_intfdata(intf, ir); in mceusb_dev_probe()
1812 device_set_wakeup_capable(ir->dev, true); in mceusb_dev_probe()
1813 device_set_wakeup_enable(ir->dev, true); in mceusb_dev_probe()
1816 name, ir->emver); in mceusb_dev_probe()
1818 ir->num_txports, ir->txports_cabled, in mceusb_dev_probe()
1819 ir->num_rxports, ir->rxports_active); in mceusb_dev_probe()
1825 cancel_work_sync(&ir->kevent); in mceusb_dev_probe()
1826 usb_put_dev(ir->usbdev); in mceusb_dev_probe()
1827 usb_kill_urb(ir->urb_in); in mceusb_dev_probe()
1828 usb_free_urb(ir->urb_in); in mceusb_dev_probe()
1830 usb_free_coherent(dev, maxp, ir->buf_in, ir->dma_in); in mceusb_dev_probe()
1832 kfree(ir); in mceusb_dev_probe()
1843 struct mceusb_dev *ir = usb_get_intfdata(intf); in mceusb_dev_disconnect() local
1849 if (!ir) in mceusb_dev_disconnect()
1852 ir->usbdev = NULL; in mceusb_dev_disconnect()
1853 cancel_work_sync(&ir->kevent); in mceusb_dev_disconnect()
1854 rc_unregister_device(ir->rc); in mceusb_dev_disconnect()
1855 usb_kill_urb(ir->urb_in); in mceusb_dev_disconnect()
1856 usb_free_urb(ir->urb_in); in mceusb_dev_disconnect()
1857 usb_free_coherent(dev, ir->len_in, ir->buf_in, ir->dma_in); in mceusb_dev_disconnect()
1860 kfree(ir); in mceusb_dev_disconnect()
1865 struct mceusb_dev *ir = usb_get_intfdata(intf); in mceusb_dev_suspend() local
1866 dev_info(ir->dev, "suspend"); in mceusb_dev_suspend()
1867 usb_kill_urb(ir->urb_in); in mceusb_dev_suspend()
1873 struct mceusb_dev *ir = usb_get_intfdata(intf); in mceusb_dev_resume() local
1874 dev_info(ir->dev, "resume"); in mceusb_dev_resume()
1875 if (usb_submit_urb(ir->urb_in, GFP_ATOMIC)) in mceusb_dev_resume()