msm: kgsl: Discard negative CRC throttling cycle readings

Ignore negative CRC throttle cycle readings in corner cases.

Change-Id: Ic237bd0558a4769dc89bfb7e70a287165f842b92
CRs-Fixed: 973565
Signed-off-by: Oleg Perelet <operelet@codeaurora.org>
This commit is contained in:
Oleg Perelet 2016-06-28 15:22:30 -07:00 committed by Kyle Yan
parent 8472130136
commit 54e3106b81

View file

@ -1264,6 +1264,9 @@ static uint64_t _read_throttling_counters(struct adreno_device *adreno_dev)
if (!ADRENO_FEATURE(adreno_dev, ADRENO_GPMU))
return 0;
if (!test_bit(ADRENO_THROTTLING_CTRL, &adreno_dev->pwrctrl_flag))
return 0;
for (i = 0; i < ADRENO_GPMU_THROTTLE_COUNTERS; i++) {
if (!adreno_dev->gpmu_throttle_counters[i])
return 0;
@ -1272,9 +1275,8 @@ static uint64_t _read_throttling_counters(struct adreno_device *adreno_dev)
adreno_dev->gpmu_throttle_counters[i],
&busy->throttle_cycles[i]);
}
return th[CRC_50PCT] + th[CRC_LESS50PCT] / 3 +
(th[CRC_MORE50PCT] - th[IDLE_10PCT]) * 3;
i = th[CRC_MORE50PCT] - th[IDLE_10PCT];
return th[CRC_50PCT] + th[CRC_LESS50PCT] / 3 + (i < 0 ? 0 : i) * 3;
}
static void _update_threshold_count(struct adreno_device *adreno_dev,