usb: dwc_otg_310: support vbus controlled by both gpio and pmic
[firefly-linux-kernel-4.4.55.git] / drivers / usb / dwc_otg_310 / usbdev_rk3368.c
index 833671c..3272e4e 100644 (file)
@@ -189,13 +189,14 @@ static void usb20otg_power_enable(int enable)
                /* disable otg_drv power */
                if (gpio_is_valid(control_usb->otg_gpios->gpio))
                        gpio_set_value(control_usb->otg_gpios->gpio, 0);
-               else if (usb20otg_get_status(USB_STATUS_BVABLID))
-                       rk_battery_charger_detect_cb(USB_OTG_POWER_OFF);
+
+               rk_battery_charger_detect_cb(USB_OTG_POWER_OFF);
        } else if (1 == enable) {
                /* enable otg_drv power */
                if (gpio_is_valid(control_usb->otg_gpios->gpio))
                        gpio_set_value(control_usb->otg_gpios->gpio, 1);
-               else if (!usb20otg_get_status(USB_STATUS_BVABLID))
+
+               if (!usb20otg_get_status(USB_STATUS_BVABLID))
                        rk_battery_charger_detect_cb(USB_OTG_POWER_ON);
        }
 }