Hi all,

This patch initializes fan control on the ADT7463/ADM1027 chip to be
dynamically regulated by the hardware, and sets sane temperature treshold
values.

Note that this is *not* the same as what the proprietary bios does on the
Tyan S2881; that BIOS initializes the fans to blow at full speed, but sets
fan control to manual mode allowing programmatic control of fan speed.

It's easy to change the fan control mode to manual once the machine has
booted, so this seems like a smarter approach - the fans should last longer,
and they will use less power. Machines will also be a whole lot quieter.

There are a few mainboard specific bits for the s2881 missing, but I've still
got to figure out how to get those loaded at the right time (i.e.  after the
adm1027 code has been run).

Comments more than welcome, of course.

Thanks,
Ward.

-- 
Ward Vandewege <[EMAIL PROTECTED]>
Free Software Foundation - Senior System Administrator
Initialize the fans on the adt7463 chip to be dynamically regulated by the
hardware, rather than always on at full speed. Set temperature treshold values
to safe defaults, rather than the not-so-safe power-on defaults.

Signed-off-by: Ward Vandewege <[EMAIL PROTECTED]>


Index: adm1027.c
===================================================================
--- adm1027.c	(revision 2663)
+++ adm1027.c	(working copy)
@@ -20,6 +20,13 @@
 #define ADM1027_REG_CONFIG2	0x73
 #define ADM1027_REG_CONFIG3	0x78
 
+/**
+ * Initialize the adm1027/ADT7463 chip for HWM.
+ * See Analog Devices ADT7463 datasheet, Rev C (2004):
+ * http://www.analog.com/en/prod/0,,766_825_ADT7463,00.html
+ * See Analog Devices ADM1027 datasheet, Rev A (2003):
+ * http://www.analog.com/en/prod/0,,766_825_ADM1027,00.html
+ */
 static void adm1027_enable_monitoring(device_t dev)
 {
 	int result;
@@ -38,6 +45,46 @@
 		printk_debug("ADM1027: monitoring would not enable\r\n");
 	}
 	printk_debug("ADM1027: monitoring enabled\r\n");
+
+	/* Set all fans to 'Fastest Speed Calculated by All 3 Temperature Channels Controls PWMx.' */
+	result = smbus_write_byte(dev, 0x5c, 0xc2);
+	result = smbus_write_byte(dev, 0x5d, 0xc2);
+	result = smbus_write_byte(dev, 0x5e, 0xc2);
+
+	/* Make sure that our fans never stop when temp falls below Tmin, 
+	   but rather keep going at minimum duty cycle (applies to automatic 
+	   fan control mode only) */
+	result = smbus_write_byte(dev, 0x62, 0xc0);
+
+	/* Set minimum PWM duty cycle to 25%, rather than the default 50% */
+	result = smbus_write_byte(dev, 0x64, 0x40);
+	result = smbus_write_byte(dev, 0x65, 0x40);
+	result = smbus_write_byte(dev, 0x66, 0x40);
+
+	/* Set Tmin to 55C, rather than the default 90C. Above this temperature
+	   the fans will start blowing harder as temperature increases
+	   (automatic mode only) */
+	result = smbus_write_byte(dev, 0x67, 0x37);
+	result = smbus_write_byte(dev, 0x68, 0x37);
+	result = smbus_write_byte(dev, 0x69, 0x37);
+
+	/* Set THERM limit to 70C, rather than the default 100C
+	   The fans will kick in at 100% if the sensors reach this temperature,
+	   (only in automatic mode, but supposedly even when hardware is locked up)
+	   This is a failsafe measure. */
+	result = smbus_write_byte(dev, 0x6a, 0x46);
+	result = smbus_write_byte(dev, 0x6b, 0x46);
+	result = smbus_write_byte(dev, 0x6c, 0x46);
 }
 
 static void adm1027_init(device_t dev)
-- 
linuxbios mailing list
[email protected]
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to