• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/macintosh/

Lines Matching defs:th

91 static void write_both_fan_speed(struct thermostat *th, int speed);
92 static void write_fan_speed(struct thermostat *th, int speed, int fan);
97 write_reg(struct thermostat* th, int reg, u8 data)
104 rc = i2c_master_send(th->clt, (const char *)tmp, 2);
113 read_reg(struct thermostat* th, int reg)
119 rc = i2c_master_send(th->clt, &reg_addr, 1);
124 rc = i2c_master_recv(th->clt, (char *)&data, 1);
163 struct thermostat *th = i2c_get_clientdata(client);
174 th->limits[0], th->limits[1], th->limits[2],
175 th->initial_limits[0], th->initial_limits[1],
176 th->initial_limits[2]);
179 write_reg(th, LIMIT_REG[i], th->initial_limits[i]);
181 write_both_fan_speed(th, -1);
185 kfree(th);
190 static int read_fan_speed(struct thermostat *th, u8 addr)
196 tmp[1] = read_reg(th, addr);
197 tmp[0] = read_reg(th, addr + 1);
204 static void write_both_fan_speed(struct thermostat *th, int speed)
206 write_fan_speed(th, speed, 0);
208 write_fan_speed(th, speed, 1);
211 static void write_fan_speed(struct thermostat *th, int speed, int fan)
223 if (th->last_speed[fan] != speed) {
236 manual = read_reg(th, MANUAL_MODE[fan]);
238 write_reg(th, MANUAL_MODE[fan],
239 manual | MANUAL_MASK | th->pwm_inv[fan]);
240 write_reg(th, FAN_SPD_SET[fan], speed);
244 manual = read_reg(th,
247 manual |= th->pwm_inv[fan];
248 write_reg(th,
251 manual = read_reg(th, MANUAL_MODE[fan]);
253 manual |= th->pwm_inv[fan];
254 write_reg(th, MANUAL_MODE[fan], manual&(~AUTO_MASK));
258 th->last_speed[fan] = speed;
261 static void read_sensors(struct thermostat *th)
266 th->temps[i] = read_reg(th, TEMP_REG[i]);
270 static void display_stats(struct thermostat *th)
272 if (th->temps[0] != th->cached_temp[0]
273 || th->temps[1] != th->cached_temp[1]
274 || th->temps[2] != th->cached_temp[2]) {
279 th->temps[0], th->temps[1], th->temps[2],
280 th->limits[0], th->limits[1], th->limits[2],
281 read_fan_speed(th, FAN_SPEED[0]));
283 th->cached_temp[0] = th->temps[0];
284 th->cached_temp[1] = th->temps[1];
285 th->cached_temp[2] = th->temps[2];
289 static void update_fans_speed (struct thermostat *th)
298 int var = th->temps[i] - th->limits[i];
306 if (abs(var - th->last_var[fan_number]) < 2)
322 write_both_fan_speed(th, new_speed);
323 th->last_var[fan_number] = var;
328 if (th->last_speed[fan_number] != 0)
332 write_both_fan_speed(th, 0);
346 struct thermostat* th = arg;
355 read_sensors(th);
357 read_sensors(th);
361 update_fans_speed(th);
364 display_stats(th);
372 static void set_limit(struct thermostat *th, int i)
375 th->limits[i] = default_limits_chip[i] + limit_adjust;
376 write_reg(th, LIMIT_REG[i], th->limits[i]);
379 th->limits[i] = default_limits_local[i] + limit_adjust;
385 struct thermostat* th;
392 th = kzalloc(sizeof(struct thermostat), GFP_KERNEL);
393 if (!th)
396 i2c_set_clientdata(client, th);
397 th->clt = client;
399 rc = read_reg(th, CONFIG_REG);
402 kfree(th);
413 write_reg(th, CONFIG_REG, 1);
418 th->initial_limits[i] = read_reg(th, LIMIT_REG[i]);
419 set_limit(th, i);
424 th->initial_limits[0], th->initial_limits[1],
425 th->initial_limits[2], th->limits[0], th->limits[1],
426 th->limits[2]);
428 thermostat = th;
431 th->pwm_inv[0] = read_reg(th, MANUAL_MODE[0]) & INVERT_MASK;
432 th->pwm_inv[1] = read_reg(th, MANUAL_MODE[1]) & INVERT_MASK;
435 th->last_speed[0] = -2;
436 th->last_speed[1] = -2;
437 th->last_var[0] = -80;
438 th->last_var[1] = -80;
442 write_both_fan_speed(th, 0);
445 write_both_fan_speed(th, -1);
448 thread_therm = kthread_run(monitor_task, th, "kfand");