fanctl.c

Go to the documentation of this file.
00001 #include <arch/io.h>
00002 #include <stdlib.h>
00003 
00004 static void write_index(uint16_t port_base, uint8_t reg, uint8_t value)
00005 {
00006         outb(reg, port_base);
00007         outb(value, port_base + 1);
00008 }
00009 
00010 static const struct {
00011         uint8_t index, value;
00012 } sequence[]= {
00013         /* Make sure we can monitor, and enable SMI# interrupt output */
00014         { 0x00, 0x13},
00015         /* Disable fan interrupt status bits for SMI# */
00016         { 0x04, 0x37},
00017         /* Disable VIN interrupt status bits for SMI# */
00018         { 0x05, 0xff},
00019         /* Disable fan interrupt status bits for IRQ */
00020         { 0x07, 0x37},
00021         /* Disable VIN interrupt status bits for IRQ */
00022         { 0x08, 0xff},
00023         /* Disable external sensor interrupt */
00024         { 0x09, 0x87},
00025         /* Enable 16 bit counter divisors */
00026         { 0x0c, 0x07},
00027         /* Set FAN_CTL control register (0x14) polarity to high, and
00028            activate fans 1, 2 and 3. */
00029         { 0x14, 0xd7},
00030         /* set the correct sensor types 1,2 thermistor; 3 diode */
00031         { 0x51, 0x1c},
00032         /* set the 'zero' voltage for diode type sensor 3 */
00033         { 0x5c, 0x80},
00034 //      { 0x56, 0xe5},
00035 //      { 0x57, 0xe5},
00036         { 0x59, 0xec},
00037         { 0x5c, 0x00},
00038         /* fan1 (controlled by temp3) control parameters */
00039         /* fan off limit */
00040         { 0x60, 0xff},
00041         /* fan start limit */
00042         { 0x61, 0x14},
00043         /* ???? */
00044 //      { 0x62, 0x00},
00045         /* start PWM */
00046         { 0x63, 0x27},
00047         /* smooth and slope PWM */
00048         { 0x64, 0x90},
00049         /* direct-down and interval */
00050         { 0x65, 0x03},
00051         /* temperature limit of fan stop for fan3 (automatic) */
00052         { 0x70, 0xff},
00053         /* temperature limit of fan start for fan3 (automatic) */
00054         { 0x71, 0x14},
00055         /* Set PWM start & slope for fan3 */
00056         { 0x73, 0x20},
00057         /* Initialize PWM automatic mode slope values for fan3 */
00058         { 0x74, 0x90},
00059         /* set smartguardian temperature interval for fan3 */
00060         { 0x75, 0x03},
00061         /* fan1 auto controlled by temp3 */
00062         { 0x15, 0x82},
00063         /* fan2 auto controlled by temp3 */
00064         { 0x16, 0x82},
00065         /* fan3 auto controlled by temp3 */
00066         { 0x17, 0x82},
00067         /* all fans enable, fan1 ctl smart */
00068         { 0x13, 0x77}
00069 };
00070 
00071 /*
00072  * Called from superio.c
00073  */
00074 void init_ec(uint16_t base)
00075 {
00076         int i;
00077         for (i=0; i<ARRAY_SIZE(sequence); i++) {
00078                 write_index(base, sequence[i].index, sequence[i].value);
00079         }
00080 }

Generated on Mon Dec 29 10:54:10 2008 for coreboot by  doxygen 1.5.5