Lines Matching full:otg
22 #include <linux/usb/otg.h>
78 switch (tu->phy.otg->state) { in check_vbus_state()
81 if (tu->phy.otg->gadget) in check_vbus_state()
82 usb_gadget_vbus_connect(tu->phy.otg->gadget); in check_vbus_state()
83 tu->phy.otg->state = OTG_STATE_B_PERIPHERAL; in check_vbus_state()
91 tu->phy.otg->state = OTG_STATE_A_HOST; in check_vbus_state()
98 switch (tu->phy.otg->state) { in check_vbus_state()
100 if (tu->phy.otg->gadget) in check_vbus_state()
101 usb_gadget_vbus_disconnect(tu->phy.otg->gadget); in check_vbus_state()
102 tu->phy.otg->state = OTG_STATE_B_IDLE; in check_vbus_state()
106 tu->phy.otg->state = OTG_STATE_A_IDLE; in check_vbus_state()
131 tu->phy.otg->state = OTG_STATE_A_IDLE; in tahvo_usb_become_host()
138 tu->phy.otg->state = OTG_STATE_A_IDLE; in tahvo_usb_stop_host()
150 tu->phy.otg->state = OTG_STATE_B_IDLE; in tahvo_usb_become_peripheral()
157 if (tu->phy.otg->gadget) in tahvo_usb_stop_peripheral()
158 usb_gadget_vbus_disconnect(tu->phy.otg->gadget); in tahvo_usb_stop_peripheral()
159 tu->phy.otg->state = OTG_STATE_B_IDLE; in tahvo_usb_stop_peripheral()
167 if (tu->phy.otg->gadget) in tahvo_usb_power_off()
168 usb_gadget_vbus_disconnect(tu->phy.otg->gadget); in tahvo_usb_power_off()
172 tu->phy.otg->state = OTG_STATE_UNDEFINED; in tahvo_usb_power_off()
193 static int tahvo_usb_set_host(struct usb_otg *otg, struct usb_bus *host) in tahvo_usb_set_host() argument
195 struct tahvo_usb *tu = container_of(otg->usb_phy, struct tahvo_usb, in tahvo_usb_set_host()
203 otg->host = NULL; in tahvo_usb_set_host()
209 otg->host = NULL; in tahvo_usb_set_host()
213 otg->host = host; in tahvo_usb_set_host()
220 static int tahvo_usb_set_peripheral(struct usb_otg *otg, in tahvo_usb_set_peripheral() argument
223 struct tahvo_usb *tu = container_of(otg->usb_phy, struct tahvo_usb, in tahvo_usb_set_peripheral()
231 tu->phy.otg->gadget = NULL; in tahvo_usb_set_peripheral()
236 tu->phy.otg->gadget = gadget; in tahvo_usb_set_peripheral()
283 if (tu->phy.otg->host) { in otg_mode_store()
295 if (tu->phy.otg->gadget) { in otg_mode_store()
329 tu->phy.otg = devm_kzalloc(&pdev->dev, sizeof(*tu->phy.otg), in tahvo_usb_probe()
331 if (!tu->phy.otg) in tahvo_usb_probe()
373 /* Create OTG interface */ in tahvo_usb_probe()
376 tu->phy.otg->state = OTG_STATE_UNDEFINED; in tahvo_usb_probe()
380 tu->phy.otg->usb_phy = &tu->phy; in tahvo_usb_probe()
381 tu->phy.otg->set_host = tahvo_usb_set_host; in tahvo_usb_probe()
382 tu->phy.otg->set_peripheral = tahvo_usb_set_peripheral; in tahvo_usb_probe()