aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e091b0afdc8a..f3ea977a5b1b 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -638,6 +638,19 @@ void pci_update_current_state(struct pci_dev *dev, pci_power_t state)
638} 638}
639 639
640/** 640/**
641 * pci_power_up - Put the given device into D0 forcibly
642 * @dev: PCI device to power up
643 */
644void pci_power_up(struct pci_dev *dev)
645{
646 if (platform_pci_power_manageable(dev))
647 platform_pci_set_power_state(dev, PCI_D0);
648
649 pci_raw_set_power_state(dev, PCI_D0);
650 pci_update_current_state(dev, PCI_D0);
651}
652
653/**
641 * pci_platform_power_transition - Use platform to change device power state 654 * pci_platform_power_transition - Use platform to change device power state
642 * @dev: PCI device to handle. 655 * @dev: PCI device to handle.
643 * @state: State to put the device into. 656 * @state: State to put the device into.
@@ -727,7 +740,7 @@ int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state)
727{ 740{
728 int ret; 741 int ret;
729 742
730 if (state < PCI_D0) 743 if (state <= PCI_D0)
731 return -EINVAL; 744 return -EINVAL;
732 ret = pci_platform_power_transition(dev, state); 745 ret = pci_platform_power_transition(dev, state);
733 /* Power off the bridge may power off the whole hierarchy */ 746 /* Power off the bridge may power off the whole hierarchy */
@@ -769,6 +782,10 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
769 */ 782 */
770 return 0; 783 return 0;
771 784
785 /* Check if we're already there */
786 if (dev->current_state == state)
787 return 0;
788
772 __pci_start_power_transition(dev, state); 789 __pci_start_power_transition(dev, state);
773 790
774 /* This device is quirked not to be put into D3, so 791 /* This device is quirked not to be put into D3, so