summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/zero.c
diff options
context:
space:
mode:
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>2012-04-16 14:19:06 -0700
committerFelipe Balbi <balbi@ti.com>2012-05-04 15:53:08 +0300
commitb4036ccdd2ce5ec0c4f29b91312dd3cf19fc9152 (patch)
treeb48719669536a489f842b1a8d55fd73a69055066 /drivers/usb/gadget/zero.c
parent20c5e74c7b47cefaf2cd0f84bdb4830b66452384 (diff)
downloadop-kernel-dev-b4036ccdd2ce5ec0c4f29b91312dd3cf19fc9152.zip
op-kernel-dev-b4036ccdd2ce5ec0c4f29b91312dd3cf19fc9152.tar.gz
usb: gadget: add isochronous support to gadget zero
Add two isochronous endpoints to the gadget zero source/sink function. They are enabled by selecting alternate interface 1, so by default they are not enabled. Module parameters for setting all the isoc endpoint characteristics are also provided. Signed-off-by: Pratyush Anand <pratyush.anand@st.com> Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/zero.c')
-rw-r--r--drivers/usb/gadget/zero.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index 31d3483..12ad516 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -72,7 +72,7 @@
static const char longname[] = "Gadget Zero";
-unsigned buflen = 4096;
+unsigned buflen = 4096; /* only used for bulk endpoints */
module_param(buflen, uint, 0);
/*
@@ -170,14 +170,17 @@ static struct usb_gadget_strings *dev_strings[] = {
/*-------------------------------------------------------------------------*/
-struct usb_request *alloc_ep_req(struct usb_ep *ep)
+struct usb_request *alloc_ep_req(struct usb_ep *ep, int len)
{
struct usb_request *req;
req = usb_ep_alloc_request(ep, GFP_ATOMIC);
if (req) {
- req->length = buflen;
- req->buf = kmalloc(buflen, GFP_ATOMIC);
+ if (len)
+ req->length = len;
+ else
+ req->length = buflen;
+ req->buf = kmalloc(req->length, GFP_ATOMIC);
if (!req->buf) {
usb_ep_free_request(ep, req);
req = NULL;
@@ -206,10 +209,15 @@ static void disable_ep(struct usb_composite_dev *cdev, struct usb_ep *ep)
}
void disable_endpoints(struct usb_composite_dev *cdev,
- struct usb_ep *in, struct usb_ep *out)
+ struct usb_ep *in, struct usb_ep *out,
+ struct usb_ep *iso_in, struct usb_ep *iso_out)
{
disable_ep(cdev, in);
disable_ep(cdev, out);
+ if (iso_in)
+ disable_ep(cdev, iso_in);
+ if (iso_out)
+ disable_ep(cdev, iso_out);
}
/*-------------------------------------------------------------------------*/
@@ -311,7 +319,6 @@ static int __init zero_bind(struct usb_composite_dev *cdev)
device_desc.bcdDevice = cpu_to_le16(0x9999);
}
-
INFO(cdev, "%s, version: " DRIVER_VERSION "\n", longname);
snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
OpenPOWER on IntegriCloud