usb: rockchip-inno-usb2: use EXTCON_USB_VBUS_EN to control vbus
authorMeng Dongyang <daniel.meng@rock-chips.com>
Wed, 12 Oct 2016 11:26:10 +0000 (19:26 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 13 Oct 2016 08:16:18 +0000 (16:16 +0800)
Add EXTCON_USB_VBUS_EN cable and change EXTCON_USB_HOST to
EXTCON_USB_VBUS_EN cable to control vbus.

Change-Id: I2e7c6111f723e425bd4c156e803cb6a1a9f17511
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
drivers/phy/phy-rockchip-inno-usb2.c

index 9da2af7740b070721d693e741bf1a90b56fa3573..e9a5f51c91463cf8f3e1bf52ce6681eeeeec5f8f 100644 (file)
@@ -81,6 +81,7 @@ enum usb_chg_state {
 static const unsigned int rockchip_usb2phy_extcon_cable[] = {
        EXTCON_USB,
        EXTCON_USB_HOST,
+       EXTCON_USB_VBUS_EN,
        EXTCON_CHG_USB_SDP,
        EXTCON_CHG_USB_CDP,
        EXTCON_CHG_USB_DCP,
@@ -1011,13 +1012,16 @@ static irqreturn_t rockchip_usb2phy_id_irq(int irq, void *data)
                property_enable(rphy, &rport->port_cfg->idfall_det_clr,
                                true);
                extcon_set_state(rphy->edev, EXTCON_USB_HOST, true);
+               extcon_set_state(rphy->edev, EXTCON_USB_VBUS_EN, true);
        } else if (property_enabled(rphy, &rport->port_cfg->idrise_det_st)) {
                property_enable(rphy, &rport->port_cfg->idrise_det_clr,
                                true);
                extcon_set_state(rphy->edev, EXTCON_USB_HOST, false);
+               extcon_set_state(rphy->edev, EXTCON_USB_VBUS_EN, false);
        }
 
        extcon_sync(rphy->edev, EXTCON_USB_HOST);
+       extcon_sync(rphy->edev, EXTCON_USB_VBUS_EN);
 
        mutex_unlock(&rport->mutex);
 
@@ -1135,8 +1139,10 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
                if (!iddig) {
                        extcon_set_state(rphy->edev, EXTCON_USB, false);
                        extcon_set_state(rphy->edev, EXTCON_USB_HOST, true);
+                       extcon_set_state(rphy->edev, EXTCON_USB_VBUS_EN, true);
                } else {
                        extcon_set_state(rphy->edev, EXTCON_USB_HOST, false);
+                       extcon_set_state(rphy->edev, EXTCON_USB_VBUS_EN, false);
                }
        }