Lines Matching refs:otg
461 struct usb_bus *bus = phy->otg->host; in msm_otg_suspend()
558 struct usb_bus *bus = phy->otg->host; in msm_otg_resume()
666 if (!phy->otg->host) in msm_otg_start_host()
669 hcd = bus_to_hcd(phy->otg->host); in msm_otg_start_host()
700 static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host) in msm_otg_set_host() argument
702 struct msm_otg *motg = container_of(otg->usb_phy, struct msm_otg, phy); in msm_otg_set_host()
710 dev_info(otg->usb_phy->dev, "Host mode is not supported\n"); in msm_otg_set_host()
715 if (otg->state == OTG_STATE_A_HOST) { in msm_otg_set_host()
716 pm_runtime_get_sync(otg->usb_phy->dev); in msm_otg_set_host()
717 msm_otg_start_host(otg->usb_phy, 0); in msm_otg_set_host()
718 otg->host = NULL; in msm_otg_set_host()
719 otg->state = OTG_STATE_UNDEFINED; in msm_otg_set_host()
722 otg->host = NULL; in msm_otg_set_host()
731 otg->host = host; in msm_otg_set_host()
732 dev_dbg(otg->usb_phy->dev, "host driver registered w/ tranceiver\n"); in msm_otg_set_host()
738 if (motg->pdata->mode == USB_DR_MODE_HOST || otg->gadget) { in msm_otg_set_host()
739 pm_runtime_get_sync(otg->usb_phy->dev); in msm_otg_set_host()
751 if (!phy->otg->gadget) in msm_otg_start_peripheral()
763 usb_gadget_vbus_connect(phy->otg->gadget); in msm_otg_start_peripheral()
766 usb_gadget_vbus_disconnect(phy->otg->gadget); in msm_otg_start_peripheral()
773 static int msm_otg_set_peripheral(struct usb_otg *otg, in msm_otg_set_peripheral() argument
776 struct msm_otg *motg = container_of(otg->usb_phy, struct msm_otg, phy); in msm_otg_set_peripheral()
783 dev_info(otg->usb_phy->dev, "Peripheral mode is not supported\n"); in msm_otg_set_peripheral()
788 if (otg->state == OTG_STATE_B_PERIPHERAL) { in msm_otg_set_peripheral()
789 pm_runtime_get_sync(otg->usb_phy->dev); in msm_otg_set_peripheral()
790 msm_otg_start_peripheral(otg->usb_phy, 0); in msm_otg_set_peripheral()
791 otg->gadget = NULL; in msm_otg_set_peripheral()
792 otg->state = OTG_STATE_UNDEFINED; in msm_otg_set_peripheral()
795 otg->gadget = NULL; in msm_otg_set_peripheral()
800 otg->gadget = gadget; in msm_otg_set_peripheral()
801 dev_dbg(otg->usb_phy->dev, in msm_otg_set_peripheral()
808 if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL || otg->host) { in msm_otg_set_peripheral()
809 pm_runtime_get_sync(otg->usb_phy->dev); in msm_otg_set_peripheral()
1163 struct usb_otg *otg = motg->phy.otg; in msm_otg_sm_work() local
1165 switch (otg->state) { in msm_otg_sm_work()
1167 dev_dbg(otg->usb_phy->dev, "OTG_STATE_UNDEFINED state\n"); in msm_otg_sm_work()
1168 msm_otg_reset(otg->usb_phy); in msm_otg_sm_work()
1170 otg->state = OTG_STATE_B_IDLE; in msm_otg_sm_work()
1173 dev_dbg(otg->usb_phy->dev, "OTG_STATE_B_IDLE state\n"); in msm_otg_sm_work()
1174 if (!test_bit(ID, &motg->inputs) && otg->host) { in msm_otg_sm_work()
1177 msm_otg_start_host(otg->usb_phy, 1); in msm_otg_sm_work()
1178 otg->state = OTG_STATE_A_HOST; in msm_otg_sm_work()
1193 msm_otg_start_peripheral(otg->usb_phy, in msm_otg_sm_work()
1195 otg->state in msm_otg_sm_work()
1200 msm_otg_start_peripheral(otg->usb_phy, in msm_otg_sm_work()
1202 otg->state in msm_otg_sm_work()
1219 pm_runtime_put_sync(otg->usb_phy->dev); in msm_otg_sm_work()
1220 msm_otg_reset(otg->usb_phy); in msm_otg_sm_work()
1227 if (otg->state == OTG_STATE_B_IDLE) in msm_otg_sm_work()
1228 pm_runtime_put_sync(otg->usb_phy->dev); in msm_otg_sm_work()
1231 dev_dbg(otg->usb_phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); in msm_otg_sm_work()
1235 msm_otg_start_peripheral(otg->usb_phy, 0); in msm_otg_sm_work()
1238 otg->state = OTG_STATE_B_IDLE; in msm_otg_sm_work()
1239 msm_otg_reset(otg->usb_phy); in msm_otg_sm_work()
1244 dev_dbg(otg->usb_phy->dev, "OTG_STATE_A_HOST state\n"); in msm_otg_sm_work()
1246 msm_otg_start_host(otg->usb_phy, 0); in msm_otg_sm_work()
1247 otg->state = OTG_STATE_B_IDLE; in msm_otg_sm_work()
1248 msm_otg_reset(otg->usb_phy); in msm_otg_sm_work()
1298 struct usb_otg *otg = motg->phy.otg; in msm_otg_mode_show() local
1300 switch (otg->state) { in msm_otg_mode_show()
1326 struct usb_otg *otg = motg->phy.otg; in msm_otg_mode_write() local
1350 switch (otg->state) { in msm_otg_mode_write()
1361 switch (otg->state) { in msm_otg_mode_write()
1372 switch (otg->state) { in msm_otg_mode_write()
1385 pm_runtime_get_sync(otg->usb_phy->dev); in msm_otg_mode_write()
1537 motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), in msm_otg_probe()
1539 if (!motg->phy.otg) in msm_otg_probe()
1655 phy->otg->usb_phy = &motg->phy; in msm_otg_probe()
1656 phy->otg->set_host = msm_otg_set_host; in msm_otg_probe()
1657 phy->otg->set_peripheral = msm_otg_set_peripheral; in msm_otg_probe()
1700 if (phy->otg->host || phy->otg->gadget) in msm_otg_remove()
1746 struct usb_otg *otg = motg->phy.otg; in msm_otg_runtime_idle() local
1756 if (otg->state != OTG_STATE_UNDEFINED) in msm_otg_runtime_idle()