diff options
Diffstat (limited to 'include/linux/usb/gadget.h')
| -rw-r--r-- | include/linux/usb/gadget.h | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 9517466ababb..5b6e50888248 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
| @@ -474,7 +474,8 @@ struct usb_gadget_ops { | |||
| 474 | 474 | ||
| 475 | /* Those two are deprecated */ | 475 | /* Those two are deprecated */ |
| 476 | int (*start)(struct usb_gadget_driver *, | 476 | int (*start)(struct usb_gadget_driver *, |
| 477 | int (*bind)(struct usb_gadget *)); | 477 | int (*bind)(struct usb_gadget *, |
| 478 | struct usb_gadget_driver *driver)); | ||
| 478 | int (*stop)(struct usb_gadget_driver *); | 479 | int (*stop)(struct usb_gadget_driver *); |
| 479 | }; | 480 | }; |
| 480 | 481 | ||
| @@ -502,6 +503,8 @@ struct usb_gadget_ops { | |||
| 502 | * @name: Identifies the controller hardware type. Used in diagnostics | 503 | * @name: Identifies the controller hardware type. Used in diagnostics |
| 503 | * and sometimes configuration. | 504 | * and sometimes configuration. |
| 504 | * @dev: Driver model state for this abstract device. | 505 | * @dev: Driver model state for this abstract device. |
| 506 | * @out_epnum: last used out ep number | ||
| 507 | * @in_epnum: last used in ep number | ||
| 505 | * | 508 | * |
| 506 | * Gadgets have a mostly-portable "gadget driver" implementing device | 509 | * Gadgets have a mostly-portable "gadget driver" implementing device |
| 507 | * functions, handling all usb configurations and interfaces. Gadget | 510 | * functions, handling all usb configurations and interfaces. Gadget |
| @@ -536,6 +539,8 @@ struct usb_gadget { | |||
| 536 | unsigned a_alt_hnp_support:1; | 539 | unsigned a_alt_hnp_support:1; |
| 537 | const char *name; | 540 | const char *name; |
| 538 | struct device dev; | 541 | struct device dev; |
| 542 | unsigned out_epnum; | ||
| 543 | unsigned in_epnum; | ||
| 539 | }; | 544 | }; |
| 540 | 545 | ||
| 541 | static inline void set_gadget_data(struct usb_gadget *gadget, void *data) | 546 | static inline void set_gadget_data(struct usb_gadget *gadget, void *data) |
| @@ -558,14 +563,7 @@ static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev) | |||
| 558 | */ | 563 | */ |
| 559 | static inline int gadget_is_dualspeed(struct usb_gadget *g) | 564 | static inline int gadget_is_dualspeed(struct usb_gadget *g) |
| 560 | { | 565 | { |
| 561 | #ifdef CONFIG_USB_GADGET_DUALSPEED | 566 | return g->max_speed >= USB_SPEED_HIGH; |
| 562 | /* runtime test would check "g->max_speed" ... that might be | ||
| 563 | * useful to work around hardware bugs, but is mostly pointless | ||
| 564 | */ | ||
| 565 | return 1; | ||
| 566 | #else | ||
| 567 | return 0; | ||
| 568 | #endif | ||
| 569 | } | 567 | } |
| 570 | 568 | ||
| 571 | /** | 569 | /** |
| @@ -575,15 +573,7 @@ static inline int gadget_is_dualspeed(struct usb_gadget *g) | |||
| 575 | */ | 573 | */ |
| 576 | static inline int gadget_is_superspeed(struct usb_gadget *g) | 574 | static inline int gadget_is_superspeed(struct usb_gadget *g) |
| 577 | { | 575 | { |
| 578 | #ifdef CONFIG_USB_GADGET_SUPERSPEED | 576 | return g->max_speed >= USB_SPEED_SUPER; |
| 579 | /* | ||
| 580 | * runtime test would check "g->max_speed" ... that might be | ||
| 581 | * useful to work around hardware bugs, but is mostly pointless | ||
| 582 | */ | ||
| 583 | return 1; | ||
| 584 | #else | ||
| 585 | return 0; | ||
| 586 | #endif | ||
| 587 | } | 577 | } |
| 588 | 578 | ||
| 589 | /** | 579 | /** |
| @@ -781,6 +771,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget) | |||
| 781 | * when the host is disconnected. May be called in_interrupt; this | 771 | * when the host is disconnected. May be called in_interrupt; this |
| 782 | * may not sleep. Some devices can't detect disconnect, so this might | 772 | * may not sleep. Some devices can't detect disconnect, so this might |
| 783 | * not be called except as part of controller shutdown. | 773 | * not be called except as part of controller shutdown. |
| 774 | * @bind: the driver's bind callback | ||
| 784 | * @unbind: Invoked when the driver is unbound from a gadget, | 775 | * @unbind: Invoked when the driver is unbound from a gadget, |
| 785 | * usually from rmmod (after a disconnect is reported). | 776 | * usually from rmmod (after a disconnect is reported). |
| 786 | * Called in a context that permits sleeping. | 777 | * Called in a context that permits sleeping. |
| @@ -835,6 +826,8 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget) | |||
| 835 | struct usb_gadget_driver { | 826 | struct usb_gadget_driver { |
| 836 | char *function; | 827 | char *function; |
| 837 | enum usb_device_speed max_speed; | 828 | enum usb_device_speed max_speed; |
| 829 | int (*bind)(struct usb_gadget *gadget, | ||
| 830 | struct usb_gadget_driver *driver); | ||
| 838 | void (*unbind)(struct usb_gadget *); | 831 | void (*unbind)(struct usb_gadget *); |
| 839 | int (*setup)(struct usb_gadget *, | 832 | int (*setup)(struct usb_gadget *, |
| 840 | const struct usb_ctrlrequest *); | 833 | const struct usb_ctrlrequest *); |
| @@ -860,7 +853,6 @@ struct usb_gadget_driver { | |||
| 860 | /** | 853 | /** |
| 861 | * usb_gadget_probe_driver - probe a gadget driver | 854 | * usb_gadget_probe_driver - probe a gadget driver |
| 862 | * @driver: the driver being registered | 855 | * @driver: the driver being registered |
| 863 | * @bind: the driver's bind callback | ||
| 864 | * Context: can sleep | 856 | * Context: can sleep |
| 865 | * | 857 | * |
| 866 | * Call this in your gadget driver's module initialization function, | 858 | * Call this in your gadget driver's module initialization function, |
| @@ -869,8 +861,7 @@ struct usb_gadget_driver { | |||
| 869 | * registration call returns. It's expected that the @bind() function will | 861 | * registration call returns. It's expected that the @bind() function will |
| 870 | * be in init sections. | 862 | * be in init sections. |
| 871 | */ | 863 | */ |
| 872 | int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | 864 | int usb_gadget_probe_driver(struct usb_gadget_driver *driver); |
| 873 | int (*bind)(struct usb_gadget *)); | ||
| 874 | 865 | ||
| 875 | /** | 866 | /** |
| 876 | * usb_gadget_unregister_driver - unregister a gadget driver | 867 | * usb_gadget_unregister_driver - unregister a gadget driver |
