aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-10-22 16:15:06 -0400
committerFelipe Balbi <balbi@ti.com>2012-10-31 09:09:44 -0400
commit10287baec761d33f0a82d84b46e37a44030350d8 (patch)
treeb769a6dddfd4ccf81a986386bf5771182d1b0c55 /include/linux
parent0f9df939385527049c8062a099fbfa1479fe7ce0 (diff)
usb: gadget: always update HS/SS descriptors and create a copy of them
HS and SS descriptors are staticaly created. They are updated during the bind process with the endpoint address, string id or interface numbers. After that, the descriptor chain is linked to struct usb_function which is used by composite in order to serve the GET_DESCRIPTOR requests, number of available configs and so on. There is no need to assign the HS descriptor only if the UDC supports HS speed because composite won't report those to the host if HS support has not been reached. The same reasoning is valid for SS. This patch makes sure each function updates HS/SS descriptors unconditionally and uses the newly introduced helper function to create a copy the descriptors for the speed which is supported by the UDC. While at that, also rename f->descriptors to f->fs_descriptors in order to make it more explicit what that means. Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/usb/composite.h2
-rw-r--r--include/linux/usb/gadget.h7
2 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 8634a127bdd3..b09c37e04a91 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -119,7 +119,7 @@ struct usb_configuration;
119struct usb_function { 119struct usb_function {
120 const char *name; 120 const char *name;
121 struct usb_gadget_strings **strings; 121 struct usb_gadget_strings **strings;
122 struct usb_descriptor_header **descriptors; 122 struct usb_descriptor_header **fs_descriptors;
123 struct usb_descriptor_header **hs_descriptors; 123 struct usb_descriptor_header **hs_descriptors;
124 struct usb_descriptor_header **ss_descriptors; 124 struct usb_descriptor_header **ss_descriptors;
125 125
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 5b6e50888248..0af6569b8cc6 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -939,6 +939,13 @@ static inline void usb_free_descriptors(struct usb_descriptor_header **v)
939 kfree(v); 939 kfree(v);
940} 940}
941 941
942struct usb_function;
943int usb_assign_descriptors(struct usb_function *f,
944 struct usb_descriptor_header **fs,
945 struct usb_descriptor_header **hs,
946 struct usb_descriptor_header **ss);
947void usb_free_all_descriptors(struct usb_function *f);
948
942/*-------------------------------------------------------------------------*/ 949/*-------------------------------------------------------------------------*/
943 950
944/* utility to simplify map/unmap of usb_requests to/from DMA */ 951/* utility to simplify map/unmap of usb_requests to/from DMA */