Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Benjamin Herrenschmidt and committed by
Linus Torvalds
18a0d89e 65c24491

+24
+24
drivers/video/aty/radeon_pm.c
··· 2507 2507 2508 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 2529 static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend) 2511 2530 { 2512 2531 u32 tmp; ··· 2577 2558 /* Switch PCI power management to D2. */ 2578 2559 pci_disable_device(rinfo->pdev); 2579 2560 pci_save_state(rinfo->pdev); 2561 + /* The chip seems to need us to whack the PM register 2562 + * repeatedly until it sticks. We do that -prior- to 2563 + * calling pci_set_power_state() 2564 + */ 2565 + radeonfb_whack_power_state(rinfo, PCI_D2); 2580 2566 pci_set_power_state(rinfo->pdev, PCI_D2); 2581 2567 } else { 2582 2568 printk(KERN_DEBUG "radeonfb (%s): switching to D0 state...\n",