aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/therm_adt746x.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
index f38696622eb4..5e1f5e9653cb 100644
--- a/drivers/macintosh/therm_adt746x.c
+++ b/drivers/macintosh/therm_adt746x.c
@@ -52,6 +52,7 @@ static char *sensor_location[3] = {NULL, NULL, NULL};
52 52
53static int limit_adjust = 0; 53static int limit_adjust = 0;
54static int fan_speed = -1; 54static int fan_speed = -1;
55static int verbose = 0;
55 56
56MODULE_AUTHOR("Colin Leroy <colin@colino.net>"); 57MODULE_AUTHOR("Colin Leroy <colin@colino.net>");
57MODULE_DESCRIPTION("Driver for ADT746x thermostat in iBook G4 and " 58MODULE_DESCRIPTION("Driver for ADT746x thermostat in iBook G4 and "
@@ -66,6 +67,10 @@ module_param(fan_speed, int, 0644);
66MODULE_PARM_DESC(fan_speed,"Specify starting fan speed (0-255) " 67MODULE_PARM_DESC(fan_speed,"Specify starting fan speed (0-255) "
67 "(default 64)"); 68 "(default 64)");
68 69
70module_param(verbose, bool, 0);
71MODULE_PARM_DESC(verbose,"Verbose log operations "
72 "(default 0)");
73
69struct thermostat { 74struct thermostat {
70 struct i2c_client clt; 75 struct i2c_client clt;
71 u8 temps[3]; 76 u8 temps[3];
@@ -149,13 +154,13 @@ detach_thermostat(struct i2c_adapter *adapter)
149 if (thread_therm != NULL) { 154 if (thread_therm != NULL) {
150 kthread_stop(thread_therm); 155 kthread_stop(thread_therm);
151 } 156 }
152 157
153 printk(KERN_INFO "adt746x: Putting max temperatures back from " 158 printk(KERN_INFO "adt746x: Putting max temperatures back from "
154 "%d, %d, %d to %d, %d, %d\n", 159 "%d, %d, %d to %d, %d, %d\n",
155 th->limits[0], th->limits[1], th->limits[2], 160 th->limits[0], th->limits[1], th->limits[2],
156 th->initial_limits[0], th->initial_limits[1], 161 th->initial_limits[0], th->initial_limits[1],
157 th->initial_limits[2]); 162 th->initial_limits[2]);
158 163
159 for (i = 0; i < 3; i++) 164 for (i = 0; i < 3; i++)
160 write_reg(th, LIMIT_REG[i], th->initial_limits[i]); 165 write_reg(th, LIMIT_REG[i], th->initial_limits[i]);
161 166
@@ -212,12 +217,14 @@ static void write_fan_speed(struct thermostat *th, int speed, int fan)
212 return; 217 return;
213 218
214 if (th->last_speed[fan] != speed) { 219 if (th->last_speed[fan] != speed) {
215 if (speed == -1) 220 if (verbose) {
216 printk(KERN_DEBUG "adt746x: Setting speed to automatic " 221 if (speed == -1)
217 "for %s fan.\n", sensor_location[fan+1]); 222 printk(KERN_DEBUG "adt746x: Setting speed to automatic "
218 else 223 "for %s fan.\n", sensor_location[fan+1]);
219 printk(KERN_DEBUG "adt746x: Setting speed to %d " 224 else
220 "for %s fan.\n", speed, sensor_location[fan+1]); 225 printk(KERN_DEBUG "adt746x: Setting speed to %d "
226 "for %s fan.\n", speed, sensor_location[fan+1]);
227 }
221 } else 228 } else
222 return; 229 return;
223 230
@@ -298,10 +305,11 @@ static void update_fans_speed (struct thermostat *th)
298 if (new_speed > 255) 305 if (new_speed > 255)
299 new_speed = 255; 306 new_speed = 255;
300 307
301 printk(KERN_DEBUG "adt746x: setting fans speed to %d " 308 if (verbose)
302 "(limit exceeded by %d on %s) \n", 309 printk(KERN_DEBUG "adt746x: Setting fans speed to %d "
303 new_speed, var, 310 "(limit exceeded by %d on %s) \n",
304 sensor_location[fan_number+1]); 311 new_speed, var,
312 sensor_location[fan_number+1]);
305 write_both_fan_speed(th, new_speed); 313 write_both_fan_speed(th, new_speed);
306 th->last_var[fan_number] = var; 314 th->last_var[fan_number] = var;
307 } else if (var < -2) { 315 } else if (var < -2) {
@@ -309,8 +317,9 @@ static void update_fans_speed (struct thermostat *th)
309 * so cold (lastvar >= -1) */ 317 * so cold (lastvar >= -1) */
310 if (i == 2 && lastvar < -1) { 318 if (i == 2 && lastvar < -1) {
311 if (th->last_speed[fan_number] != 0) 319 if (th->last_speed[fan_number] != 0)
312 printk(KERN_DEBUG "adt746x: Stopping " 320 if (verbose)
313 "fans.\n"); 321 printk(KERN_DEBUG "adt746x: Stopping "
322 "fans.\n");
314 write_both_fan_speed(th, 0); 323 write_both_fan_speed(th, 0);
315 } 324 }
316 } 325 }
@@ -406,7 +415,7 @@ static int attach_one_thermostat(struct i2c_adapter *adapter, int addr,
406 th->initial_limits[i] = read_reg(th, LIMIT_REG[i]); 415 th->initial_limits[i] = read_reg(th, LIMIT_REG[i]);
407 set_limit(th, i); 416 set_limit(th, i);
408 } 417 }
409 418
410 printk(KERN_INFO "adt746x: Lowering max temperatures from %d, %d, %d" 419 printk(KERN_INFO "adt746x: Lowering max temperatures from %d, %d, %d"
411 " to %d, %d, %d\n", 420 " to %d, %d, %d\n",
412 th->initial_limits[0], th->initial_limits[1], 421 th->initial_limits[0], th->initial_limits[1],