Hi all,
Attached is a patch giving preliminary support for PowerPlay on r5xx chips. What's contained has been tested only on a single M52 (Mobility Radeon X1300 in a Thinkpad T60)---I figured it was about time I got it into more people's hands.
NO GUARANTEES ARE MADE THAT THE ADDED CODE WILL FUNCTION AS EXPECTED. YOUR EXPERIENCE MAY VARY. VOLTAGE AND CLOCK SETTINGS ARE CHANGED BY THE NEW CODE, AND THIS MAY BE DANGEROUS TO YOUR HARDWARE. TEST AT YOUR OWN RISK.
DO _NOT_ ATTEMPT TO RUN ON A GPU THAT IS NOT PART OF THE R500 SERIES.
(Phew! Now that I've got that out of the way...)
The patch is against current master at time of writing: commit 0fd255dbf3a861e4192ddbc4ce8453c9b3965877.
It started as a port of agd5f's experimental PowerPlay support branch from xf86-video-radeon, with the infrastructure necessary to support it. Some additional bit-banging were added later to enable various power management related features not referenced by atombios.h.
I have not tried to make sure it compiles and runs with different compile-time configurations, and as such, both AtomBIOS and RandR support are required. If you need to use the NoRandr option to have reliable mode setting, this patch will most likely not work for you.
At driver start time, it will parse the AtomBIOS PowerPlay table and automatically attempt to apply the mode marked as default. You can override the default mode by specifying a "PowerPlayMode" option with the desired mode number, but it is not possible to disable this behaviour completely. You can see a dump of the PowerPlay modes available in Xorg.log. This dump is done twice: first directly from AtomBIOS, then again from what was collected by the driver.
The effective PowerPlay mode is exposed through the POWERPLAY RandR property, and can be viewed and set using xrandr. This property is available on all outputs.
As PowerPlay is not yet documented, most of the options applied were determined through guesswork and experimentation. Again, I can't make any assurances as to whether they will work or are even safe for your particular hardware.
If you would like to help out, a copy of Xorg.log running on your R500 hardware would be much appreciate it, as I do not have access to any other R500 hardware. logverbose=7 is not required.
If you are feeling particularly brave and would like to experiment, it would be nice to find out how to properly enable MC host dynamic clock gating support. This is the only option from my own PowerPlay table with corresponding register settings (MC_HOST_DYN_CNTL) that I have not been able to tweak without causing issues.
Give it a go, let me know how it goes, and try not to set anything on fire. :)
Cheers, Yang Zhao