diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-03-19 18:22:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-22 14:08:53 -0400 |
commit | 18a0d89e54ca0f6f33582f99ae39867b2c975559 (patch) | |
tree | 6698711fdad0ded22c69b1e83d2984ffaf70cb96 | |
parent | 65c24491b4fef017c64e39ec64384fde5e05e0a0 (diff) |
radeonfb: Whack the PCI PM register until it sticks
This fixes a regression introduced when we switched to using the core
pci_set_power_state(). The chip seems to need the state to be written
over and over again until it sticks, so we do that.
Note that the code is a bit blunt, without timeout, etc... but that's
pretty much because I put back in there the code exactly as it used to
be before the regression. I still add a call to pci_set_power_state()
at the end so that ACPI gets called appropriately on x86.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Tested-by: Raymond Wooninck <tittiatcoke@gmail.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-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", |