diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2009-03-31 17:24:29 -0400 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2009-04-15 11:45:52 -0400 |
commit | 533d01a5933cd491bbc09cd463ea62475abf4bf2 (patch) | |
tree | 452fc99279a7581a9a263e087a105b39ffa04967 | |
parent | adb099409768e695b9928fa6aa5760f93dadd9af (diff) |
radeon: Add functions to set sclk/mclk using atombios
-rw-r--r-- | src/radeon_atombios.c | 53 | ||||
-rw-r--r-- | src/radeon_atombios.h | 6 |
2 files changed, 59 insertions, 0 deletions
diff --git a/src/radeon_atombios.c b/src/radeon_atombios.c index e32f7ba4..f6fe9615 100644 --- a/src/radeon_atombios.c +++ b/src/radeon_atombios.c @@ -571,6 +571,59 @@ atombios_static_pwrmgt_setup(ScrnInfoPtr pScrn, Bool enable) } +int +atombios_set_engine_clock(ScrnInfoPtr pScrn, int engclock) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + SET_ENGINE_CLOCK_PS_ALLOCATION eng_clock_ps; + AtomBiosArgRec data; + unsigned char *space; + + RADEONWaitForIdleMMIO(pScrn); + + eng_clock_ps.ulTargetEngineClock = engclock; /* 10 khz */ + + /*ErrorF("Attempting to set engine clock to: %d\n", engclock);*/ + data.exec.index = GetIndexIntoMasterTable(COMMAND, SetEngineClock); + data.exec.dataSpace = (void *)&space; + data.exec.pspace = &eng_clock_ps; + + if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) { + /* ErrorF("Set engine clock success\n"); */ + return ATOM_SUCCESS; + } + /* ErrorF("Set engine clock failed\n"); */ + return ATOM_NOT_IMPLEMENTED; +} + +int +atombios_set_memory_clock(ScrnInfoPtr pScrn, int memclock) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + SET_MEMORY_CLOCK_PS_ALLOCATION mem_clock_ps; + AtomBiosArgRec data; + unsigned char *space; + + if (info->IsIGP) + return ATOM_SUCCESS; + + RADEONWaitForIdleMMIO(pScrn); + + mem_clock_ps.ulTargetMemoryClock = memclock; /* 10 khz */ + + /* ErrorF("Attempting to set mem clock to: %d\n", memclock); */ + data.exec.index = GetIndexIntoMasterTable(COMMAND, SetMemoryClock); + data.exec.dataSpace = (void *)&space; + data.exec.pspace = &mem_clock_ps; + + if (RHDAtomBiosFunc(info->atomBIOS->scrnIndex, info->atomBIOS, ATOMBIOS_EXEC, &data) == ATOM_SUCCESS) { + /* ErrorF("Set memory clock success\n"); */ + return ATOM_SUCCESS; + } + /* ErrorF("Set memory clock failed\n"); */ + return ATOM_NOT_IMPLEMENTED; +} + # endif static AtomBiosResult diff --git a/src/radeon_atombios.h b/src/radeon_atombios.h index 806df303..69e27a34 100644 --- a/src/radeon_atombios.h +++ b/src/radeon_atombios.h @@ -122,6 +122,12 @@ atombios_clk_gating_setup(ScrnInfoPtr pScrn, Bool enable); extern int atombios_static_pwrmgt_setup(ScrnInfoPtr pScrn, Bool enable); +extern int +atombios_set_engine_clock(ScrnInfoPtr pScrn, int engclock); + +extern int +atombios_set_memory_clock(ScrnInfoPtr pScrn, int memclock); + extern Bool RADEONGetATOMTVInfo(xf86OutputPtr output); |