Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f34f516a authored by Dave Airlie's avatar Dave Airlie
Browse files

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
parents e9e3c8a2 5a344dda
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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;
+6 −5
Original line number Diff line number Diff line
@@ -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);

@@ -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);
@@ -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) {
+7 −7
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -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;
@@ -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;
}