Lines Matching refs:otg
487 struct usb_bus *bus = phy->otg->host; in msm_otg_suspend()
584 struct usb_bus *bus = phy->otg->host; in msm_otg_resume()
692 if (!phy->otg->host) in msm_otg_start_host()
695 hcd = bus_to_hcd(phy->otg->host); in msm_otg_start_host()
726 static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host) in msm_otg_set_host() argument
728 struct msm_otg *motg = container_of(otg->usb_phy, struct msm_otg, phy); in msm_otg_set_host()
736 dev_info(otg->usb_phy->dev, "Host mode is not supported\n"); in msm_otg_set_host()
741 if (otg->state == OTG_STATE_A_HOST) { in msm_otg_set_host()
742 pm_runtime_get_sync(otg->usb_phy->dev); in msm_otg_set_host()
743 msm_otg_start_host(otg->usb_phy, 0); in msm_otg_set_host()
744 otg->host = NULL; in msm_otg_set_host()
745 otg->state = OTG_STATE_UNDEFINED; in msm_otg_set_host()
748 otg->host = NULL; in msm_otg_set_host()
757 otg->host = host; in msm_otg_set_host()
758 dev_dbg(otg->usb_phy->dev, "host driver registered w/ tranceiver\n"); in msm_otg_set_host()
764 if (motg->pdata->mode == USB_DR_MODE_HOST || otg->gadget) { in msm_otg_set_host()
765 pm_runtime_get_sync(otg->usb_phy->dev); in msm_otg_set_host()
777 if (!phy->otg->gadget) in msm_otg_start_peripheral()
789 usb_gadget_vbus_connect(phy->otg->gadget); in msm_otg_start_peripheral()
792 usb_gadget_vbus_disconnect(phy->otg->gadget); in msm_otg_start_peripheral()
799 static int msm_otg_set_peripheral(struct usb_otg *otg, in msm_otg_set_peripheral() argument
802 struct msm_otg *motg = container_of(otg->usb_phy, struct msm_otg, phy); in msm_otg_set_peripheral()
809 dev_info(otg->usb_phy->dev, "Peripheral mode is not supported\n"); in msm_otg_set_peripheral()
814 if (otg->state == OTG_STATE_B_PERIPHERAL) { in msm_otg_set_peripheral()
815 pm_runtime_get_sync(otg->usb_phy->dev); in msm_otg_set_peripheral()
816 msm_otg_start_peripheral(otg->usb_phy, 0); in msm_otg_set_peripheral()
817 otg->gadget = NULL; in msm_otg_set_peripheral()
818 otg->state = OTG_STATE_UNDEFINED; in msm_otg_set_peripheral()
821 otg->gadget = NULL; in msm_otg_set_peripheral()
826 otg->gadget = gadget; in msm_otg_set_peripheral()
827 dev_dbg(otg->usb_phy->dev, in msm_otg_set_peripheral()
834 if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL || otg->host) { in msm_otg_set_peripheral()
835 pm_runtime_get_sync(otg->usb_phy->dev); in msm_otg_set_peripheral()
1189 struct usb_otg *otg = motg->phy.otg; in msm_otg_sm_work() local
1191 switch (otg->state) { in msm_otg_sm_work()
1193 dev_dbg(otg->usb_phy->dev, "OTG_STATE_UNDEFINED state\n"); in msm_otg_sm_work()
1194 msm_otg_reset(otg->usb_phy); in msm_otg_sm_work()
1196 otg->state = OTG_STATE_B_IDLE; in msm_otg_sm_work()
1199 dev_dbg(otg->usb_phy->dev, "OTG_STATE_B_IDLE state\n"); in msm_otg_sm_work()
1200 if (!test_bit(ID, &motg->inputs) && otg->host) { in msm_otg_sm_work()
1203 msm_otg_start_host(otg->usb_phy, 1); in msm_otg_sm_work()
1204 otg->state = OTG_STATE_A_HOST; in msm_otg_sm_work()
1219 msm_otg_start_peripheral(otg->usb_phy, in msm_otg_sm_work()
1221 otg->state in msm_otg_sm_work()
1226 msm_otg_start_peripheral(otg->usb_phy, in msm_otg_sm_work()
1228 otg->state in msm_otg_sm_work()
1245 pm_runtime_put_sync(otg->usb_phy->dev); in msm_otg_sm_work()
1246 msm_otg_reset(otg->usb_phy); in msm_otg_sm_work()
1253 if (otg->state == OTG_STATE_B_IDLE) in msm_otg_sm_work()
1254 pm_runtime_put_sync(otg->usb_phy->dev); in msm_otg_sm_work()
1257 dev_dbg(otg->usb_phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); in msm_otg_sm_work()
1261 msm_otg_start_peripheral(otg->usb_phy, 0); in msm_otg_sm_work()
1264 otg->state = OTG_STATE_B_IDLE; in msm_otg_sm_work()
1265 msm_otg_reset(otg->usb_phy); in msm_otg_sm_work()
1270 dev_dbg(otg->usb_phy->dev, "OTG_STATE_A_HOST state\n"); in msm_otg_sm_work()
1272 msm_otg_start_host(otg->usb_phy, 0); in msm_otg_sm_work()
1273 otg->state = OTG_STATE_B_IDLE; in msm_otg_sm_work()
1274 msm_otg_reset(otg->usb_phy); in msm_otg_sm_work()
1324 struct usb_otg *otg = motg->phy.otg; in msm_otg_mode_show() local
1326 switch (otg->state) { in msm_otg_mode_show()
1352 struct usb_otg *otg = motg->phy.otg; in msm_otg_mode_write() local
1376 switch (otg->state) { in msm_otg_mode_write()
1387 switch (otg->state) { in msm_otg_mode_write()
1398 switch (otg->state) { in msm_otg_mode_write()
1411 pm_runtime_get_sync(otg->usb_phy->dev); in msm_otg_mode_write()
1665 motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), in msm_otg_probe()
1667 if (!motg->phy.otg) in msm_otg_probe()
1795 phy->otg->usb_phy = &motg->phy; in msm_otg_probe()
1796 phy->otg->set_host = msm_otg_set_host; in msm_otg_probe()
1797 phy->otg->set_peripheral = msm_otg_set_peripheral; in msm_otg_probe()
1857 if (phy->otg->host || phy->otg->gadget) in msm_otg_remove()
1914 struct usb_otg *otg = motg->phy.otg; in msm_otg_runtime_idle() local
1924 if (otg->state != OTG_STATE_UNDEFINED) in msm_otg_runtime_idle()