Lines Matching +full:thermal +full:- +full:regulation +full:- +full:threshold

1 // SPDX-License-Identifier: GPL-2.0-only
3 * gov_bang_bang.c - A simple thermal throttling governor using hysteresis
12 #include <linux/thermal.h>
19 if (instance->target != 0 && instance->target != 1 && in bang_bang_set_instance_target()
20 instance->target != THERMAL_NO_TARGET) in bang_bang_set_instance_target()
21 pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n", in bang_bang_set_instance_target()
22 instance->target, instance->name); in bang_bang_set_instance_target()
28 instance->target = target; in bang_bang_set_instance_target()
29 instance->initialized = true; in bang_bang_set_instance_target()
31 dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target); in bang_bang_set_instance_target()
33 thermal_cdev_update_nocheck(instance->cdev); in bang_bang_set_instance_target()
37 * bang_bang_control - controls devices associated with the given zone
42 * Regulation Logic: a two point regulation, deliver cooling state depending
49 * trip_temp: +---->+
53 * (trip_temp - hyst): +<----+
61 * (trip_temp - hyst) so that the fan gets turned off again.
71 lockdep_assert_held(&tz->lock); in bang_bang_control()
73 dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n", in bang_bang_control()
74 thermal_zone_trip_id(tz, trip), trip->temperature, in bang_bang_control()
75 tz->temperature, trip->hysteresis); in bang_bang_control()
77 list_for_each_entry(instance, &td->thermal_instances, trip_node) in bang_bang_control()
87 if (tz->governor_data) in bang_bang_manage()
91 const struct thermal_trip *trip = &td->trip; in bang_bang_manage()
94 if (trip->temperature == THERMAL_TEMP_INVALID || in bang_bang_manage()
95 trip->type == THERMAL_TRIP_CRITICAL || in bang_bang_manage()
96 trip->type == THERMAL_TRIP_HOT) in bang_bang_manage()
100 * Adjust the target states for uninitialized thermal instances in bang_bang_manage()
101 * to the thermal zone temperature and the trip point threshold. in bang_bang_manage()
103 turn_on = tz->temperature >= td->threshold; in bang_bang_manage()
104 list_for_each_entry(instance, &td->thermal_instances, trip_node) { in bang_bang_manage()
105 if (!instance->initialized) in bang_bang_manage()
110 tz->governor_data = (void *)true; in bang_bang_manage()
121 tz->governor_data = NULL; in bang_bang_update_tz()