diff options
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r-- | include/linux/usb.h | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index dea39dc551d4..30d1ae38eab1 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -77,14 +77,15 @@ struct usb_host_endpoint { | |||
77 | struct usb_host_interface { | 77 | struct usb_host_interface { |
78 | struct usb_interface_descriptor desc; | 78 | struct usb_interface_descriptor desc; |
79 | 79 | ||
80 | int extralen; | ||
81 | unsigned char *extra; /* Extra descriptors */ | ||
82 | |||
80 | /* array of desc.bNumEndpoint endpoints associated with this | 83 | /* array of desc.bNumEndpoint endpoints associated with this |
81 | * interface setting. these will be in no particular order. | 84 | * interface setting. these will be in no particular order. |
82 | */ | 85 | */ |
83 | struct usb_host_endpoint *endpoint; | 86 | struct usb_host_endpoint *endpoint; |
84 | 87 | ||
85 | char *string; /* iInterface string, if present */ | 88 | char *string; /* iInterface string, if present */ |
86 | unsigned char *extra; /* Extra descriptors */ | ||
87 | int extralen; | ||
88 | }; | 89 | }; |
89 | 90 | ||
90 | enum usb_interface_condition { | 91 | enum usb_interface_condition { |
@@ -331,6 +332,11 @@ struct usb_bus { | |||
331 | u8 otg_port; /* 0, or number of OTG/HNP port */ | 332 | u8 otg_port; /* 0, or number of OTG/HNP port */ |
332 | unsigned is_b_host:1; /* true during some HNP roleswitches */ | 333 | unsigned is_b_host:1; /* true during some HNP roleswitches */ |
333 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ | 334 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ |
335 | unsigned no_stop_on_short:1; /* | ||
336 | * Quirk: some controllers don't stop | ||
337 | * the ep queue on a short transfer | ||
338 | * with the URB_SHORT_NOT_OK flag set. | ||
339 | */ | ||
334 | unsigned sg_tablesize; /* 0 or largest number of sg list entries */ | 340 | unsigned sg_tablesize; /* 0 or largest number of sg list entries */ |
335 | 341 | ||
336 | int devnum_next; /* Next open device number in | 342 | int devnum_next; /* Next open device number in |
@@ -556,7 +562,6 @@ struct usb_device { | |||
556 | struct usb3_lpm_parameters u1_params; | 562 | struct usb3_lpm_parameters u1_params; |
557 | struct usb3_lpm_parameters u2_params; | 563 | struct usb3_lpm_parameters u2_params; |
558 | unsigned lpm_disable_count; | 564 | unsigned lpm_disable_count; |
559 | unsigned hub_initiated_lpm_disable_count; | ||
560 | }; | 565 | }; |
561 | #define to_usb_device(d) container_of(d, struct usb_device, dev) | 566 | #define to_usb_device(d) container_of(d, struct usb_device, dev) |
562 | 567 | ||
@@ -629,6 +634,17 @@ extern void usb_enable_lpm(struct usb_device *udev); | |||
629 | extern int usb_unlocked_disable_lpm(struct usb_device *udev); | 634 | extern int usb_unlocked_disable_lpm(struct usb_device *udev); |
630 | extern void usb_unlocked_enable_lpm(struct usb_device *udev); | 635 | extern void usb_unlocked_enable_lpm(struct usb_device *udev); |
631 | 636 | ||
637 | extern int usb_disable_ltm(struct usb_device *udev); | ||
638 | extern void usb_enable_ltm(struct usb_device *udev); | ||
639 | |||
640 | static inline bool usb_device_supports_ltm(struct usb_device *udev) | ||
641 | { | ||
642 | if (udev->speed != USB_SPEED_SUPER || !udev->bos || !udev->bos->ss_cap) | ||
643 | return false; | ||
644 | return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT; | ||
645 | } | ||
646 | |||
647 | |||
632 | /*-------------------------------------------------------------------------*/ | 648 | /*-------------------------------------------------------------------------*/ |
633 | 649 | ||
634 | /* for drivers using iso endpoints */ | 650 | /* for drivers using iso endpoints */ |
@@ -777,6 +793,22 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size) | |||
777 | .bInterfaceProtocol = (pr) | 793 | .bInterfaceProtocol = (pr) |
778 | 794 | ||
779 | /** | 795 | /** |
796 | * USB_DEVICE_INTERFACE_NUMBER - describe a usb device with a specific interface number | ||
797 | * @vend: the 16 bit USB Vendor ID | ||
798 | * @prod: the 16 bit USB Product ID | ||
799 | * @num: bInterfaceNumber value | ||
800 | * | ||
801 | * This macro is used to create a struct usb_device_id that matches a | ||
802 | * specific interface number of devices. | ||
803 | */ | ||
804 | #define USB_DEVICE_INTERFACE_NUMBER(vend, prod, num) \ | ||
805 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ | ||
806 | USB_DEVICE_ID_MATCH_INT_NUMBER, \ | ||
807 | .idVendor = (vend), \ | ||
808 | .idProduct = (prod), \ | ||
809 | .bInterfaceNumber = (num) | ||
810 | |||
811 | /** | ||
780 | * USB_DEVICE_INFO - macro used to describe a class of usb devices | 812 | * USB_DEVICE_INFO - macro used to describe a class of usb devices |
781 | * @cl: bDeviceClass value | 813 | * @cl: bDeviceClass value |
782 | * @sc: bDeviceSubClass value | 814 | * @sc: bDeviceSubClass value |
@@ -829,6 +861,27 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size) | |||
829 | .bInterfaceSubClass = (sc), \ | 861 | .bInterfaceSubClass = (sc), \ |
830 | .bInterfaceProtocol = (pr) | 862 | .bInterfaceProtocol = (pr) |
831 | 863 | ||
864 | /** | ||
865 | * USB_VENDOR_AND_INTERFACE_INFO - describe a specific usb vendor with a class of usb interfaces | ||
866 | * @vend: the 16 bit USB Vendor ID | ||
867 | * @cl: bInterfaceClass value | ||
868 | * @sc: bInterfaceSubClass value | ||
869 | * @pr: bInterfaceProtocol value | ||
870 | * | ||
871 | * This macro is used to create a struct usb_device_id that matches a | ||
872 | * specific vendor with a specific class of interfaces. | ||
873 | * | ||
874 | * This is especially useful when explicitly matching devices that have | ||
875 | * vendor specific bDeviceClass values, but standards-compliant interfaces. | ||
876 | */ | ||
877 | #define USB_VENDOR_AND_INTERFACE_INFO(vend, cl, sc, pr) \ | ||
878 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ | ||
879 | | USB_DEVICE_ID_MATCH_VENDOR, \ | ||
880 | .idVendor = (vend), \ | ||
881 | .bInterfaceClass = (cl), \ | ||
882 | .bInterfaceSubClass = (sc), \ | ||
883 | .bInterfaceProtocol = (pr) | ||
884 | |||
832 | /* ----------------------------------------------------------------------- */ | 885 | /* ----------------------------------------------------------------------- */ |
833 | 886 | ||
834 | /* Stuff for dynamic usb ids */ | 887 | /* Stuff for dynamic usb ids */ |