summaryrefslogtreecommitdiff
path: root/drivers/usb/mtu3/mtu3_host.c
diff options
context:
space:
mode:
authorChunfeng Yun <chunfeng.yun@mediatek.com>2016-10-19 10:28:26 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-27 17:02:41 +0200
commitd0ed062a8b75b9c9ba5a942894636f2d9bb72040 (patch)
tree13f0860c5451f03778668e823b7c9321b5089d00 /drivers/usb/mtu3/mtu3_host.c
parentb3f4e727c1ecec36e628e89298349d9c51a32aac (diff)
usb: mtu3: dual-role mode support
support dual-role mode; there are two ways to switch between host and device modes, one is by idpin, another is by debugfs which depends on user input. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/mtu3/mtu3_host.c')
-rw-r--r--drivers/usb/mtu3/mtu3_host.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/mtu3/mtu3_host.c b/drivers/usb/mtu3/mtu3_host.c
index 361d6d844ce5..cd4d01087855 100644
--- a/drivers/usb/mtu3/mtu3_host.c
+++ b/drivers/usb/mtu3/mtu3_host.c
@@ -230,10 +230,16 @@ static void ssusb_host_setup(struct ssusb_mtk *ssusb)
* if support OTG, gadget driver will switch port0 to device mode
*/
ssusb_host_enable(ssusb);
+
+ /* if port0 supports dual-role, works as host mode by default */
+ ssusb_set_vbus(&ssusb->otg_switch, 1);
}
static void ssusb_host_cleanup(struct ssusb_mtk *ssusb)
{
+ if (ssusb->is_host)
+ ssusb_set_vbus(&ssusb->otg_switch, 0);
+
ssusb_host_disable(ssusb, false);
}