Loading drivers/usb/dwc3/dwc3-msm.c +24 −28 Original line number Diff line number Diff line Loading @@ -2142,6 +2142,8 @@ static void dwc3_ext_event_notify(struct dwc3_msm *mdwc) if (!mdwc->init) { mdwc->init = true; pm_runtime_set_autosuspend_delay(mdwc->dev, 1000); pm_runtime_use_autosuspend(mdwc->dev); if (!work_busy(&mdwc->sm_work.work)) schedule_delayed_work(&mdwc->sm_work, 0); Loading @@ -2150,6 +2152,7 @@ static void dwc3_ext_event_notify(struct dwc3_msm *mdwc) return; } schedule_delayed_work(&mdwc->sm_work, 0); } Loading Loading @@ -3078,17 +3081,17 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on) if (on) { dev_dbg(mdwc->dev, "%s: turn on host\n", __func__); pm_runtime_get_sync(dwc->dev); pm_runtime_get_sync(mdwc->dev); dbg_event(0xFF, "StrtHost gync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); usb_phy_notify_connect(mdwc->hs_phy, USB_SPEED_HIGH); if (!IS_ERR(mdwc->vbus_reg)) ret = regulator_enable(mdwc->vbus_reg); if (ret) { dev_err(dwc->dev, "unable to enable vbus_reg\n"); pm_runtime_put_sync(dwc->dev); dev_err(mdwc->dev, "unable to enable vbus_reg\n"); pm_runtime_put_sync(mdwc->dev); dbg_event(0xFF, "vregerr psync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); return ret; } Loading @@ -3109,9 +3112,9 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on) __func__, ret); if (!IS_ERR(mdwc->vbus_reg)) regulator_disable(mdwc->vbus_reg); pm_runtime_put_sync(dwc->dev); pm_runtime_put_sync(mdwc->dev); dbg_event(0xFF, "pdeverr psync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); return ret; } Loading @@ -3127,22 +3130,23 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on) dwc3_gadget_usb3_phy_suspend(dwc, true); /* xHCI should have incremented child count as necessary */ pm_runtime_put_sync(dwc->dev); dbg_event(0xFF, "StrtHost psync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); pm_runtime_mark_last_busy(mdwc->dev); pm_runtime_put_sync_autosuspend(mdwc->dev); } else { dev_dbg(dwc->dev, "%s: turn off host\n", __func__); dev_dbg(mdwc->dev, "%s: turn off host\n", __func__); if (!IS_ERR(mdwc->vbus_reg)) ret = regulator_disable(mdwc->vbus_reg); if (ret) { dev_err(dwc->dev, "unable to disable vbus_reg\n"); dev_err(mdwc->dev, "unable to disable vbus_reg\n"); return ret; } pm_runtime_get_sync(dwc->dev); pm_runtime_get_sync(mdwc->dev); dbg_event(0xFF, "StopHost gsync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); usb_phy_notify_disconnect(mdwc->hs_phy, USB_SPEED_HIGH); platform_device_del(dwc->xhci); Loading @@ -3160,9 +3164,10 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on) /* re-init core and OTG registers as block reset clears these */ dwc3_post_host_reset_core_init(dwc); pm_runtime_put_sync(dwc->dev); pm_runtime_mark_last_busy(mdwc->dev); pm_runtime_put_sync_autosuspend(mdwc->dev); dbg_event(0xFF, "StopHost psync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); } return 0; Loading @@ -3180,9 +3185,9 @@ static int dwc3_otg_start_peripheral(struct dwc3_msm *mdwc, int on) { struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3); pm_runtime_get_sync(dwc->dev); pm_runtime_get_sync(mdwc->dev); dbg_event(0xFF, "StrtGdgt gsync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); if (on) { dev_dbg(mdwc->dev, "%s: turn on gadget %s\n", Loading @@ -3206,9 +3211,9 @@ static int dwc3_otg_start_peripheral(struct dwc3_msm *mdwc, int on) dwc3_gadget_usb3_phy_suspend(dwc, false); } pm_runtime_put_sync(dwc->dev); pm_runtime_put_sync(mdwc->dev); dbg_event(0xFF, "StopGdgt psync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); return 0; } Loading Loading @@ -3587,15 +3592,6 @@ static void dwc3_otg_sm_work(struct work_struct *w) dev_err(mdwc->dev, "unable to start host\n"); mdwc->otg_state = OTG_STATE_A_IDLE; goto ret; } else { /* * delay 1s to allow for xHCI to detect * just-attached devices before allowing * runtime suspend */ dev_dbg(mdwc->dev, "a_host state entered\n"); delay = VBUS_REG_CHECK_DELAY; work = 1; } } break; Loading drivers/usb/host/xhci-plat.c +14 −6 Original line number Diff line number Diff line Loading @@ -235,6 +235,8 @@ static int xhci_plat_probe(struct platform_device *pdev) if (ret) dev_err(&pdev->dev, "%s: unable to create imod sysfs entry\n", __func__); pm_runtime_mark_last_busy(&pdev->dev); pm_runtime_put_autosuspend(&pdev->dev); return 0; Loading Loading @@ -280,12 +282,18 @@ static int xhci_plat_remove(struct platform_device *dev) #ifdef CONFIG_PM_RUNTIME static int xhci_plat_runtime_idle(struct device *dev) { if (pm_runtime_autosuspend_expiration(dev)) { /* * When pm_runtime_put_autosuspend() is called on this device, * after this idle callback returns the PM core will schedule the * autosuspend if there is any remaining time until expiry. However, * when reaching this point because the child_count becomes 0, the * core does not honor autosuspend in that case and results in * idle/suspend happening immediately. In order to have a delay * before suspend we have to call pm_runtime_autosuspend() manually. */ pm_runtime_mark_last_busy(dev); pm_runtime_autosuspend(dev); return -EAGAIN; } return 0; return -EBUSY; } static int xhci_plat_runtime_suspend(struct device *dev) Loading Loading
drivers/usb/dwc3/dwc3-msm.c +24 −28 Original line number Diff line number Diff line Loading @@ -2142,6 +2142,8 @@ static void dwc3_ext_event_notify(struct dwc3_msm *mdwc) if (!mdwc->init) { mdwc->init = true; pm_runtime_set_autosuspend_delay(mdwc->dev, 1000); pm_runtime_use_autosuspend(mdwc->dev); if (!work_busy(&mdwc->sm_work.work)) schedule_delayed_work(&mdwc->sm_work, 0); Loading @@ -2150,6 +2152,7 @@ static void dwc3_ext_event_notify(struct dwc3_msm *mdwc) return; } schedule_delayed_work(&mdwc->sm_work, 0); } Loading Loading @@ -3078,17 +3081,17 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on) if (on) { dev_dbg(mdwc->dev, "%s: turn on host\n", __func__); pm_runtime_get_sync(dwc->dev); pm_runtime_get_sync(mdwc->dev); dbg_event(0xFF, "StrtHost gync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); usb_phy_notify_connect(mdwc->hs_phy, USB_SPEED_HIGH); if (!IS_ERR(mdwc->vbus_reg)) ret = regulator_enable(mdwc->vbus_reg); if (ret) { dev_err(dwc->dev, "unable to enable vbus_reg\n"); pm_runtime_put_sync(dwc->dev); dev_err(mdwc->dev, "unable to enable vbus_reg\n"); pm_runtime_put_sync(mdwc->dev); dbg_event(0xFF, "vregerr psync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); return ret; } Loading @@ -3109,9 +3112,9 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on) __func__, ret); if (!IS_ERR(mdwc->vbus_reg)) regulator_disable(mdwc->vbus_reg); pm_runtime_put_sync(dwc->dev); pm_runtime_put_sync(mdwc->dev); dbg_event(0xFF, "pdeverr psync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); return ret; } Loading @@ -3127,22 +3130,23 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on) dwc3_gadget_usb3_phy_suspend(dwc, true); /* xHCI should have incremented child count as necessary */ pm_runtime_put_sync(dwc->dev); dbg_event(0xFF, "StrtHost psync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); pm_runtime_mark_last_busy(mdwc->dev); pm_runtime_put_sync_autosuspend(mdwc->dev); } else { dev_dbg(dwc->dev, "%s: turn off host\n", __func__); dev_dbg(mdwc->dev, "%s: turn off host\n", __func__); if (!IS_ERR(mdwc->vbus_reg)) ret = regulator_disable(mdwc->vbus_reg); if (ret) { dev_err(dwc->dev, "unable to disable vbus_reg\n"); dev_err(mdwc->dev, "unable to disable vbus_reg\n"); return ret; } pm_runtime_get_sync(dwc->dev); pm_runtime_get_sync(mdwc->dev); dbg_event(0xFF, "StopHost gsync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); usb_phy_notify_disconnect(mdwc->hs_phy, USB_SPEED_HIGH); platform_device_del(dwc->xhci); Loading @@ -3160,9 +3164,10 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on) /* re-init core and OTG registers as block reset clears these */ dwc3_post_host_reset_core_init(dwc); pm_runtime_put_sync(dwc->dev); pm_runtime_mark_last_busy(mdwc->dev); pm_runtime_put_sync_autosuspend(mdwc->dev); dbg_event(0xFF, "StopHost psync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); } return 0; Loading @@ -3180,9 +3185,9 @@ static int dwc3_otg_start_peripheral(struct dwc3_msm *mdwc, int on) { struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3); pm_runtime_get_sync(dwc->dev); pm_runtime_get_sync(mdwc->dev); dbg_event(0xFF, "StrtGdgt gsync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); if (on) { dev_dbg(mdwc->dev, "%s: turn on gadget %s\n", Loading @@ -3206,9 +3211,9 @@ static int dwc3_otg_start_peripheral(struct dwc3_msm *mdwc, int on) dwc3_gadget_usb3_phy_suspend(dwc, false); } pm_runtime_put_sync(dwc->dev); pm_runtime_put_sync(mdwc->dev); dbg_event(0xFF, "StopGdgt psync", atomic_read(&dwc->dev->power.usage_count)); atomic_read(&mdwc->dev->power.usage_count)); return 0; } Loading Loading @@ -3587,15 +3592,6 @@ static void dwc3_otg_sm_work(struct work_struct *w) dev_err(mdwc->dev, "unable to start host\n"); mdwc->otg_state = OTG_STATE_A_IDLE; goto ret; } else { /* * delay 1s to allow for xHCI to detect * just-attached devices before allowing * runtime suspend */ dev_dbg(mdwc->dev, "a_host state entered\n"); delay = VBUS_REG_CHECK_DELAY; work = 1; } } break; Loading
drivers/usb/host/xhci-plat.c +14 −6 Original line number Diff line number Diff line Loading @@ -235,6 +235,8 @@ static int xhci_plat_probe(struct platform_device *pdev) if (ret) dev_err(&pdev->dev, "%s: unable to create imod sysfs entry\n", __func__); pm_runtime_mark_last_busy(&pdev->dev); pm_runtime_put_autosuspend(&pdev->dev); return 0; Loading Loading @@ -280,12 +282,18 @@ static int xhci_plat_remove(struct platform_device *dev) #ifdef CONFIG_PM_RUNTIME static int xhci_plat_runtime_idle(struct device *dev) { if (pm_runtime_autosuspend_expiration(dev)) { /* * When pm_runtime_put_autosuspend() is called on this device, * after this idle callback returns the PM core will schedule the * autosuspend if there is any remaining time until expiry. However, * when reaching this point because the child_count becomes 0, the * core does not honor autosuspend in that case and results in * idle/suspend happening immediately. In order to have a delay * before suspend we have to call pm_runtime_autosuspend() manually. */ pm_runtime_mark_last_busy(dev); pm_runtime_autosuspend(dev); return -EAGAIN; } return 0; return -EBUSY; } static int xhci_plat_runtime_suspend(struct device *dev) Loading