On Thu, 13 May 2010, Anand Gadiyar wrote:
> Add support for suspend and resume to the ehci-omap driver.
> Added routines for platform_driver suspend/resume and
> wrappers around ehci_bus_suspend/resume.
> +#ifdef CONFIG_PM
> /*-------------------------------------------------------------------------*/
> +static int ehci_omap_dev_suspend(struct device *dev)
> +{
> + struct ehci_hcd_omap *omap = dev_get_drvdata(dev);
> +
> + if (!omap->suspended)
> + ehci_omap_enable(omap, 0);
> + return 0;
> +}
> +
> +static int ehci_omap_dev_resume(struct device *dev)
> +{
> + struct ehci_hcd_omap *omap = dev_get_drvdata(dev);
> +
> + if (omap->suspended)
> + ehci_omap_enable(omap, 1);
> + return 0;
> +}
> +
> +static int ehci_omap_bus_suspend(struct usb_hcd *hcd)
> +{
> + struct usb_bus *bus = hcd_to_bus(hcd);
> + int ret;
> +
> + ret = ehci_bus_suspend(hcd);
> +
> + ehci_omap_dev_suspend(bus->controller);
> +
> + return ret;
> +}
> +static int ehci_omap_bus_resume(struct usb_hcd *hcd)
> +{
> + struct usb_bus *bus = hcd_to_bus(hcd);
> + int ret;
> +
> + ehci_omap_dev_resume(bus->controller);
> +
> + ret = ehci_bus_resume(hcd);
> +
> + return ret;
> +}
You could use the runtime-PM interface instead of explicitly suspending
and resuming the controller. It is now standard.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html