Loading drivers/usb/dwc3/dwc3_otg.c +15 −25 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ MODULE_PARM_DESC(max_chgr_retry_count, "Max invalid charger retry count"); static struct dwc3_otg *the_dotg; static void dwc3_otg_reset(struct dwc3_otg *dotg); static int dwc3_otg_set_host(struct usb_otg *otg, struct usb_bus *host); static void dwc3_otg_notify_host_mode(struct usb_otg *otg, int host_mode); static void dwc3_otg_reset(struct dwc3_otg *dotg); Loading Loading @@ -77,25 +77,6 @@ static void dwc3_otg_set_host_regs(struct dwc3_otg *dotg) } } static int dwc3_otg_set_suspend(struct usb_phy *phy, int suspend) { struct usb_otg *otg = phy->otg; struct dwc3_otg *dotg = container_of(otg, struct dwc3_otg, otg); if (dotg->host_bus_suspend == suspend) return 0; dotg->host_bus_suspend = suspend; if (suspend) { pm_runtime_put_sync(phy->dev); } else { pm_runtime_get_noresume(phy->dev); pm_runtime_resume(phy->dev); } return 0; } static void dwc3_otg_set_hsphy_auto_suspend(struct dwc3_otg *dotg, bool susp) { struct dwc3 *dwc = dotg->dwc; Loading Loading @@ -181,6 +162,7 @@ static int dwc3_otg_start_host(struct usb_otg *otg, int on) struct dwc3_otg *dotg = container_of(otg, struct dwc3_otg, otg); struct dwc3_ext_xceiv *ext_xceiv = dotg->ext_xceiv; struct dwc3 *dwc = dotg->dwc; struct usb_hcd *hcd; int ret = 0; if (!dwc->xhci) Loading Loading @@ -228,7 +210,10 @@ static int dwc3_otg_start_host(struct usb_otg *otg, int on) return ret; } hcd = platform_get_drvdata(dwc->xhci); dwc3_otg_set_host(otg, &hcd->self); dwc3_otg_notify_host_mode(otg, on); ret = regulator_enable(dotg->vbus_otg); if (ret) { dev_err(otg->phy->dev, "unable to enable vbus_otg\n"); Loading @@ -247,9 +232,11 @@ static int dwc3_otg_start_host(struct usb_otg *otg, int on) dev_err(otg->phy->dev, "unable to disable vbus_otg\n"); return ret; } dwc3_otg_notify_host_mode(otg, on); dwc3_otg_notify_host_mode(otg, on); dwc3_otg_set_host(otg, NULL); platform_device_del(dwc->xhci); /* * Perform USB hardware RESET (both core reset and DBM reset) * when moving from host to peripheral. This is required for Loading Loading @@ -441,9 +428,6 @@ static void dwc3_ext_event_notify(struct usb_otg *otg, dev_dbg(phy->dev, "ext PHY_RESUME event received\n"); /* ext_xceiver would have taken h/w out of LPM by now */ ret = pm_runtime_get(phy->dev); if ((phy->state == OTG_STATE_A_HOST) && dotg->host_bus_suspend) dotg->host_bus_suspend = 0; if (ret == -EACCES) { /* pm_runtime_get may fail during system resume with -EACCES error */ Loading Loading @@ -872,6 +856,10 @@ static void dwc3_otg_sm_work(struct work_struct *w) phy->state = OTG_STATE_A_IDLE; pm_runtime_put_sync(phy->dev); return; } else { /* xHCI increments PM child count as needed */ dev_dbg(phy->dev, "a_host state entered. Allow runtime suspend.\n"); pm_runtime_put_sync(phy->dev); } } break; Loading @@ -883,6 +871,9 @@ static void dwc3_otg_sm_work(struct work_struct *w) phy->state = OTG_STATE_B_IDLE; dotg->vbus_retry_count = 0; work = 1; } else { dev_dbg(phy->dev, "a_host state entered. Allow runtime suspend.\n"); pm_runtime_put_sync(phy->dev); } break; Loading Loading @@ -964,7 +955,6 @@ int dwc3_otg_register_phys(struct platform_device *pdev) dotg->otg.phy->otg = &dotg->otg; dotg->otg.phy->dev = &pdev->dev; dotg->otg.phy->set_power = dwc3_otg_set_power; dotg->otg.phy->set_suspend = dwc3_otg_set_suspend; dotg->otg.set_peripheral = dwc3_otg_set_peripheral; dotg->otg.set_host = dwc3_otg_set_host; Loading drivers/usb/dwc3/dwc3_otg.h +0 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ struct dwc3_otg { unsigned long inputs; struct power_supply *psy; struct completion dwc3_xcvr_vbus_init; int host_bus_suspend; int charger_retry_count; int vbus_retry_count; }; Loading drivers/usb/dwc3/host.c +1 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ int dwc3_host_init(struct dwc3 *dwc) dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask); xhci->dev.parent = dwc->dev; xhci->dev.dma_mask = dwc->dev->dma_mask; xhci->dev.dma_parms = dwc->dev->dma_parms; Loading @@ -79,7 +80,6 @@ int dwc3_host_init(struct dwc3 *dwc) /* Add XHCI device if !OTG, otherwise OTG takes care of this */ if (!dwc->dotg) { xhci->dev.parent = dwc->dev; ret = platform_device_add(xhci); if (ret) { dev_err(dwc->dev, "failed to register xHCI device\n"); Loading drivers/usb/host/xhci-plat.c +1 −83 Original line number Diff line number Diff line Loading @@ -15,15 +15,11 @@ #include <linux/pm_runtime.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/usb/otg.h> #include <linux/usb/msm_hsusb.h> #include "xhci.h" #define SYNOPSIS_DWC3_VENDOR 0x5533 static struct usb_phy *phy; static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) { struct xhci_plat_data *pdata = dev->platform_data; Loading Loading @@ -147,6 +143,7 @@ static int xhci_plat_probe(struct platform_device *pdev) goto release_mem_region; } pm_runtime_no_callbacks(&pdev->dev); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); pm_runtime_get_sync(&pdev->dev); Loading Loading @@ -176,19 +173,6 @@ static int xhci_plat_probe(struct platform_device *pdev) if (ret) goto put_usb3_hcd; phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2); if (phy && phy->otg && !(phy->flags & ENABLE_SECONDARY_PHY)) { dev_dbg(&pdev->dev, "%s otg support available\n", __func__); ret = otg_set_host(phy->otg, &hcd->self); if (ret) { dev_err(&pdev->dev, "%s otg_set_host failed\n", __func__); goto put_usb3_hcd; } } else { pm_runtime_no_callbacks(&pdev->dev); } pm_runtime_put(&pdev->dev); return 0; Loading Loading @@ -226,80 +210,14 @@ static int xhci_plat_remove(struct platform_device *dev) usb_put_hcd(hcd); kfree(xhci); if (phy && phy->otg) otg_set_host(phy->otg, NULL); return 0; } #ifdef CONFIG_PM_RUNTIME static int xhci_msm_runtime_idle(struct device *dev) { dev_dbg(dev, "xhci msm runtime idle\n"); return 0; } static int xhci_msm_runtime_suspend(struct device *dev) { dev_dbg(dev, "xhci msm runtime suspend\n"); /* * Notify OTG about suspend. It takes care of * putting the hardware in LPM. */ if (phy) return usb_phy_set_suspend(phy, 1); return 0; } static int xhci_msm_runtime_resume(struct device *dev) { dev_dbg(dev, "xhci msm runtime resume\n"); if (phy) return usb_phy_set_suspend(phy, 0); return 0; } #endif #ifdef CONFIG_PM_SLEEP static int xhci_msm_pm_suspend(struct device *dev) { dev_dbg(dev, "xhci-msm PM suspend\n"); if (phy) return usb_phy_set_suspend(phy, 1); return 0; } static int xhci_msm_pm_resume(struct device *dev) { dev_dbg(dev, "xhci-msm PM resume\n"); if (pm_runtime_suspended(dev)) return 0; if (phy) return usb_phy_set_suspend(phy, 0); return 0; } #endif static const struct dev_pm_ops xhci_msm_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(xhci_msm_pm_suspend, xhci_msm_pm_resume) SET_RUNTIME_PM_OPS(xhci_msm_runtime_suspend, xhci_msm_runtime_resume, xhci_msm_runtime_idle) }; static struct platform_driver usb_xhci_driver = { .probe = xhci_plat_probe, .remove = xhci_plat_remove, .driver = { .name = "xhci-hcd", .pm = &xhci_msm_dev_pm_ops, }, }; MODULE_ALIAS("platform:xhci-hcd"); Loading Loading
drivers/usb/dwc3/dwc3_otg.c +15 −25 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ MODULE_PARM_DESC(max_chgr_retry_count, "Max invalid charger retry count"); static struct dwc3_otg *the_dotg; static void dwc3_otg_reset(struct dwc3_otg *dotg); static int dwc3_otg_set_host(struct usb_otg *otg, struct usb_bus *host); static void dwc3_otg_notify_host_mode(struct usb_otg *otg, int host_mode); static void dwc3_otg_reset(struct dwc3_otg *dotg); Loading Loading @@ -77,25 +77,6 @@ static void dwc3_otg_set_host_regs(struct dwc3_otg *dotg) } } static int dwc3_otg_set_suspend(struct usb_phy *phy, int suspend) { struct usb_otg *otg = phy->otg; struct dwc3_otg *dotg = container_of(otg, struct dwc3_otg, otg); if (dotg->host_bus_suspend == suspend) return 0; dotg->host_bus_suspend = suspend; if (suspend) { pm_runtime_put_sync(phy->dev); } else { pm_runtime_get_noresume(phy->dev); pm_runtime_resume(phy->dev); } return 0; } static void dwc3_otg_set_hsphy_auto_suspend(struct dwc3_otg *dotg, bool susp) { struct dwc3 *dwc = dotg->dwc; Loading Loading @@ -181,6 +162,7 @@ static int dwc3_otg_start_host(struct usb_otg *otg, int on) struct dwc3_otg *dotg = container_of(otg, struct dwc3_otg, otg); struct dwc3_ext_xceiv *ext_xceiv = dotg->ext_xceiv; struct dwc3 *dwc = dotg->dwc; struct usb_hcd *hcd; int ret = 0; if (!dwc->xhci) Loading Loading @@ -228,7 +210,10 @@ static int dwc3_otg_start_host(struct usb_otg *otg, int on) return ret; } hcd = platform_get_drvdata(dwc->xhci); dwc3_otg_set_host(otg, &hcd->self); dwc3_otg_notify_host_mode(otg, on); ret = regulator_enable(dotg->vbus_otg); if (ret) { dev_err(otg->phy->dev, "unable to enable vbus_otg\n"); Loading @@ -247,9 +232,11 @@ static int dwc3_otg_start_host(struct usb_otg *otg, int on) dev_err(otg->phy->dev, "unable to disable vbus_otg\n"); return ret; } dwc3_otg_notify_host_mode(otg, on); dwc3_otg_notify_host_mode(otg, on); dwc3_otg_set_host(otg, NULL); platform_device_del(dwc->xhci); /* * Perform USB hardware RESET (both core reset and DBM reset) * when moving from host to peripheral. This is required for Loading Loading @@ -441,9 +428,6 @@ static void dwc3_ext_event_notify(struct usb_otg *otg, dev_dbg(phy->dev, "ext PHY_RESUME event received\n"); /* ext_xceiver would have taken h/w out of LPM by now */ ret = pm_runtime_get(phy->dev); if ((phy->state == OTG_STATE_A_HOST) && dotg->host_bus_suspend) dotg->host_bus_suspend = 0; if (ret == -EACCES) { /* pm_runtime_get may fail during system resume with -EACCES error */ Loading Loading @@ -872,6 +856,10 @@ static void dwc3_otg_sm_work(struct work_struct *w) phy->state = OTG_STATE_A_IDLE; pm_runtime_put_sync(phy->dev); return; } else { /* xHCI increments PM child count as needed */ dev_dbg(phy->dev, "a_host state entered. Allow runtime suspend.\n"); pm_runtime_put_sync(phy->dev); } } break; Loading @@ -883,6 +871,9 @@ static void dwc3_otg_sm_work(struct work_struct *w) phy->state = OTG_STATE_B_IDLE; dotg->vbus_retry_count = 0; work = 1; } else { dev_dbg(phy->dev, "a_host state entered. Allow runtime suspend.\n"); pm_runtime_put_sync(phy->dev); } break; Loading Loading @@ -964,7 +955,6 @@ int dwc3_otg_register_phys(struct platform_device *pdev) dotg->otg.phy->otg = &dotg->otg; dotg->otg.phy->dev = &pdev->dev; dotg->otg.phy->set_power = dwc3_otg_set_power; dotg->otg.phy->set_suspend = dwc3_otg_set_suspend; dotg->otg.set_peripheral = dwc3_otg_set_peripheral; dotg->otg.set_host = dwc3_otg_set_host; Loading
drivers/usb/dwc3/dwc3_otg.h +0 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ struct dwc3_otg { unsigned long inputs; struct power_supply *psy; struct completion dwc3_xcvr_vbus_init; int host_bus_suspend; int charger_retry_count; int vbus_retry_count; }; Loading
drivers/usb/dwc3/host.c +1 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ int dwc3_host_init(struct dwc3 *dwc) dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask); xhci->dev.parent = dwc->dev; xhci->dev.dma_mask = dwc->dev->dma_mask; xhci->dev.dma_parms = dwc->dev->dma_parms; Loading @@ -79,7 +80,6 @@ int dwc3_host_init(struct dwc3 *dwc) /* Add XHCI device if !OTG, otherwise OTG takes care of this */ if (!dwc->dotg) { xhci->dev.parent = dwc->dev; ret = platform_device_add(xhci); if (ret) { dev_err(dwc->dev, "failed to register xHCI device\n"); Loading
drivers/usb/host/xhci-plat.c +1 −83 Original line number Diff line number Diff line Loading @@ -15,15 +15,11 @@ #include <linux/pm_runtime.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/usb/otg.h> #include <linux/usb/msm_hsusb.h> #include "xhci.h" #define SYNOPSIS_DWC3_VENDOR 0x5533 static struct usb_phy *phy; static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) { struct xhci_plat_data *pdata = dev->platform_data; Loading Loading @@ -147,6 +143,7 @@ static int xhci_plat_probe(struct platform_device *pdev) goto release_mem_region; } pm_runtime_no_callbacks(&pdev->dev); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); pm_runtime_get_sync(&pdev->dev); Loading Loading @@ -176,19 +173,6 @@ static int xhci_plat_probe(struct platform_device *pdev) if (ret) goto put_usb3_hcd; phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2); if (phy && phy->otg && !(phy->flags & ENABLE_SECONDARY_PHY)) { dev_dbg(&pdev->dev, "%s otg support available\n", __func__); ret = otg_set_host(phy->otg, &hcd->self); if (ret) { dev_err(&pdev->dev, "%s otg_set_host failed\n", __func__); goto put_usb3_hcd; } } else { pm_runtime_no_callbacks(&pdev->dev); } pm_runtime_put(&pdev->dev); return 0; Loading Loading @@ -226,80 +210,14 @@ static int xhci_plat_remove(struct platform_device *dev) usb_put_hcd(hcd); kfree(xhci); if (phy && phy->otg) otg_set_host(phy->otg, NULL); return 0; } #ifdef CONFIG_PM_RUNTIME static int xhci_msm_runtime_idle(struct device *dev) { dev_dbg(dev, "xhci msm runtime idle\n"); return 0; } static int xhci_msm_runtime_suspend(struct device *dev) { dev_dbg(dev, "xhci msm runtime suspend\n"); /* * Notify OTG about suspend. It takes care of * putting the hardware in LPM. */ if (phy) return usb_phy_set_suspend(phy, 1); return 0; } static int xhci_msm_runtime_resume(struct device *dev) { dev_dbg(dev, "xhci msm runtime resume\n"); if (phy) return usb_phy_set_suspend(phy, 0); return 0; } #endif #ifdef CONFIG_PM_SLEEP static int xhci_msm_pm_suspend(struct device *dev) { dev_dbg(dev, "xhci-msm PM suspend\n"); if (phy) return usb_phy_set_suspend(phy, 1); return 0; } static int xhci_msm_pm_resume(struct device *dev) { dev_dbg(dev, "xhci-msm PM resume\n"); if (pm_runtime_suspended(dev)) return 0; if (phy) return usb_phy_set_suspend(phy, 0); return 0; } #endif static const struct dev_pm_ops xhci_msm_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(xhci_msm_pm_suspend, xhci_msm_pm_resume) SET_RUNTIME_PM_OPS(xhci_msm_runtime_suspend, xhci_msm_runtime_resume, xhci_msm_runtime_idle) }; static struct platform_driver usb_xhci_driver = { .probe = xhci_plat_probe, .remove = xhci_plat_remove, .driver = { .name = "xhci-hcd", .pm = &xhci_msm_dev_pm_ops, }, }; MODULE_ALIAS("platform:xhci-hcd"); Loading