Skip to content
  • Martin Kepplinger's avatar
    thermal/drivers/cpu_cooling: workaround cpuidle time calculation error · 6e8fe3aa
    Martin Kepplinger authored
    For cpuidle_cooling_runtime() returning 0, no idle-injection is
    applied. For an idle injection percentage of 0, this makes sense. But
    this happends for the idle injection percentage of 100 too, which is
    wrong.
    
    The documented calculation: ((idle_cycle * 100) / state) - idle_cycle
    results 0 for state being 100. For "state" from 0 to 99, the thermal
    driver throttles accordingly and keeps the CPUs cool. When switching
    to 100, it stops cooling, we see a jump up in temperature and the CPU
    heats up until it shuts down.
    
    Work around this problem by keeping the "state" at 99 for calculations,
    never reaching 100. The user interface still reaches 100, but there
    is no formal connection to actual data and the UI. It's just a unified
    range that can be implemented in various ways.
    6e8fe3aa