>From 1a2dbfe1542356e747c675bd4cac7d4713e21bed Mon Sep 17 00:00:00 2001 From: Hao Wu <[email protected]> Date: Wed, 24 Nov 2010 12:58:17 +0800 Subject: [PATCH] usb: ehci-langwell-pci: add transceiver driver interface for runtime pm.
This patch adds transceiver driver interface for runtime pm, in order to support OTG case. Signed-off-by: Hao Wu <[email protected]> --- drivers/usb/host/ehci-langwell-pci.c | 53 +++++++++++++++++++++++++++++++++- 1 files changed, 52 insertions(+), 1 deletions(-) diff --git a/drivers/usb/host/ehci-langwell-pci.c b/drivers/usb/host/ehci-langwell-pci.c index ee2a56f..742c556 100644 --- a/drivers/usb/host/ehci-langwell-pci.c +++ b/drivers/usb/host/ehci-langwell-pci.c @@ -225,18 +225,65 @@ static int ehci_mid_stop_host(struct intel_mid_otg_xceiv *iotg) return 0; } +#ifdef CONFIG_PM_RUNTIME +static int ehci_mid_runtime_suspend_host(struct intel_mid_otg_xceiv *iotg) +{ + int retval; + + if (iotg == NULL) + return -EINVAL; + + if (ehci_otg_driver.driver.pm == NULL || + ehci_otg_driver.driver.pm->runtime_suspend == NULL) + return -EINVAL; + + retval = ehci_otg_driver.driver.pm->runtime_suspend(iotg->otg.dev); + if (retval) + dev_warn(iotg->otg.dev, "runtime suspend failed\n"); + + return retval; +} + +static int ehci_mid_runtime_resume_host(struct intel_mid_otg_xceiv *iotg) +{ + int retval; + + if (iotg == NULL) + return -EINVAL; + + if (ehci_otg_driver.driver.pm == NULL || + ehci_otg_driver.driver.pm->runtime_resume == NULL) + return -EINVAL; + + retval = ehci_otg_driver.driver.pm->runtime_resume(iotg->otg.dev); + if (retval) + dev_warn(iotg->otg.dev, "runtime suspend failed\n"); + + return retval; +} +#else + +#define ehci_mid_runtime_suspend_host NULL +#define ehci_mid_runtime_resume_host NULL + +#endif + static int intel_mid_ehci_driver_register(struct pci_driver *host_driver) { struct otg_transceiver *otg; struct intel_mid_otg_xceiv *iotg; otg = otg_get_transceiver(); - if (otg == NULL) + if (otg == NULL || host_driver == NULL) return -EINVAL; iotg = otg_to_mid_xceiv(otg); iotg->start_host = ehci_mid_start_host; iotg->stop_host = ehci_mid_stop_host; +#ifdef CONFIG_PM_RUNTIME + iotg->runtime_suspend_host = ehci_mid_runtime_suspend_host; + iotg->runtime_resume_host = ehci_mid_runtime_resume_host; +#endif /* notify host driver is registered */ atomic_notifier_call_chain(&iotg->iotg_notifier, @@ -259,6 +306,10 @@ static void intel_mid_ehci_driver_unregister(struct pci_driver *host_driver) iotg = otg_to_mid_xceiv(otg); iotg->start_host = NULL; iotg->stop_host = NULL; +#ifdef CONFIG_PM_RUNTIME + iotg->runtime_suspend_host = NULL; + iotg->runtime_resume_host = NULL; +#endif /* notify host driver is unregistered */ atomic_notifier_call_chain(&iotg->iotg_notifier, -- 1.6.0.6
0003-usb-ehci-langwell-pci-add-transceiver-driver-inter.patch
Description: 0003-usb-ehci-langwell-pci-add-transceiver-driver-inter.patch
_______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
