usb: dwc3-msm: Use ADC for ID pin detection

Configure ADC to periodically poll for the ID pin voltage. Register
for high and low voltage threshold notification in order to allow
for detecting when a micro-A cable is inserted or removed. This
notification will then be used to enter/exit OTG host mode.

Add module parameters to override the threshold levels as well as
the polling rate. These take effect when disable and enable is issued
to the "adc_enable" file in msm_dwc3's device node in sysfs.

Change-Id: Ibacb8f0f02bc94de8a3084e0b6673e3a4ca93f1d
Signed-off-by: Jack Pham <jackp@codeaurora.org>
diff --git a/drivers/usb/dwc3/dwc3_otg.c b/drivers/usb/dwc3/dwc3_otg.c
index fab443c..01ba161 100644
--- a/drivers/usb/dwc3/dwc3_otg.c
+++ b/drivers/usb/dwc3/dwc3_otg.c
@@ -1,7 +1,7 @@
 /**
  * dwc3_otg.c - DesignWare USB3 DRD Controller OTG
  *
- * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2012, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -331,10 +331,13 @@
 			}
 		}
 	} else if (event == DWC3_EVENT_XCEIV_STATE) {
-		if (ext_xceiv->id == DWC3_ID_FLOAT)
+		if (ext_xceiv->id == DWC3_ID_FLOAT) {
+			dev_dbg(phy->dev, "XCVR: ID set\n");
 			set_bit(ID, &dotg->inputs);
-		else
+		} else {
+			dev_dbg(phy->dev, "XCVR: ID clear\n");
 			clear_bit(ID, &dotg->inputs);
+		}
 
 		if (ext_xceiv->bsv) {
 			dev_dbg(phy->dev, "XCVR: BSV set\n");