aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb/gadget.h
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2012-10-09 10:03:21 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-10-09 10:04:25 -0400
commitffe315012510165ce82e4dd4767f0a5dba9edbf7 (patch)
treef601cd980af9d0ced5ca9aedecef4fa0d2ca0e15 /include/linux/usb/gadget.h
parente2d3a35ee427aaba99b6c68a56609ce276c51270 (diff)
parent4a8e43feeac7996b8de2d5b2823e316917493df4 (diff)
Merge tag 'disintegrate-mtd-20121009' of git://git.infradead.org/users/dhowells/linux-headers
UAPI Disintegration 2012-10-09 Conflicts: MAINTAINERS arch/arm/configs/bcmring_defconfig arch/arm/mach-imx/clk-imx51-imx53.c drivers/mtd/nand/Kconfig drivers/mtd/nand/bcm_umi_nand.c drivers/mtd/nand/nand_bcm_umi.h drivers/mtd/nand/orion_nand.c
Diffstat (limited to 'include/linux/usb/gadget.h')
-rw-r--r--include/linux/usb/gadget.h33
1 files changed, 12 insertions, 21 deletions
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 9517466abab..5b6e5088824 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
541static inline void set_gadget_data(struct usb_gadget *gadget, void *data) 546static 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 */
559static inline int gadget_is_dualspeed(struct usb_gadget *g) 564static 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 */
576static inline int gadget_is_superspeed(struct usb_gadget *g) 574static 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)
835struct usb_gadget_driver { 826struct 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 */
872int usb_gadget_probe_driver(struct usb_gadget_driver *driver, 864int 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