Lines Matching refs:xpad
724 static int xpad_init_input(struct usb_xpad *xpad);
725 static void xpad_deinit_input(struct usb_xpad *xpad);
726 static void xpadone_ack_mode_report(struct usb_xpad *xpad, u8 seq_num);
727 static void xpad360w_poweroff_controller(struct usb_xpad *xpad);
738 static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data) in xpad_process_packet() argument
740 struct input_dev *dev = xpad->dev; in xpad_process_packet()
742 if (!(xpad->mapping & MAP_STICKS_TO_NULL)) { in xpad_process_packet()
757 if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { in xpad_process_packet()
766 if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { in xpad_process_packet()
809 static void xpad360_process_packet(struct usb_xpad *xpad, struct input_dev *dev, in xpad360_process_packet() argument
817 if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { in xpad360_process_packet()
831 if (!(xpad->mapping & MAP_DPAD_TO_BUTTONS) || in xpad360_process_packet()
832 xpad->xtype == XTYPE_XBOX360W) { in xpad360_process_packet()
856 if (!(xpad->mapping & MAP_STICKS_TO_NULL)) { in xpad360_process_packet()
871 if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { in xpad360_process_packet()
882 if (xpad->xtype == XTYPE_XBOX360W) { in xpad360_process_packet()
883 if (xpad->mode_btn_down_ts > 0 && xpad->pad_present && in xpad360_process_packet()
884 ((ktime_get_seconds() - xpad->mode_btn_down_ts) >= in xpad360_process_packet()
886 xpad360w_poweroff_controller(xpad); in xpad360_process_packet()
887 xpad->mode_btn_down_ts = 0; in xpad360_process_packet()
893 xpad->mode_btn_down_ts = ktime_get_seconds(); in xpad360_process_packet()
895 xpad->mode_btn_down_ts = 0; in xpad360_process_packet()
901 struct usb_xpad *xpad = container_of(work, struct usb_xpad, work); in xpad_presence_work() local
904 if (xpad->pad_present) { in xpad_presence_work()
905 error = xpad_init_input(xpad); in xpad_presence_work()
908 dev_err(&xpad->dev->dev, in xpad_presence_work()
911 rcu_assign_pointer(xpad->x360w_dev, xpad->dev); in xpad_presence_work()
914 RCU_INIT_POINTER(xpad->x360w_dev, NULL); in xpad_presence_work()
920 xpad_deinit_input(xpad); in xpad_presence_work()
938 static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data) in xpad360w_process_packet() argument
947 if (xpad->pad_present != present) { in xpad360w_process_packet()
948 xpad->pad_present = present; in xpad360w_process_packet()
949 schedule_work(&xpad->work); in xpad360w_process_packet()
958 dev = rcu_dereference(xpad->x360w_dev); in xpad360w_process_packet()
960 xpad360_process_packet(xpad, dev, cmd, &data[4]); in xpad360w_process_packet()
973 static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data) in xpadone_process_packet() argument
975 struct input_dev *dev = xpad->dev; in xpadone_process_packet()
986 xpadone_ack_mode_report(xpad, data[2]); in xpadone_process_packet()
994 if (xpad->packet_type == PKT_XBE2_FW_5_11) { in xpadone_process_packet()
1014 if (xpad->mapping & MAP_SELECT_BUTTON) in xpadone_process_packet()
1024 if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { in xpadone_process_packet()
1045 if (!(xpad->mapping & MAP_STICKS_TO_NULL)) { in xpadone_process_packet()
1060 if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { in xpadone_process_packet()
1073 if (xpad->mapping & MAP_PROFILE_BUTTON) in xpadone_process_packet()
1078 if (xpad->mapping & MAP_PADDLES) { in xpadone_process_packet()
1079 if (xpad->packet_type == PKT_XBE1) { in xpadone_process_packet()
1092 } else if (xpad->packet_type == PKT_XBE2_FW_OLD) { in xpadone_process_packet()
1105 } else if (xpad->packet_type == PKT_XBE2_FW_5_EARLY) { in xpadone_process_packet()
1132 struct usb_xpad *xpad = urb->context; in xpad_irq_in() local
1133 struct device *dev = &xpad->intf->dev; in xpad_irq_in()
1155 switch (xpad->xtype) { in xpad_irq_in()
1157 xpad360_process_packet(xpad, xpad->dev, 0, xpad->idata); in xpad_irq_in()
1160 xpad360w_process_packet(xpad, 0, xpad->idata); in xpad_irq_in()
1163 xpadone_process_packet(xpad, 0, xpad->idata); in xpad_irq_in()
1166 xpad_process_packet(xpad, 0, xpad->idata); in xpad_irq_in()
1177 static bool xpad_prepare_next_init_packet(struct usb_xpad *xpad) in xpad_prepare_next_init_packet() argument
1181 if (xpad->xtype != XTYPE_XBOXONE) in xpad_prepare_next_init_packet()
1185 while (xpad->init_seq < ARRAY_SIZE(xboxone_init_packets)) { in xpad_prepare_next_init_packet()
1186 init_packet = &xboxone_init_packets[xpad->init_seq++]; in xpad_prepare_next_init_packet()
1189 init_packet->idVendor != xpad->dev->id.vendor) in xpad_prepare_next_init_packet()
1193 init_packet->idProduct != xpad->dev->id.product) in xpad_prepare_next_init_packet()
1197 memcpy(xpad->odata, init_packet->data, init_packet->len); in xpad_prepare_next_init_packet()
1198 xpad->irq_out->transfer_buffer_length = init_packet->len; in xpad_prepare_next_init_packet()
1201 xpad->odata[2] = xpad->odata_serial++; in xpad_prepare_next_init_packet()
1209 static bool xpad_prepare_next_out_packet(struct usb_xpad *xpad) in xpad_prepare_next_out_packet() argument
1215 if (xpad_prepare_next_init_packet(xpad)) in xpad_prepare_next_out_packet()
1219 if (++xpad->last_out_packet >= XPAD_NUM_OUT_PACKETS) in xpad_prepare_next_out_packet()
1220 xpad->last_out_packet = 0; in xpad_prepare_next_out_packet()
1222 pkt = &xpad->out_packets[xpad->last_out_packet]; in xpad_prepare_next_out_packet()
1224 dev_dbg(&xpad->intf->dev, in xpad_prepare_next_out_packet()
1226 __func__, xpad->last_out_packet); in xpad_prepare_next_out_packet()
1233 memcpy(xpad->odata, packet->data, packet->len); in xpad_prepare_next_out_packet()
1234 xpad->irq_out->transfer_buffer_length = packet->len; in xpad_prepare_next_out_packet()
1243 static int xpad_try_sending_next_out_packet(struct usb_xpad *xpad) in xpad_try_sending_next_out_packet() argument
1247 if (!xpad->irq_out_active && xpad_prepare_next_out_packet(xpad)) { in xpad_try_sending_next_out_packet()
1248 usb_anchor_urb(xpad->irq_out, &xpad->irq_out_anchor); in xpad_try_sending_next_out_packet()
1249 error = usb_submit_urb(xpad->irq_out, GFP_ATOMIC); in xpad_try_sending_next_out_packet()
1251 dev_err(&xpad->intf->dev, in xpad_try_sending_next_out_packet()
1254 usb_unanchor_urb(xpad->irq_out); in xpad_try_sending_next_out_packet()
1258 xpad->irq_out_active = true; in xpad_try_sending_next_out_packet()
1266 struct usb_xpad *xpad = urb->context; in xpad_irq_out() local
1267 struct device *dev = &xpad->intf->dev; in xpad_irq_out()
1272 spin_lock_irqsave(&xpad->odata_lock, flags); in xpad_irq_out()
1277 xpad->irq_out_active = xpad_prepare_next_out_packet(xpad); in xpad_irq_out()
1286 xpad->irq_out_active = false; in xpad_irq_out()
1295 if (xpad->irq_out_active) { in xpad_irq_out()
1296 usb_anchor_urb(urb, &xpad->irq_out_anchor); in xpad_irq_out()
1303 xpad->irq_out_active = false; in xpad_irq_out()
1307 spin_unlock_irqrestore(&xpad->odata_lock, flags); in xpad_irq_out()
1310 static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad, in xpad_init_output() argument
1315 if (xpad->xtype == XTYPE_UNKNOWN) in xpad_init_output()
1318 init_usb_anchor(&xpad->irq_out_anchor); in xpad_init_output()
1320 xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN, in xpad_init_output()
1321 GFP_KERNEL, &xpad->odata_dma); in xpad_init_output()
1322 if (!xpad->odata) in xpad_init_output()
1325 spin_lock_init(&xpad->odata_lock); in xpad_init_output()
1327 xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL); in xpad_init_output()
1328 if (!xpad->irq_out) { in xpad_init_output()
1333 usb_fill_int_urb(xpad->irq_out, xpad->udev, in xpad_init_output()
1334 usb_sndintpipe(xpad->udev, ep_irq_out->bEndpointAddress), in xpad_init_output()
1335 xpad->odata, XPAD_PKT_LEN, in xpad_init_output()
1336 xpad_irq_out, xpad, ep_irq_out->bInterval); in xpad_init_output()
1337 xpad->irq_out->transfer_dma = xpad->odata_dma; in xpad_init_output()
1338 xpad->irq_out->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in xpad_init_output()
1343 usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma); in xpad_init_output()
1347 static void xpad_stop_output(struct usb_xpad *xpad) in xpad_stop_output() argument
1349 if (xpad->xtype != XTYPE_UNKNOWN) { in xpad_stop_output()
1350 if (!usb_wait_anchor_empty_timeout(&xpad->irq_out_anchor, in xpad_stop_output()
1352 dev_warn(&xpad->intf->dev, in xpad_stop_output()
1354 usb_kill_anchored_urbs(&xpad->irq_out_anchor); in xpad_stop_output()
1359 static void xpad_deinit_output(struct usb_xpad *xpad) in xpad_deinit_output() argument
1361 if (xpad->xtype != XTYPE_UNKNOWN) { in xpad_deinit_output()
1362 usb_free_urb(xpad->irq_out); in xpad_deinit_output()
1363 usb_free_coherent(xpad->udev, XPAD_PKT_LEN, in xpad_deinit_output()
1364 xpad->odata, xpad->odata_dma); in xpad_deinit_output()
1368 static int xpad_inquiry_pad_presence(struct usb_xpad *xpad) in xpad_inquiry_pad_presence() argument
1371 &xpad->out_packets[XPAD_OUT_CMD_IDX]; in xpad_inquiry_pad_presence()
1375 spin_lock_irqsave(&xpad->odata_lock, flags); in xpad_inquiry_pad_presence()
1393 xpad->last_out_packet = -1; in xpad_inquiry_pad_presence()
1394 retval = xpad_try_sending_next_out_packet(xpad); in xpad_inquiry_pad_presence()
1396 spin_unlock_irqrestore(&xpad->odata_lock, flags); in xpad_inquiry_pad_presence()
1401 static int xpad_start_xbox_one(struct usb_xpad *xpad) in xpad_start_xbox_one() argument
1406 if (usb_ifnum_to_if(xpad->udev, GIP_WIRED_INTF_AUDIO)) { in xpad_start_xbox_one()
1413 retval = usb_set_interface(xpad->udev, in xpad_start_xbox_one()
1416 dev_warn(&xpad->dev->dev, in xpad_start_xbox_one()
1421 spin_lock_irqsave(&xpad->odata_lock, flags); in xpad_start_xbox_one()
1428 xpad->init_seq = 0; in xpad_start_xbox_one()
1429 retval = xpad_try_sending_next_out_packet(xpad); in xpad_start_xbox_one()
1431 spin_unlock_irqrestore(&xpad->odata_lock, flags); in xpad_start_xbox_one()
1436 static void xpadone_ack_mode_report(struct usb_xpad *xpad, u8 seq_num) in xpadone_ack_mode_report() argument
1440 &xpad->out_packets[XPAD_OUT_CMD_IDX]; in xpadone_ack_mode_report()
1446 spin_lock_irqsave(&xpad->odata_lock, flags); in xpadone_ack_mode_report()
1454 xpad->last_out_packet = -1; in xpadone_ack_mode_report()
1455 xpad_try_sending_next_out_packet(xpad); in xpadone_ack_mode_report()
1457 spin_unlock_irqrestore(&xpad->odata_lock, flags); in xpadone_ack_mode_report()
1463 struct usb_xpad *xpad = input_get_drvdata(dev); in xpad_play_effect() local
1464 struct xpad_output_packet *packet = &xpad->out_packets[XPAD_OUT_FF_IDX]; in xpad_play_effect()
1476 spin_lock_irqsave(&xpad->odata_lock, flags); in xpad_play_effect()
1478 switch (xpad->xtype) { in xpad_play_effect()
1523 packet->data[2] = xpad->odata_serial++; in xpad_play_effect()
1539 dev_dbg(&xpad->dev->dev, in xpad_play_effect()
1541 __func__, xpad->xtype); in xpad_play_effect()
1546 retval = xpad_try_sending_next_out_packet(xpad); in xpad_play_effect()
1549 spin_unlock_irqrestore(&xpad->odata_lock, flags); in xpad_play_effect()
1553 static int xpad_init_ff(struct usb_xpad *xpad) in xpad_init_ff() argument
1555 if (xpad->xtype == XTYPE_UNKNOWN) in xpad_init_ff()
1558 input_set_capability(xpad->dev, EV_FF, FF_RUMBLE); in xpad_init_ff()
1560 return input_ff_create_memless(xpad->dev, NULL, xpad_play_effect); in xpad_init_ff()
1564 static int xpad_init_ff(struct usb_xpad *xpad) { return 0; } in xpad_init_ff() argument
1576 struct usb_xpad *xpad; member
1599 static void xpad_send_led_command(struct usb_xpad *xpad, int command) in xpad_send_led_command() argument
1602 &xpad->out_packets[XPAD_OUT_LED_IDX]; in xpad_send_led_command()
1607 spin_lock_irqsave(&xpad->odata_lock, flags); in xpad_send_led_command()
1609 switch (xpad->xtype) { in xpad_send_led_command()
1636 xpad_try_sending_next_out_packet(xpad); in xpad_send_led_command()
1638 spin_unlock_irqrestore(&xpad->odata_lock, flags); in xpad_send_led_command()
1645 static void xpad_identify_controller(struct usb_xpad *xpad) in xpad_identify_controller() argument
1647 led_set_brightness(&xpad->led->led_cdev, (xpad->pad_nr % 4) + 2); in xpad_identify_controller()
1656 xpad_send_led_command(xpad_led->xpad, value); in xpad_led_set()
1659 static int xpad_led_probe(struct usb_xpad *xpad) in xpad_led_probe() argument
1665 if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX360W) in xpad_led_probe()
1668 xpad->led = led = kzalloc(sizeof(struct xpad_led), GFP_KERNEL); in xpad_led_probe()
1672 xpad->pad_nr = ida_simple_get(&xpad_pad_seq, 0, 0, GFP_KERNEL); in xpad_led_probe()
1673 if (xpad->pad_nr < 0) { in xpad_led_probe()
1674 error = xpad->pad_nr; in xpad_led_probe()
1678 snprintf(led->name, sizeof(led->name), "xpad%d", xpad->pad_nr); in xpad_led_probe()
1679 led->xpad = xpad; in xpad_led_probe()
1686 error = led_classdev_register(&xpad->udev->dev, led_cdev); in xpad_led_probe()
1690 xpad_identify_controller(xpad); in xpad_led_probe()
1695 ida_simple_remove(&xpad_pad_seq, xpad->pad_nr); in xpad_led_probe()
1698 xpad->led = NULL; in xpad_led_probe()
1702 static void xpad_led_disconnect(struct usb_xpad *xpad) in xpad_led_disconnect() argument
1704 struct xpad_led *xpad_led = xpad->led; in xpad_led_disconnect()
1708 ida_simple_remove(&xpad_pad_seq, xpad->pad_nr); in xpad_led_disconnect()
1713 static int xpad_led_probe(struct usb_xpad *xpad) { return 0; } in xpad_led_probe() argument
1714 static void xpad_led_disconnect(struct usb_xpad *xpad) { } in xpad_led_disconnect() argument
1717 static int xpad_start_input(struct usb_xpad *xpad) in xpad_start_input() argument
1721 if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) in xpad_start_input()
1724 if (xpad->xtype == XTYPE_XBOXONE) { in xpad_start_input()
1725 error = xpad_start_xbox_one(xpad); in xpad_start_input()
1727 usb_kill_urb(xpad->irq_in); in xpad_start_input()
1731 if (xpad->xtype == XTYPE_XBOX360) { in xpad_start_input()
1738 error = usb_control_msg_recv(xpad->udev, 0, in xpad_start_input()
1748 dev_warn(&xpad->dev->dev, in xpad_start_input()
1756 static void xpad_stop_input(struct usb_xpad *xpad) in xpad_stop_input() argument
1758 usb_kill_urb(xpad->irq_in); in xpad_stop_input()
1761 static void xpad360w_poweroff_controller(struct usb_xpad *xpad) in xpad360w_poweroff_controller() argument
1765 &xpad->out_packets[XPAD_OUT_CMD_IDX]; in xpad360w_poweroff_controller()
1767 spin_lock_irqsave(&xpad->odata_lock, flags); in xpad360w_poweroff_controller()
1785 xpad->last_out_packet = -1; in xpad360w_poweroff_controller()
1786 xpad_try_sending_next_out_packet(xpad); in xpad360w_poweroff_controller()
1788 spin_unlock_irqrestore(&xpad->odata_lock, flags); in xpad360w_poweroff_controller()
1791 static int xpad360w_start_input(struct usb_xpad *xpad) in xpad360w_start_input() argument
1795 error = usb_submit_urb(xpad->irq_in, GFP_KERNEL); in xpad360w_start_input()
1806 error = xpad_inquiry_pad_presence(xpad); in xpad360w_start_input()
1808 usb_kill_urb(xpad->irq_in); in xpad360w_start_input()
1815 static void xpad360w_stop_input(struct usb_xpad *xpad) in xpad360w_stop_input() argument
1817 usb_kill_urb(xpad->irq_in); in xpad360w_stop_input()
1820 flush_work(&xpad->work); in xpad360w_stop_input()
1825 struct usb_xpad *xpad = input_get_drvdata(dev); in xpad_open() local
1827 return xpad_start_input(xpad); in xpad_open()
1832 struct usb_xpad *xpad = input_get_drvdata(dev); in xpad_close() local
1834 xpad_stop_input(xpad); in xpad_close()
1839 struct usb_xpad *xpad = input_get_drvdata(input_dev); in xpad_set_up_abs() local
1850 if (xpad->xtype == XTYPE_XBOXONE) in xpad_set_up_abs()
1868 static void xpad_deinit_input(struct usb_xpad *xpad) in xpad_deinit_input() argument
1870 if (xpad->input_created) { in xpad_deinit_input()
1871 xpad->input_created = false; in xpad_deinit_input()
1872 xpad_led_disconnect(xpad); in xpad_deinit_input()
1873 input_unregister_device(xpad->dev); in xpad_deinit_input()
1877 static int xpad_init_input(struct usb_xpad *xpad) in xpad_init_input() argument
1886 xpad->dev = input_dev; in xpad_init_input()
1887 input_dev->name = xpad->name; in xpad_init_input()
1888 input_dev->phys = xpad->phys; in xpad_init_input()
1889 usb_to_input_id(xpad->udev, &input_dev->id); in xpad_init_input()
1891 if (xpad->xtype == XTYPE_XBOX360W) { in xpad_init_input()
1896 input_dev->dev.parent = &xpad->intf->dev; in xpad_init_input()
1898 input_set_drvdata(input_dev, xpad); in xpad_init_input()
1900 if (xpad->xtype != XTYPE_XBOX360W) { in xpad_init_input()
1905 if (!(xpad->mapping & MAP_STICKS_TO_NULL)) { in xpad_init_input()
1916 if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W || in xpad_init_input()
1917 xpad->xtype == XTYPE_XBOXONE) { in xpad_init_input()
1920 if (xpad->mapping & MAP_SELECT_BUTTON) in xpad_init_input()
1927 if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { in xpad_init_input()
1934 if (xpad->mapping & MAP_PADDLES) { in xpad_init_input()
1945 if (!(xpad->mapping & MAP_DPAD_TO_BUTTONS) || in xpad_init_input()
1946 xpad->xtype == XTYPE_XBOX360W) { in xpad_init_input()
1951 if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { in xpad_init_input()
1961 if (xpad->mapping & MAP_PROFILE_BUTTON) in xpad_init_input()
1964 error = xpad_init_ff(xpad); in xpad_init_input()
1968 error = xpad_led_probe(xpad); in xpad_init_input()
1972 error = input_register_device(xpad->dev); in xpad_init_input()
1976 xpad->input_created = true; in xpad_init_input()
1980 xpad_led_disconnect(xpad); in xpad_init_input()
1991 struct usb_xpad *xpad; in xpad_probe() local
2004 xpad = kzalloc(sizeof(struct usb_xpad), GFP_KERNEL); in xpad_probe()
2005 if (!xpad) in xpad_probe()
2008 usb_make_path(udev, xpad->phys, sizeof(xpad->phys)); in xpad_probe()
2009 strlcat(xpad->phys, "/input0", sizeof(xpad->phys)); in xpad_probe()
2011 xpad->idata = usb_alloc_coherent(udev, XPAD_PKT_LEN, in xpad_probe()
2012 GFP_KERNEL, &xpad->idata_dma); in xpad_probe()
2013 if (!xpad->idata) { in xpad_probe()
2018 xpad->irq_in = usb_alloc_urb(0, GFP_KERNEL); in xpad_probe()
2019 if (!xpad->irq_in) { in xpad_probe()
2024 xpad->udev = udev; in xpad_probe()
2025 xpad->intf = intf; in xpad_probe()
2026 xpad->mapping = xpad_device[i].mapping; in xpad_probe()
2027 xpad->xtype = xpad_device[i].xtype; in xpad_probe()
2028 xpad->name = xpad_device[i].name; in xpad_probe()
2029 xpad->packet_type = PKT_XB; in xpad_probe()
2030 INIT_WORK(&xpad->work, xpad_presence_work); in xpad_probe()
2032 if (xpad->xtype == XTYPE_UNKNOWN) { in xpad_probe()
2035 xpad->xtype = XTYPE_XBOX360W; in xpad_probe()
2037 xpad->xtype = XTYPE_XBOXONE; in xpad_probe()
2039 xpad->xtype = XTYPE_XBOX360; in xpad_probe()
2041 xpad->xtype = XTYPE_XBOX; in xpad_probe()
2045 xpad->mapping |= MAP_DPAD_TO_BUTTONS; in xpad_probe()
2047 xpad->mapping |= MAP_TRIGGERS_TO_BUTTONS; in xpad_probe()
2049 xpad->mapping |= MAP_STICKS_TO_NULL; in xpad_probe()
2052 if (xpad->xtype == XTYPE_XBOXONE && in xpad_probe()
2082 error = xpad_init_output(intf, xpad, ep_irq_out); in xpad_probe()
2086 usb_fill_int_urb(xpad->irq_in, udev, in xpad_probe()
2088 xpad->idata, XPAD_PKT_LEN, xpad_irq_in, in xpad_probe()
2089 xpad, ep_irq_in->bInterval); in xpad_probe()
2090 xpad->irq_in->transfer_dma = xpad->idata_dma; in xpad_probe()
2091 xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in xpad_probe()
2093 usb_set_intfdata(intf, xpad); in xpad_probe()
2101 xpad->packet_type = PKT_XBE1; in xpad_probe()
2111 xpad->packet_type = PKT_XBE2_FW_OLD; in xpad_probe()
2117 xpad->packet_type = PKT_XBE2_FW_5_EARLY; in xpad_probe()
2122 xpad->packet_type = PKT_XBE2_FW_5_11; in xpad_probe()
2127 if (xpad->xtype == XTYPE_XBOX360W) { in xpad_probe()
2135 error = xpad360w_start_input(xpad); in xpad_probe()
2147 error = xpad_init_input(xpad); in xpad_probe()
2154 xpad_deinit_output(xpad); in xpad_probe()
2156 usb_free_urb(xpad->irq_in); in xpad_probe()
2158 usb_free_coherent(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma); in xpad_probe()
2160 kfree(xpad); in xpad_probe()
2166 struct usb_xpad *xpad = usb_get_intfdata(intf); in xpad_disconnect() local
2168 if (xpad->xtype == XTYPE_XBOX360W) in xpad_disconnect()
2169 xpad360w_stop_input(xpad); in xpad_disconnect()
2171 xpad_deinit_input(xpad); in xpad_disconnect()
2177 xpad_stop_output(xpad); in xpad_disconnect()
2179 xpad_deinit_output(xpad); in xpad_disconnect()
2181 usb_free_urb(xpad->irq_in); in xpad_disconnect()
2182 usb_free_coherent(xpad->udev, XPAD_PKT_LEN, in xpad_disconnect()
2183 xpad->idata, xpad->idata_dma); in xpad_disconnect()
2185 kfree(xpad); in xpad_disconnect()
2192 struct usb_xpad *xpad = usb_get_intfdata(intf); in xpad_suspend() local
2193 struct input_dev *input = xpad->dev; in xpad_suspend()
2195 if (xpad->xtype == XTYPE_XBOX360W) { in xpad_suspend()
2201 xpad360w_stop_input(xpad); in xpad_suspend()
2209 if (auto_poweroff && xpad->pad_present) in xpad_suspend()
2210 xpad360w_poweroff_controller(xpad); in xpad_suspend()
2214 xpad_stop_input(xpad); in xpad_suspend()
2218 xpad_stop_output(xpad); in xpad_suspend()
2225 struct usb_xpad *xpad = usb_get_intfdata(intf); in xpad_resume() local
2226 struct input_dev *input = xpad->dev; in xpad_resume()
2229 if (xpad->xtype == XTYPE_XBOX360W) { in xpad_resume()
2230 retval = xpad360w_start_input(xpad); in xpad_resume()
2234 retval = xpad_start_input(xpad); in xpad_resume()
2235 } else if (xpad->xtype == XTYPE_XBOXONE) { in xpad_resume()
2241 retval = xpad_start_xbox_one(xpad); in xpad_resume()