Lines Matching +full:fan +full:- +full:1

3  *   Time-stamp: <2004/03/20 14:20:59 samuel>
7 * The G4 "windtunnel" has a single fan controlled by an
8 * ADM1030 fan controller and a DS1775 thermostat.
10 * The fan controller is equipped with a temperature sensor
13 * behavior of the fan. It is based upon empirical observations
58 struct i2c_client *fan; member
60 int overheat_temp; /* 100% fan at this temp */
79 { 11, T(0,0), 11 }, /* min fan */
89 { 2, T(60,1), 2 },
90 { 1, 0xfffff, 1 } /* on fire */
125 if( len < 1 || len > 2 || data < 0 ) in write_reg()
126 return -EINVAL; in write_reg()
129 tmp[1] = (len == 1) ? data : (data >> 8); in write_reg()
134 return -ENODEV; in write_reg()
143 if( len != 1 && len != 2 ) in read_reg()
144 return -EINVAL; in read_reg()
146 if( i2c_master_send(cl, buf, 1) != 1 ) in read_reg()
147 return -ENODEV; in read_reg()
149 return -ENODEV; in read_reg()
150 return (len == 2)? ((unsigned int)buf[0] << 8) | buf[1] : buf[0]; in read_reg()
158 /* write_reg( x.fan, 0x24, val, 1 ); */ in tune_fan()
159 write_reg( x.fan, 0x25, val, 1 ); in tune_fan()
160 write_reg( x.fan, 0x20, 0, 1 ); in tune_fan()
161 print_temp("CPU-temp: ", x.temp ); in tune_fan()
164 printk(", Fan: %d (tuned %+d)\n", 11-fan_setting, x.fan_level-fan_setting ); in tune_fan()
180 casetemp = read_reg(x.fan, 0x0b, 1) << 8; in poll_temp()
181 casetemp |= (read_reg(x.fan, 0x06, 1) & 0x7) << 5; in poll_temp()
184 print_temp("CPU-temp: ", temp ); in poll_temp()
186 printk(", Fan: %d\n", 11-x.fan_level ); in poll_temp()
191 level = -1; in poll_temp()
198 for( i=0; (temp & 0xffff) >= fan_table[i+1].temp ; i++ ) in poll_temp()
216 x.r0 = read_reg( x.fan, 0x00, 1 ); in setup_hardware()
217 x.r1 = read_reg( x.fan, 0x01, 1 ); in setup_hardware()
218 x.r20 = read_reg( x.fan, 0x20, 1 ); in setup_hardware()
219 x.r23 = read_reg( x.fan, 0x23, 1 ); in setup_hardware()
220 x.r25 = read_reg( x.fan, 0x25, 1 ); in setup_hardware()
223 if( (val=read_reg(x.thermostat, 1, 1)) >= 0 ) { in setup_hardware()
225 if( write_reg( x.thermostat, 1, val, 1 ) ) in setup_hardware()
229 write_reg( x.fan, 0x01, 0x01, 1 ); in setup_hardware()
231 write_reg( x.fan, 0x23, 0x91, 1 ); in setup_hardware()
232 /* remote temp. controls fan */ in setup_hardware()
233 write_reg( x.fan, 0x00, 0x95, 1 ); in setup_hardware()
236 * has a THERM output which puts the fan on 100%) is usually in setup_hardware()
251 /* set an initial fan setting */ in setup_hardware()
253 x.upind = -1; in setup_hardware()
256 err = device_create_file( &x.of_dev->dev, &dev_attr_cpu_temperature ); in setup_hardware()
257 err |= device_create_file( &x.of_dev->dev, &dev_attr_case_temperature ); in setup_hardware()
266 device_remove_file( &x.of_dev->dev, &dev_attr_cpu_temperature ); in restore_regs()
267 device_remove_file( &x.of_dev->dev, &dev_attr_case_temperature ); in restore_regs()
269 write_reg( x.fan, 0x01, x.r1, 1 ); in restore_regs()
270 write_reg( x.fan, 0x20, x.r20, 1 ); in restore_regs()
271 write_reg( x.fan, 0x23, x.r23, 1 ); in restore_regs()
272 write_reg( x.fan, 0x25, x.r25, 1 ); in restore_regs()
273 write_reg( x.fan, 0x00, x.r0, 1 ); in restore_regs()
309 /* scan 0x48-0x4f (DS1775) and 0x2c-2x2f (ADM1030) */ in do_attach()
319 if (x.running || strncmp(adapter->name, "uni-n", 5)) in do_attach()
322 of_node_get(adapter->dev.of_node); in do_attach()
323 np = of_find_compatible_node(adapter->dev.of_node, NULL, "MAC,ds1775"); in do_attach()
331 of_node_get(adapter->dev.of_node); in do_attach()
332 np = of_find_compatible_node(adapter->dev.of_node, NULL, "MAC,adm1030"); in do_attach()
351 else if (client == x.fan) in do_remove()
352 x.fan = NULL; in do_remove()
360 if( x.fan ) in attach_fan()
364 if( read_reg(cl, 0x3d, 1) != 0x30 || read_reg(cl, 0x3e, 1) != 0x41 ) in attach_fan()
366 printk("ADM1030 fan controller [@%02x]\n", cl->addr ); in attach_fan()
368 x.fan = cl; in attach_fan()
392 printk("DS1775 digital thermometer [@%02x]\n", cl->addr ); in attach_thermostat()
419 struct i2c_adapter *adapter = cl->adapter; in do_probe()
426 switch (id->driver_data) { in do_probe()
435 if (!x.running && x.thermostat && x.fan) { in do_probe()
436 x.running = 1; in do_probe()
464 return -EPROBE_DEFER; in therm_of_probe()
481 return -ENODEV; in therm_of_probe()
490 .name = "fan",
520 if( !(np=of_find_node_by_name(NULL, "power-mgt")) ) in g4fan_init()
521 return -ENODEV; in g4fan_init()
522 info = of_get_property(np, "thermal-info", NULL); in g4fan_init()
526 return -ENODEV; in g4fan_init()
528 if( info->id != 3 ) { in g4fan_init()
529 printk(KERN_ERR "therm_windtunnel: unsupported thermal design %d\n", info->id ); in g4fan_init()
530 return -ENODEV; in g4fan_init()
532 if( !(np=of_find_node_by_name(NULL, "fan")) ) in g4fan_init()
533 return -ENODEV; in g4fan_init()
538 printk(KERN_ERR "Can't register fan controller!\n"); in g4fan_init()
539 return -ENODEV; in g4fan_init()
552 of_platform_device_destroy(&x.of_dev->dev, NULL); in g4fan_exit()
559 MODULE_DESCRIPTION("Apple G4 (windtunnel) fan controller");