add supports OTG 2.0 for multi.c

Signed-off-by: Macpaul Lin <macp...@gmail.com>

changes for v2:
  - no change
changes for v3:
  - multi.c: migrate global static const OTG descriptor with runtime retrived
    capability information by calling usb_gadget_customize_otg_desc().
---
 drivers/usb/gadget/legacy/multi.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/gadget/legacy/multi.c 
b/drivers/usb/gadget/legacy/multi.c
index 39d27bb..01bfe42 100644
--- a/drivers/usb/gadget/legacy/multi.c
+++ b/drivers/usb/gadget/legacy/multi.c
@@ -78,22 +78,6 @@ static struct usb_device_descriptor device_desc = {
        .idProduct =            cpu_to_le16(MULTI_PRODUCT_NUM),
 };
 
-
-static const struct usb_descriptor_header *otg_desc[] = {
-       (struct usb_descriptor_header *) &(struct usb_otg_descriptor){
-               .bLength =              sizeof(struct usb_otg_descriptor),
-               .bDescriptorType =      USB_DT_OTG,
-
-               /*
-                * REVISIT SRP-only hardware is possible, although
-                * it would not be called "OTG" ...
-                */
-               .bmAttributes =         USB_OTG_SRP | USB_OTG_HNP,
-       },
-       NULL,
-};
-
-
 enum {
        MULTI_STRING_RNDIS_CONFIG_IDX = USB_GADGET_FIRST_AVAIL_IDX,
        MULTI_STRING_CDC_CONFIG_IDX,
@@ -152,9 +136,13 @@ static struct usb_function *f_msg_rndis;
 static __init int rndis_do_config(struct usb_configuration *c)
 {
        struct fsg_opts *fsg_opts;
+       static const struct usb_descriptor_header *otg_desc[2];
        int ret;
 
        if (gadget_is_otg(c->cdev->gadget)) {
+               otg_desc[0] = (struct usb_descriptor_header *)
+                               usb_gadget_customize_otg_desc(c->cdev->gadget);
+               otg_desc[1] = NULL;
                c->descriptors = otg_desc;
                c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
        }
@@ -240,9 +228,13 @@ static struct usb_function *f_msg_multi;
 static __init int cdc_do_config(struct usb_configuration *c)
 {
        struct fsg_opts *fsg_opts;
+       static const struct usb_descriptor_header *otg_desc[2];
        int ret;
 
        if (gadget_is_otg(c->cdev->gadget)) {
+               otg_desc[0] = (struct usb_descriptor_header *)
+                               usb_gadget_customize_otg_desc(c->cdev->gadget);
+               otg_desc[1] = NULL;
                c->descriptors = otg_desc;
                c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
        }
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to