Lines Matching +full:lower +full:- +full:case

1 // SPDX-License-Identifier: GPL-2.0-only
3 * step_wise.c - A step-by-step Thermal throttling governor
26 * d. if the trend is THERMAL_TREND_DROP_FULL, use lower limit
28 * If the temperature is lower than a trip point,
30 * b. if the trend is THERMAL_TREND_DROPPING, use lower cooling
32 * equals lower limit, deactivate the thermal instance
34 * d. if the trend is THERMAL_TREND_DROP_FULL, use lower limit,
35 * if the cooling state already equals lower limit,
41 struct thermal_cooling_device *cdev = instance->cdev; in get_target_state()
50 cdev->ops->get_cur_state(cdev, &cur_state); in get_target_state()
51 next_target = instance->target; in get_target_state()
52 dev_dbg(&cdev->device, "cur_state=%ld\n", cur_state); in get_target_state()
54 if (!instance->initialized) { in get_target_state()
56 next_target = clamp((cur_state + 1), instance->lower, instance->upper); in get_target_state()
65 case THERMAL_TREND_RAISING: in get_target_state()
67 next_target = clamp((cur_state + 1), instance->lower, instance->upper); in get_target_state()
70 case THERMAL_TREND_DROPPING: in get_target_state()
71 if (cur_state <= instance->lower) { in get_target_state()
76 next_target = clamp((cur_state - 1), instance->lower, instance->upper); in get_target_state()
92 * If value is -1, deactivate a passive instance. in update_passive_instance()
95 tz->passive += value; in update_passive_instance()
107 tz->ops->get_trip_temp(tz, trip, &trip_temp); in thermal_zone_trip_update()
108 tz->ops->get_trip_type(tz, trip, &trip_type); in thermal_zone_trip_update()
112 if (tz->temperature >= trip_temp) { in thermal_zone_trip_update()
117 dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d]:trend=%d,throttle=%d\n", in thermal_zone_trip_update()
120 list_for_each_entry(instance, &tz->thermal_instances, tz_node) { in thermal_zone_trip_update()
121 if (instance->trip != trip) in thermal_zone_trip_update()
124 old_target = instance->target; in thermal_zone_trip_update()
125 instance->target = get_target_state(instance, trend, throttle); in thermal_zone_trip_update()
126 dev_dbg(&instance->cdev->device, "old_target=%d, target=%d\n", in thermal_zone_trip_update()
127 old_target, (int)instance->target); in thermal_zone_trip_update()
129 if (instance->initialized && old_target == instance->target) in thermal_zone_trip_update()
134 instance->target != THERMAL_NO_TARGET) in thermal_zone_trip_update()
138 instance->target == THERMAL_NO_TARGET) in thermal_zone_trip_update()
139 update_passive_instance(tz, trip_type, -1); in thermal_zone_trip_update()
141 instance->initialized = true; in thermal_zone_trip_update()
142 mutex_lock(&instance->cdev->lock); in thermal_zone_trip_update()
143 instance->cdev->updated = false; /* cdev needs update */ in thermal_zone_trip_update()
144 mutex_unlock(&instance->cdev->lock); in thermal_zone_trip_update()
149 * step_wise_throttle - throttles devices associated with the given zone
163 lockdep_assert_held(&tz->lock); in step_wise_throttle()
167 list_for_each_entry(instance, &tz->thermal_instances, tz_node) in step_wise_throttle()
168 thermal_cdev_update(instance->cdev); in step_wise_throttle()