aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2013-07-30 18:46:21 -0400
committerDave Airlie <airlied@redhat.com>2013-07-30 18:46:21 -0400
commitf34f516a8daa2517ac19916b88aff60e82d7e13d (patch)
treea9def5d5c9078047fb17a9fb5a81cff42aa4ea10
parente9e3c8a20b2ac89a5770a6bb0a1d0dafc7f0edb0 (diff)
parent5a344dda944b4eea5a95e47a49ae5b53ce4f49b6 (diff)
Merge branch 'drm-fixes-3.11' of git://people.freedesktop.org/~agd5f/linux
Alex writes: - more fixes for SI dpm - fix DP on some rv6xx boards * 'drm-fixes-3.11' of git://people.freedesktop.org/~agd5f/linux: drm/radeon/dpm: re-enable cac control on SI drm/radeon/dpm: fix calculations in si_calculate_leakage_for_v_and_t_formula drm: fix 64 bit drm fixed point helpers drm/radeon/atom: initialize more atom interpretor elements to 0
-rw-r--r--drivers/gpu/drm/radeon/atom.c5
-rw-r--r--drivers/gpu/drm/radeon/si_dpm.c11
-rw-r--r--include/drm/drm_fixed.h14
3 files changed, 18 insertions, 12 deletions
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index fb441a790f3d..15da7ef344a4 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -1222,12 +1222,17 @@ int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
1222 int r; 1222 int r;
1223 1223
1224 mutex_lock(&ctx->mutex); 1224 mutex_lock(&ctx->mutex);
1225 /* reset data block */
1226 ctx->data_block = 0;
1225 /* reset reg block */ 1227 /* reset reg block */
1226 ctx->reg_block = 0; 1228 ctx->reg_block = 0;
1227 /* reset fb window */ 1229 /* reset fb window */
1228 ctx->fb_base = 0; 1230 ctx->fb_base = 0;
1229 /* reset io mode */ 1231 /* reset io mode */
1230 ctx->io_mode = ATOM_IO_MM; 1232 ctx->io_mode = ATOM_IO_MM;
1233 /* reset divmul */
1234 ctx->divmul[0] = 0;
1235 ctx->divmul[1] = 0;
1231 r = atom_execute_table_locked(ctx, index, params); 1236 r = atom_execute_table_locked(ctx, index, params);
1232 mutex_unlock(&ctx->mutex); 1237 mutex_unlock(&ctx->mutex);
1233 return r; 1238 return r;
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 1604a87cf2fe..7ad22e87cd62 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);
@@ -2042,8 +2044,7 @@ static void si_initialize_powertune_defaults(struct radeon_device *rdev)
2042 ni_pi->enable_sq_ramping = false; 2044 ni_pi->enable_sq_ramping = false;
2043 si_pi->enable_dte = false; 2045 si_pi->enable_dte = false;
2044 2046
2045 /* XXX: fix me */ 2047 if (si_pi->powertune_data->enable_powertune_by_default) {
2046 if (0/*si_pi->powertune_data->enable_powertune_by_default*/) {
2047 ni_pi->enable_power_containment= true; 2048 ni_pi->enable_power_containment= true;
2048 ni_pi->enable_cac = true; 2049 ni_pi->enable_cac = true;
2049 if (si_pi->dte_data.enable_dte_by_default) { 2050 if (si_pi->dte_data.enable_dte_by_default) {
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h
index f5e1168c7647..d639049a613d 100644
--- a/include/drm/drm_fixed.h
+++ b/include/drm/drm_fixed.h
@@ -84,12 +84,12 @@ static inline int drm_fixp2int(int64_t a)
84 return ((s64)a) >> DRM_FIXED_POINT; 84 return ((s64)a) >> DRM_FIXED_POINT;
85} 85}
86 86
87static inline s64 drm_fixp_msbset(int64_t a) 87static inline unsigned drm_fixp_msbset(int64_t a)
88{ 88{
89 unsigned shift, sign = (a >> 63) & 1; 89 unsigned shift, sign = (a >> 63) & 1;
90 90
91 for (shift = 62; shift > 0; --shift) 91 for (shift = 62; shift > 0; --shift)
92 if ((a >> shift) != sign) 92 if (((a >> shift) & 1) != sign)
93 return shift; 93 return shift;
94 94
95 return 0; 95 return 0;
@@ -100,9 +100,9 @@ static inline s64 drm_fixp_mul(s64 a, s64 b)
100 unsigned shift = drm_fixp_msbset(a) + drm_fixp_msbset(b); 100 unsigned shift = drm_fixp_msbset(a) + drm_fixp_msbset(b);
101 s64 result; 101 s64 result;
102 102
103 if (shift > 63) { 103 if (shift > 61) {
104 shift = shift - 63; 104 shift = shift - 61;
105 a >>= shift >> 1; 105 a >>= (shift >> 1) + (shift & 1);
106 b >>= shift >> 1; 106 b >>= shift >> 1;
107 } else 107 } else
108 shift = 0; 108 shift = 0;
@@ -120,7 +120,7 @@ static inline s64 drm_fixp_mul(s64 a, s64 b)
120 120
121static inline s64 drm_fixp_div(s64 a, s64 b) 121static inline s64 drm_fixp_div(s64 a, s64 b)
122{ 122{
123 unsigned shift = 63 - drm_fixp_msbset(a); 123 unsigned shift = 62 - drm_fixp_msbset(a);
124 s64 result; 124 s64 result;
125 125
126 a <<= shift; 126 a <<= shift;
@@ -154,7 +154,7 @@ static inline s64 drm_fixp_exp(s64 x)
154 } 154 }
155 155
156 if (x < 0) 156 if (x < 0)
157 sum = drm_fixp_div(1, sum); 157 sum = drm_fixp_div(DRM_FIXED_ONE, sum);
158 158
159 return sum; 159 return sum;
160} 160}