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.

aty128fb: Properly save PCI state before changing PCI PM level

This fixes aty128fb to properly save the PCI config space -before- it
potentially switches the PM state of the chip. This avoids a
warning with the new PM core and is the right thing to do anyway.

I also replaced the hand-coded switch to D2 with a call to the
genericc pci_set_power_state() and removed the code that switches it
back to D0 since the generic code is doing that for us nowadays.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Benjamin Herrenschmidt and committed by
Linus Torvalds
b746bb77 b7468168

+15 -10
+15 -10
drivers/video/aty/aty128fb.c
··· 2374 2374 /* Set the chip into the appropriate suspend mode (we use D2, 2375 2375 * D3 would require a complete re-initialisation of the chip, 2376 2376 * including PCI config registers, clocks, AGP configuration, ...) 2377 + * 2378 + * For resume, the core will have already brought us back to D0 2377 2379 */ 2378 2380 if (suspend) { 2379 2381 /* Make sure CRTC2 is reset. Remove that the day we decide to ··· 2393 2391 aty_st_le32(BUS_CNTL1, 0x00000010); 2394 2392 aty_st_le32(MEM_POWER_MISC, 0x0c830000); 2395 2393 mdelay(100); 2396 - pci_read_config_word(pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command); 2394 + 2397 2395 /* Switch PCI power management to D2 */ 2398 - pci_write_config_word(pdev, par->pm_reg+PCI_PM_CTRL, 2399 - (pwr_command & ~PCI_PM_CTRL_STATE_MASK) | 2); 2400 - pci_read_config_word(pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command); 2401 - } else { 2402 - /* Switch back PCI power management to D0 */ 2403 - mdelay(100); 2404 - pci_write_config_word(pdev, par->pm_reg+PCI_PM_CTRL, 0); 2405 - pci_read_config_word(pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command); 2406 - mdelay(100); 2396 + pci_set_power_state(pdev, PCI_D2); 2407 2397 } 2408 2398 } 2409 2399 ··· 2403 2409 { 2404 2410 struct fb_info *info = pci_get_drvdata(pdev); 2405 2411 struct aty128fb_par *par = info->par; 2412 + 2413 + /* Because we may change PCI D state ourselves, we need to 2414 + * first save the config space content so the core can 2415 + * restore it properly on resume. 2416 + */ 2417 + pci_save_state(pdev); 2406 2418 2407 2419 /* We don't do anything but D2, for now we return 0, but 2408 2420 * we may want to change that. How do we know if the BIOS ··· 2475 2475 2476 2476 if (pdev->dev.power.power_state.event == PM_EVENT_ON) 2477 2477 return 0; 2478 + 2479 + /* PCI state will have been restored by the core, so 2480 + * we should be in D0 now with our config space fully 2481 + * restored 2482 + */ 2478 2483 2479 2484 /* Wakeup chip */ 2480 2485 aty128_set_suspend(par, 0);