aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJibben Nee <ziddey@ijib.com>2013-10-16 23:26:08 -0400
committerToni Toivanen <tonitoivanen95@gmail.com>2014-05-11 16:20:12 +0300
commit69a8edcfd8ca6987626f20cd5a78051f43f532e9 (patch)
treebefc24ba027135b7625175fb929e404028bbecc0
parent5b3d457e132569dee15997f9fcfe1001c57810de (diff)
msm_otg: hack to allow manual usb host mode (externally powered)kitkat-442
Enable debugfs /sys/kernel/debug/msm_otg/mode for manual otg mode manipulation. Always force requested mode (none, peripheral, host). Use ID_A bit instead of ID for host mode. Change-Id: If46de86cebb51c1cff47300dec7acc9f321bf420 Note: There are no provisions for charger detection when setting host mode manually.
-rw-r--r--drivers/usb/otg/msm_otg.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
index 68ecce4f1e9..ac8639df511 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -1235,7 +1235,7 @@ static int msm_otg_usbdev_notify(struct notifier_block *self,
*/
// do not cause required code to be skipped -ziddey
- // will not switch to a_host / charge otherwise
+ // will not switch to a_host or charge otherwise
/*if (!udev->parent || udev->parent->parent ||
motg->chg_type == USB_ACA_DOCK_CHARGER)
goto out;*/
@@ -3159,39 +3159,43 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
goto out;
}
+ // always force req_mode, and use ID_A instead of ID for host mode -ziddey
switch (req_mode) {
case USB_NONE:
- switch (phy->state) {
+ /*switch (phy->state) {
case OTG_STATE_A_HOST:
case OTG_STATE_B_PERIPHERAL:
- set_bit(ID, &motg->inputs);
+ set_bit(ID, &motg->inputs);*/
+ clear_bit(ID_A, &motg->inputs);
clear_bit(B_SESS_VLD, &motg->inputs);
break;
- default:
+ /*default:
goto out;
}
- break;
+ break;*/
case USB_PERIPHERAL:
- switch (phy->state) {
+ /*switch (phy->state) {
case OTG_STATE_B_IDLE:
case OTG_STATE_A_HOST:
- set_bit(ID, &motg->inputs);
+ set_bit(ID, &motg->inputs);*/
+ clear_bit(ID_A, &motg->inputs);
set_bit(B_SESS_VLD, &motg->inputs);
break;
- default:
+ /*default:
goto out;
}
- break;
+ break;*/
case USB_HOST:
- switch (phy->state) {
+ /*switch (phy->state) {
case OTG_STATE_B_IDLE:
case OTG_STATE_B_PERIPHERAL:
- clear_bit(ID, &motg->inputs);
+ clear_bit(ID, &motg->inputs);*/
+ set_bit(ID_A, &motg->inputs);
break;
- default:
+ /*default:
goto out;
}
- break;
+ break;*/
default:
goto out;
}
@@ -3356,8 +3360,9 @@ static int msm_otg_debugfs_init(struct msm_otg *motg)
if (!msm_otg_dbg_root || IS_ERR(msm_otg_dbg_root))
return -ENODEV;
- if (motg->pdata->mode == USB_OTG &&
- motg->pdata->otg_control == OTG_USER_CONTROL) {
+ // enable /sys/kernel/debug/msm_otg/host -ziddey
+ if (motg->pdata->mode == USB_OTG /*&&
+ motg->pdata->otg_control == OTG_USER_CONTROL*/) {
msm_otg_dentry = debugfs_create_file("mode", S_IRUGO |
S_IWUSR, msm_otg_dbg_root, motg,