if (prev->ktime) {
u64 time, c0;
u32 render, media;
- unsigned int mul;
-
- mul = 1000 * 100; /* scale to threshold% */
- if (I915_READ(VLV_COUNTER_CONTROL) & VLV_COUNT_RANGE_HIGH)
- mul <<= 8;
time = ktime_us_delta(now.ktime, prev->ktime);
time *= dev_priv->czclk_freq;
render = now.render_c0 - prev->render_c0;
media = now.media_c0 - prev->media_c0;
c0 = max(render, media);
- c0 *= mul;
+ c0 *= 1000 * 100 << 8; /* to usecs and scale to threshold% */
if (c0 > time * dev_priv->rps.up_threshold)
events = GEN6_PM_RP_UP_THRESHOLD;
/* allows RC6 residency counter to work */
I915_WRITE(VLV_COUNTER_CONTROL,
- _MASKED_BIT_ENABLE(VLV_MEDIA_RC0_COUNT_EN |
+ _MASKED_BIT_ENABLE(VLV_COUNT_RANGE_HIGH |
+ VLV_MEDIA_RC0_COUNT_EN |
VLV_RENDER_RC0_COUNT_EN |
VLV_MEDIA_RC6_COUNT_EN |
VLV_RENDER_RC6_COUNT_EN));
spin_lock_irq(&dev_priv->uncore.lock);
saved_ctl = I915_READ_FW(VLV_COUNTER_CONTROL);
- if (!(saved_ctl & VLV_COUNT_RANGE_HIGH))
+ if (WARN_ON(!(saved_ctl & VLV_COUNT_RANGE_HIGH)))
I915_WRITE_FW(VLV_COUNTER_CONTROL,
_MASKED_BIT_ENABLE(VLV_COUNT_RANGE_HIGH));
upper = I915_READ_FW(reg);
} while (upper != tmp);
- if (!(saved_ctl & VLV_COUNT_RANGE_HIGH))
- I915_WRITE_FW(VLV_COUNTER_CONTROL,
- _MASKED_BIT_DISABLE(VLV_COUNT_RANGE_HIGH));
-
spin_unlock_irq(&dev_priv->uncore.lock);
return lower | (u64)upper << 8;