aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/si_dpm.c
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2013-07-30 16:56:52 -0400
committerAlex Deucher <alexander.deucher@amd.com>2013-07-30 17:24:13 -0400
commit31f731af513bb9925d0a29dba34bb4f71141bf91 (patch)
tree55214f3c0abe069b792377f3d8aa0fb4d121e727 /drivers/gpu/drm/radeon/si_dpm.c
parenta838834b2f7cbc09b6319a1fc332c03e4d665b20 (diff)
drm/radeon/dpm: fix calculations in si_calculate_leakage_for_v_and_t_formula
Need to make some slight adjustments for the fixed point math to work properly. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/si_dpm.c')
-rw-r--r--drivers/gpu/drm/radeon/si_dpm.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 1604a87cf2fe..cfb444870068 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -1765,8 +1765,9 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe
1765{ 1765{
1766 s64 kt, kv, leakage_w, i_leakage, vddc; 1766 s64 kt, kv, leakage_w, i_leakage, vddc;
1767 s64 temperature, t_slope, t_intercept, av, bv, t_ref; 1767 s64 temperature, t_slope, t_intercept, av, bv, t_ref;
1768 s64 tmp;
1768 1769
1769 i_leakage = drm_int2fixp(ileakage / 100); 1770 i_leakage = drm_int2fixp(ileakage) / 100;
1770 vddc = div64_s64(drm_int2fixp(v), 1000); 1771 vddc = div64_s64(drm_int2fixp(v), 1000);
1771 temperature = div64_s64(drm_int2fixp(t), 1000); 1772 temperature = div64_s64(drm_int2fixp(t), 1000);
1772 1773
@@ -1776,8 +1777,9 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe
1776 bv = div64_s64(drm_int2fixp(coeff->bv), 100000000); 1777 bv = div64_s64(drm_int2fixp(coeff->bv), 100000000);
1777 t_ref = drm_int2fixp(coeff->t_ref); 1778 t_ref = drm_int2fixp(coeff->t_ref);
1778 1779
1779 kt = drm_fixp_div(drm_fixp_exp(drm_fixp_mul(drm_fixp_mul(t_slope, vddc) + t_intercept, temperature)), 1780 tmp = drm_fixp_mul(t_slope, vddc) + t_intercept;
1780 drm_fixp_exp(drm_fixp_mul(drm_fixp_mul(t_slope, vddc) + t_intercept, t_ref))); 1781 kt = drm_fixp_exp(drm_fixp_mul(tmp, temperature));
1782 kt = drm_fixp_div(kt, drm_fixp_exp(drm_fixp_mul(tmp, t_ref)));
1781 kv = drm_fixp_mul(av, drm_fixp_exp(drm_fixp_mul(bv, vddc))); 1783 kv = drm_fixp_mul(av, drm_fixp_exp(drm_fixp_mul(bv, vddc)));
1782 1784
1783 leakage_w = drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage, kt), kv), vddc); 1785 leakage_w = drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage, kt), kv), vddc);