Merge remote-tracking branch 'usb-gadget/next'
[deliverable/linux.git] / drivers / usb / phy / phy-generic.c
index 427efb5eebae9b386c2437d0da82477462cd184f..8311ba2968cd1e14f21b6c497b463d4ec4cf9abe 100644 (file)
@@ -118,8 +118,6 @@ static irqreturn_t nop_gpio_vbus_thread(int irq, void *data)
                status = USB_EVENT_VBUS;
                otg->state = OTG_STATE_B_PERIPHERAL;
                nop->phy.last_event = status;
-               if (otg->gadget)
-                       usb_gadget_vbus_connect(otg->gadget);
 
                /* drawing a "unit load" is *always* OK, except for OTG */
                nop_set_vbus_draw(nop, 100);
@@ -129,8 +127,6 @@ static irqreturn_t nop_gpio_vbus_thread(int irq, void *data)
        } else {
                nop_set_vbus_draw(nop, 0);
 
-               if (otg->gadget)
-                       usb_gadget_vbus_disconnect(otg->gadget);
                status = USB_EVENT_NONE;
                otg->state = OTG_STATE_B_IDLE;
                nop->phy.last_event = status;
@@ -191,7 +187,8 @@ static int nop_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget)
 
        otg->gadget = gadget;
        if (otg->state == OTG_STATE_B_PERIPHERAL)
-               usb_gadget_vbus_connect(gadget);
+               atomic_notifier_call_chain(&otg->usb_phy->notifier,
+                                          USB_EVENT_VBUS, otg->gadget);
        else
                otg->state = OTG_STATE_B_IDLE;
        return 0;
@@ -326,6 +323,8 @@ static int usb_phy_generic_probe(struct platform_device *pdev)
                                gpiod_to_irq(nop->gpiod_vbus), err);
                        return err;
                }
+               nop->phy.otg->state = gpiod_get_value(nop->gpiod_vbus) ?
+                       OTG_STATE_B_PERIPHERAL : OTG_STATE_B_IDLE;
        }
 
        nop->phy.init           = usb_gen_phy_init;
This page took 0.024808 seconds and 5 git commands to generate.