aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSakethram Bommisetti <sakethram.bommisetti@stericsson.com>2011-01-25 16:10:30 +0530
committerHenrik Öhman <henrik.ohman@stericsson.com>2011-03-07 10:16:27 +0100
commit29372ff1386b6d316a37b0a41a382a8c161f160f (patch)
treef5ffc6a7ec115ae2f7deac5c91867b571e24e864 /include
parent2bc9de64f8c94fe8fcf5aa4d3fe61a99efa533b6 (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: Ic5ea40369159c10e524a13a2d9b1722fb3ee6921 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/13421 Reviewed-by: Praveena NADAHALLY <praveen.nadahally@stericsson.com> Tested-by: Praveena NADAHALLY <praveen.nadahally@stericsson.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/usb/gadget.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index d3ef42d7d2f..cffc247c5ba 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -443,6 +443,8 @@ struct usb_gadget_ops {
* operation. If it does, the gadget driver must also support both.
* @is_otg: True if the USB device port uses a Mini-AB jack, so that the
* gadget driver must provide a USB OTG descriptor.
+ * @otg_version: UDC OTG version based on which gadget driver fills the
+ * bcdOTG field in a USB OTG descriptor.
* @is_a_peripheral: False unless is_otg, the "A" end of a USB cable
* is in the Mini-AB jack, and HNP has been used to switch roles
* so that the "A" device currently acts as A-Peripheral, not A-Host.
@@ -452,6 +454,7 @@ struct usb_gadget_ops {
* only supports HNP on a different root port.
* @b_hnp_enable: OTG device feature flag, indicating that the A-Host
* enabled HNP support.
+ * @host_request: A Flag, indicating that user wishes to take the host role.
* @name: Identifies the controller hardware type. Used in diagnostics
* and sometimes configuration.
* @dev: Driver model state for this abstract device.
@@ -482,10 +485,14 @@ struct usb_gadget {
enum usb_device_speed speed;
unsigned is_dualspeed:1;
unsigned is_otg:1;
+ u16 otg_version;
+#define UDC_OTG1 0x0000
+#define UDC_OTG2 0x0001
unsigned is_a_peripheral:1;
unsigned b_hnp_enable:1;
unsigned a_hnp_support:1;
unsigned a_alt_hnp_support:1;
+ unsigned host_request:1;
const char *name;
struct device dev;
};
@@ -537,6 +544,20 @@ static inline int gadget_is_otg(struct usb_gadget *g)
}
/**
+ * gadget_is_otg2 - return true if UDC is compliant to OTG 2.0
+ * @g: controller that might have a Mini-AB/Micro-AB connector
+ *
+ */
+static inline int gadget_is_otg2(struct usb_gadget *g)
+{
+#ifdef CONFIG_USB_OTG
+ return g->otg_version && UDC_OTG2;
+#else
+ return 0;
+#endif
+}
+
+/**
* usb_gadget_frame_number - returns the current frame number
* @gadget: controller that reports the frame number
*