hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/include/linux/usb.h
....@@ -285,6 +285,11 @@
285285 #define USB_MAXINTERFACES 32
286286 #define USB_MAXIADS (USB_MAXINTERFACES/2)
287287
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
+
288293 /*
289294 * USB Resume Timer: Every Host controller driver should drive the resume
290295 * signalling on the bus for the amount of time defined by this macro.
....@@ -331,7 +336,7 @@
331336
332337 /* variable-length array of alternate settings for this interface,
333338 * stored in no particular order */
334
- struct usb_host_interface altsetting[0];
339
+ struct usb_host_interface altsetting[];
335340 };
336341 #define ref_to_usb_interface_cache(r) \
337342 container_of(r, struct usb_interface_cache, ref)
....@@ -347,7 +352,7 @@
347352 * @interface: array of pointers to usb_interface structures, one for each
348353 * interface in the configuration. The number of interfaces is stored
349354 * in desc.bNumInterfaces. These pointers are valid only while the
350
- * the configuration is active.
355
+ * configuration is active.
351356 * @intf_cache: array of pointers to usb_interface_cache structures, one
352357 * for each interface in the configuration. These structures exist
353358 * for the entire life of the device.
....@@ -408,8 +413,6 @@
408413 struct usb_ssp_cap_descriptor *ssp_cap;
409414 struct usb_ss_container_id_descriptor *ss_id;
410415 struct usb_ptm_cap_descriptor *ptm_cap;
411
- struct usb_config_summary_descriptor *config_summary;
412
- unsigned int num_config_summary_desc;
413416
414417 ANDROID_KABI_RESERVE(1);
415418 ANDROID_KABI_RESERVE(2);
....@@ -435,11 +438,10 @@
435438 * Allocated per bus (tree of devices) we have:
436439 */
437440 struct usb_bus {
438
- struct device *controller; /* host/master side hardware */
441
+ struct device *controller; /* host side hardware */
439442 struct device *sysdev; /* as seen from firmware or bus */
440443 int busnum; /* Bus number (in order of reg) */
441444 const char *bus_name; /* stable id (PCI slot_name etc) */
442
- u8 uses_dma; /* Does the host controller use DMA? */
443445 u8 uses_pio_for_control; /*
444446 * Does the host controller use PIO
445447 * for control transfers?
....@@ -479,15 +481,6 @@
479481 struct mon_bus *mon_bus; /* non-null when associated */
480482 int monitored; /* non-zero when monitored */
481483 #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
- */
491484
492485 ANDROID_KABI_RESERVE(1);
493486 ANDROID_KABI_RESERVE(2);
....@@ -605,6 +598,7 @@
605598 * @bus_mA: Current available from the bus
606599 * @portnum: parent port number (origin 1)
607600 * @level: number of USB hub ancestors
601
+ * @devaddr: device address, XHCI: assigned by HW, others: same as devnum
608602 * @can_submit: URBs may be submitted
609603 * @persist_enabled: USB_PERSIST enabled for this device
610604 * @have_langid: whether string_langid is valid
....@@ -647,9 +641,9 @@
647641 * Management to be disabled for this usb_device. This count should only
648642 * be manipulated by those functions, with the bandwidth_mutex is held.
649643 * @hub_delay: cached value consisting of:
650
- * parent->hub_delay + wHubDelay + tTPTransmissionDelay (40ns)
651
- *
644
+ * parent->hub_delay + wHubDelay + tTPTransmissionDelay (40ns)
652645 * Will be used as wValue for SetIsochDelay requests.
646
+ * @use_generic_driver: ask driver core to reprobe using the generic driver.
653647 *
654648 * Notes:
655649 * Usbcore drivers should not set usbdev->state directly. Instead use
....@@ -688,6 +682,7 @@
688682 unsigned short bus_mA;
689683 u8 portnum;
690684 u8 level;
685
+ u8 devaddr;
691686
692687 unsigned can_submit:1;
693688 unsigned persist_enabled:1;
....@@ -734,6 +729,7 @@
734729 unsigned lpm_disable_count;
735730
736731 u16 hub_delay;
732
+ unsigned use_generic_driver:1;
737733
738734 ANDROID_KABI_RESERVE(1);
739735 ANDROID_KABI_RESERVE(2);
....@@ -776,15 +772,20 @@
776772 extern int usb_reset_device(struct usb_device *dev);
777773 extern void usb_queue_reset_device(struct usb_interface *dev);
778774
775
+extern struct device *usb_intf_get_dma_device(struct usb_interface *intf);
776
+
779777 #ifdef CONFIG_ACPI
780778 extern int usb_acpi_set_power_state(struct usb_device *hdev, int index,
781779 bool enable);
782780 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);
783782 #else
784783 static inline int usb_acpi_set_power_state(struct usb_device *hdev, int index,
785784 bool enable) { return 0; }
786785 static inline bool usb_acpi_power_manageable(struct usb_device *hdev, int index)
787786 { return true; }
787
+static inline int usb_acpi_port_lpm_incapable(struct usb_device *hdev, int index)
788
+ { return 0; }
788789 #endif
789790
790791 /* USB autosuspend and autoresume */
....@@ -856,19 +857,6 @@
856857
857858 /* for drivers using iso endpoints */
858859 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);
872860
873861 /* Sets up a group of bulk endpoints to support multiple stream IDs. */
874862 extern int usb_alloc_streams(struct usb_interface *interface,
....@@ -1194,6 +1182,8 @@
11941182 * @id_table: USB drivers use ID table to support hotplugging.
11951183 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set
11961184 * 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.
11971187 * @dynids: used internally to hold the list of dynamically added device
11981188 * ids for this driver.
11991189 * @drvwrap: Driver-model core structure wrapper.
....@@ -1241,6 +1231,7 @@
12411231 int (*post_reset)(struct usb_interface *intf);
12421232
12431233 const struct usb_device_id *id_table;
1234
+ const struct attribute_group **dev_groups;
12441235
12451236 struct usb_dynids dynids;
12461237 struct usbdrv_wrap drvwrap;
....@@ -1260,6 +1251,7 @@
12601251 * struct usb_device_driver - identifies USB device driver to usbcore
12611252 * @name: The driver name should be unique among USB drivers,
12621253 * and should normally be the same as the module name.
1254
+ * @match: If set, used for better device/driver matching.
12631255 * @probe: Called to see if the driver is willing to manage a particular
12641256 * device. If it is, probe returns zero and uses dev_set_drvdata()
12651257 * to associate driver-specific data with the device. If unwilling
....@@ -1269,22 +1261,34 @@
12691261 * module is being unloaded.
12701262 * @suspend: Called when the device is going to be suspended by the system.
12711263 * @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.
12721266 * @drvwrap: Driver-model core structure wrapper.
1267
+ * @id_table: used with @match() to select better matching driver at
1268
+ * probe() time.
12731269 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
12741270 * 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.
12751274 *
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.
12771277 */
12781278 struct usb_device_driver {
12791279 const char *name;
12801280
1281
+ bool (*match) (struct usb_device *udev);
12811282 int (*probe) (struct usb_device *udev);
12821283 void (*disconnect) (struct usb_device *udev);
12831284
12841285 int (*suspend) (struct usb_device *udev, pm_message_t message);
12851286 int (*resume) (struct usb_device *udev, pm_message_t message);
1287
+ const struct attribute_group **dev_groups;
12861288 struct usbdrv_wrap drvwrap;
1289
+ const struct usb_device_id *id_table;
12871290 unsigned int supports_autosuspend:1;
1291
+ unsigned int generic_subclass:1;
12881292 };
12891293 #define to_usb_device_driver(d) container_of(d, struct usb_device_driver, \
12901294 drvwrap.driver)
....@@ -1505,7 +1509,7 @@
15051509 * field rather than determining a dma address themselves.
15061510 *
15071511 * 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
15091513 * to root hub. If you have to trasfer between highmem zone and the device
15101514 * on such controller, create a bounce buffer or bail out with an error.
15111515 * If transfer_buffer cannot be set (is in highmem) and the controller is DMA
....@@ -1593,10 +1597,10 @@
15931597 struct urb {
15941598 /* private: usb core and host controller only fields in the urb */
15951599 struct kref kref; /* reference count of the URB */
1600
+ int unlinked; /* unlink error code */
15961601 void *hcpriv; /* private data for host controller */
15971602 atomic_t use_count; /* concurrent submissions counter */
15981603 atomic_t reject; /* submissions will fail */
1599
- int unlinked; /* unlink error code */
16001604
16011605 /* public: documented fields in the urb that can be used by drivers */
16021606 struct list_head urb_list; /* list head for use by the urb's
....@@ -1625,12 +1629,14 @@
16251629 int error_count; /* (return) number of ISO errors */
16261630 void *context; /* (in) context for completion */
16271631 usb_complete_t complete; /* (in) completion routine */
1628
- struct usb_iso_packet_descriptor iso_frame_desc[0];
1629
- /* (in) ISO ONLY */
1632
+
16301633 ANDROID_KABI_RESERVE(1);
16311634 ANDROID_KABI_RESERVE(2);
16321635 ANDROID_KABI_RESERVE(3);
16331636 ANDROID_KABI_RESERVE(4);
1637
+
1638
+ struct usb_iso_packet_descriptor iso_frame_desc[];
1639
+ /* (in) ISO ONLY */
16341640 };
16351641
16361642 /* ----------------------------------------------------------------------- */
....@@ -1800,6 +1806,7 @@
18001806 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;
18011807 }
18021808
1809
+int usb_pipe_type_check(struct usb_device *dev, unsigned int pipe);
18031810 int usb_urb_ep_type_check(const struct urb *urb);
18041811
18051812 void *usb_alloc_coherent(struct usb_device *dev, size_t size,
....@@ -1837,6 +1844,14 @@
18371844 int timeout);
18381845
18391846 /* 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);
18401855 extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype,
18411856 unsigned char descindex, void *buf, int size);
18421857 extern int usb_get_status(struct usb_device *dev,
....@@ -2044,11 +2059,8 @@
20442059 #define USB_DEVICE_REMOVE 0x0002
20452060 #define USB_BUS_ADD 0x0003
20462061 #define USB_BUS_REMOVE 0x0004
2047
-#define USB_BUS_DIED 0x0005
20482062 extern void usb_register_notify(struct notifier_block *nb);
20492063 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);
20522064
20532065 /* debugfs stuff */
20542066 extern struct dentry *usb_debug_root;