aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorSakethram Bommisetti <sakethram.bommisetti@stericsson.com>2011-01-25 16:10:30 +0530
committerJonas ABERG <jonas.aberg@stericsson.com>2011-02-04 12:47:09 +0100
commite7605f04bd6ebafec097e5cc734ff9affbc17158 (patch)
tree052179b849bc319bc845ddfdec05647c457d2e73 /drivers/usb
parent28327e018d157f3445d34e76a9f55ed010ef9327 (diff)
USB: gadget: OTG supplement revision 2.0 updates
Introduce otg_version field in usb_gadget struct.UDC can advertise OTG spec version compatibility by setting otg_version field appropriately. Gadget drivers fill the bcdOTG field in OTG descriptor based on UDC's OTG version. Add sysfs file for host_request and UDC returns the same when HNP polling request arrives from the host. Signed-off-by: Pavankumar Kondeti <pkondeti@...> Change-Id: Idde2bfcdbdada1023ef2bc7ef8d01d85fa271331 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/14267 Tested-by: Sakethram BOMMISETTI <sakethram.bommisetti@stericsson.com> Reviewed-by: Praveena NADAHALLY <praveen.nadahally@stericsson.com> Reviewed-by: QATOOLS
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/composite.c27
-rw-r--r--drivers/usb/gadget/zero.c2
2 files changed, 29 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 94d65056741..f95c855786f 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1016,6 +1016,7 @@ static void composite_disconnect(struct usb_gadget *gadget)
struct usb_composite_dev *cdev = get_gadget_data(gadget);
unsigned long flags;
+ gadget->host_request = 0;
/* REVISIT: should we have config and device level
* disconnect callbacks?
*/
@@ -1044,6 +1045,25 @@ static ssize_t composite_show_suspended(struct device *dev,
static DEVICE_ATTR(suspended, 0444, composite_show_suspended, NULL);
+
+static ssize_t composite_set_host_request(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct usb_gadget *gadget = dev_to_usb_gadget(dev);
+ int value;
+
+ if (sscanf(buf, "%d", &value) != 1)
+ return -EINVAL;
+
+ gadget->host_request = !!value;
+ return count;
+
+}
+
+static DEVICE_ATTR(host_request, S_IWUSR, NULL, composite_set_host_request);
+
+
static void
composite_unbind(struct usb_gadget *gadget)
{
@@ -1089,6 +1109,7 @@ composite_unbind(struct usb_gadget *gadget)
usb_ep_free_request(gadget->ep0, cdev->req);
}
+ device_remove_file(&gadget->dev, &dev_attr_host_request);
switch_dev_unregister(&cdev->sdev);
kfree(cdev);
set_gadget_data(gadget, NULL);
@@ -1188,12 +1209,18 @@ static int composite_bind(struct usb_gadget *gadget)
if (status < 0)
goto fail;
+
cdev->sdev.name = "usb_configuration";
status = switch_dev_register(&cdev->sdev);
if (status < 0)
goto fail;
INIT_WORK(&cdev->switch_work, composite_switch_work);
+ status = device_create_file(&gadget->dev, &dev_attr_host_request);
+ if (status)
+ DBG(cdev, "unable to create host_request sysfs file\n");
+
+
cdev->desc = *composite->dev;
cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index 807280d069f..fc5e261e31e 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -293,6 +293,8 @@ static int __init zero_bind(struct usb_composite_dev *cdev)
setup_timer(&autoresume_timer, zero_autoresume, (unsigned long) cdev);
+ if (gadget_is_otg2(cdev->gadget))
+ otg_descriptor.bcdOTG = __constant_cpu_to_le16(0x0200);
/* Register primary, then secondary configuration. Note that
* SH3 only allows one config...
*/