]> www.infradead.org Git - users/hch/misc.git/commitdiff
usb: core: Introduce usb_endpoint_is_hs_isoc_double()
authorSakari Ailus <sakari.ailus@linux.intel.com>
Wed, 20 Aug 2025 14:38:21 +0000 (17:38 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Sep 2025 13:25:05 +0000 (15:25 +0200)
Introduce usb_endpoint_is_hs_isoc_double() tell whether an endpoint
conforms to USB 2.0 Isochronous Double IN Bandwidth ECN.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20250820143824.551777-7-sakari.ailus@linux.intel.com
drivers/usb/core/usb.c
include/linux/usb.h

index ca9ff6ad8e739f147f4e37497b027453153d518a..939dc4aafb898c53e9c702d432b5ef488ea81532 100644 (file)
@@ -1139,6 +1139,25 @@ u32 usb_endpoint_max_periodic_payload(struct usb_device *udev,
 }
 EXPORT_SYMBOL_GPL(usb_endpoint_max_periodic_payload);
 
+/**
+ * usb_endpoint_is_hs_isoc_double - Tell whether an endpoint uses USB 2
+ *                                  Isochronous Double IN Bandwidth
+ * @udev: The USB device
+ * @ep: The endpoint
+ *
+ * Returns: true if an endpoint @ep conforms to USB 2 Isochronous Double IN
+ * Bandwidth ECN, false otherwise.
+ */
+bool usb_endpoint_is_hs_isoc_double(struct usb_device *udev,
+                                   const struct usb_host_endpoint *ep)
+{
+       return ep->eusb2_isoc_ep_comp.bDescriptorType &&
+               le16_to_cpu(udev->descriptor.bcdUSB) == 0x220 &&
+               usb_endpoint_is_isoc_in(&ep->desc) &&
+               !le16_to_cpu(ep->desc.wMaxPacketSize);
+}
+EXPORT_SYMBOL_GPL(usb_endpoint_is_hs_isoc_double);
+
 /*
  * Notifications of device and interface registration
  */
index e9cf2786d8bdcd0c5142044ab820120b9c84b95e..70ef00c42d22caf8f0efd8c5c494ad2df95d9ad9 100644 (file)
@@ -2042,6 +2042,9 @@ static inline u16 usb_maxpacket(struct usb_device *udev, int pipe)
 u32 usb_endpoint_max_periodic_payload(struct usb_device *udev,
                                      const struct usb_host_endpoint *ep);
 
+bool usb_endpoint_is_hs_isoc_double(struct usb_device *udev,
+                                   const struct usb_host_endpoint *ep);
+
 /* translate USB error codes to codes user space understands */
 static inline int usb_translate_errors(int error_code)
 {