aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Luo <yifei.luo@intel.com>2010-12-09 10:37:46 +0000
committerAlan Cox <alan@linux.intel.com>2010-12-09 10:37:46 +0000
commitbd0e50951679bf66135f6758c8d7ff975b1f5a9f (patch)
treee528c5734ac3fbe0442de144e89a9018338db3a8
parente64d83526267343548625b74bb40a83cfc53fa02 (diff)
downloadmrst-s0i3-test-bd0e50951679bf66135f6758c8d7ff975b1f5a9f.tar.gz
mrst-s0i3-test-bd0e50951679bf66135f6758c8d7ff975b1f5a9f.tar.xz
mrst-s0i3-test-bd0e50951679bf66135f6758c8d7ff975b1f5a9f.zip
usb: core: add runtime pm support for Intel Medfield platform
This patch enables runtime pm support for usb host driver Signed-off-by: Andy Luo <yifei.luo@intel.com> Signed-off-by: Hao Wu <hao.wu@intel.com>
-rw-r--r--drivers/usb/core/hcd-pci.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 3799573bd38..bc509846e2d 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -339,7 +339,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_shutdown);
#ifdef CONFIG_PM_OPS
#ifdef CONFIG_PPC_PMAC
-static void powermac_set_asic(struct pci_dev *pci_dev, int enable)
+static void hcd_pci_set_platform_config(struct pci_dev *pci_dev, int enable)
{
/* Enanble or disable ASIC clocks for USB */
if (machine_is(powermac)) {
@@ -352,9 +352,24 @@ static void powermac_set_asic(struct pci_dev *pci_dev, int enable)
}
}
-#else
+#elif defined(CONFIG_X86_MRST)
+static void hcd_pci_set_platform_config(struct pci_dev *pci_dev, int enable)
+{
+ /* Check if it is Intel Medfield platform */
+ if (pci_dev->vendor == PCI_VENDOR_ID_INTEL &&
+ pci_dev->device == 0x0829) {
+ if (enable) {
+ pci_restore_state(pci_dev);
+ pci_set_power_state(pci_dev, PCI_D0);
+ } else {
+ pci_save_state(pci_dev);
+ pci_set_power_state(pci_dev, PCI_D3hot);
+ }
+ }
+}
-static inline void powermac_set_asic(struct pci_dev *pci_dev, int enable)
+#else
+static inline void hcd_pci_set_platform_config(struct pci_dev *pci_dev, int enable)
{}
#endif /* CONFIG_PPC_PMAC */
@@ -493,7 +508,7 @@ static int hcd_pci_suspend_noirq(struct device *dev)
return retval;
}
- powermac_set_asic(pci_dev, 0);
+ hcd_pci_set_platform_config(pci_dev, 0);
return retval;
}
@@ -501,7 +516,7 @@ static int hcd_pci_resume_noirq(struct device *dev)
{
struct pci_dev *pci_dev = to_pci_dev(dev);
- powermac_set_asic(pci_dev, 1);
+ hcd_pci_set_platform_config(pci_dev, 1);
/* Go back to D0 and disable remote wakeup */
pci_back_from_sleep(pci_dev);
@@ -536,7 +551,7 @@ static int hcd_pci_runtime_suspend(struct device *dev)
retval = suspend_common(dev, true);
if (retval == 0)
- powermac_set_asic(to_pci_dev(dev), 0);
+ hcd_pci_set_platform_config(to_pci_dev(dev), 0);
dev_dbg(dev, "hcd_pci_runtime_suspend: %d\n", retval);
return retval;
}
@@ -545,7 +560,7 @@ static int hcd_pci_runtime_resume(struct device *dev)
{
int retval;
- powermac_set_asic(to_pci_dev(dev), 1);
+ hcd_pci_set_platform_config(to_pci_dev(dev), 1);
retval = resume_common(dev, PM_EVENT_AUTO_RESUME);
dev_dbg(dev, "hcd_pci_runtime_resume: %d\n", retval);
return retval;