Loading drivers/usb/gadget/epautoconf.c +38 −0 Original line number Diff line number Diff line Loading @@ -209,3 +209,41 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget) gadget->out_epnum = 0; } EXPORT_SYMBOL_GPL(usb_ep_autoconfig_reset); /** * usb_ep_autoconfig_by_name - Used to pick the endpoint by name. eg ep1in-gsi * @gadget: The device to which the endpoint must belong. * @desc: Endpoint descriptor, with endpoint direction and transfer mode * initialized. * @ep_name: EP name that is to be searched. * */ struct usb_ep *usb_ep_autoconfig_by_name( struct usb_gadget *gadget, struct usb_endpoint_descriptor *desc, const char *ep_name ) { struct usb_ep *ep; bool ep_found = false; list_for_each_entry(ep, &gadget->ep_list, ep_list) if (strcmp(ep->name, ep_name) == 0 && !ep->driver_data) { ep_found = true; break; } if (ep_found) { desc->bEndpointAddress &= USB_DIR_IN; desc->bEndpointAddress |= ep->ep_num; ep->address = desc->bEndpointAddress; pr_debug("Allocating ep address:%x\n", ep->address); ep->desc = NULL; ep->comp_desc = NULL; return ep; } pr_err("%s:error finding ep %s\n", __func__, ep_name); return NULL; } EXPORT_SYMBOL(usb_ep_autoconfig_by_name); include/linux/usb/gadget.h +5 −0 Original line number Diff line number Diff line Loading @@ -297,6 +297,7 @@ struct usb_ep_caps { * @comp_desc: In case of SuperSpeed support, this is the endpoint companion * descriptor that is used to configure the endpoint * @ep_type: Used to specify type of EP eg. normal vs h/w accelerated. * @ep_num: Used EP number * @ep_intr_num: Interrupter number for EP. * * the bus controller driver lists all the general purpose endpoints in Loading @@ -322,6 +323,7 @@ struct usb_ep { const struct usb_endpoint_descriptor *desc; const struct usb_ss_ep_comp_descriptor *comp_desc; enum ep_type ep_type; u8 ep_num; u8 ep_intr_num; }; Loading Loading @@ -984,6 +986,9 @@ extern struct usb_ep *usb_ep_autoconfig_ss(struct usb_gadget *, extern void usb_ep_autoconfig_release(struct usb_ep *); extern void usb_ep_autoconfig_reset(struct usb_gadget *); extern struct usb_ep *usb_ep_autoconfig_by_name(struct usb_gadget *gadget, struct usb_endpoint_descriptor *desc, const char *ep_name); #ifdef CONFIG_USB_DWC3_MSM int msm_ep_config(struct usb_ep *ep); Loading Loading
drivers/usb/gadget/epautoconf.c +38 −0 Original line number Diff line number Diff line Loading @@ -209,3 +209,41 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget) gadget->out_epnum = 0; } EXPORT_SYMBOL_GPL(usb_ep_autoconfig_reset); /** * usb_ep_autoconfig_by_name - Used to pick the endpoint by name. eg ep1in-gsi * @gadget: The device to which the endpoint must belong. * @desc: Endpoint descriptor, with endpoint direction and transfer mode * initialized. * @ep_name: EP name that is to be searched. * */ struct usb_ep *usb_ep_autoconfig_by_name( struct usb_gadget *gadget, struct usb_endpoint_descriptor *desc, const char *ep_name ) { struct usb_ep *ep; bool ep_found = false; list_for_each_entry(ep, &gadget->ep_list, ep_list) if (strcmp(ep->name, ep_name) == 0 && !ep->driver_data) { ep_found = true; break; } if (ep_found) { desc->bEndpointAddress &= USB_DIR_IN; desc->bEndpointAddress |= ep->ep_num; ep->address = desc->bEndpointAddress; pr_debug("Allocating ep address:%x\n", ep->address); ep->desc = NULL; ep->comp_desc = NULL; return ep; } pr_err("%s:error finding ep %s\n", __func__, ep_name); return NULL; } EXPORT_SYMBOL(usb_ep_autoconfig_by_name);
include/linux/usb/gadget.h +5 −0 Original line number Diff line number Diff line Loading @@ -297,6 +297,7 @@ struct usb_ep_caps { * @comp_desc: In case of SuperSpeed support, this is the endpoint companion * descriptor that is used to configure the endpoint * @ep_type: Used to specify type of EP eg. normal vs h/w accelerated. * @ep_num: Used EP number * @ep_intr_num: Interrupter number for EP. * * the bus controller driver lists all the general purpose endpoints in Loading @@ -322,6 +323,7 @@ struct usb_ep { const struct usb_endpoint_descriptor *desc; const struct usb_ss_ep_comp_descriptor *comp_desc; enum ep_type ep_type; u8 ep_num; u8 ep_intr_num; }; Loading Loading @@ -984,6 +986,9 @@ extern struct usb_ep *usb_ep_autoconfig_ss(struct usb_gadget *, extern void usb_ep_autoconfig_release(struct usb_ep *); extern void usb_ep_autoconfig_reset(struct usb_gadget *); extern struct usb_ep *usb_ep_autoconfig_by_name(struct usb_gadget *gadget, struct usb_endpoint_descriptor *desc, const char *ep_name); #ifdef CONFIG_USB_DWC3_MSM int msm_ep_config(struct usb_ep *ep); Loading