Skip to content

Commit faee822

Browse files
matnymangregkh
authored andcommitted
usb: Add USB 3.1 Precision time measurement capability descriptor support
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>
1 parent b37d83a commit faee822

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎drivers/usb/core/config.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,9 @@ int usb_get_bos_descriptor(struct usb_device *dev)
894894
dev->bos->ss_id =
895895
(struct usb_ss_container_id_descriptor *)buffer;
896896
break;
897+
case USB_PTM_CAP_TYPE:
898+
dev->bos->ptm_cap =
899+
(struct usb_ptm_cap_descriptor *)buffer;
897900
default:
898901
break;
899902
}

‎include/linux/usb.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ struct usb_host_bos {
332332
struct usb_ss_cap_descriptor *ss_cap;
333333
struct usb_ssp_cap_descriptor *ssp_cap;
334334
struct usb_ss_container_id_descriptor *ss_id;
335+
struct usb_ptm_cap_descriptor *ptm_cap;
335336
};
336337

337338
int __usb_get_extra_descriptor(char *buffer, unsigned size,

‎include/uapi/linux/usb/ch9.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,16 @@ struct usb_ssp_cap_descriptor {
912912
#define USB_SSP_SUBLINK_SPEED_LSM (0xff << 16) /* Lanespeed mantissa */
913913
} __attribute__((packed));
914914

915+
/*
916+
* Precision time measurement capability descriptor: advertised by devices and
917+
* hubs that support PTM
918+
*/
919+
#define USB_PTM_CAP_TYPE 0xb
920+
struct usb_ptm_cap_descriptor {
921+
__u8 bLength;
922+
__u8 bDescriptorType;
923+
__u8 bDevCapabilityType;
924+
} __attribute__((packed));
915925

916926
/*-------------------------------------------------------------------------*/
917927

0 commit comments

Comments
 (0)