diff options
author | Hao Wu <hao.wu@intel.com> | 2010-12-09 10:37:46 +0000 |
---|---|---|
committer | Alan Cox <alan@linux.intel.com> | 2010-12-09 10:37:46 +0000 |
commit | e64d83526267343548625b74bb40a83cfc53fa02 (patch) | |
tree | 5ddd35db37fa90a86ab17e297dc47d28ae9843ee /drivers | |
parent | bd8d6557190bc4faf583756e1e19fc826602e76b (diff) | |
download | mrst-s0i3-test-e64d83526267343548625b74bb40a83cfc53fa02.tar.gz mrst-s0i3-test-e64d83526267343548625b74bb40a83cfc53fa02.tar.xz mrst-s0i3-test-e64d83526267343548625b74bb40a83cfc53fa02.zip |
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 <hao.wu@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/ehci-langwell-pci.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/drivers/usb/host/ehci-langwell-pci.c b/drivers/usb/host/ehci-langwell-pci.c index 46b09851175..58b888c2dc0 100644 --- a/drivers/usb/host/ehci-langwell-pci.c +++ b/drivers/usb/host/ehci-langwell-pci.c @@ -225,18 +225,61 @@ 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) + 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) + 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; + iotg->runtime_suspend_host = ehci_mid_runtime_suspend_host; + iotg->runtime_resume_host = ehci_mid_runtime_resume_host; /* notify host driver is registered */ atomic_notifier_call_chain(&iotg->iotg_notifier, @@ -259,6 +302,8 @@ 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; + iotg->runtime_suspend_host = NULL; + iotg->runtime_resume_host = NULL; /* notify host driver is unregistered */ atomic_notifier_call_chain(&iotg->iotg_notifier, |