tegra-otg: HACK to allow OTG peripheral and charging at the same time
Signed-off-by: Paul Reioux <reioux@gmail.com>
Conflicts:
drivers/usb/otg/tegra-otg.c
diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig
index bcb3e86..726f3a2 100644
--- a/drivers/usb/otg/Kconfig
+++ b/drivers/usb/otg/Kconfig
@@ -129,6 +129,13 @@
Enable this driver on boards which use the internal VBUS and ID
sensing of the Tegra USB PHY.
+config USB_OTG_ON_CHARGING
+ boolean "Tegra OTG On Charging Hack"
+ depends on USB && USB_TEGRA_OTG
+ default y
+ help
+ Enable this to allow OTG peripheral and charging at the same time
+
config AB8500_USB
tristate "AB8500 USB Transceiver Driver"
depends on AB8500_CORE
diff --git a/drivers/usb/otg/tegra-otg.c b/drivers/usb/otg/tegra-otg.c
index 8bcb837..5062125 100755
--- a/drivers/usb/otg/tegra-otg.c
+++ b/drivers/usb/otg/tegra-otg.c
@@ -68,6 +68,11 @@
};
static struct tegra_otg_data *tegra_clone;
+#ifdef CONFIG_USB_OTG_ON_CHARGING
+static bool tegra_otg_on_charging = false;
+module_param(tegra_otg_on_charging, bool, 0664);
+#endif
+
static inline unsigned long otg_readl(struct tegra_otg_data *tegra,
unsigned int offset)
{
@@ -236,6 +241,15 @@
// tmtmtm
smb347_deep_sleep = 0;
+ if (tegra->charger_cb) {
+ if (tegra_otg_on_charging)
+ /* enable v_bus detection for charging */
+ tegra->detect_vbus = true;
+ else
+ /* enable OTG to supply internal power */
+ tegra->charger_cb(to, from, tegra->charger_cb_data);
+ }
+
if (to == OTG_STATE_A_SUSPEND) {
if (from == OTG_STATE_A_HOST) {
if (tegra->charger_cb) {