Skip to content

Commit

Permalink
Merge branch 'drm-fixes-3.11' of git://people.freedesktop.org/~agd5f/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Dave Airlie committed Jul 30, 2013
2 parents e9e3c8a + 5a344dd commit f34f516
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
5 changes: 5 additions & 0 deletions drivers/gpu/drm/radeon/atom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,12 +1222,17 @@ int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
int r;

mutex_lock(&ctx->mutex);
/* reset data block */
ctx->data_block = 0;
/* reset reg block */
ctx->reg_block = 0;
/* reset fb window */
ctx->fb_base = 0;
/* reset io mode */
ctx->io_mode = ATOM_IO_MM;
/* reset divmul */
ctx->divmul[0] = 0;
ctx->divmul[1] = 0;
r = atom_execute_table_locked(ctx, index, params);
mutex_unlock(&ctx->mutex);
return r;
Expand Down
11 changes: 6 additions & 5 deletions drivers/gpu/drm/radeon/si_dpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1765,8 +1765,9 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe
{
s64 kt, kv, leakage_w, i_leakage, vddc;
s64 temperature, t_slope, t_intercept, av, bv, t_ref;
s64 tmp;

i_leakage = drm_int2fixp(ileakage / 100);
i_leakage = drm_int2fixp(ileakage) / 100;
vddc = div64_s64(drm_int2fixp(v), 1000);
temperature = div64_s64(drm_int2fixp(t), 1000);

Expand All @@ -1776,8 +1777,9 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe
bv = div64_s64(drm_int2fixp(coeff->bv), 100000000);
t_ref = drm_int2fixp(coeff->t_ref);

kt = drm_fixp_div(drm_fixp_exp(drm_fixp_mul(drm_fixp_mul(t_slope, vddc) + t_intercept, temperature)),
drm_fixp_exp(drm_fixp_mul(drm_fixp_mul(t_slope, vddc) + t_intercept, t_ref)));
tmp = drm_fixp_mul(t_slope, vddc) + t_intercept;
kt = drm_fixp_exp(drm_fixp_mul(tmp, temperature));
kt = drm_fixp_div(kt, drm_fixp_exp(drm_fixp_mul(tmp, t_ref)));
kv = drm_fixp_mul(av, drm_fixp_exp(drm_fixp_mul(bv, vddc)));

leakage_w = drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage, kt), kv), vddc);
Expand Down Expand Up @@ -2042,8 +2044,7 @@ static void si_initialize_powertune_defaults(struct radeon_device *rdev)
ni_pi->enable_sq_ramping = false;
si_pi->enable_dte = false;

/* XXX: fix me */
if (0/*si_pi->powertune_data->enable_powertune_by_default*/) {
if (si_pi->powertune_data->enable_powertune_by_default) {
ni_pi->enable_power_containment= true;
ni_pi->enable_cac = true;
if (si_pi->dte_data.enable_dte_by_default) {
Expand Down
14 changes: 7 additions & 7 deletions include/drm/drm_fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ static inline int drm_fixp2int(int64_t a)
return ((s64)a) >> DRM_FIXED_POINT;
}

static inline s64 drm_fixp_msbset(int64_t a)
static inline unsigned drm_fixp_msbset(int64_t a)
{
unsigned shift, sign = (a >> 63) & 1;

for (shift = 62; shift > 0; --shift)
if ((a >> shift) != sign)
if (((a >> shift) & 1) != sign)
return shift;

return 0;
Expand All @@ -100,9 +100,9 @@ static inline s64 drm_fixp_mul(s64 a, s64 b)
unsigned shift = drm_fixp_msbset(a) + drm_fixp_msbset(b);
s64 result;

if (shift > 63) {
shift = shift - 63;
a >>= shift >> 1;
if (shift > 61) {
shift = shift - 61;
a >>= (shift >> 1) + (shift & 1);
b >>= shift >> 1;
} else
shift = 0;
Expand All @@ -120,7 +120,7 @@ static inline s64 drm_fixp_mul(s64 a, s64 b)

static inline s64 drm_fixp_div(s64 a, s64 b)
{
unsigned shift = 63 - drm_fixp_msbset(a);
unsigned shift = 62 - drm_fixp_msbset(a);
s64 result;

a <<= shift;
Expand Down Expand Up @@ -154,7 +154,7 @@ static inline s64 drm_fixp_exp(s64 x)
}

if (x < 0)
sum = drm_fixp_div(1, sum);
sum = drm_fixp_div(DRM_FIXED_ONE, sum);

return sum;
}
Expand Down

0 comments on commit f34f516

Please sign in to comment.