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_rk3126.c
index bd39911..2cf9c5a 100755 (executable)
@@ -194,13 +194,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);
        }
 }