Lines Matching +full:fan +full:-
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2009-2011 Nathan Whitehorn
62 &enable_pmac_thermal, 1, "Enable automatic fan management");
66 struct pmac_fan *fan; member
99 struct pmac_fan_le *fan; in pmac_therm_manage_fans() local
110 temp = sensor->sensor->read(sensor->sensor); in pmac_therm_manage_fans()
112 sensor->last_val = temp; in pmac_therm_manage_fans()
114 if (sensor->last_val > sensor->sensor->max_temp) { in pmac_therm_manage_fans()
115 sensor->critical_count++; in pmac_therm_manage_fans()
119 sensor->sensor->name, in pmac_therm_manage_fans()
120 (sensor->last_val - ZERO_C_TO_K) / 10, in pmac_therm_manage_fans()
121 (sensor->last_val - ZERO_C_TO_K) % 10, in pmac_therm_manage_fans()
122 (sensor->sensor->max_temp - ZERO_C_TO_K) / 10, in pmac_therm_manage_fans()
123 (sensor->sensor->max_temp - ZERO_C_TO_K) % 10, in pmac_therm_manage_fans()
124 sensor->critical_count); in pmac_therm_manage_fans()
125 if (sensor->critical_count >= MAX_CRITICAL_COUNT) { in pmac_therm_manage_fans()
129 sensor->sensor->name, in pmac_therm_manage_fans()
130 sensor->critical_count); in pmac_therm_manage_fans()
134 if (sensor->critical_count > 0) in pmac_therm_manage_fans()
135 sensor->critical_count--; in pmac_therm_manage_fans()
140 SLIST_FOREACH(fan, &fans, entries) { in pmac_therm_manage_fans()
144 temp = imin(sensor->last_val, in pmac_therm_manage_fans()
145 sensor->sensor->max_temp); in pmac_therm_manage_fans()
146 frac_excess = (temp - in pmac_therm_manage_fans()
147 sensor->sensor->target_temp)*100 / in pmac_therm_manage_fans()
148 (sensor->sensor->max_temp - temp + 1); in pmac_therm_manage_fans()
151 if (sensor->sensor->zone == fan->fan->zone) { in pmac_therm_manage_fans()
166 fan->fan->set(fan->fan, fan->fan->default_rpm); in pmac_therm_manage_fans()
171 * Scale the fan linearly in the max temperature in its in pmac_therm_manage_fans()
176 (fan->fan->max_rpm - fan->fan->min_rpm)/100 + in pmac_therm_manage_fans()
177 fan->fan->min_rpm; in pmac_therm_manage_fans()
178 if (fan_speed >= fan->last_val) { in pmac_therm_manage_fans()
179 fan->timer = FAN_HYSTERESIS_TIMER; in pmac_therm_manage_fans()
180 fan->last_val = fan_speed; in pmac_therm_manage_fans()
182 fan->timer--; in pmac_therm_manage_fans()
183 if (fan->timer == 0) { in pmac_therm_manage_fans()
184 fan->last_val = fan_speed; in pmac_therm_manage_fans()
185 fan->timer = FAN_HYSTERESIS_TIMER; in pmac_therm_manage_fans()
188 fan->fan->set(fan->fan, fan->last_val); in pmac_therm_manage_fans()
193 pmac_thermal_fan_register(struct pmac_fan *fan) in pmac_thermal_fan_register() argument
199 list_entry->fan = fan; in pmac_thermal_fan_register()
211 list_entry->sensor = sensor; in pmac_thermal_sensor_register()
212 list_entry->last_val = 0; in pmac_thermal_sensor_register()
213 list_entry->critical_count = 0; in pmac_thermal_sensor_register()