Skip to content

Commit

Permalink
thermal: gov_bang_bang: Fix possible cooling device state ping-pong
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rafael J. Wysocki committed Jan 29, 2024
1 parent f2675e5 commit 54d9400
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/thermal/gov_bang_bang.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static int thermal_zone_trip_update(struct thermal_zone_device *tz,
if (instance->target == 0 && tz->temperature >= trip->temperature)
instance->target = 1;
else if (instance->target == 1 &&
tz->temperature <= trip->temperature - trip->hysteresis)
tz->temperature < trip->temperature - trip->hysteresis)
instance->target = 0;

dev_dbg(&instance->cdev->device, "target=%d\n",
Expand Down

0 comments on commit 54d9400

Please sign in to comment.