aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r--include/linux/usb.h69
1 files changed, 66 insertions, 3 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 56aa2ee21f1b..7a60946df3b6 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -146,6 +146,10 @@ struct usb_interface {
146 * active alternate setting */ 146 * active alternate setting */
147 unsigned num_altsetting; /* number of alternate settings */ 147 unsigned num_altsetting; /* number of alternate settings */
148 148
149 /* If there is an interface association descriptor then it will list
150 * the associated interfaces */
151 struct usb_interface_assoc_descriptor *intf_assoc;
152
149 int minor; /* minor number this interface is 153 int minor; /* minor number this interface is
150 * bound to */ 154 * bound to */
151 enum usb_interface_condition condition; /* state of binding */ 155 enum usb_interface_condition condition; /* state of binding */
@@ -175,6 +179,7 @@ void usb_put_intf(struct usb_interface *intf);
175 179
176/* this maximum is arbitrary */ 180/* this maximum is arbitrary */
177#define USB_MAXINTERFACES 32 181#define USB_MAXINTERFACES 32
182#define USB_MAXIADS USB_MAXINTERFACES/2
178 183
179/** 184/**
180 * struct usb_interface_cache - long-term representation of a device interface 185 * struct usb_interface_cache - long-term representation of a device interface
@@ -245,6 +250,11 @@ struct usb_host_config {
245 struct usb_config_descriptor desc; 250 struct usb_config_descriptor desc;
246 251
247 char *string; /* iConfiguration string, if present */ 252 char *string; /* iConfiguration string, if present */
253
254 /* List of any Interface Association Descriptors in this
255 * configuration. */
256 struct usb_interface_assoc_descriptor *intf_assoc[USB_MAXIADS];
257
248 /* the interfaces associated with this configuration, 258 /* the interfaces associated with this configuration,
249 * stored in no particular order */ 259 * stored in no particular order */
250 struct usb_interface *interface[USB_MAXINTERFACES]; 260 struct usb_interface *interface[USB_MAXINTERFACES];
@@ -403,6 +413,8 @@ struct usb_device {
403 413
404 unsigned auto_pm:1; /* autosuspend/resume in progress */ 414 unsigned auto_pm:1; /* autosuspend/resume in progress */
405 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ 415 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */
416 unsigned reset_resume:1; /* needs reset instead of resume */
417 unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */
406 unsigned autosuspend_disabled:1; /* autosuspend and autoresume */ 418 unsigned autosuspend_disabled:1; /* autosuspend and autoresume */
407 unsigned autoresume_disabled:1; /* disabled by the user */ 419 unsigned autoresume_disabled:1; /* disabled by the user */
408#endif 420#endif
@@ -770,6 +782,28 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
770 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \ 782 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \
771 .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) 783 .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr)
772 784
785/**
786 * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device
787 * with a class of usb interfaces
788 * @vend: the 16 bit USB Vendor ID
789 * @prod: the 16 bit USB Product ID
790 * @cl: bInterfaceClass value
791 * @sc: bInterfaceSubClass value
792 * @pr: bInterfaceProtocol value
793 *
794 * This macro is used to create a struct usb_device_id that matches a
795 * specific device with a specific class of interfaces.
796 *
797 * This is especially useful when explicitly matching devices that have
798 * vendor specific bDeviceClass values, but standards-compliant interfaces.
799 */
800#define USB_DEVICE_AND_INTERFACE_INFO(vend,prod,cl,sc,pr) \
801 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
802 | USB_DEVICE_ID_MATCH_DEVICE, \
803 .idVendor = (vend), .idProduct = (prod), \
804 .bInterfaceClass = (cl), \
805 .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr)
806
773/* ----------------------------------------------------------------------- */ 807/* ----------------------------------------------------------------------- */
774 808
775/* Stuff for dynamic usb ids */ 809/* Stuff for dynamic usb ids */
@@ -816,10 +850,15 @@ struct usbdrv_wrap {
816 * do (or don't) show up otherwise in the filesystem. 850 * do (or don't) show up otherwise in the filesystem.
817 * @suspend: Called when the device is going to be suspended by the system. 851 * @suspend: Called when the device is going to be suspended by the system.
818 * @resume: Called when the device is being resumed by the system. 852 * @resume: Called when the device is being resumed by the system.
853 * @reset_resume: Called when the suspended device has been reset instead
854 * of being resumed.
819 * @pre_reset: Called by usb_reset_composite_device() when the device 855 * @pre_reset: Called by usb_reset_composite_device() when the device
820 * is about to be reset. 856 * is about to be reset.
821 * @post_reset: Called by usb_reset_composite_device() after the device 857 * @post_reset: Called by usb_reset_composite_device() after the device
822 * has been reset. 858 * has been reset, or in lieu of @resume following a reset-resume
859 * (i.e., the device is reset instead of being resumed, as might
860 * happen if power was lost). The second argument tells which is
861 * the reason.
823 * @id_table: USB drivers use ID table to support hotplugging. 862 * @id_table: USB drivers use ID table to support hotplugging.
824 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set 863 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set
825 * or your driver's probe function will never get called. 864 * or your driver's probe function will never get called.
@@ -859,9 +898,10 @@ struct usb_driver {
859 898
860 int (*suspend) (struct usb_interface *intf, pm_message_t message); 899 int (*suspend) (struct usb_interface *intf, pm_message_t message);
861 int (*resume) (struct usb_interface *intf); 900 int (*resume) (struct usb_interface *intf);
901 int (*reset_resume)(struct usb_interface *intf);
862 902
863 void (*pre_reset) (struct usb_interface *intf); 903 int (*pre_reset)(struct usb_interface *intf);
864 void (*post_reset) (struct usb_interface *intf); 904 int (*post_reset)(struct usb_interface *intf);
865 905
866 const struct usb_device_id *id_table; 906 const struct usb_device_id *id_table;
867 907
@@ -964,6 +1004,7 @@ extern int usb_disabled(void);
964#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */ 1004#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */
965#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt 1005#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt
966 * needed */ 1006 * needed */
1007#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */
967 1008
968struct usb_iso_packet_descriptor { 1009struct usb_iso_packet_descriptor {
969 unsigned int offset; 1010 unsigned int offset;
@@ -974,11 +1015,26 @@ struct usb_iso_packet_descriptor {
974 1015
975struct urb; 1016struct urb;
976 1017
1018struct usb_anchor {
1019 struct list_head urb_list;
1020 wait_queue_head_t wait;
1021 spinlock_t lock;
1022};
1023
1024static inline void init_usb_anchor(struct usb_anchor *anchor)
1025{
1026 INIT_LIST_HEAD(&anchor->urb_list);
1027 init_waitqueue_head(&anchor->wait);
1028 spin_lock_init(&anchor->lock);
1029}
1030
977typedef void (*usb_complete_t)(struct urb *); 1031typedef void (*usb_complete_t)(struct urb *);
978 1032
979/** 1033/**
980 * struct urb - USB Request Block 1034 * struct urb - USB Request Block
981 * @urb_list: For use by current owner of the URB. 1035 * @urb_list: For use by current owner of the URB.
1036 * @anchor_list: membership in the list of an anchor
1037 * @anchor: to anchor URBs to a common mooring
982 * @pipe: Holds endpoint number, direction, type, and more. 1038 * @pipe: Holds endpoint number, direction, type, and more.
983 * Create these values with the eight macros available; 1039 * Create these values with the eight macros available;
984 * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl" 1040 * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl"
@@ -1151,6 +1207,8 @@ struct urb
1151 /* public: documented fields in the urb that can be used by drivers */ 1207 /* public: documented fields in the urb that can be used by drivers */
1152 struct list_head urb_list; /* list head for use by the urb's 1208 struct list_head urb_list; /* list head for use by the urb's
1153 * current owner */ 1209 * current owner */
1210 struct list_head anchor_list; /* the URB may be anchored by the driver */
1211 struct usb_anchor *anchor;
1154 struct usb_device *dev; /* (in) pointer to associated device */ 1212 struct usb_device *dev; /* (in) pointer to associated device */
1155 unsigned int pipe; /* (in) pipe information */ 1213 unsigned int pipe; /* (in) pipe information */
1156 int status; /* (return) non-ISO status */ 1214 int status; /* (return) non-ISO status */
@@ -1286,6 +1344,11 @@ extern struct urb *usb_get_urb(struct urb *urb);
1286extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags); 1344extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags);
1287extern int usb_unlink_urb(struct urb *urb); 1345extern int usb_unlink_urb(struct urb *urb);
1288extern void usb_kill_urb(struct urb *urb); 1346extern void usb_kill_urb(struct urb *urb);
1347extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1348extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1349extern void usb_unanchor_urb(struct urb *urb);
1350extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
1351 unsigned int timeout);
1289 1352
1290void *usb_buffer_alloc (struct usb_device *dev, size_t size, 1353void *usb_buffer_alloc (struct usb_device *dev, size_t size,
1291 gfp_t mem_flags, dma_addr_t *dma); 1354 gfp_t mem_flags, dma_addr_t *dma);