static int msm_otg_set_host(struct otg_transceiver *xceiv, struct usb_bus *host) { struct msm_otg *dev = container_of(xceiv, struct msm_otg, otg); if (!dev || (dev != the_msm_otg)) return -ENODEV; /* Id pin is not routed to PMIC. Host mode can not be * supported with pmic notification support. */ if (!dev->start_host || dev->pmic_notif_supp) return -ENODEV; if (!host) { msm_otg_start_host(xceiv, REQUEST_STOP); usb_unregister_notify(&dev->usbdev_nb); dev->otg.host = 0; dev->start_host = 0; disable_idgnd(dev); return 0; } dev->usbdev_nb.notifier_call = usbdev_notify; usb_register_notify(&dev->usbdev_nb); dev->otg.host = host; enable_idgnd(dev); pr_info("host driver registered w/ tranceiver\n"); #ifdef CONFIG_USB_OTG host->otg_port = 1; #else wake_lock(&dev->wlock); queue_work(dev->wq, &dev->sm_work); #endif return 0; }
static int msm_otg_set_host(struct otg_transceiver *xceiv, struct usb_bus *host) { struct msm_otg *dev = container_of(xceiv, struct msm_otg, otg); if (!dev || (dev != the_msm_otg)) return -ENODEV; if (!host) { msm_otg_start_host(xceiv, 0); dev->otg.host = 0; disable_idgnd(dev); return 0; } dev->otg.host = host; enable_idgnd(dev); pr_info("host driver registered w/ tranceiver\n"); #ifndef CONFIG_USB_GADGET_MSM_72K if (is_host()) msm_otg_start_host(&dev->otg, 1); else msm_otg_suspend(dev); #endif return 0; }