thermal: gov_bang_bang: Fix possible cooling device state ping-pong
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 15 Jan 2024 17:57:06 +0000 (18:57 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 29 Jan 2024 14:37:56 +0000 (15:37 +0100)
commit54d94009cb6f51d3ecd56bfc63c83e789c0b18b4
tree3a911adfc6e7392aaa117c7fbaf166e52f81bcfb
parentf2675e588f928f7f3051765563a18f90332bd57b
thermal: gov_bang_bang: Fix possible cooling device state ping-pong

The current behavior of thermal_zone_trip_update() in the bang-bang
thermal governor may be problematic for trip points with 0 hysteresis,
because when the zone temperature reaches the trip temperature and
stays there, it will then cause the cooling device go "on" and "off"
alternately, which is not desirable.

Address this by requiring the zone temperature to actually fall below
trip->temperature - trip->hysteresis for the cooling device to go off.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/gov_bang_bang.c