usb: Add USB 3.1 Precision time measurement capability descriptor support
authorMathias Nyman <mathias.nyman@linux.intel.com>
Fri, 12 Feb 2016 14:40:14 +0000 (16:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Feb 2016 01:03:23 +0000 (17:03 -0800)
USB 3.1 devices that support precision time measurement have an
additional PTM cabaility descriptor as part of the full BOS descriptor

Look for this descriptor while parsing the BOS descriptor, and store it in
struct usb_hub_bos if it exists.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/config.c
include/linux/usb.h
include/uapi/linux/usb/ch9.h

index 58d089802ab3f18fcf65ec77364c41cb6bbdf4fb..5eb1a87228b47afd397fecfd4180413e7043a304 100644 (file)
@@ -894,6 +894,9 @@ int usb_get_bos_descriptor(struct usb_device *dev)
                        dev->bos->ss_id =
                                (struct usb_ss_container_id_descriptor *)buffer;
                        break;
+               case USB_PTM_CAP_TYPE:
+                       dev->bos->ptm_cap =
+                               (struct usb_ptm_cap_descriptor *)buffer;
                default:
                        break;
                }
index 8fc881af87352798e96731002d3d8ef98591dd9b..6a9a0c28415da603f0d76f9d101630c77658a3ce 100644 (file)
@@ -332,6 +332,7 @@ struct usb_host_bos {
        struct usb_ss_cap_descriptor    *ss_cap;
        struct usb_ssp_cap_descriptor   *ssp_cap;
        struct usb_ss_container_id_descriptor   *ss_id;
+       struct usb_ptm_cap_descriptor   *ptm_cap;
 };
 
 int __usb_get_extra_descriptor(char *buffer, unsigned size,
index a65f1f328de1aa6f3cac9b0a8feea9de0444bc07..252ac16635dce1f820c90ecb92c1609862fcaf25 100644 (file)
@@ -912,6 +912,16 @@ struct usb_ssp_cap_descriptor {
 #define USB_SSP_SUBLINK_SPEED_LSM      (0xff << 16)    /* Lanespeed mantissa */
 } __attribute__((packed));
 
+/*
+ * Precision time measurement capability descriptor: advertised by devices and
+ * hubs that support PTM
+ */
+#define        USB_PTM_CAP_TYPE        0xb
+struct usb_ptm_cap_descriptor {
+       __u8  bLength;
+       __u8  bDescriptorType;
+       __u8  bDevCapabilityType;
+} __attribute__((packed));
 
 /*-------------------------------------------------------------------------*/