mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
Merge "usb: dwc3-msm: Add usb_ep_autoconfig_by_name"
This commit is contained in:
commit
b49d4cf260
2 changed files with 51 additions and 0 deletions
|
|
@ -1861,6 +1861,51 @@ static int dbm_ep_config(struct dwc3_msm *mdwc, u8 usb_ep, u8 bam_pipe,
|
|||
return dbm_ep;
|
||||
}
|
||||
|
||||
/**
|
||||
* usb_ep_autoconfig_by_name - Used to pick the endpoint by name. eg gsi-epin1
|
||||
* @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;
|
||||
struct dwc3_ep *dep;
|
||||
bool ep_found = false;
|
||||
|
||||
if (!ep_name || !strlen(ep_name))
|
||||
goto err;
|
||||
|
||||
list_for_each_entry(ep, &gadget->ep_list, ep_list)
|
||||
if (strncmp(ep->name, ep_name, strlen(ep_name)) == 0 &&
|
||||
!ep->driver_data) {
|
||||
ep_found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ep_found) {
|
||||
dep = to_dwc3_ep(ep);
|
||||
desc->bEndpointAddress &= USB_DIR_IN;
|
||||
desc->bEndpointAddress |= dep->number >> 1;
|
||||
ep->address = desc->bEndpointAddress;
|
||||
pr_debug("Allocating ep address:%x\n", ep->address);
|
||||
ep->desc = NULL;
|
||||
ep->comp_desc = NULL;
|
||||
return ep;
|
||||
}
|
||||
|
||||
err:
|
||||
pr_err("%s:error finding ep %s\n", __func__, ep_name);
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(usb_ep_autoconfig_by_name);
|
||||
|
||||
/**
|
||||
* Configure MSM endpoint.
|
||||
* This function do specific configurations
|
||||
|
|
|
|||
|
|
@ -112,6 +112,8 @@ struct gsi_channel_info {
|
|||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_USB_DWC3_MSM)
|
||||
struct usb_ep *usb_ep_autoconfig_by_name(struct usb_gadget *gadget,
|
||||
struct usb_endpoint_descriptor *desc, const char *ep_name);
|
||||
int usb_gsi_ep_op(struct usb_ep *ep, void *op_data, enum gsi_ep_op op);
|
||||
int msm_ep_config(struct usb_ep *ep, struct usb_request *request, u32 bam_opts);
|
||||
int msm_ep_unconfig(struct usb_ep *ep);
|
||||
|
|
@ -121,6 +123,10 @@ int msm_data_fifo_config(struct usb_ep *ep, unsigned long addr, u32 size,
|
|||
bool msm_dwc3_reset_ep_after_lpm(struct usb_gadget *gadget);
|
||||
int msm_dwc3_reset_dbm_ep(struct usb_ep *ep);
|
||||
#else
|
||||
static inline struct usb_ep *usb_ep_autoconfig_by_name(
|
||||
struct usb_gadget *gadget, struct usb_endpoint_descriptor *desc,
|
||||
const char *ep_name)
|
||||
{ return NULL; }
|
||||
static inline int usb_gsi_ep_op(struct usb_ep *ep, void *op_data,
|
||||
enum gsi_ep_op op)
|
||||
{ return 0; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue