usb: mtu3: use force mode for dual role switch

Force IDDIG status for all three ways of dual role switch, this
is needed when use Type-C to switch mode.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1623139069-8173-13-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Chunfeng Yun 2021-06-08 15:57:38 +08:00 committed by Greg Kroah-Hartman
parent 6c7b949762
commit 13862176a3
2 changed files with 4 additions and 12 deletions

View File

@ -148,12 +148,14 @@ static void ssusb_mode_sw_work(struct work_struct *work)
switch (desired_role) {
case USB_ROLE_HOST:
ssusb_set_force_mode(ssusb, MTU3_DR_FORCE_HOST);
mtu3_stop(mtu);
switch_port_to_host(ssusb);
ssusb_set_vbus(otg_sx, 1);
ssusb->is_host = true;
break;
case USB_ROLE_DEVICE:
ssusb_set_force_mode(ssusb, MTU3_DR_FORCE_DEVICE);
ssusb->is_host = false;
ssusb_set_vbus(otg_sx, 0);
switch_port_to_device(ssusb);
@ -225,13 +227,7 @@ void ssusb_mode_switch(struct ssusb_mtk *ssusb, int to_host)
{
struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
if (to_host) {
ssusb_set_force_mode(ssusb, MTU3_DR_FORCE_HOST);
ssusb_set_mode(otg_sx, USB_ROLE_HOST);
} else {
ssusb_set_force_mode(ssusb, MTU3_DR_FORCE_DEVICE);
ssusb_set_mode(otg_sx, USB_ROLE_DEVICE);
}
ssusb_set_mode(otg_sx, to_host ? USB_ROLE_HOST : USB_ROLE_DEVICE);
}
void ssusb_set_force_mode(struct ssusb_mtk *ssusb,

View File

@ -213,8 +213,6 @@ int ssusb_host_disable(struct ssusb_mtk *ssusb, bool suspend)
static void ssusb_host_setup(struct ssusb_mtk *ssusb)
{
struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
host_ports_num_get(ssusb);
/*
@ -222,8 +220,6 @@ 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 (otg_sx->manual_drd_enabled)
ssusb_set_force_mode(ssusb, MTU3_DR_FORCE_HOST);
/* if port0 supports dual-role, works as host mode by default */