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 mutex_lock(&instance->cdev->lock); in bang_bang_set_instance_target()
34 __thermal_cdev_update(instance->cdev); in bang_bang_set_instance_target()
35 mutex_unlock(&instance->cdev->lock); in bang_bang_set_instance_target()
39 * bang_bang_control - controls devices associated with the given zone
44 * Regulation Logic: a two point regulation, deliver cooling state depending
51 * trip_temp: +---->+
55 * (trip_temp - hyst): +<----+
63 * (trip_temp - hyst) so that the fan gets turned off again.
72 lockdep_assert_held(&tz->lock); in bang_bang_control()
74 dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n", in bang_bang_control()
75 thermal_zone_trip_id(tz, trip), trip->temperature, in bang_bang_control()
76 tz->temperature, trip->hysteresis); in bang_bang_control()
78 list_for_each_entry(instance, &tz->thermal_instances, tz_node) { in bang_bang_control()
79 if (instance->trip == trip) in bang_bang_control()
90 if (tz->governor_data) in bang_bang_manage()
94 const struct thermal_trip *trip = &td->trip; in bang_bang_manage()
97 if (trip->temperature == THERMAL_TEMP_INVALID || in bang_bang_manage()
98 trip->type == THERMAL_TRIP_CRITICAL || in bang_bang_manage()
99 trip->type == THERMAL_TRIP_HOT) in bang_bang_manage()
103 * Adjust the target states for uninitialized thermal instances in bang_bang_manage()
104 * to the thermal zone temperature and the trip point threshold. in bang_bang_manage()
106 turn_on = tz->temperature >= td->threshold; in bang_bang_manage()
107 list_for_each_entry(instance, &tz->thermal_instances, tz_node) { in bang_bang_manage()
108 if (!instance->initialized && instance->trip == trip) in bang_bang_manage()
113 tz->governor_data = (void *)true; in bang_bang_manage()
124 tz->governor_data = NULL; in bang_bang_update_tz()