.. | .. |
---|
285 | 285 | #define USB_MAXINTERFACES 32 |
---|
286 | 286 | #define USB_MAXIADS (USB_MAXINTERFACES/2) |
---|
287 | 287 | |
---|
| 288 | +bool usb_check_bulk_endpoints( |
---|
| 289 | + const struct usb_interface *intf, const u8 *ep_addrs); |
---|
| 290 | +bool usb_check_int_endpoints( |
---|
| 291 | + const struct usb_interface *intf, const u8 *ep_addrs); |
---|
| 292 | + |
---|
288 | 293 | /* |
---|
289 | 294 | * USB Resume Timer: Every Host controller driver should drive the resume |
---|
290 | 295 | * signalling on the bus for the amount of time defined by this macro. |
---|
.. | .. |
---|
331 | 336 | |
---|
332 | 337 | /* variable-length array of alternate settings for this interface, |
---|
333 | 338 | * stored in no particular order */ |
---|
334 | | - struct usb_host_interface altsetting[0]; |
---|
| 339 | + struct usb_host_interface altsetting[]; |
---|
335 | 340 | }; |
---|
336 | 341 | #define ref_to_usb_interface_cache(r) \ |
---|
337 | 342 | container_of(r, struct usb_interface_cache, ref) |
---|
.. | .. |
---|
347 | 352 | * @interface: array of pointers to usb_interface structures, one for each |
---|
348 | 353 | * interface in the configuration. The number of interfaces is stored |
---|
349 | 354 | * in desc.bNumInterfaces. These pointers are valid only while the |
---|
350 | | - * the configuration is active. |
---|
| 355 | + * configuration is active. |
---|
351 | 356 | * @intf_cache: array of pointers to usb_interface_cache structures, one |
---|
352 | 357 | * for each interface in the configuration. These structures exist |
---|
353 | 358 | * for the entire life of the device. |
---|
.. | .. |
---|
408 | 413 | struct usb_ssp_cap_descriptor *ssp_cap; |
---|
409 | 414 | struct usb_ss_container_id_descriptor *ss_id; |
---|
410 | 415 | struct usb_ptm_cap_descriptor *ptm_cap; |
---|
411 | | - struct usb_config_summary_descriptor *config_summary; |
---|
412 | | - unsigned int num_config_summary_desc; |
---|
413 | 416 | |
---|
414 | 417 | ANDROID_KABI_RESERVE(1); |
---|
415 | 418 | ANDROID_KABI_RESERVE(2); |
---|
.. | .. |
---|
435 | 438 | * Allocated per bus (tree of devices) we have: |
---|
436 | 439 | */ |
---|
437 | 440 | struct usb_bus { |
---|
438 | | - struct device *controller; /* host/master side hardware */ |
---|
| 441 | + struct device *controller; /* host side hardware */ |
---|
439 | 442 | struct device *sysdev; /* as seen from firmware or bus */ |
---|
440 | 443 | int busnum; /* Bus number (in order of reg) */ |
---|
441 | 444 | const char *bus_name; /* stable id (PCI slot_name etc) */ |
---|
442 | | - u8 uses_dma; /* Does the host controller use DMA? */ |
---|
443 | 445 | u8 uses_pio_for_control; /* |
---|
444 | 446 | * Does the host controller use PIO |
---|
445 | 447 | * for control transfers? |
---|
.. | .. |
---|
479 | 481 | struct mon_bus *mon_bus; /* non-null when associated */ |
---|
480 | 482 | int monitored; /* non-zero when monitored */ |
---|
481 | 483 | #endif |
---|
482 | | - unsigned skip_resume:1; /* All USB devices are brought into full |
---|
483 | | - * power state after system resume. It |
---|
484 | | - * is desirable for some buses to keep |
---|
485 | | - * their devices in suspend state even |
---|
486 | | - * after system resume. The devices |
---|
487 | | - * are resumed later when a remote |
---|
488 | | - * wakeup is detected or an interface |
---|
489 | | - * driver starts I/O. |
---|
490 | | - */ |
---|
491 | 484 | |
---|
492 | 485 | ANDROID_KABI_RESERVE(1); |
---|
493 | 486 | ANDROID_KABI_RESERVE(2); |
---|
.. | .. |
---|
605 | 598 | * @bus_mA: Current available from the bus |
---|
606 | 599 | * @portnum: parent port number (origin 1) |
---|
607 | 600 | * @level: number of USB hub ancestors |
---|
| 601 | + * @devaddr: device address, XHCI: assigned by HW, others: same as devnum |
---|
608 | 602 | * @can_submit: URBs may be submitted |
---|
609 | 603 | * @persist_enabled: USB_PERSIST enabled for this device |
---|
610 | 604 | * @have_langid: whether string_langid is valid |
---|
.. | .. |
---|
647 | 641 | * Management to be disabled for this usb_device. This count should only |
---|
648 | 642 | * be manipulated by those functions, with the bandwidth_mutex is held. |
---|
649 | 643 | * @hub_delay: cached value consisting of: |
---|
650 | | - * parent->hub_delay + wHubDelay + tTPTransmissionDelay (40ns) |
---|
651 | | - * |
---|
| 644 | + * parent->hub_delay + wHubDelay + tTPTransmissionDelay (40ns) |
---|
652 | 645 | * Will be used as wValue for SetIsochDelay requests. |
---|
| 646 | + * @use_generic_driver: ask driver core to reprobe using the generic driver. |
---|
653 | 647 | * |
---|
654 | 648 | * Notes: |
---|
655 | 649 | * Usbcore drivers should not set usbdev->state directly. Instead use |
---|
.. | .. |
---|
688 | 682 | unsigned short bus_mA; |
---|
689 | 683 | u8 portnum; |
---|
690 | 684 | u8 level; |
---|
| 685 | + u8 devaddr; |
---|
691 | 686 | |
---|
692 | 687 | unsigned can_submit:1; |
---|
693 | 688 | unsigned persist_enabled:1; |
---|
.. | .. |
---|
734 | 729 | unsigned lpm_disable_count; |
---|
735 | 730 | |
---|
736 | 731 | u16 hub_delay; |
---|
| 732 | + unsigned use_generic_driver:1; |
---|
737 | 733 | |
---|
738 | 734 | ANDROID_KABI_RESERVE(1); |
---|
739 | 735 | ANDROID_KABI_RESERVE(2); |
---|
.. | .. |
---|
776 | 772 | extern int usb_reset_device(struct usb_device *dev); |
---|
777 | 773 | extern void usb_queue_reset_device(struct usb_interface *dev); |
---|
778 | 774 | |
---|
| 775 | +extern struct device *usb_intf_get_dma_device(struct usb_interface *intf); |
---|
| 776 | + |
---|
779 | 777 | #ifdef CONFIG_ACPI |
---|
780 | 778 | extern int usb_acpi_set_power_state(struct usb_device *hdev, int index, |
---|
781 | 779 | bool enable); |
---|
782 | 780 | extern bool usb_acpi_power_manageable(struct usb_device *hdev, int index); |
---|
| 781 | +extern int usb_acpi_port_lpm_incapable(struct usb_device *hdev, int index); |
---|
783 | 782 | #else |
---|
784 | 783 | static inline int usb_acpi_set_power_state(struct usb_device *hdev, int index, |
---|
785 | 784 | bool enable) { return 0; } |
---|
786 | 785 | static inline bool usb_acpi_power_manageable(struct usb_device *hdev, int index) |
---|
787 | 786 | { return true; } |
---|
| 787 | +static inline int usb_acpi_port_lpm_incapable(struct usb_device *hdev, int index) |
---|
| 788 | + { return 0; } |
---|
788 | 789 | #endif |
---|
789 | 790 | |
---|
790 | 791 | /* USB autosuspend and autoresume */ |
---|
.. | .. |
---|
856 | 857 | |
---|
857 | 858 | /* for drivers using iso endpoints */ |
---|
858 | 859 | extern int usb_get_current_frame_number(struct usb_device *usb_dev); |
---|
859 | | -extern int usb_sec_event_ring_setup(struct usb_device *dev, |
---|
860 | | - unsigned int intr_num); |
---|
861 | | -extern int usb_sec_event_ring_cleanup(struct usb_device *dev, |
---|
862 | | - unsigned int intr_num); |
---|
863 | | - |
---|
864 | | -extern phys_addr_t usb_get_sec_event_ring_phys_addr( |
---|
865 | | - struct usb_device *dev, unsigned int intr_num, dma_addr_t *dma); |
---|
866 | | -extern phys_addr_t usb_get_xfer_ring_phys_addr(struct usb_device *dev, |
---|
867 | | - struct usb_host_endpoint *ep, dma_addr_t *dma); |
---|
868 | | -extern int usb_get_controller_id(struct usb_device *dev); |
---|
869 | | - |
---|
870 | | -extern int usb_stop_endpoint(struct usb_device *dev, |
---|
871 | | - struct usb_host_endpoint *ep); |
---|
872 | 860 | |
---|
873 | 861 | /* Sets up a group of bulk endpoints to support multiple stream IDs. */ |
---|
874 | 862 | extern int usb_alloc_streams(struct usb_interface *interface, |
---|
.. | .. |
---|
1194 | 1182 | * @id_table: USB drivers use ID table to support hotplugging. |
---|
1195 | 1183 | * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set |
---|
1196 | 1184 | * or your driver's probe function will never get called. |
---|
| 1185 | + * @dev_groups: Attributes attached to the device that will be created once it |
---|
| 1186 | + * is bound to the driver. |
---|
1197 | 1187 | * @dynids: used internally to hold the list of dynamically added device |
---|
1198 | 1188 | * ids for this driver. |
---|
1199 | 1189 | * @drvwrap: Driver-model core structure wrapper. |
---|
.. | .. |
---|
1241 | 1231 | int (*post_reset)(struct usb_interface *intf); |
---|
1242 | 1232 | |
---|
1243 | 1233 | const struct usb_device_id *id_table; |
---|
| 1234 | + const struct attribute_group **dev_groups; |
---|
1244 | 1235 | |
---|
1245 | 1236 | struct usb_dynids dynids; |
---|
1246 | 1237 | struct usbdrv_wrap drvwrap; |
---|
.. | .. |
---|
1260 | 1251 | * struct usb_device_driver - identifies USB device driver to usbcore |
---|
1261 | 1252 | * @name: The driver name should be unique among USB drivers, |
---|
1262 | 1253 | * and should normally be the same as the module name. |
---|
| 1254 | + * @match: If set, used for better device/driver matching. |
---|
1263 | 1255 | * @probe: Called to see if the driver is willing to manage a particular |
---|
1264 | 1256 | * device. If it is, probe returns zero and uses dev_set_drvdata() |
---|
1265 | 1257 | * to associate driver-specific data with the device. If unwilling |
---|
.. | .. |
---|
1269 | 1261 | * module is being unloaded. |
---|
1270 | 1262 | * @suspend: Called when the device is going to be suspended by the system. |
---|
1271 | 1263 | * @resume: Called when the device is being resumed by the system. |
---|
| 1264 | + * @dev_groups: Attributes attached to the device that will be created once it |
---|
| 1265 | + * is bound to the driver. |
---|
1272 | 1266 | * @drvwrap: Driver-model core structure wrapper. |
---|
| 1267 | + * @id_table: used with @match() to select better matching driver at |
---|
| 1268 | + * probe() time. |
---|
1273 | 1269 | * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend |
---|
1274 | 1270 | * for devices bound to this driver. |
---|
| 1271 | + * @generic_subclass: if set to 1, the generic USB driver's probe, disconnect, |
---|
| 1272 | + * resume and suspend functions will be called in addition to the driver's |
---|
| 1273 | + * own, so this part of the setup does not need to be replicated. |
---|
1275 | 1274 | * |
---|
1276 | | - * USB drivers must provide all the fields listed above except drvwrap. |
---|
| 1275 | + * USB drivers must provide all the fields listed above except drvwrap, |
---|
| 1276 | + * match, and id_table. |
---|
1277 | 1277 | */ |
---|
1278 | 1278 | struct usb_device_driver { |
---|
1279 | 1279 | const char *name; |
---|
1280 | 1280 | |
---|
| 1281 | + bool (*match) (struct usb_device *udev); |
---|
1281 | 1282 | int (*probe) (struct usb_device *udev); |
---|
1282 | 1283 | void (*disconnect) (struct usb_device *udev); |
---|
1283 | 1284 | |
---|
1284 | 1285 | int (*suspend) (struct usb_device *udev, pm_message_t message); |
---|
1285 | 1286 | int (*resume) (struct usb_device *udev, pm_message_t message); |
---|
| 1287 | + const struct attribute_group **dev_groups; |
---|
1286 | 1288 | struct usbdrv_wrap drvwrap; |
---|
| 1289 | + const struct usb_device_id *id_table; |
---|
1287 | 1290 | unsigned int supports_autosuspend:1; |
---|
| 1291 | + unsigned int generic_subclass:1; |
---|
1288 | 1292 | }; |
---|
1289 | 1293 | #define to_usb_device_driver(d) container_of(d, struct usb_device_driver, \ |
---|
1290 | 1294 | drvwrap.driver) |
---|
.. | .. |
---|
1505 | 1509 | * field rather than determining a dma address themselves. |
---|
1506 | 1510 | * |
---|
1507 | 1511 | * Note that transfer_buffer must still be set if the controller |
---|
1508 | | - * does not support DMA (as indicated by bus.uses_dma) and when talking |
---|
| 1512 | + * does not support DMA (as indicated by hcd_uses_dma()) and when talking |
---|
1509 | 1513 | * to root hub. If you have to trasfer between highmem zone and the device |
---|
1510 | 1514 | * on such controller, create a bounce buffer or bail out with an error. |
---|
1511 | 1515 | * If transfer_buffer cannot be set (is in highmem) and the controller is DMA |
---|
.. | .. |
---|
1593 | 1597 | struct urb { |
---|
1594 | 1598 | /* private: usb core and host controller only fields in the urb */ |
---|
1595 | 1599 | struct kref kref; /* reference count of the URB */ |
---|
| 1600 | + int unlinked; /* unlink error code */ |
---|
1596 | 1601 | void *hcpriv; /* private data for host controller */ |
---|
1597 | 1602 | atomic_t use_count; /* concurrent submissions counter */ |
---|
1598 | 1603 | atomic_t reject; /* submissions will fail */ |
---|
1599 | | - int unlinked; /* unlink error code */ |
---|
1600 | 1604 | |
---|
1601 | 1605 | /* public: documented fields in the urb that can be used by drivers */ |
---|
1602 | 1606 | struct list_head urb_list; /* list head for use by the urb's |
---|
.. | .. |
---|
1625 | 1629 | int error_count; /* (return) number of ISO errors */ |
---|
1626 | 1630 | void *context; /* (in) context for completion */ |
---|
1627 | 1631 | usb_complete_t complete; /* (in) completion routine */ |
---|
1628 | | - struct usb_iso_packet_descriptor iso_frame_desc[0]; |
---|
1629 | | - /* (in) ISO ONLY */ |
---|
| 1632 | + |
---|
1630 | 1633 | ANDROID_KABI_RESERVE(1); |
---|
1631 | 1634 | ANDROID_KABI_RESERVE(2); |
---|
1632 | 1635 | ANDROID_KABI_RESERVE(3); |
---|
1633 | 1636 | ANDROID_KABI_RESERVE(4); |
---|
| 1637 | + |
---|
| 1638 | + struct usb_iso_packet_descriptor iso_frame_desc[]; |
---|
| 1639 | + /* (in) ISO ONLY */ |
---|
1634 | 1640 | }; |
---|
1635 | 1641 | |
---|
1636 | 1642 | /* ----------------------------------------------------------------------- */ |
---|
.. | .. |
---|
1800 | 1806 | return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; |
---|
1801 | 1807 | } |
---|
1802 | 1808 | |
---|
| 1809 | +int usb_pipe_type_check(struct usb_device *dev, unsigned int pipe); |
---|
1803 | 1810 | int usb_urb_ep_type_check(const struct urb *urb); |
---|
1804 | 1811 | |
---|
1805 | 1812 | void *usb_alloc_coherent(struct usb_device *dev, size_t size, |
---|
.. | .. |
---|
1837 | 1844 | int timeout); |
---|
1838 | 1845 | |
---|
1839 | 1846 | /* wrappers around usb_control_msg() for the most common standard requests */ |
---|
| 1847 | +int usb_control_msg_send(struct usb_device *dev, __u8 endpoint, __u8 request, |
---|
| 1848 | + __u8 requesttype, __u16 value, __u16 index, |
---|
| 1849 | + const void *data, __u16 size, int timeout, |
---|
| 1850 | + gfp_t memflags); |
---|
| 1851 | +int usb_control_msg_recv(struct usb_device *dev, __u8 endpoint, __u8 request, |
---|
| 1852 | + __u8 requesttype, __u16 value, __u16 index, |
---|
| 1853 | + void *data, __u16 size, int timeout, |
---|
| 1854 | + gfp_t memflags); |
---|
1840 | 1855 | extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype, |
---|
1841 | 1856 | unsigned char descindex, void *buf, int size); |
---|
1842 | 1857 | extern int usb_get_status(struct usb_device *dev, |
---|
.. | .. |
---|
2044 | 2059 | #define USB_DEVICE_REMOVE 0x0002 |
---|
2045 | 2060 | #define USB_BUS_ADD 0x0003 |
---|
2046 | 2061 | #define USB_BUS_REMOVE 0x0004 |
---|
2047 | | -#define USB_BUS_DIED 0x0005 |
---|
2048 | 2062 | extern void usb_register_notify(struct notifier_block *nb); |
---|
2049 | 2063 | extern void usb_unregister_notify(struct notifier_block *nb); |
---|
2050 | | -extern void usb_register_atomic_notify(struct notifier_block *nb); |
---|
2051 | | -extern void usb_unregister_atomic_notify(struct notifier_block *nb); |
---|
2052 | 2064 | |
---|
2053 | 2065 | /* debugfs stuff */ |
---|
2054 | 2066 | extern struct dentry *usb_debug_root; |
---|