Changeset 2478

Show
Ignore:
Timestamp:
04/25/04 21:43:54 (9 years ago)
Author:
khali
Message:

Fix setting voltage limits. This got broken by my previous

fix of inaccurate voltage roundings.

Files:
1 modified

Legend:

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

    r2458 r2478  
    110110#define VIA686A_TEMP_MODE_CONTINUOUS (0x00) 
    111111 
    112 /* Conversions. Rounding and limit checking is only done on the TO_REG 
     112/* Conversions. Limit checking is only done on the TO_REG 
    113113   variants. */ 
    114114 
     
    129129{ 
    130130        /* To avoid floating point, we multiply constants by 10 (100 for +12V). 
    131            Rounding is done (1205000 is actually 1330000 - 125000). 
     131           Rounding is done (120500 is actually 133000 - 12500). 
    132132           Remember that val is expressed in 0.01V/bit, which is why we divide 
    133133           by an additional 1000 (10000 for +12V): 100 for val and 10 (100) 
     
    135135        if (inNum <= 1) 
    136136                return (u8) 
    137                     SENSORS_LIMIT((val * 21024 - 1205000) / 250000, 0, 255); 
     137                    SENSORS_LIMIT((val * 21024 - 120500) / 25000, 0, 255); 
    138138        else if (inNum == 2) 
    139139                return (u8) 
    140                     SENSORS_LIMIT((val * 15737 - 1205000) / 250000, 0, 255); 
     140                    SENSORS_LIMIT((val * 15737 - 120500) / 25000, 0, 255); 
    141141        else if (inNum == 3) 
    142142                return (u8) 
    143                     SENSORS_LIMIT((val * 10108 - 1205000) / 250000, 0, 255); 
     143                    SENSORS_LIMIT((val * 10108 - 120500) / 25000, 0, 255); 
    144144        else 
    145145                return (u8) 
    146                     SENSORS_LIMIT((val * 41714 - 12050000) / 2500000, 0, 255); 
     146                    SENSORS_LIMIT((val * 41714 - 1205000) / 250000, 0, 255); 
    147147} 
    148148