Lines Matching full:otg

21 #include <linux/usb/otg.h>
77 switch (tu->phy.otg->state) { in check_vbus_state()
80 if (tu->phy.otg->gadget) in check_vbus_state()
81 usb_gadget_vbus_connect(tu->phy.otg->gadget); in check_vbus_state()
82 tu->phy.otg->state = OTG_STATE_B_PERIPHERAL; in check_vbus_state()
90 tu->phy.otg->state = OTG_STATE_A_HOST; in check_vbus_state()
97 switch (tu->phy.otg->state) { in check_vbus_state()
99 if (tu->phy.otg->gadget) in check_vbus_state()
100 usb_gadget_vbus_disconnect(tu->phy.otg->gadget); in check_vbus_state()
101 tu->phy.otg->state = OTG_STATE_B_IDLE; in check_vbus_state()
105 tu->phy.otg->state = OTG_STATE_A_IDLE; in check_vbus_state()
130 tu->phy.otg->state = OTG_STATE_A_IDLE; in tahvo_usb_become_host()
137 tu->phy.otg->state = OTG_STATE_A_IDLE; in tahvo_usb_stop_host()
149 tu->phy.otg->state = OTG_STATE_B_IDLE; in tahvo_usb_become_peripheral()
156 if (tu->phy.otg->gadget) in tahvo_usb_stop_peripheral()
157 usb_gadget_vbus_disconnect(tu->phy.otg->gadget); in tahvo_usb_stop_peripheral()
158 tu->phy.otg->state = OTG_STATE_B_IDLE; in tahvo_usb_stop_peripheral()
166 if (tu->phy.otg->gadget) in tahvo_usb_power_off()
167 usb_gadget_vbus_disconnect(tu->phy.otg->gadget); in tahvo_usb_power_off()
171 tu->phy.otg->state = OTG_STATE_UNDEFINED; in tahvo_usb_power_off()
192 static int tahvo_usb_set_host(struct usb_otg *otg, struct usb_bus *host) in tahvo_usb_set_host() argument
194 struct tahvo_usb *tu = container_of(otg->usb_phy, struct tahvo_usb, in tahvo_usb_set_host()
204 otg->host = NULL; in tahvo_usb_set_host()
210 otg->host = NULL; in tahvo_usb_set_host()
214 otg->host = host; in tahvo_usb_set_host()
221 static int tahvo_usb_set_peripheral(struct usb_otg *otg, in tahvo_usb_set_peripheral() argument
224 struct tahvo_usb *tu = container_of(otg->usb_phy, struct tahvo_usb, in tahvo_usb_set_peripheral()
234 tu->phy.otg->gadget = NULL; in tahvo_usb_set_peripheral()
239 tu->phy.otg->gadget = gadget; in tahvo_usb_set_peripheral()
286 if (tu->phy.otg->host) { in otg_mode_store()
298 if (tu->phy.otg->gadget) { in otg_mode_store()
332 tu->phy.otg = devm_kzalloc(&pdev->dev, sizeof(*tu->phy.otg), in tahvo_usb_probe()
334 if (!tu->phy.otg) in tahvo_usb_probe()
376 /* Create OTG interface */ in tahvo_usb_probe()
379 tu->phy.otg->state = OTG_STATE_UNDEFINED; in tahvo_usb_probe()
383 tu->phy.otg->usb_phy = &tu->phy; in tahvo_usb_probe()
384 tu->phy.otg->set_host = tahvo_usb_set_host; in tahvo_usb_probe()
385 tu->phy.otg->set_peripheral = tahvo_usb_set_peripheral; in tahvo_usb_probe()