# ACPI/PM/somehow. . . Can I put my Radeon to sleep?

## tbrass

I have a homebrew htpc that I would like to turn into an always-on vdr box. My saa7164-based TV card can handle most of the encoding, so in theory, I could do this with very little heat generated. Here's my problem:

In order to get decent BD support back when I was running a different OS, I invested in a radeon hd4850 (also good for games and great for GPU folding). I am hoping that someday I'll be able to do both again, but for right now--the card is just too hot! not only does it block a lot of my airflow, but the thing is putting out an enormous amount of heat itself.

How can I put my radeon to sleep without putting the rest of my system to sleep? (and, later, how can I wake it up???)

I am using the Radeon with DRM/KMS:

```
$ uname -a

Linux HALcentral 2.6.34-gentoojune16 #1 SMP Fri Jun 18 03:25:04 EDT 2010 x86_64 Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz GenuineIntel GNU/Linux
```

```
[    0.000000] Command line: BOOT_IMAGE=/bzImage-2.6.34-gentoojune16 root=/dev/sda4 rootfstype=btrfs radeon.modeset=1 radeon.dynpm=1 radeon.dynclks=1

[    0.000000]  [ffffea0000000000-ffffea00029fffff] PMD -> [ffff880002000000-ffff8800049fffff] on node 0

[    0.000000] ACPI: PM-Timer IO Port: 0x808

[    0.000000] PM: Registered nosave memory: 000000000009e000 - 000000000009f000

[    0.000000] PM: Registered nosave memory: 000000000009f000 - 00000000000a0000

[    0.000000] PM: Registered nosave memory: 00000000000a0000 - 00000000000e4000

[    0.000000] PM: Registered nosave memory: 00000000000e4000 - 0000000000100000

[    0.000000] Kernel command line: BOOT_IMAGE=/bzImage-2.6.34-gentoojune16 root=/dev/sda4 rootfstype=btrfs radeon.modeset=1 radeon.dynpm=1 radeon.dynclks=1

[    0.004582] Performance Events: Core2 events, Intel PMU driver.

[    0.123277] ACPI: SSDT 00000000bff9e0c0 001C6 (v01    AMI   CPU1PM 00000001 INTL 20060113)

[    0.124222] ACPI: SSDT 00000000bff9e290 0013A (v01    AMI   CPU2PM 00000001 INTL 20060113)

[    0.163330] pci 0000:00:01.0: PME# supported from D0 D3hot D3cold

[    0.163333] pci 0000:00:01.0: PME# disabled

[    0.163527] pci 0000:00:1a.7: PME# supported from D0 D3hot D3cold

[    0.163531] pci 0000:00:1a.7: PME# disabled

[    0.163600] pci 0000:00:1b.0: PME# supported from D0 D3hot D3cold

[    0.163603] pci 0000:00:1b.0: PME# disabled

[    1.360237] pcieport 0000:00:01.0: Requesting control of PCIe PME from ACPI BIOS

[    1.360506] pcieport 0000:00:01.0: Failed to receive control of PCIe PME service: no _OSC support

[    1.360767] pcie_pme: probe of 0000:00:01.0:pcie01 failed with error -13

[    1.360915] pcieport 0000:00:1c.0: Requesting control of PCIe PME from ACPI BIOS

[    1.361172] pcieport 0000:00:1c.0: Failed to receive control of PCIe PME service: no _OSC support

[    1.361433] pcie_pme: probe of 0000:00:1c.0:pcie01 failed with error -13

[    1.361582] pcieport 0000:00:1c.2: Requesting control of PCIe PME from ACPI BIOS

[    1.361838] pcieport 0000:00:1c.2: Failed to receive control of PCIe PME service: no _OSC support

```

```
$ modinfo radeon

filename:       /lib/modules/2.6.34-gentoojune16/kernel/drivers/gpu/drm/radeon/radeon.ko

license:        GPL and additional rights

description:    ATI Radeon

author:         Gareth Hughes, Keith Whitwell, others.

firmware:       radeon/R520_cp.bin

firmware:       radeon/RS600_cp.bin

firmware:       radeon/RS690_cp.bin

firmware:       radeon/R420_cp.bin

firmware:       radeon/R300_cp.bin

firmware:       radeon/R200_cp.bin

firmware:       radeon/R100_cp.bin

firmware:       radeon/RV710_me.bin

firmware:       radeon/RV710_pfp.bin

firmware:       radeon/RV730_me.bin

firmware:       radeon/RV730_pfp.bin

firmware:       radeon/RV770_me.bin

firmware:       radeon/RV770_pfp.bin

firmware:       radeon/RS780_me.bin

firmware:       radeon/RS780_pfp.bin

firmware:       radeon/RV670_me.bin

firmware:       radeon/RV670_pfp.bin

firmware:       radeon/RV635_me.bin

firmware:       radeon/RV635_pfp.bin

firmware:       radeon/RV620_me.bin

firmware:       radeon/RV620_pfp.bin

firmware:       radeon/RV630_me.bin

firmware:       radeon/RV630_pfp.bin

firmware:       radeon/RV610_me.bin

firmware:       radeon/RV610_pfp.bin

firmware:       radeon/R600_me.bin

firmware:       radeon/R600_pfp.bin

license:        GPL

firmware:       radeon/R520_cp.bin

firmware:       radeon/RS600_cp.bin

firmware:       radeon/RS690_cp.bin

firmware:       radeon/R420_cp.bin

firmware:       radeon/R300_cp.bin

firmware:       radeon/R200_cp.bin

firmware:       radeon/R100_cp.bin

firmware:       radeon/R700_rlc.bin

firmware:       radeon/R600_rlc.bin

firmware:       radeon/RV710_me.bin

firmware:       radeon/RV710_pfp.bin

firmware:       radeon/RV730_me.bin

firmware:       radeon/RV730_pfp.bin

firmware:       radeon/RV770_me.bin

firmware:       radeon/RV770_pfp.bin

firmware:       radeon/RS780_me.bin

firmware:       radeon/RS780_pfp.bin

firmware:       radeon/RV670_me.bin

firmware:       radeon/RV670_pfp.bin

firmware:       radeon/RV635_me.bin

firmware:       radeon/RV635_pfp.bin

firmware:       radeon/RV620_me.bin

firmware:       radeon/RV620_pfp.bin

firmware:       radeon/RV630_me.bin

firmware:       radeon/RV630_pfp.bin

firmware:       radeon/RV610_me.bin

firmware:       radeon/RV610_pfp.bin

firmware:       radeon/R600_me.bin

firmware:       radeon/R600_pfp.bin

alias:          pci:v00001002d00009715sv*sd*bc*sc*i*

blahblahblah

alias:          pci:v00001002d00003150sv*sd*bc*sc*i*

depends:        drm,drm_kms_helper,ttm,fb,cfbfillrect,cfbimgblt,cfbcopyarea,i2c-algo-bit

vermagic:       2.6.34-gentoojune16 SMP mod_unload 

parm:           no_wb:Disable AGP writeback for scratch registers (int)

parm:           modeset:Disable/Enable modesetting (int)

parm:           dynclks:Disable/Enable dynamic clocks (int)

parm:           r4xx_atom:Enable ATOMBIOS modesetting for R4xx (int)

parm:           vramlimit:Restrict VRAM for testing (int)

parm:           agpmode:AGP Mode (-1 == PCI) (int)

parm:           gartsize:Size of PCIE/IGP gart to setup in megabytes (32,64, etc)

 (int)

parm:           benchmark:Run benchmark (int)

parm:           test:Run tests (int)

parm:           connector_table:Force connector table (int)

parm:           tv:TV enable (0 = disable) (int)

parm:           new_pll:Select new PLL code (int)

parm:           dynpm:Disable/Enable dynamic power management (1 = enable) (int)

parm:           audio:Audio enable (0 = disable) (int)

parm:           disp_priority:Display Priority (0 = auto, 1 = normal, 2 = high) (int)

parm:           hw_i2c:hw i2c engine enable (0 = disable) (int)
```

I know that one of the touted points of the r600/mesa/kms is the ability to do power management (esp. for laptops), but I think that it would really help in my case too. I have tried searching through phoronix and here (which led me to enable dynpm and dynclks, at least once I start up x)... but what about pre-x? and how do I control it?

I have tried enabling ACPI, APIC, and even VGA-POST on resume in bios... 

My MB is the Asus P5B-DeluxeWifi w/ the latest bios installed.

any help would be greatly appreciated!

Thanks,

Ted

----------

## tuomaspt

I don't think graphics adapters have sleep states like that. Dynpm, if working correctly, should get you to about 16W idle usage for the GPU (Power Consumption of Contemporary Graphics Accelerators: Spring 2010). Dynpm works for me with 2.6.34 and KMS.

----------

## savalas

 *tbrass wrote:*   

> (which led me to enable dynpm and dynclks, at least once I start up x)... but what about pre-x? and how do I control it?

 

You should be able to add "radeon.dynpm=1 radeon.dynclks=1" to your kernel boot options.

----------

## Link31

The radeon driver (with dynpm/dynclks enabled) will automatically put the GPU into a lower power state when idle, e.g. when nothing is happening on the screen. You can't really control it. It will also switch to the lowest power state when the screen itself is turned off (DPMS).

So, if you need to "turn off" the GPU, and you don't have an integrated GPU to switch to, just turn off the screen:

```
xset dpms force off
```

As for "pre-X": on some laptops that come with two GPUs you can boot on the integrated GPU, and then switch to the discrete GPU when Xorg starts up. But I've never seen that in practice in desktop computers...

----------

## tbrass

Thanks for all of your suggestions. I know that a lot of what I am looking for is "coming soon, to a development build near you" (e.g. voltage regulation, etc), and that a lot of this code is very much a work in progress. So please tell me if I am looking for functions that simply aren't there yet.

Link: no integrated graphics, alas.

Since I started experimenting with grub commandline options, I haven't gotten the card to run at spec OR (seemingly) to draw less power. (wattage from the wall remains consistent regardless of whether I am attempting to pull a heavy or a light load). And now, no matter what commandline options I push, I can't get the card to do remotely 'high quality' 3d. E.g. Penumbra Overture runs at a very low framerate w/ 800x600 full screen, no antiailiasing, no anitropic, 'midlevel' shader, and 'midlevel' textures. This seems 'underperforming' (but may be a penumbra/s3tc problem); Extremetuxracer is also acting up w/ bad framerates, no apparent change when I disable dynpm and dynclks.

As many others have pointed out, drm.debug=1 has a tendency to flood syslogs (as I found out 66mb of 'messages' later)

This is what I get every time drm tries (I think) to change the state: "not in vbl for pm change 00020002 00000000 at entry" or something of that sort. 

```
$ cat /proc/cmdline

BOOT_IMAGE=/bzImage-2.6.34-gentoo-r1june23 root=/dev/sda4 rootfstype=btrfs radeon.modeset=1 radeon.dynpm=1 radeon.dynclks=1 radeon.new_pll=1 radeon.hw_i2c=1
```

Right now, I am showing 4 power states ( /sys/kernel/debug/dri/0/radeon_pm_state says is 'active', but the clockspeed never changes) All of them (pleasantly) have 16 pcie lanes open... when I last did a cold boot, I had only 1 lane open (and pm_state_minimal), but I can't say that noticed any change in functionality.

```
$ dmesg | grep -i drm

[    8.034906] [drm] Initialized drm 1.1.0 20060810

[    8.176469] [drm] radeon kernel modesetting enabled.

[    8.178964] [drm] initializing kernel modesetting (RV770 0x1002:0x9442).

[    8.179117] [drm] register mmio base: 0xFB1E0000

[    8.179118] [drm] register mmio size: 65536

[    8.179883] [drm] Clocks initialized !

[    8.179887] [drm] Internal thermal controller with fan control

[    8.179891] [drm] 4 Power State(s)

[    8.179893] [drm] State 0 Performance 

[    8.179895] [drm]    16 PCIE Lanes

[    8.179896] [drm]    3 Clock Mode(s)

[    8.179898] [drm]       0 engine/memory: 500000/750000

[    8.179899] [drm]       1 engine/memory: 500000/750000

[    8.179901] [drm]       2 engine/memory: 650000/950000

[    8.179903] [drm] State 1 Default 

[    8.179904] [drm]    16 PCIE Lanes

[    8.179905] [drm]    3 Clock Mode(s)

[    8.179907] [drm]       0 engine/memory: 500000/750000

[    8.179909] [drm]       1 engine/memory: 500000/750000

[    8.179910] [drm]       2 engine/memory: 500000/750000

[    8.179912] [drm] State 2 Performance 

[    8.179913] [drm]    16 PCIE Lanes

[    8.179915] [drm]    3 Clock Mode(s)

[    8.179916] [drm]       0 engine/memory: 650000/950000

[    8.179918] [drm]       1 engine/memory: 650000/950000

[    8.179919] [drm]       2 engine/memory: 650000/950000

[    8.179921] [drm] State 3 Default (default)

[    8.179923] [drm]    16 PCIE Lanes

[    8.179924] [drm]    1 Clock Mode(s)

[    8.179925] [drm]       0 engine/memory: 650000/950000

[    8.179931] [drm] radeon: dynamic power management enabled

[    8.179932] [drm] radeon: power management initialized

[    8.180631] [drm] Detected VRAM RAM=256M, BAR=256M

[    8.180634] [drm] RAM width 256bits DDR

[    8.180697] [drm] radeon: 256M of VRAM memory ready

[    8.180699] [drm] radeon: 512M of GTT memory ready.

[    8.180784] [drm] radeon: using MSI.

[    8.180810] [drm] radeon: irq initialized.

[    8.180813] [drm] GART: num cpu pages 131072, num gpu pages 131072

[    8.181570] [drm] Loading RV770 Microcode

[    8.301132] [drm] ring test succeeded in 1 usecs

[    8.302821] [drm] radeon: ib pool ready.

[    8.302909] [drm] ib test succeeded in 0 usecs

[    8.302911] [drm] Enabling audio support

[    8.303547] [drm] Default TV standard: PAL

[    8.303694] [drm] Default TV standard: PAL

[    8.303698] [drm] Default TV standard: PAL

[    8.303747] [drm] Radeon Display Connectors

[    8.303749] [drm] Connector 0:

[    8.303750] [drm]   HDMI-A

[    8.303751] [drm]   HPD1

[    8.303753] [drm]   DDC: 0x7e60 0x7e60 0x7e64 0x7e64 0x7e68 0x7e68 0x7e6c 0x7e6c

[    8.303755] [drm]   Encoders:

[    8.303756] [drm]     DFP1: INTERNAL_UNIPHY

[    8.303758] [drm] Connector 1:

[    8.303759] [drm]   DisplayPort

[    8.303760] [drm]   HPD3

[    8.303762] [drm]   DDC: 0x7e20 0x7e20 0x7e24 0x7e24 0x7e28 0x7e28 0x7e2c 0x7e2c

[    8.303763] [drm]   Encoders:

[    8.303765] [drm]     DFP2: INTERNAL_UNIPHY

[    8.303766] [drm] Connector 2:

[    8.303767] [drm]   DVI-I

[    8.303768] [drm]   HPD2

[    8.303770] [drm]   DDC: 0x7e40 0x7e40 0x7e44 0x7e44 0x7e48 0x7e48 0x7e4c 0x7e4c

[    8.303772] [drm]   Encoders:

[    8.303773] [drm]     CRT1: INTERNAL_KLDSCP_DAC1

[    8.303774] [drm]     DFP3: INTERNAL_KLDSCP_LVTMA

[    8.303776] [drm] Connector 3:

[    8.303777] [drm]   DIN

[    8.303778] [drm]   Encoders:

[    8.303779] [drm]     TV1: INTERNAL_KLDSCP_DAC2

[    8.485987] [drm] Requested: e: 50000 m: 75000 p: 16

[    8.485990] [drm] Setting: e: 50000 m: 75000 p: 16

[    8.670143] [drm] fb mappable at 0xD0141000

[    8.670146] [drm] vram apper at 0xD0000000

[    8.670148] [drm] size 3686400

[    8.670149] [drm] fb depth is 24

[    8.670150] [drm]    pitch is 5120

[    8.670208] fb0: radeondrmfb frame buffer device

[    8.670215] [drm] Initialized radeon 2.3.0 20080528 for 0000:01:00.0 on minor 0

[   19.881367] [drm] Requested: e: 65000 m: 95000 p: 16

[   19.881370] [drm] Setting: e: 65000 m: 95000 p: 16

[   20.481259] [drm] Requested: e: 50000 m: 75000 p: 16

[   20.481263] [drm] Setting: e: 50000 m: 75000 p: 16

[   20.483719] [drm] not in vbl for pm change 00020002 00000000 at entry
```

Any hints on how to get the device to change its state? Is my acpi (either BIOS or acpid) to blame? Any thoughts re: why the Default TV is PAL (I am in the US, so it ought to be NTSC/ATSC, though I don't know if this matters).

Potentially related: if I reboot with the monitor off, I have been unable to 'wake' the connection (either HDMI or DVI->VGA). Any thoughts on how to fix?

Also potentially related: dmesg shows the following oddities (for example, I don't have an ICH6 southbridge):

```

$ dmesg | grep -i quirk[    0.172056] pci 0000:00:1f.0: quirk: [io  0x0800-0x087f] claimed by ICH6 ACPI/GPIO/TCO

[    0.172123] pci 0000:00:1f.0: quirk: [io  0x0480-0x04bf] claimed by ICH6 GPIO

[    7.847053] firewire_ohci: Added fw-ohci device 0000:06:03.0, OHCI v1.10, 4 IR + 8 IT contexts, quirks 0x2

dmesg | grep -i bug

[    0.169138] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug

$ dmesg | grep -i mmconfig

[    0.102042] PCI: MMCONFIG for domain 0000 [bus 00-ff] at [mem 0xe0000000-0xefffffff] (base 0xe0000000)

[    0.102109] PCI: not using MMCONFIG

[    0.121142] PCI: MMCONFIG for domain 0000 [bus 00-ff] at [mem 0xe0000000-0xefffffff] (base 0xe0000000)

[    0.122188] PCI: MMCONFIG at [mem 0xe0000000-0xefffffff] reserved in ACPI motherboard resources

$ dmesg | grep -i disable

[    0.000000] NX (Execute Disable) protection: active

[    0.000000]   2 disabled

[    0.000000]   3 disabled

[    0.000000]   4 disabled

[    0.000000]   5 disabled

[    0.000000]   6 disabled

[    0.000000]   7 disabled

[    0.000000] ACPI: LAPIC (acpi_id[0x03] lapic_id[0x82] disabled)

[    0.000000] ACPI: LAPIC (acpi_id[0x04] lapic_id[0x83] disabled)

[    0.171073] pci 0000:00:01.0: PME# disabled

[    0.171268] pci 0000:00:1a.7: PME# disabled

[    0.171339] pci 0000:00:1b.0: PME# disabled

[    0.171403] pci 0000:00:1c.0: PME# disabled

[    0.171467] pci 0000:00:1c.2: PME# disabled

[    0.171531] pci 0000:00:1c.4: PME# disabled

[    0.171594] pci 0000:00:1c.5: PME# disabled

[    0.171813] pci 0000:00:1d.7: PME# disabled

[    0.172338] pci 0000:00:1f.2: PME# disabled

[    0.172697] pci 0000:00:1c.0:   bridge window [io  0xf000-0x0000] (disabled)

[    0.172701] pci 0000:00:1c.0:   bridge window [mem 0xfff00000-0x000fffff] (disabled)

[    0.172863] pci 0000:04:00.0: PME# disabled

[    0.174067] pci 0000:00:1c.2:   bridge window [io  0xf000-0x0000] (disabled)

[    0.174079] pci 0000:00:1c.2:   bridge window [mem 0xfff00000-0x000fffff pref] (disabled)

[    0.174251] pci 0000:03:00.0: PME# disabled

[    0.174522] pci 0000:00:1c.4:   bridge window [mem 0xfff00000-0x000fffff pref] (disabled)

[    0.174670] pci 0000:02:00.0: PME# disabled

[    0.176078] pci 0000:00:1c.5:   bridge window [mem 0xfff00000-0x000fffff pref] (disabled)

[    0.176190] pci 0000:06:03.0: PME# disabled

[    0.176290] pci 0000:06:04.0: PME# disabled

[    0.176387] pci 0000:00:1e.0:   bridge window [mem 0xfff00000-0x000fffff pref] (disabled)

[    0.195744] ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 7 10 11 12 14 15) *0, disabled.

[    0.214332] pci 0000:00:1e.0:   bridge window [mem pref disabled]

$ dmesg | grep -i OSC

[    1.290080] pcieport 0000:00:01.0: Failed to receive control of PCIe PME service: no _OSC support

[    1.290263] pcieport 0000:00:1c.0: Failed to receive control of PCIe PME service: no _OSC support

[    1.290444] pcieport 0000:00:1c.2: Failed to receive control of PCIe PME service: no _OSC support

[    1.290629] pcieport 0000:00:1c.4: Failed to receive control of PCIe PME service: no _OSC support

[    1.290811] pcieport 0000:00:1c.5: Failed to receive control of PCIe PME service: no _OSC support
```

Any insight as to whether this is my radeon problem (or something unrelated but also not good), would be much appreciated!

Thanks,

tbrass

----------

