static int tegra_ehci_suspend(struct platform_device *pdev, pm_message_t state) { struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); struct tegra_usb_platform_data *pdata = dev_get_platdata(&pdev->dev); int err; /* bus suspend could have failed because of remote wakeup resume */ if (tegra->bus_suspended_fail) return -EBUSY; else { err = tegra_usb_phy_power_off(tegra->phy); if (err < 0) return err; if (pdata->u_data.host.turn_off_vbus_on_lp0) { tegra_usb_enable_vbus(tegra->phy, false); tegra_usb_phy_pmc_disable(tegra->phy); } if (tegra->irq) { err = enable_irq_wake(tegra->irq); if (err < 0) dev_err(&pdev->dev, "Couldn't enable USB host mode wakeup, irq=%d, " "error=%d\n", tegra->irq, err); } return err; } }
static int tegra_ehci_resume(struct platform_device *pdev) { struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); struct tegra_usb_platform_data *pdata = dev_get_platdata(&pdev->dev); if (pdata->u_data.host.turn_off_vbus_on_lp0 && pdata->port_otg) tegra_usb_enable_vbus(tegra->phy, true); return tegra_usb_phy_power_on(tegra->phy); }
static void tegra_ehci_shutdown(struct usb_hcd *hcd) { struct ehci_hcd *ehci = hcd_to_ehci(hcd); struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); struct platform_device *pdev = to_platform_device(hcd->self.controller); struct tegra_usb_platform_data *pdata = dev_get_platdata(&pdev->dev); mutex_lock(&tegra->sync_lock); if (tegra_usb_phy_hw_accessible(tegra->phy)) { ehci_silence_controller(ehci); } if (pdata->port_otg) tegra_usb_enable_vbus(tegra->phy, false); mutex_unlock(&tegra->sync_lock); }
static int tegra_ehci_suspend(struct platform_device *pdev, pm_message_t state) { struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); int err; struct tegra_usb_platform_data *pdata = dev_get_platdata(&pdev->dev); /* bus suspend could have failed because of remote wakeup resume */ if (tegra->bus_suspended_fail) return -EBUSY; else { err = tegra_usb_phy_power_off(tegra->phy); if (pdata->u_data.host.turn_off_vbus_on_lp0 && pdata->port_otg) tegra_usb_enable_vbus(tegra->phy, false); return err; } }
static int tegra_ehci_resume(struct platform_device *pdev) { int err = 0; struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); struct tegra_usb_platform_data *pdata = dev_get_platdata(&pdev->dev); if (tegra->irq) { err = disable_irq_wake(tegra->irq); if (err < 0) dev_err(&pdev->dev, "Couldn't disable USB host mode wakeup, irq=%d, " "error=%d\n", tegra->irq, err); } if (pdata->u_data.host.turn_off_vbus_on_lp0) { tegra_usb_enable_vbus(tegra->phy, true); tegra_ehci_notify_event(tegra, USB_EVENT_ID); } return tegra_usb_phy_power_on(tegra->phy); }