Changeset 2585

Show
Ignore:
Timestamp:
06/06/04 19:42:41 (9 years ago)
Author:
khali
Message:

Rework fan trustability function.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/kernel/chips/adm1031.c

    r2581 r2585  
    44  Based on lm75.c and lm85.c 
    55  Supports Analog Devices ADM1030 and ADM1031 
    6   Copyright (C) 2004 Alexandre d'Alton <alex@alexdalton.org> 
     6  Copyright (C) 2004 Alexandre d'Alton <alex@alexdalton.org> and 
     7                     Jean Delvare <khali@linux-fr.org> 
    78 
    89  This program is free software; you can redistribute it and/or modify 
     
    225226#define FAN_DIV_FROM_REG(reg)           (1 << (((reg)&0xc0) >> 6)) 
    226227 
    227 #define AUTO_TEMP_OFF_FROM_REG(reg)     (((((reg) >> 3) & 0x1f) << 2) - 5) 
     228#define AUTO_TEMP_MIN_FROM_REG(reg)     (((reg) >> 3) * 4) 
    228229 
    229230 
     
    522523        if (data->conf1 & ADM1031_CONF1_AUTO_MODE) { 
    523524                switch(data->conf1 & 0x60) { 
    524                 case 0x00: /* remote temp1 controls fan1 remote temp2 
    525                               controls fan2 */ 
    526                         res = chan == 0 ? data->temp[1] > 
    527                               AUTO_TEMP_OFF_FROM_REG(data->auto_temp[1]) : 
    528                               data->temp[2] > 
    529                               AUTO_TEMP_OFF_FROM_REG(data->auto_temp[2]); 
     525                case 0x00: /* temp2 controls fan1, temp3 controls fan2 */ 
     526                        res = data->temp[chan+1] >= 
     527                              AUTO_TEMP_MIN_FROM_REG(data->auto_temp[chan+1]); 
    530528                        break; 
    531                 case 0x20: /* remote temp1 controls both fans*/ 
    532                         if (data->chip_type == adm1030) 
    533                                 res = 0; 
    534                         else 
    535                                 res = data->temp[1] > 
    536                                       AUTO_TEMP_OFF_FROM_REG(data->auto_temp[1]); 
     529                case 0x20: /* temp2 controls both fans */ 
     530                        res = data->temp[1] >= 
     531                              AUTO_TEMP_MIN_FROM_REG(data->auto_temp[1]); 
    537532                        break; 
    538                 case 0x40: /* remote temp2 controls both fans*/ 
    539                         if (data->chip_type == adm1030) 
    540                                 res = 0; 
    541                         else 
    542                                 res = data->temp[2] > 
    543                                       AUTO_TEMP_OFF_FROM_REG(data->auto_temp[2]); 
     533                case 0x40: /* temp3 controls both fans */ 
     534                        res = data->temp[2] >= 
     535                              AUTO_TEMP_MIN_FROM_REG(data->auto_temp[2]); 
    544536                        break; 
    545                 case 0x60: /* max controls both fans */ 
    546                         if (data->chip_type == adm1030){ 
    547                                 res = data->temp[0] > 
    548                                       AUTO_TEMP_OFF_FROM_REG(data->auto_temp[0]) 
    549                                       || data->temp[1] > 
    550                                       AUTO_TEMP_OFF_FROM_REG(data->auto_temp[1]); 
    551                         } else { 
    552                                 res = data->temp[0] > 
    553                                       AUTO_TEMP_OFF_FROM_REG(data->auto_temp[0]) 
    554                                       || data->temp[1] > 
    555                                       AUTO_TEMP_OFF_FROM_REG(data->auto_temp[1]) 
    556                                       || data->temp[2] > 
    557                                       AUTO_TEMP_OFF_FROM_REG(data->auto_temp[2]); 
    558                         } 
    559                         break; 
    560                 default: 
    561                         res = 0; 
     537                case 0x60: /* max of temp1, temp2 and temp3 controls both 
     538                              fans */ 
     539                        res = data->temp[0] >= 
     540                              AUTO_TEMP_MIN_FROM_REG(data->auto_temp[0]) 
     541                              || data->temp[1] >= 
     542                              AUTO_TEMP_MIN_FROM_REG(data->auto_temp[1]) 
     543                              || (data->chip_type == adm1031 
     544                                  && data->temp[2] >= 
     545                                  AUTO_TEMP_MIN_FROM_REG(data->auto_temp[2])); 
    562546                        break; 
    563547                }