Lines Matching +full:usb2 +full:- +full:lpm +full:- +full:disable
1 /* SPDX-License-Identifier: GPL-2.0 */
14 #include <linux/errno.h> /* for -ENODEV */
29 /*-------------------------------------------------------------------------*/
32 * Host-side wrappers for standard USB descriptors ... these are parsed
36 * - devices have one (usually) or more configs;
37 * - configs have one (often) or more interfaces;
38 * - interfaces have one (usually) or more settings;
39 * - each interface setting has zero or (usually) more endpoints.
40 * - a SuperSpeed endpoint has a companion descriptor
44 * Devices may also have class-specific or vendor-specific descriptors.
50 * struct usb_host_endpoint - host-side endpoint descriptor and queue
61 * @streams: number of USB-3 streams allocated on the endpoint
80 /* host-side wrapper for one interface setting's parsed descriptors */
179 * struct usb_interface - what usb device drivers talk to
195 * @ep_devs_created: endpoint child pseudo-devices exist
197 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
199 * @needs_altsetting0: flag set when a set-interface request for altsetting 0
201 * @needs_binding: flag set when the driver should be re-probed or unbound
232 * All standards-conformant USB devices that use isochronous endpoints
233 * will use them in non-default settings.
277 return dev_get_drvdata(&intf->dev); in usb_get_intfdata()
281 * usb_set_intfdata() - associate driver-specific data with an interface
286 * driver-specific data with an interface.
288 * Note that there is generally no need to clear the driver-data pointer even
289 * if some drivers do so for historical or implementation-specific reasons.
293 dev_set_drvdata(&intf->dev, data); in usb_set_intfdata()
337 * struct usb_interface_cache - long-term representation of a device interface
340 * @altsetting: variable-length array of interface structures, one for
348 * providing support for the /sys/kernel/debug/usb/devices pseudo-file.
354 /* variable-length array of alternate settings for this interface,
364 * struct usb_host_config - representation of a device's configuration
383 * for example, a dual-speed device would have separate configurations for
384 * full-speed and high-speed operation. The number of configurations
390 * are supposed to be numbered from 0 to desc.bNumInterfaces-1, but a lot
423 /* USB2.0 and USB3.0 device BOS descriptor set */
437 __usb_get_extra_descriptor((ifpoint)->extra, \
438 (ifpoint)->extralen, \
441 /* ----------------------------------------------------------------------- */
457 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
467 * round-robin allocation */
484 unsigned resuming_ports; /* bit array: resuming root-hub ports */
487 struct mon_bus *mon_bus; /* non-null when associated */
488 int monitored; /* non-zero when monitored */
494 /* ----------------------------------------------------------------------- */
522 * USB 2.0 Link Power Management (LPM) parameters.
530 /* Timeout value in microseconds for the L1 inactivity (LPM) timer.
531 * When the timer counts to zero, the parent hub will initiate a LPM
538 * USB 3.0 Link Power Management (LPM) parameters.
540 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit.
541 * MEL is the USB 3.0 Link PM latency for host-initiated LPM exit.
553 * Maximum exit latency for a device-initiated LPM transition to bring
563 * receive the data packet. Basically, SEL should be the worse-case
571 * will initiate an LPM transition to either U1 or U2.
577 * struct usb_device - kernel's representation of a USB device
583 * @rx_lanes: number of rx lanes in use, USB 3.2 adds dual-lane support
584 * @tx_lanes: number of tx lanes in use, USB 3.2 adds dual-lane support
612 * FIXME -- complete doc
615 * @lpm_capable: device supports LPM
616 * @lpm_devinit_allow: Allow USB3 device initiated LPM, exit latency is in range
617 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM
618 * @usb2_hw_lpm_besl_capable: device can perform USB2 hardware BESL LPM
619 * @usb2_hw_lpm_enabled: USB2 hardware LPM is enabled
620 * @usb2_hw_lpm_allowed: Userspace allows USB 2.0 LPM to be enabled
621 * @usb3_lpm_u1_enabled: USB3 hardware U1 LPM enabled
622 * @usb3_lpm_u2_enabled: USB3 hardware U2 LPM enabled
637 * @l1_params: best effor service latency for USB2 L1 LPM state, and L1 timeout.
638 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout.
639 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout.
645 * parent->hub_delay + wHubDelay + tTPTransmissionDelay (40ns)
650 * Usbcore drivers should not set usbdev->state directly. Instead use
740 return to_usb_device(intf->dev.parent); in __intf_to_usbdev()
744 return to_usb_device((const struct device *)intf->dev.parent); in __intf_to_usbdev_const()
758 * usb_hub_for_each_child - iterate over all child devices on the hub
765 port1 <= hdev->maxchild; \
770 #define usb_lock_device(udev) device_lock(&(udev)->dev)
771 #define usb_unlock_device(udev) device_unlock(&(udev)->dev)
772 #define usb_lock_device_interruptible(udev) device_lock_interruptible(&(udev)->dev)
773 #define usb_trylock_device(udev) device_trylock(&(udev)->dev)
811 pm_runtime_mark_last_busy(&udev->dev); in usb_mark_last_busy()
851 if (udev->speed < USB_SPEED_SUPER || !udev->bos || !udev->bos->ss_cap) in usb_device_supports_ltm()
853 return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT; in usb_device_supports_ltm()
858 return udev && udev->bus && udev->bus->no_sg_constraint; in usb_device_no_sg_constraint()
862 /*-------------------------------------------------------------------------*/
877 /* used these for multi-interface device registration */
882 * usb_interface_claimed - returns true iff an interface is claimed
896 return (iface->dev.driver != NULL); in usb_interface_claimed()
929 * usb_make_path - returns stable device path in the usb tree
940 * reconfigured, by re-cabling a tree of USB devices or by moving USB host
943 * neither does rebooting or re-enumerating. These are more useful identifiers
956 actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name, in usb_make_path()
957 dev->devpath); in usb_make_path()
958 return (actual >= (int)size) ? -1 : actual; in usb_make_path()
961 /*-------------------------------------------------------------------------*/
979 * USB_DEVICE - macro used to describe a specific usb device
991 * USB_DEVICE_VER - describe a specific usb device with a version range
1008 * USB_DEVICE_INTERFACE_CLASS - describe a usb device with a specific interface class
1024 * USB_DEVICE_INTERFACE_PROTOCOL - describe a usb device with a specific interface protocol
1040 * USB_DEVICE_INTERFACE_NUMBER - describe a usb device with a specific interface number
1056 * USB_DEVICE_INFO - macro used to describe a class of usb devices
1071 * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces
1086 * USB_DEVICE_AND_INTERFACE_INFO - describe a specific usb device with a class of usb interfaces
1097 * vendor specific bDeviceClass values, but standards-compliant interfaces.
1109 * USB_VENDOR_AND_INTERFACE_INFO - describe a specific usb vendor with a class of usb interfaces
1119 * vendor specific bDeviceClass values, but standards-compliant interfaces.
1129 /* ----------------------------------------------------------------------- */
1150 * struct usb_driver - identifies USB interface driver to usbcore
1155 * usb_set_intfdata() to associate driver-specific data with the
1158 * return -ENODEV, if genuine IO errors occurred, an appropriate
1171 * Instead, let the resume or reset-resume routine recover from
1182 * @shutdown: Called at shut-down time to quiesce the device.
1190 * @driver: The driver-model core driver structure.
1195 * @soft_unbind: if set to 1, the USB core will not kill URBs and disable
1199 * occurs. Device-initiated USB 3.0 link PM will still be allowed.
1249 * struct usb_device_driver - identifies USB device driver to usbcore
1255 * to associate driver-specific data with the device. If unwilling
1262 * @choose_configuration: If non-NULL, called instead of the default
1267 * @driver: The driver-model core driver structure.
1301 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number
1333 * module_usb_driver() - Helper macro for registering a USB driver
1355 /* ----------------------------------------------------------------------- */
1362 * urb->transfer_flags:
1367 #define URB_ISO_ASAP 0x0002 /* iso-only; use the first unexpired
1369 #define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
1371 #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt
1380 #define URB_DMA_MAP_SINGLE 0x00010000 /* Non-scatter-gather mapping */
1381 #define URB_DMA_MAP_PAGE 0x00020000 /* HCD-unsupported S-G */
1382 #define URB_DMA_MAP_SG 0x00040000 /* HCD-supported S-G */
1383 #define URB_MAP_LOCAL 0x00080000 /* HCD-local-memory mapping */
1385 #define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */
1386 #define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */
1409 INIT_LIST_HEAD(&anchor->urb_list); in init_usb_anchor()
1410 init_waitqueue_head(&anchor->wait); in init_usb_anchor()
1411 spin_lock_init(&anchor->lock); in init_usb_anchor()
1417 * struct urb - USB Request Block
1434 * @status: This is read in non-iso completion functions to get the
1437 * each frame is in the fields of the iso_frame-desc.
1462 * @actual_length: This is read in non-iso completion functions, and
1481 * request-specific driver context.
1507 * the device driver is DMA-aware. For example, a device driver might
1562 * transfer was scheduled. Ranges for frame counter values are HC-specific
1580 * unlinked URBs, and status for all non-ISO transfers. It should not
1586 * When the completion callback is invoked for non-isochronous URBs, the
1616 int status; /* (return) non-ISO status */
1638 /* ----------------------------------------------------------------------- */
1641 * usb_fill_control_urb - initializes a control urb
1674 urb->dev = dev; in usb_fill_control_urb()
1675 urb->pipe = pipe; in usb_fill_control_urb()
1676 urb->setup_packet = setup_packet; in usb_fill_control_urb()
1677 urb->transfer_buffer = transfer_buffer; in usb_fill_control_urb()
1678 urb->transfer_buffer_length = buffer_length; in usb_fill_control_urb()
1679 urb->complete = complete_fn; in usb_fill_control_urb()
1680 urb->context = context; in usb_fill_control_urb()
1684 * usb_fill_bulk_urb - macro to help initialize a bulk urb
1708 urb->dev = dev; in usb_fill_bulk_urb()
1709 urb->pipe = pipe; in usb_fill_bulk_urb()
1710 urb->transfer_buffer = transfer_buffer; in usb_fill_bulk_urb()
1711 urb->transfer_buffer_length = buffer_length; in usb_fill_bulk_urb()
1712 urb->complete = complete_fn; in usb_fill_bulk_urb()
1713 urb->context = context; in usb_fill_bulk_urb()
1717 * usb_fill_int_urb - macro to help initialize a interrupt urb
1749 urb->dev = dev; in usb_fill_int_urb()
1750 urb->pipe = pipe; in usb_fill_int_urb()
1751 urb->transfer_buffer = transfer_buffer; in usb_fill_int_urb()
1752 urb->transfer_buffer_length = buffer_length; in usb_fill_int_urb()
1753 urb->complete = complete_fn; in usb_fill_int_urb()
1754 urb->context = context; in usb_fill_int_urb()
1756 if (dev->speed == USB_SPEED_HIGH || dev->speed >= USB_SPEED_SUPER) { in usb_fill_int_urb()
1760 urb->interval = 1 << (interval - 1); in usb_fill_int_urb()
1762 urb->interval = interval; in usb_fill_int_urb()
1765 urb->start_frame = -1; in usb_fill_int_urb()
1796 * usb_urb_dir_in - check if an URB describes an IN transfer
1799 * Return: 1 if @urb describes an IN transfer (device-to-host),
1804 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN; in usb_urb_dir_in()
1808 * usb_urb_dir_out - check if an URB describes an OUT transfer
1811 * Return: 1 if @urb describes an OUT transfer (host-to-device),
1816 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; in usb_urb_dir_out()
1827 /*-------------------------------------------------------------------*
1829 *-------------------------------------------------------------------*/
1895 * struct usb_sg_request - support for scatter/gather I/O
1944 /* ----------------------------------------------------------------------- */
1952 * - direction: bit 7 (0 = Host-to-Device [Out],
1953 * 1 = Device-to-Host [In] ...
1955 * - device address: bits 8-14 ... bit positions known to uhci-hcd
1956 * - endpoint: bits 15-18 ... bit positions known to uhci-hcd
1957 * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
1985 return (dev->devnum << 8) | (endpoint << 15); in __create_pipe()
2010 eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out; in usb_pipe_endpoint()
2022 return usb_endpoint_maxp(&ep->desc); in usb_maxpacket()
2030 case -ENOMEM: in usb_translate_errors()
2031 case -ENODEV: in usb_translate_errors()
2032 case -EOPNOTSUPP: in usb_translate_errors()
2035 return -EIO; in usb_translate_errors()