powermac_thermal.c (cbfd4d0cbcea14c674035cfc37e3a8df25f6f959) powermac_thermal.c (d015abb77401bd22e153648571b9b229bc643b29)
1/*-
2 * Copyright (c) 2009-2011 Nathan Whitehorn
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 80 unchanged lines hidden (view full) ---

89
90static void
91pmac_therm_manage_fans(void)
92{
93 struct pmac_sens_le *sensor;
94 struct pmac_fan_le *fan;
95 int average_excess, max_excess_zone, frac_excess;
96 int nsens, nsens_zone;
1/*-
2 * Copyright (c) 2009-2011 Nathan Whitehorn
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 80 unchanged lines hidden (view full) ---

89
90static void
91pmac_therm_manage_fans(void)
92{
93 struct pmac_sens_le *sensor;
94 struct pmac_fan_le *fan;
95 int average_excess, max_excess_zone, frac_excess;
96 int nsens, nsens_zone;
97 int temp;
97
98 if (!enable_pmac_thermal)
99 return;
100
101 /* Read all the sensors */
102 SLIST_FOREACH(sensor, &sensors, entries) {
98
99 if (!enable_pmac_thermal)
100 return;
101
102 /* Read all the sensors */
103 SLIST_FOREACH(sensor, &sensors, entries) {
103 sensor->last_val = sensor->sensor->read(sensor->sensor);
104 temp = sensor->sensor->read(sensor->sensor);
105 if (temp > 0) /* Use the previous temp in case of error */
106 sensor->last_val = temp;
107
104 if (sensor->last_val > sensor->sensor->max_temp) {
105 printf("WARNING: Current temperature (%s: %d.%d C) "
106 "exceeds critical temperature (%d.%d C)! "
107 "Shutting down!\n", sensor->sensor->name,
108 sensor->last_val / 10, sensor->last_val % 10,
109 sensor->sensor->max_temp / 10,
110 sensor->sensor->max_temp % 10);
111 shutdown_nice(RB_POWEROFF);

--- 67 unchanged lines hidden ---
108 if (sensor->last_val > sensor->sensor->max_temp) {
109 printf("WARNING: Current temperature (%s: %d.%d C) "
110 "exceeds critical temperature (%d.%d C)! "
111 "Shutting down!\n", sensor->sensor->name,
112 sensor->last_val / 10, sensor->last_val % 10,
113 sensor->sensor->max_temp / 10,
114 sensor->sensor->max_temp % 10);
115 shutdown_nice(RB_POWEROFF);

--- 67 unchanged lines hidden ---