Lines Matching refs:dev
68 dev_dbg(&urb->dev->dev, in usb_start_wait_urb()
137 int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, in usb_control_msg() argument
154 ret = usb_internal_control_msg(dev, pipe, dr, data, size, timeout); in usb_control_msg()
157 if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG) in usb_control_msg()
199 int usb_control_msg_send(struct usb_device *dev, __u8 endpoint, __u8 request, in usb_control_msg_send() argument
204 unsigned int pipe = usb_sndctrlpipe(dev, endpoint); in usb_control_msg_send()
214 ret = usb_control_msg(dev, pipe, request, requesttype, value, index, in usb_control_msg_send()
264 int usb_control_msg_recv(struct usb_device *dev, __u8 endpoint, __u8 request, in usb_control_msg_recv() argument
269 unsigned int pipe = usb_rcvctrlpipe(dev, endpoint); in usb_control_msg_recv()
280 ret = usb_control_msg(dev, pipe, request, requesttype, value, index, in usb_control_msg_recv()
402 io->dev = NULL; in sg_clean()
427 dev_err(io->dev->bus->controller, in sg_complete()
429 io->dev->devpath, in sg_complete()
456 dev_err(&io->dev->dev, in sg_complete()
502 int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev, in usb_sg_init() argument
510 if (!io || !dev || !sg in usb_sg_init()
517 io->dev = dev; in usb_sg_init()
520 if (dev->bus->sg_tablesize > 0) { in usb_sg_init()
548 urb->dev = NULL; in usb_sg_init()
662 io->urbs[i]->dev = io->dev; in usb_sg_wait()
690 dev_dbg(&io->dev->dev, "%s, submit --> %d\n", in usb_sg_wait()
744 dev_warn(&io->dev->dev, "%s, unlink --> %d\n", in usb_sg_cancel()
781 int usb_get_descriptor(struct usb_device *dev, unsigned char type, in usb_get_descriptor() argument
794 result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), in usb_get_descriptor()
833 static int usb_get_string(struct usb_device *dev, unsigned short langid, in usb_get_string() argument
844 result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), in usb_get_string()
873 static int usb_string_sub(struct usb_device *dev, unsigned int langid, in usb_string_sub() argument
880 if (dev->quirks & USB_QUIRK_STRING_FETCH_255) in usb_string_sub()
883 rc = usb_get_string(dev, langid, index, buf, 255); in usb_string_sub()
888 rc = usb_get_string(dev, langid, index, buf, 2); in usb_string_sub()
890 rc = usb_get_string(dev, langid, index, buf, buf[0]); in usb_string_sub()
910 static int usb_get_langid(struct usb_device *dev, unsigned char *tbuf) in usb_get_langid() argument
914 if (dev->have_langid) in usb_get_langid()
917 if (dev->string_langid < 0) in usb_get_langid()
920 err = usb_string_sub(dev, 0, 0, tbuf); in usb_get_langid()
925 dev->string_langid = 0x0409; in usb_get_langid()
926 dev->have_langid = 1; in usb_get_langid()
927 dev_err(&dev->dev, in usb_get_langid()
936 dev_info(&dev->dev, "string descriptor 0 read error: %d\n", in usb_get_langid()
938 dev->string_langid = -1; in usb_get_langid()
943 dev->string_langid = tbuf[2] | (tbuf[3] << 8); in usb_get_langid()
944 dev->have_langid = 1; in usb_get_langid()
945 dev_dbg(&dev->dev, "default language 0x%04x\n", in usb_get_langid()
946 dev->string_langid); in usb_get_langid()
968 int usb_string(struct usb_device *dev, int index, char *buf, size_t size) in usb_string() argument
973 if (dev->state == USB_STATE_SUSPENDED) in usb_string()
984 err = usb_get_langid(dev, tbuf); in usb_string()
988 err = usb_string_sub(dev, dev->string_langid, index, tbuf); in usb_string()
998 dev_dbg(&dev->dev, in usb_string()
1082 int usb_set_isoch_delay(struct usb_device *dev) in usb_set_isoch_delay() argument
1085 if (dev->descriptor.bDeviceClass == USB_CLASS_HUB) in usb_set_isoch_delay()
1089 if (dev->speed < USB_SPEED_SUPER) in usb_set_isoch_delay()
1092 return usb_control_msg_send(dev, 0, in usb_set_isoch_delay()
1095 dev->hub_delay, 0, NULL, 0, in usb_set_isoch_delay()
1124 int usb_get_status(struct usb_device *dev, int recip, int type, int target, in usb_get_status() argument
1149 ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), in usb_get_status()
1205 int usb_clear_halt(struct usb_device *dev, int pipe) in usb_clear_halt() argument
1217 result = usb_control_msg_send(dev, 0, in usb_clear_halt()
1234 usb_reset_endpoint(dev, endp); in usb_clear_halt()
1250 (void) usb_create_ep_devs(&intf->dev, &alt->endpoint[i], udev); in create_intf_ep_devs()
1280 void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr, in usb_disable_endpoint() argument
1286 if (!dev) in usb_disable_endpoint()
1290 ep = dev->ep_out[epnum]; in usb_disable_endpoint()
1292 dev->ep_out[epnum] = NULL; in usb_disable_endpoint()
1294 ep = dev->ep_in[epnum]; in usb_disable_endpoint()
1296 dev->ep_in[epnum] = NULL; in usb_disable_endpoint()
1300 usb_hcd_flush_endpoint(dev, ep); in usb_disable_endpoint()
1302 usb_hcd_disable_endpoint(dev, ep); in usb_disable_endpoint()
1315 void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr) in usb_reset_endpoint() argument
1321 ep = dev->ep_out[epnum]; in usb_reset_endpoint()
1323 ep = dev->ep_in[epnum]; in usb_reset_endpoint()
1325 usb_hcd_reset_endpoint(dev, ep); in usb_reset_endpoint()
1339 void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, in usb_disable_interface() argument
1346 usb_disable_endpoint(dev, in usb_disable_interface()
1357 static void usb_disable_device_endpoints(struct usb_device *dev, int skip_ep0) in usb_disable_device_endpoints() argument
1359 struct usb_hcd *hcd = bus_to_hcd(dev->bus); in usb_disable_device_endpoints()
1365 usb_disable_endpoint(dev, i, false); in usb_disable_device_endpoints()
1366 usb_disable_endpoint(dev, i + USB_DIR_IN, false); in usb_disable_device_endpoints()
1370 usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); in usb_disable_device_endpoints()
1375 usb_disable_endpoint(dev, i, true); in usb_disable_device_endpoints()
1376 usb_disable_endpoint(dev, i + USB_DIR_IN, true); in usb_disable_device_endpoints()
1390 void usb_disable_device(struct usb_device *dev, int skip_ep0) in usb_disable_device() argument
1397 if (dev->actconfig) { in usb_disable_device()
1403 for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) in usb_disable_device()
1404 dev->actconfig->interface[i]->unregistering = 1; in usb_disable_device()
1406 for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { in usb_disable_device()
1410 interface = dev->actconfig->interface[i]; in usb_disable_device()
1411 if (!device_is_registered(&interface->dev)) in usb_disable_device()
1413 dev_dbg(&dev->dev, "unregistering interface %s\n", in usb_disable_device()
1414 dev_name(&interface->dev)); in usb_disable_device()
1416 device_del(&interface->dev); in usb_disable_device()
1422 for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { in usb_disable_device()
1423 put_device(&dev->actconfig->interface[i]->dev); in usb_disable_device()
1424 dev->actconfig->interface[i] = NULL; in usb_disable_device()
1427 usb_disable_usb2_hardware_lpm(dev); in usb_disable_device()
1428 usb_unlocked_disable_lpm(dev); in usb_disable_device()
1429 usb_disable_ltm(dev); in usb_disable_device()
1431 dev->actconfig = NULL; in usb_disable_device()
1432 if (dev->state == USB_STATE_CONFIGURED) in usb_disable_device()
1433 usb_set_device_state(dev, USB_STATE_ADDRESS); in usb_disable_device()
1436 dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__, in usb_disable_device()
1439 usb_disable_device_endpoints(dev, skip_ep0); in usb_disable_device()
1451 void usb_enable_endpoint(struct usb_device *dev, struct usb_host_endpoint *ep, in usb_enable_endpoint() argument
1459 usb_hcd_reset_endpoint(dev, ep); in usb_enable_endpoint()
1461 dev->ep_out[epnum] = ep; in usb_enable_endpoint()
1463 dev->ep_in[epnum] = ep; in usb_enable_endpoint()
1475 void usb_enable_interface(struct usb_device *dev, in usb_enable_interface() argument
1482 usb_enable_endpoint(dev, &alt->endpoint[i], reset_eps); in usb_enable_interface()
1524 int usb_set_interface(struct usb_device *dev, int interface, int alternate) in usb_set_interface() argument
1528 struct usb_hcd *hcd = bus_to_hcd(dev->bus); in usb_set_interface()
1533 if (dev->state == USB_STATE_SUSPENDED) in usb_set_interface()
1536 iface = usb_ifnum_to_if(dev, interface); in usb_set_interface()
1538 dev_dbg(&dev->dev, "selecting invalid interface %d\n", in usb_set_interface()
1547 dev_warn(&dev->dev, "selecting invalid altsetting %d\n", in usb_set_interface()
1556 usb_disable_interface(dev, iface, false); in usb_set_interface()
1565 if (usb_disable_lpm(dev)) { in usb_set_interface()
1566 dev_err(&iface->dev, "%s Failed to disable LPM\n", __func__); in usb_set_interface()
1574 ret = usb_hcd_alloc_bandwidth(dev, NULL, iface->cur_altsetting, alt); in usb_set_interface()
1576 dev_info(&dev->dev, "Not enough bandwidth for altsetting %d\n", in usb_set_interface()
1578 usb_enable_lpm(dev); in usb_set_interface()
1583 if (dev->quirks & USB_QUIRK_NO_SET_INTF) in usb_set_interface()
1586 ret = usb_control_msg_send(dev, 0, in usb_set_interface()
1596 dev_dbg(&dev->dev, in usb_set_interface()
1602 usb_hcd_alloc_bandwidth(dev, NULL, alt, iface->cur_altsetting); in usb_set_interface()
1603 usb_enable_lpm(dev); in usb_set_interface()
1620 usb_disable_interface(dev, iface, true); in usb_set_interface()
1625 usb_unlocked_enable_lpm(dev); in usb_set_interface()
1635 pipe = __create_pipe(dev, in usb_set_interface()
1640 usb_clear_halt(dev, pipe); in usb_set_interface()
1655 usb_enable_interface(dev, iface, true); in usb_set_interface()
1656 if (device_is_registered(&iface->dev)) { in usb_set_interface()
1689 int usb_reset_configuration(struct usb_device *dev) in usb_reset_configuration() argument
1693 struct usb_hcd *hcd = bus_to_hcd(dev->bus); in usb_reset_configuration()
1695 if (dev->state == USB_STATE_SUSPENDED) in usb_reset_configuration()
1703 usb_disable_device_endpoints(dev, 1); /* skip ep0*/ in usb_reset_configuration()
1705 config = dev->actconfig; in usb_reset_configuration()
1711 if (usb_disable_lpm(dev)) { in usb_reset_configuration()
1712 dev_err(&dev->dev, "%s Failed to disable LPM\n", __func__); in usb_reset_configuration()
1718 retval = usb_hcd_alloc_bandwidth(dev, config, NULL, NULL); in usb_reset_configuration()
1720 usb_enable_lpm(dev); in usb_reset_configuration()
1724 retval = usb_control_msg_send(dev, 0, USB_REQ_SET_CONFIGURATION, 0, in usb_reset_configuration()
1729 usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); in usb_reset_configuration()
1730 usb_enable_lpm(dev); in usb_reset_configuration()
1756 usb_enable_interface(dev, intf, true); in usb_reset_configuration()
1757 if (device_is_registered(&intf->dev)) { in usb_reset_configuration()
1763 usb_unlocked_enable_lpm(dev); in usb_reset_configuration()
1768 static void usb_release_interface(struct device *dev) in usb_release_interface() argument
1770 struct usb_interface *intf = to_usb_interface(dev); in usb_release_interface()
1776 of_node_put(dev->of_node); in usb_release_interface()
1787 struct device *dev = &intf->dev; in usb_deauthorize_interface() local
1789 device_lock(dev->parent); in usb_deauthorize_interface()
1792 device_lock(dev); in usb_deauthorize_interface()
1794 device_unlock(dev); in usb_deauthorize_interface()
1799 device_unlock(dev->parent); in usb_deauthorize_interface()
1809 struct device *dev = &intf->dev; in usb_authorize_interface() local
1812 device_lock(dev); in usb_authorize_interface()
1814 device_unlock(dev); in usb_authorize_interface()
1818 static int usb_if_uevent(const struct device *dev, struct kobj_uevent_env *env) in usb_if_uevent() argument
1824 intf = to_usb_interface(dev); in usb_if_uevent()
1858 static struct usb_interface_assoc_descriptor *find_iad(struct usb_device *dev, in find_iad() argument
1879 dev_err(&dev->dev, "Interface #%d referenced" in find_iad()
1916 device_lock(iface->dev.parent); in __usb_wireless_status_intf()
1919 device_unlock(iface->dev.parent); in __usb_wireless_status_intf()
1993 int usb_set_configuration(struct usb_device *dev, int configuration) in usb_set_configuration() argument
1998 struct usb_hcd *hcd = bus_to_hcd(dev->bus); in usb_set_configuration()
2001 if (dev->authorized == 0 || configuration == -1) in usb_set_configuration()
2004 for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { in usb_set_configuration()
2005 if (dev->config[i].desc.bConfigurationValue == in usb_set_configuration()
2007 cp = &dev->config[i]; in usb_set_configuration()
2021 dev_warn(&dev->dev, "config 0 descriptor??\n"); in usb_set_configuration()
2047 i = dev->bus_mA - usb_get_max_power(dev, cp); in usb_set_configuration()
2049 dev_warn(&dev->dev, "new config #%d exceeds power " in usb_set_configuration()
2055 ret = usb_autoresume_device(dev); in usb_set_configuration()
2062 if (dev->state != USB_STATE_ADDRESS) in usb_set_configuration()
2063 usb_disable_device(dev, 1); /* Skip ep0 */ in usb_set_configuration()
2066 cancel_async_set_config(dev); in usb_set_configuration()
2079 if (dev->actconfig && usb_disable_lpm(dev)) { in usb_set_configuration()
2080 dev_err(&dev->dev, "%s Failed to disable LPM\n", __func__); in usb_set_configuration()
2085 ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); in usb_set_configuration()
2087 if (dev->actconfig) in usb_set_configuration()
2088 usb_enable_lpm(dev); in usb_set_configuration()
2090 usb_autosuspend_device(dev); in usb_set_configuration()
2122 intf->intf_assoc = find_iad(dev, cp, ifnum); in usb_set_configuration()
2124 usb_enable_interface(dev, intf, true); in usb_set_configuration()
2125 intf->dev.parent = &dev->dev; in usb_set_configuration()
2126 if (usb_of_has_combined_node(dev)) { in usb_set_configuration()
2127 device_set_of_node_from_dev(&intf->dev, &dev->dev); in usb_set_configuration()
2129 intf->dev.of_node = usb_of_get_interface_node(dev, in usb_set_configuration()
2132 ACPI_COMPANION_SET(&intf->dev, ACPI_COMPANION(&dev->dev)); in usb_set_configuration()
2133 intf->dev.driver = NULL; in usb_set_configuration()
2134 intf->dev.bus = &usb_bus_type; in usb_set_configuration()
2135 intf->dev.type = &usb_if_device_type; in usb_set_configuration()
2136 intf->dev.groups = usb_interface_groups; in usb_set_configuration()
2140 device_initialize(&intf->dev); in usb_set_configuration()
2141 pm_runtime_no_callbacks(&intf->dev); in usb_set_configuration()
2142 dev_set_name(&intf->dev, "%d-%s:%d.%d", dev->bus->busnum, in usb_set_configuration()
2143 dev->devpath, configuration, ifnum); in usb_set_configuration()
2144 usb_get_dev(dev); in usb_set_configuration()
2148 ret = usb_control_msg_send(dev, 0, USB_REQ_SET_CONFIGURATION, 0, in usb_set_configuration()
2156 usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); in usb_set_configuration()
2158 usb_disable_interface(dev, cp->interface[i], true); in usb_set_configuration()
2159 put_device(&cp->interface[i]->dev); in usb_set_configuration()
2165 dev->actconfig = cp; in usb_set_configuration()
2169 usb_set_device_state(dev, USB_STATE_ADDRESS); in usb_set_configuration()
2172 usb_autosuspend_device(dev); in usb_set_configuration()
2175 usb_set_device_state(dev, USB_STATE_CONFIGURED); in usb_set_configuration()
2178 !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) in usb_set_configuration()
2179 cp->string = usb_cache_string(dev, cp->desc.iConfiguration); in usb_set_configuration()
2182 usb_unlocked_enable_lpm(dev); in usb_set_configuration()
2184 usb_enable_ltm(dev); in usb_set_configuration()
2195 if (intf->dev.of_node && in usb_set_configuration()
2196 !of_device_is_available(intf->dev.of_node)) { in usb_set_configuration()
2197 dev_info(&dev->dev, "skipping disabled interface %d\n", in usb_set_configuration()
2202 dev_dbg(&dev->dev, in usb_set_configuration()
2204 dev_name(&intf->dev), configuration, in usb_set_configuration()
2206 device_enable_async_suspend(&intf->dev); in usb_set_configuration()
2207 ret = device_add(&intf->dev); in usb_set_configuration()
2209 dev_err(&dev->dev, "device_add(%s) --> %d\n", in usb_set_configuration()
2210 dev_name(&intf->dev), ret); in usb_set_configuration()
2216 usb_autosuspend_device(dev); in usb_set_configuration()
2343 dev_err(&intf->dev, "skipping garbage byte\n"); in cdc_parse_cdc_header()
2348 dev_err(&intf->dev, "invalid descriptor buffer length\n"); in cdc_parse_cdc_header()
2352 dev_err(&intf->dev, "skipping garbage\n"); in cdc_parse_cdc_header()
2361 dev_err(&intf->dev, "More than one union descriptor, skipping ...\n"); in cdc_parse_cdc_header()
2443 dev_dbg(&intf->dev, "Ignoring descriptor: type %02x, length %ud\n", in cdc_parse_cdc_header()