diff options
Diffstat (limited to 'drivers/video/aty/radeon_pm.c')
-rw-r--r-- | drivers/video/aty/radeon_pm.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index 81603f85e17e..c6d7cc76516f 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c | |||
@@ -2507,6 +2507,25 @@ static void radeon_reinitialize_QW(struct radeonfb_info *rinfo) | |||
2507 | 2507 | ||
2508 | #endif /* CONFIG_PPC_OF */ | 2508 | #endif /* CONFIG_PPC_OF */ |
2509 | 2509 | ||
2510 | static void radeonfb_whack_power_state(struct radeonfb_info *rinfo, pci_power_t state) | ||
2511 | { | ||
2512 | u16 pwr_cmd; | ||
2513 | |||
2514 | for (;;) { | ||
2515 | pci_read_config_word(rinfo->pdev, | ||
2516 | rinfo->pm_reg+PCI_PM_CTRL, | ||
2517 | &pwr_cmd); | ||
2518 | if (pwr_cmd & 2) | ||
2519 | break; | ||
2520 | pwr_cmd = (pwr_cmd & ~PCI_PM_CTRL_STATE_MASK) | 2; | ||
2521 | pci_write_config_word(rinfo->pdev, | ||
2522 | rinfo->pm_reg+PCI_PM_CTRL, | ||
2523 | pwr_cmd); | ||
2524 | msleep(500); | ||
2525 | } | ||
2526 | rinfo->pdev->current_state = state; | ||
2527 | } | ||
2528 | |||
2510 | static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend) | 2529 | static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend) |
2511 | { | 2530 | { |
2512 | u32 tmp; | 2531 | u32 tmp; |
@@ -2558,6 +2577,11 @@ static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend) | |||
2558 | /* Switch PCI power management to D2. */ | 2577 | /* Switch PCI power management to D2. */ |
2559 | pci_disable_device(rinfo->pdev); | 2578 | pci_disable_device(rinfo->pdev); |
2560 | pci_save_state(rinfo->pdev); | 2579 | pci_save_state(rinfo->pdev); |
2580 | /* The chip seems to need us to whack the PM register | ||
2581 | * repeatedly until it sticks. We do that -prior- to | ||
2582 | * calling pci_set_power_state() | ||
2583 | */ | ||
2584 | radeonfb_whack_power_state(rinfo, PCI_D2); | ||
2561 | pci_set_power_state(rinfo->pdev, PCI_D2); | 2585 | pci_set_power_state(rinfo->pdev, PCI_D2); |
2562 | } else { | 2586 | } else { |
2563 | printk(KERN_DEBUG "radeonfb (%s): switching to D0 state...\n", | 2587 | printk(KERN_DEBUG "radeonfb (%s): switching to D0 state...\n", |