diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index a3f0a8e041ea..50a134d10d6d 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -945,6 +946,18 @@ static int rockchip_usb2phy_set_mode(struct phy *phy, switch (mode) { case PHY_MODE_USB_OTG: + if (rphy->edev_self && submode) { + if (submode == USB_ROLE_HOST) { + extcon_set_state(rphy->edev, EXTCON_USB_HOST, true); + extcon_set_state(rphy->edev, EXTCON_USB, false); + } else if (submode == USB_ROLE_DEVICE) { + extcon_set_state(rphy->edev, EXTCON_USB_HOST, false); + extcon_set_state(rphy->edev, EXTCON_USB, true); + } + + return ret; + } + /* * In case of using vbus to detect connect state by u2phy, * enable vbus detect on otg mode.