6a9c3ce563537f87ea7cfda0a56c518f7dab5a3b
[android-sdk/kernel-video.git] / include / linux / usb / drd.h
1 #include <linux/usb/gadget.h>
2 #include <linux/usb/otg.h>
3 #include <linux/usb/hcd.h>
5 struct usb_drd_setup {
6         int     (*ll_start)(void *);
7         int     (*ll_stop)(void *);
8         void    (*ll_release)(struct device *);
9         void    *data;
10 };
12 struct usb_drd_host {
13         struct usb_hcd          *main_hcd;
14         struct usb_hcd          *shared_hcd;
15         int                     hcd_irq;
16         struct usb_drd_setup *host_setup;
17 };
19 struct usb_drd_gadget {
20         struct usb_gadget_driver *g_driver;
21         struct usb_gadget *gadget;
22         struct usb_drd_setup *gadget_setup;
23 };
25 enum omap_dwc3_vbus_id_status {
26         OMAP_DWC3_ID_FLOAT,
27         OMAP_DWC3_ID_GROUND,
28         OMAP_DWC3_VBUS_OFF,
29         OMAP_DWC3_VBUS_VALID,
30 };
32 #define DRD_UNREGISTERED        0x0
33 #define DRD_DEVICE_REGISTERED   0x1
34 #define DRD_HOST_REGISTERED     0x2
35 #define DRD_HOST_ACTIVE         0x4
36 #define DRD_DEVICE_ACTIVE       0x8
38 #if IS_ENABLED(CONFIG_DRD_LIB)
39 int usb_drd_release(struct device *parent);
40 int usb_drd_add(struct device *parent);
41 int usb_drd_register_udc(struct device *parent,
42                          struct usb_drd_gadget *gadget);
43 int usb_drd_register_udc_driver(struct device *parent,
44                                 struct usb_gadget_driver *driver);
45 int usb_drd_unregister_udc(struct device *parent);
46 int usb_drd_unregister_udc_driver(struct device *parent);
47 int usb_drd_register_hcd(struct device *parent,
48                          struct usb_drd_host *host);
49 int usb_drd_unregister_hcd(struct device *parent);
50 int usb_drd_start_hcd(struct device *parent);
51 int usb_drd_stop_hcd(struct device *parent);
52 int usb_drd_start_udc(struct device *parent);
53 int usb_drd_stop_udc(struct device *parent);
54 int usb_drd_get_state(struct device *parent);
55 int dwc3_omap_usbvbus_id_handler(struct device *dev,
56         enum omap_dwc3_vbus_id_status status);
57 #else
58 static inline int usb_drd_release(struct device *parent)
59 { return 0; }
60 static inline int usb_drd_add(struct device *parent)
61 { return 0; }
62 static inline int usb_drd_register_udc(struct device *parent,
63                                        struct usb_drd_gadget *gadget)
64 { return 0; }
65 static inline int usb_drd_register_udc_driver(struct device *parent,
66                                               struct usb_gadget_driver *driver)
67 { return 0; }
68 static inline int usb_drd_unregister_udc(struct device *parent,
69                                          struct usb_drd_gadget *gadget)
70 { return 0; }
71 static inline int usb_drd_unregister_udc_driver(struct device *parent)
72 { return 0; }
73 static inline int usb_drd_register_hcd(struct device *parent,
74                                        struct usb_drd_host *host)
75 { return 0; }
76 static inline int usb_drd_unregister_hcd(struct device *parent)
77 { return 0; }
78 static inline int usb_drd_stop_hcd(struct device *parent)
79 { return 0; }
80 static inline int usb_drd_start_udc(struct device *parent)
81 { return 0; }
82 static inline int usb_drd_stop_udc(struct device *parent)
83 { return 0; }
84 static inline int usb_drd_get_state(struct device *parent)
85 { return 0; }
86 #endif