Commit 8807286e authored by Alex Deucher's avatar Alex Deucher Committed by Dave Airlie

drm/radeon/kms: use tracked values for sclk and mclk

Rather than calling get_memory_clock and get_engine_clock,
used the tracked values from the pm code.  Calling the tables
adds additional latency in the modesetting and pm paths.
Signed-off-by: default avatarAlex Deucher <alexdeucher@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 2bfc96a1
...@@ -327,6 +327,14 @@ void radeon_get_clock_info(struct drm_device *dev) ...@@ -327,6 +327,14 @@ void radeon_get_clock_info(struct drm_device *dev)
mpll->max_feedback_div = 0xff; mpll->max_feedback_div = 0xff;
mpll->best_vco = 0; mpll->best_vco = 0;
if (!rdev->clock.default_sclk)
rdev->clock.default_sclk = radeon_get_engine_clock(rdev);
if ((!rdev->clock.default_mclk) && rdev->asic->get_memory_clock)
rdev->clock.default_mclk = radeon_get_memory_clock(rdev);
rdev->pm.current_sclk = rdev->clock.default_sclk;
rdev->pm.current_mclk = rdev->clock.default_mclk;
} }
/* 10 khz */ /* 10 khz */
......
...@@ -293,30 +293,20 @@ bool radeon_card_posted(struct radeon_device *rdev) ...@@ -293,30 +293,20 @@ bool radeon_card_posted(struct radeon_device *rdev)
void radeon_update_bandwidth_info(struct radeon_device *rdev) void radeon_update_bandwidth_info(struct radeon_device *rdev)
{ {
fixed20_12 a; fixed20_12 a;
u32 sclk, mclk; u32 sclk = rdev->pm.current_sclk;
u32 mclk = rdev->pm.current_mclk;
if (rdev->flags & RADEON_IS_IGP) { /* sclk/mclk in Mhz */
sclk = radeon_get_engine_clock(rdev); a.full = dfixed_const(100);
mclk = rdev->clock.default_mclk; rdev->pm.sclk.full = dfixed_const(sclk);
rdev->pm.sclk.full = dfixed_div(rdev->pm.sclk, a);
a.full = dfixed_const(100); rdev->pm.mclk.full = dfixed_const(mclk);
rdev->pm.sclk.full = dfixed_const(sclk); rdev->pm.mclk.full = dfixed_div(rdev->pm.mclk, a);
rdev->pm.sclk.full = dfixed_div(rdev->pm.sclk, a);
rdev->pm.mclk.full = dfixed_const(mclk);
rdev->pm.mclk.full = dfixed_div(rdev->pm.mclk, a);
if (rdev->flags & RADEON_IS_IGP) {
a.full = dfixed_const(16); a.full = dfixed_const(16);
/* core_bandwidth = sclk(Mhz) * 16 */ /* core_bandwidth = sclk(Mhz) * 16 */
rdev->pm.core_bandwidth.full = dfixed_div(rdev->pm.sclk, a); rdev->pm.core_bandwidth.full = dfixed_div(rdev->pm.sclk, a);
} else {
sclk = radeon_get_engine_clock(rdev);
mclk = radeon_get_memory_clock(rdev);
a.full = dfixed_const(100);
rdev->pm.sclk.full = dfixed_const(sclk);
rdev->pm.sclk.full = dfixed_div(rdev->pm.sclk, a);
rdev->pm.mclk.full = dfixed_const(mclk);
rdev->pm.mclk.full = dfixed_div(rdev->pm.mclk, a);
} }
} }
......
...@@ -213,7 +213,7 @@ static void post_xfer(struct i2c_adapter *i2c_adap) ...@@ -213,7 +213,7 @@ static void post_xfer(struct i2c_adapter *i2c_adap)
static u32 radeon_get_i2c_prescale(struct radeon_device *rdev) static u32 radeon_get_i2c_prescale(struct radeon_device *rdev)
{ {
u32 sclk = radeon_get_engine_clock(rdev); u32 sclk = rdev->pm.current_sclk;
u32 prescale = 0; u32 prescale = 0;
u32 nm; u32 nm;
u8 n, m, loop; u8 n, m, loop;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment