Changeset 3194

Show
Ignore:
Timestamp:
11/19/05 15:55:30 (3 years ago)
Author:
khali
Message:

vt8231 cleanups, to get the 2.4 driver, libsensors and sensors
in line with the new 2.6 driver. The most important changes are temp
inputs renumbering, and conversion formulas changes, because part of the
conversions are now done by the driver as required by the interface
standard.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/trunk/doc/chips/vt8231

    r3007 r3194  
    55 
    66Supported chips: 
    7   * Via VT8231 South Bridge 
     7  * VIA VT8231 South Bridge 
    88    Prefix: 'vt8231' 
    99        Addresses scanned: none, address read from PCI space 
     
    3737----------- 
    3838 
    39 The Via VT8231 South Bridge contains voltage/temperature monitoring and 
     39The VIA VT8231 South Bridge contains voltage/temperature monitoring and 
    4040PWM control circuitry for two fans. 
    4141 
    42 We define the sensors as follows. Somewhat convoluted to minimize 
    43 changes from via686a. Temp1 and in6 are unimplemented in the vt8231 
    44 chip but are included in the driver. 
     42We define the sensors as follows. 
    4543 
    4644    Sensor          Voltage Mode    Temp Mode       uch_config bit 
    4745    ------          ------------    ---------       --------------     
    48     Reading 1                       temp3 
    49     Reading 3                       temp1 
    50     UCH1/Reading 2  in0             temp2           0x04 (4) 
    51     UCH2            in1             temp4           0x08 (8) 
    52     UCH3            in2             temp5           0x10 (16) 
    53     UCH4            in3             temp6           0x20 (32) 
    54     UCH5            in4             temp7           0x40 (64) 
     46    Reading 1                       temp1 
     47    UCH1            in0             temp2           0x04 (4) 
     48    UCH2            in1             temp3           0x08 (8) 
     49    UCH3            in2             temp4           0x10 (16) 
     50    UCH4            in3             temp5           0x20 (32) 
     51    UCH5            in4             temp6           0x40 (64) 
    5552    3.3V            in5 
    56     -12V            in6 
    5753 
    5854As noted above, 5 of the sensors are "universal channels" and can 
     
    9288in4                   -                     -                       R-     2 
    9389in5                   -                     -                       R-     2 
    94 in6                   -                     -                       R-     2 
    9590in0_min               in0                   in0                     RW     2 
    9691in1_min               in1                   in1                     RW     2 
     
    9994in4_min               in4                   in4                     RW     2 
    10095in5_min               in5                   in5                     RW     2 
    101 in6_min               in6                   in6                     RW     2 
    10296in0_max               in0                   in0                     RW     2 
    10397in1_max               in1                   in1                     RW     2 
     
    106100in4_max               in4                   in4                     RW     2 
    107101in5_max               in5                   in5                     RW     2 
    108 in6_max               in6                   in6                     RW     2 
    109102fan1                  -                     -                       R-     0 
    110103fan2                  -                     -                       R-     0 
     
    114107temp1_hyst            temp1                 temp1                   RW     1 
    115108temp1_over            temp1                 temp1                   RW     1 
    116 temp2                 -                     -                       R-     1 
    117 temp2_hyst            temp2                 temp2                   RW     1 
    118 temp2_over            temp2                 temp2                   RW     1 
    119 temp3                 -                     -                       R-     1 
    120 temp3_hyst            temp3                 temp3                   RW     1 
    121 temp3_over            temp3                 temp3                   RW     1 
    122 temp4                 -                     -                       R-     1 
    123 temp4_hyst            temp4                 temp4                   RW     1 
    124 temp4_over            temp4                 temp4                   RW     1 
    125 temp5                 -                     -                       R-     1 
    126 temp5_hyst            temp5                 temp5                   RW     1 
    127 temp5_over            temp5                 temp5                   RW     1 
    128 temp6                 -                     -                       R-     1 
    129 temp6_hyst            temp6                 temp6                   RW     1 
    130 temp6_over            temp6                 temp6                   RW     1 
    131 temp7                 -                     -                       R-     1 
    132 temp7_hyst            temp7                 temp7                   RW     1 
    133 temp7_over            temp7                 temp7                   RW     1 
     109temp2                 -                     -                       R-     2 
     110temp2_hyst            temp2                 temp2                   RW     2 
     111temp2_over            temp2                 temp2                   RW     2 
     112temp3                 -                     -                       R-     2 
     113temp3_hyst            temp3                 temp3                   RW     2 
     114temp3_over            temp3                 temp3                   RW     2 
     115temp4                 -                     -                       R-     2 
     116temp4_hyst            temp4                 temp4                   RW     2 
     117temp4_over            temp4                 temp4                   RW     2 
     118temp5                 -                     -                       R-     2 
     119temp5_hyst            temp5                 temp5                   RW     2 
     120temp5_over            temp5                 temp5                   RW     2 
     121temp6                 -                     -                       R-     2 
     122temp6_hyst            temp6                 temp6                   RW     2 
     123temp6_over            temp6                 temp6                   RW     2 
    134124fan1_div              fan1                  -                       RW     0 
    135125fan2_div              fan2                  -                       RW     0 
     
    146136in4                   SENSORS_VT8231_IN4                                  in4:3 
    147137in5                   SENSORS_VT8231_IN5                                  in5:3 
    148 in6                   SENSORS_VT8231_IN6                                  in6:3 
    149138in0_min               SENSORS_VT8231_IN0_MIN                              in0:1 
    150139in1_min               SENSORS_VT8231_IN1_MIN                              in1:1 
     
    153142in4_min               SENSORS_VT8231_IN4_MIN                              in4:1 
    154143in5_min               SENSORS_VT8231_IN5_MIN                              in5:1 
    155 in6_min               SENSORS_VT8231_IN6_MIN                              in6:1 
    156144in0_max               SENSORS_VT8231_IN0_MAX                              in0:2 
    157145in1_max               SENSORS_VT8231_IN1_MAX                              in1:2 
     
    160148in4_max               SENSORS_VT8231_IN4_MAX                              in4:2 
    161149in5_max               SENSORS_VT8231_IN5_MAX                              in5:2 
    162 in6_max               SENSORS_VT8231_IN6_MAX                              in6:2 
    163150fan1                  SENSORS_VT8231_FAN1                                fan1:2 
    164151fan2                  SENSORS_VT8231_FAN2                                fan2:2 
     
    183170temp6_hyst            SENSORS_VT8231_TEMP6_HYST                         temp6:2 
    184171temp6_over            SENSORS_VT8231_TEMP6_OVER                         temp6:1 
    185 temp7                 SENSORS_VT8231_TEMP7                              temp7:3 
    186 temp7_hyst            SENSORS_VT8231_TEMP7_HYST                         temp7:2 
    187 temp7_over            SENSORS_VT8231_TEMP7_OVER                         temp7:1 
    188172fan1_div              SENSORS_VT8231_FAN1_DIV                         fan_div:1 
    189173fan2_div              SENSORS_VT8231_FAN2_DIV                         fan_div:2 
     
    197181----- 
    198182 
    199 The lm_sensors project gratefully acknowledges the support of Via in the 
     183The lm_sensors project gratefully acknowledges the support of VIA in the 
    200184development of this driver. 
  • lm-sensors/trunk/etc/sensors.conf.eg

    r3193 r3194  
    19191919 
    19201920 
    1921 chip "vt1211-*" "vt8231-*" 
    1922 # 
    1923 # temp1 and in6 are not implemented in vt1211 / vt8231 
     1921chip "vt1211-*" 
     1922# 
     1923# temp1 and in6 are not implemented in vt1211 
    19241924# 
    19251925#                                                       1 for temp, 0 for volt. 
     
    19361936# set uch1-2 to temp mode, uch3-5 to voltage mode 
    19371937# 
    1938     set config 12 
     1938#   set config 12 
    19391939    ignore in0 
    19401940    ignore in1 
     
    20272027    set fan1_min 3000 
    20282028    set fan2_min 3000 
     2029 
     2030chip "vt8231-*" 
     2031# 
     2032#                                                       1 for temp, 0 for volt. 
     2033#       Sensor          Voltage Mode    Temp Mode       config bit 
     2034#       --------        ------------    ---------       -------------- 
     2035#       Reading 1                       temp1 
     2036#       UCH1            in0             temp2           0x04 (4) 
     2037#       UCH2            in1             temp3           0x08 (8) 
     2038#       UCH3            in2             temp4           0x10 (16) 
     2039#       UCH4            in3             temp5           0x20 (32) 
     2040#       UCH5            in4             temp6           0x40 (64) 
     2041#       3.3V            in5 
     2042# 
     2043# Hardware default is UCH1 in temp mode, UCH2-5 in voltage mode 
     2044# Note that the Linux 2.6 driver will not let you change the channel 
     2045# configuration. In theory, the BIOS should have done it properly. 
     2046#   set config 4 
     2047 
     2048#    ignore in0 
     2049#    ignore temp3 
     2050#    ignore temp4 
     2051#    ignore temp5 
     2052#    ignore temp6 
     2053 
     2054    label in1 "+2.5V" 
     2055    label in2 "VCore" 
     2056    label in3 "+5V" 
     2057    label in4 "+12V" 
     2058    label in5 "+3.3V" 
     2059 
     2060    label temp1 "CPU Temp" 
     2061    label temp2 "M/B Temp" 
     2062 
     2063# Here are the resistor values as recommended by VIA: 
     2064#   Voltage                     R1      R2 
     2065#   VCore                       no scaling 
     2066#    2.5                        2k      10k 
     2067#    3.5 (3.3V ext.)            6.8k    10k 
     2068#    5.0                        14k     10k 
     2069#   12.0                        47k     10k 
     2070 
     2071#   compute in0  @ * (1 + 6.8 / 10),  @ / (1 + 6.8 / 10) 
     2072    compute in1  @ * (1 +   2 / 10),  @ / (1 +   2 / 10) 
     2073    compute in3  @ * (1 +  14 / 10),  @ / (1 +  14 / 10) 
     2074    compute in4  @ * (1 +  47 / 10),  @ / (1 +  47 / 10) 
     2075# in5 is scaled internally so scaling is done by the driver. 
     2076 
     2077#   set in0_min 2.5 * 0.95 
     2078#   set in0_max 2.5 * 1.05 
     2079#   set in1_min 2.5 * 0.95 
     2080#   set in1_max 2.5 * 1.05 
     2081# Replace "2.0" with your nominal CPU voltage for in2. 
     2082#   set in2_min 2.0 * 0.95 
     2083#   set in2_max 2.0 * 1.05 
     2084#   set in3_min 5.0 * 0.95 
     2085    set in3_max 5.0 * 1.05 
     2086    set in4_min 12.0 * 0.95 
     2087    set in4_max 12.0 * 1.05 
     2088    set in5_min 3.3 * 0.95 
     2089    set in5_max 3.3 * 1.05 
     2090 
     2091# For Intel CPU: 
     2092    compute temp1  (@ - 65) / 0.9686,  (@ * 0.9686) + 65 
     2093 
     2094# For VIA EPIA CPU (provided by Roger Lucas): 
     2095#   compute temp1  (@ - 45) / 0.7809,  (@ * 0.7809) + 45 
     2096 
     2097# Thermistor calculations 
     2098# 3435 is the thermistor beta, 2.2 is the reference voltage. 
     2099# '^' is the e**x operator; '`' is the ln(x) operator 
     2100# (valid in library version 1.4.0 / lm_sensors 2.7.1 or higher) 
     2101# This assumes that the thermistor forms a resistor divider with a resistor 
     2102# equal to its nominal value @ 25C. 
     2103 
     2104    compute temp2  3435 / (` (1 / (1 - @ / 2.2) - 1) + 3435 / 298.15) - 273.15, \ 
     2105                   2.2 * (1 - 1 / (1 + (^ (3435 / (273.15 + @) - 3435 / 298.15)))) 
     2106    compute temp3  3435 / (` (1 / (1 - @ / 2.2) - 1) + 3435 / 298.15) - 273.15, \ 
     2107                   2.2 * (1 - 1 / (1 + (^ (3435 / (273.15 + @) - 3435 / 298.15)))) 
     2108 
     2109#    set temp2_hyst 40 
     2110#    set temp2_over 45 
     2111#    set temp3_hyst 60 
     2112#    set temp3_over 65 
     2113 
     2114#    set fan1_min 3000 
     2115#    set fan2_min 3000 
    20292116 
    20302117chip "bmc-*" 
  • lm-sensors/trunk/kernel/chips/vt8231.c

    r3190 r3194  
    5555 
    5656/* The VT8231 registers */ 
    57 /* We define the sensors as follows. Somewhat convoluted to minimize 
    58    changes from via686a. 
     57/* We define the sensors as follows. 
    5958        Sensor          Voltage Mode    Temp Mode 
    6059        --------        ------------    --------- 
    61         Reading 1                       temp3 
    62         Reading 3                       temp1   not in vt8231 
    63         UCH1/Reading2   in0             temp2 
    64         UCH2            in1             temp4 
    65         UCH3            in2             temp5 
    66         UCH4            in3             temp6 
    67         UCH5            in4             temp7 
     60        Reading 1                       temp1 
     61        UCH1            in0             temp2 
     62        UCH2            in1             temp3 
     63        UCH3            in2             temp4 
     64        UCH4            in3             temp5 
     65        UCH5            in4             temp6 
    6866        3.3V            in5 
    69         -12V            in6                     not in vt8231 
    7067*/ 
    7168 
    72 /* ins numbered 0-6 */ 
     69/* ins numbered 0-5 */ 
    7370#define VT8231_REG_IN_MAX(nr) ((nr)==0 ? 0x3d : 0x29 + ((nr) * 2)) 
    7471#define VT8231_REG_IN_MIN(nr) ((nr)==0 ? 0x3e : 0x2a + ((nr) * 2)) 
     
    7976#define VT8231_REG_FAN(nr)     (0x28 + (nr)) 
    8077 
    81 static const u8 regtemp[] = { 0x20, 0x21, 0x1f, 0x22, 0x23, 0x24, 0x25 }; 
    82 static const u8 regover[] = { 0x39, 0x3d, 0x1d, 0x2b, 0x2d, 0x2f, 0x31 }; 
    83 static const u8 reghyst[] = { 0x3a, 0x3e, 0x1e, 0x2c, 0x2e, 0x30, 0x32 }; 
    84  
    85 /* temps numbered 1-7 */ 
     78static const u8 regtemp[] = { 0x1f, 0x21, 0x22, 0x23, 0x24, 0x25 }; 
     79static const u8 regover[] = { 0x39, 0x3d, 0x2b, 0x2d, 0x2f, 0x31 }; 
     80static const u8 reghyst[] = { 0x3a, 0x3e, 0x2c, 0x2e, 0x30, 0x32 }; 
     81 
     82/* temps numbered 1-6 */ 
    8683#define VT8231_REG_TEMP(nr)             (regtemp[(nr) - 1]) 
    8784#define VT8231_REG_TEMP_OVER(nr)        (regover[(nr) - 1]) 
    8885#define VT8231_REG_TEMP_HYST(nr)        (reghyst[(nr) - 1]) 
    89 #define VT8231_REG_TEMP_LOW3    0x4b    /* bits 7-6 */ 
    90 #define VT8231_REG_TEMP_LOW2    0x49    /* bits 5-4 */ 
    91 #define VT8231_REG_TEMP_LOW47   0x4d 
     86#define VT8231_REG_TEMP_LOW12           0x49 
     87#define VT8231_REG_TEMP_LOW36           0x4d 
    9288 
    9389#define VT8231_REG_CONFIG 0x40 
     
    10096#define VT8231_REG_TEMP2_CONFIG 0x4c 
    10197 
    102 /* temps 1-7; voltages 0-6 */ 
     98/* temps 1-6; voltages 0-5 */ 
    10399#define ISTEMP(i, ch_config) ((i) == 1 ? 1 : \ 
    104                               (i) == 3 ? 1 : \ 
    105                               (i) == 2 ? ((ch_config) >> 1) & 0x01 : \ 
    106                                          ((ch_config) >> ((i)-1)) & 0x01) 
    107 #define ISVOLT(i, ch_config) ((i) > 4 ? 1 : !(((ch_config) >> ((i)+2)) & 0x01)) 
     100                              ((ch_config) >> (i)) & 0x01) 
     101#define ISVOLT(i, ch_config) ((i) == 5 ? 1 : \ 
     102                              !(((ch_config) >> ((i)+2)) & 0x01)) 
    108103 
    109104#define DIV_FROM_REG(val) (1 << (val)) 
     
    112107#define PWM_TO_REG(val) SENSORS_LIMIT((val), 0, 255) 
    113108 
     109/* Used for temp1 (diode) */ 
    114110#define TEMP_FROM_REG(val) ((val)*10) 
    115111#define TEMP_FROM_REG10(val) (((val)*10)/4) 
    116112#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0?(((val)-5)/10):\ 
    117113                                                 ((val)+5)/10),0,255)) 
    118 #define IN_FROM_REG(val) /*(((val)*10+5)/10)*/ (val) 
    119 #define IN_TO_REG(val)  (SENSORS_LIMIT((((val) * 10 + 5)/10),0,255)) 
     114 
     115/* Used for temp2-temp6 (thermistor) */ 
     116#define THERM_FROM_REG(reg)     (((253 * 4 - (reg)) * 55 + 105) / 210) 
     117#define THERM_TO_REG(val)       (253 - ((val) * 210 + 110) / 220) 
     118 
     119/* Used for in0-in4 */ 
     120#define IN_FROM_REG(val)        ((((val) - 3) * 1000 + 479) / 958) 
     121#define IN_TO_REG(val)          SENSORS_LIMIT(((val) * 958 + 500) \ 
     122                                              / 1000 + 3, 0, 255) 
     123/* Used for in5 (scaled internally) */ 
     124#define IN5_FROM_REG(val)       ((((val) - 3) * 54000 + 16286) / 32572) 
     125#define IN5_TO_REG(val)         SENSORS_LIMIT(((val) * 32572 + 27000) \ 
     126                                              / 54000 + 3, 0, 255) 
    120127 
    121128 
     
    143150        unsigned long last_updated;     /* In jiffies */ 
    144151 
    145         u8 in[7];             /* Register value */ 
    146         u8 in_max[7];         /* Register value */ 
    147         u8 in_min[7];         /* Register value */ 
    148         u16 temp[7];          /* Register value 10 bit */ 
    149         u8 temp_over[7];      /* Register value */ 
    150         u8 temp_hyst[7];      /* Register value */ 
     152        u8 in[6];             /* Register value */ 
     153        u8 in_max[6];         /* Register value */ 
     154        u8 in_min[6];         /* Register value */ 
     155        u16 temp[6];          /* Register value 10 bit */ 
     156        u8 temp_over[6];      /* Register value */ 
     157        u8 temp_hyst[6];      /* Register value */ 
    151158        u8 fan[2];              /* Register value */ 
    152159        u8 fan_min[2];          /* Register value */ 
     
    179186                            int ctl_name, int *nrels_mag, long *results); 
    180187static void vt8231_in(struct i2c_client *client, int operation, 
     188                        int ctl_name, int *nrels_mag, long *results); 
     189static void vt8231_in5(struct i2c_client *client, int operation, 
    181190                        int ctl_name, int *nrels_mag, long *results); 
    182191static void vt8231_pwm(struct i2c_client *client, int operation, 
     
    190199static void vt8231_temp(struct i2c_client *client, int operation, 
    191200                        int ctl_name, int *nrels_mag, long *results); 
     201static void vt8231_therm(struct i2c_client *client, int operation, 
     202                         int ctl_name, int *nrels_mag, long *results); 
    192203 
    193204static struct i2c_driver vt8231_driver = { 
     
    206217#define VT8231_SYSCTL_IN4 1004 
    207218#define VT8231_SYSCTL_IN5 1005 
    208 #define VT8231_SYSCTL_IN6 1006 
    209219#define VT8231_SYSCTL_FAN1 1101 
    210220#define VT8231_SYSCTL_FAN2 1102 
     
    215225#define VT8231_SYSCTL_TEMP5 1204 
    216226#define VT8231_SYSCTL_TEMP6 1205 
    217 #define VT8231_SYSCTL_TEMP7 1206 
    218227#define VT8231_SYSCTL_VID       1300 
    219228#define VT8231_SYSCTL_PWM1      1401 
     
    232241#define VT8231_ALARM_FAN2 0x80 
    233242#define VT8231_ALARM_IN4 0x100 
    234 #define VT8231_ALARM_IN6 0x200 
    235243#define VT8231_ALARM_TEMP2 0x800 
    236244#define VT8231_ALARM_CHAS 0x1000 
    237 #define VT8231_ALARM_TEMP3 0x8000 
    238245/* duplicates */ 
    239 #define VT8231_ALARM_IN0 VT8231_ALARM_TEMP 
    240 #define VT8231_ALARM_TEMP4 VT8231_ALARM_IN1 
    241 #define VT8231_ALARM_TEMP5 VT8231_ALARM_IN2 
    242 #define VT8231_ALARM_TEMP6 VT8231_ALARM_IN3 
    243 #define VT8231_ALARM_TEMP7 VT8231_ALARM_IN4 
     246#define VT8231_ALARM_IN0 VT8231_ALARM_TEMP2 
     247#define VT8231_ALARM_TEMP3 VT8231_ALARM_IN1 
     248#define VT8231_ALARM_TEMP4 VT8231_ALARM_IN2 
     249#define VT8231_ALARM_TEMP5 VT8231_ALARM_IN3 
     250#define VT8231_ALARM_TEMP6 VT8231_ALARM_IN4 
    244251 
    245252/* -- SENSORS SYSCTL END -- */ 
     
    257264         &i2c_sysctl_real, NULL, &vt8231_in}, 
    258265        {VT8231_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, 
    259          &i2c_sysctl_real, NULL, &vt8231_in}, 
    260 /* 
    261     not in 8231 
    262         {VT8231_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, 
    263          &i2c_sysctl_real, NULL, &vt8231_in}, 
    264         {VT8231_SYSCTL_TEMP, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, 
    265          &i2c_sysctl_real, NULL, &vt8231_temp}, 
    266 */ 
     266         &i2c_sysctl_real, NULL, &vt8231_in5}, 
     267        {VT8231_SYSCTL_TEMP, "temp1", NULL, 0, 0644, NULL, 
     268         &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_temp}, 
    267269        {VT8231_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, 
    268          &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_temp}, 
     270         &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_therm}, 
    269271        {VT8231_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, 
    270          &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_temp}, 
     272         &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_therm}, 
    271273        {VT8231_SYSCTL_TEMP4, "temp4", NULL, 0, 0644, NULL, 
    272          &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_temp}, 
     274         &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_therm}, 
    273275        {VT8231_SYSCTL_TEMP5, "temp5", NULL, 0, 0644, NULL, 
    274          &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_temp}, 
     276         &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_therm}, 
    275277        {VT8231_SYSCTL_TEMP6, "temp6", NULL, 0, 0644, NULL, 
    276          &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_temp}, 
    277         {VT8231_SYSCTL_TEMP7, "temp7", NULL, 0, 0644, NULL, 
    278          &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_temp}, 
     278         &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_therm}, 
    279279        {VT8231_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, 
    280280         &i2c_sysctl_real, NULL, &vt8231_fan}, 
     
    486486                                                     VT8231_REG_FAN_MIN(i)); 
    487487                } 
    488                 for (i = 2; i <= 7; i++) { 
     488                for (i = 1; i <= 6; i++) { 
    489489                        if(ISTEMP(i, data->uch_config)) { 
    490490                                data->temp[i - 1] = vt_rdval(client, 
     
    492492                                switch(i) { 
    493493                                        case 1: 
    494                                                 /* ? */ 
    495                                                 j = 0; 
     494                                                j = (vt_rdval(client, 
     495                                                  VT8231_REG_TEMP_LOW12) & 
     496                                                                    0xc0) >> 6; 
    496497                                                break; 
    497498                                        case 2: 
    498499                                                j = (vt_rdval(client, 
    499                                                   VT8231_REG_TEMP_LOW2) & 
     500                                                  VT8231_REG_TEMP_LOW12) & 
    500501                                                                    0x30) >> 4; 
    501502                                                break; 
    502                                         case 3: 
    503                                                 j = (vt_rdval(client, 
    504                                                   VT8231_REG_TEMP_LOW3) & 
    505                                                                     0xc0) >> 6; 
    506                                                 break; 
    507                                         case 4: 
    508                                         case 5: 
    509                                         case 6: 
    510                                         case 7: 
    511503                                        default: 
    512504                                                j = (vt_rdval(client, 
    513                                                   VT8231_REG_TEMP_LOW47) >> 
    514                                                             ((i-4)*2)) & 0x03;         
     505                                                  VT8231_REG_TEMP_LOW36) >> 
     506                                                            ((i-3)*2)) & 0x03;         
    515507                                                break; 
    516508         
     
    574566                        vt8231_write_value(client, VT8231_REG_IN_MAX(nr), 
    575567                                            data->in_max[nr]); 
     568                } 
     569        } 
     570} 
     571 
     572void vt8231_in5(struct i2c_client *client, int operation, int ctl_name, 
     573                int *nrels_mag, long *results) 
     574{ 
     575        struct vt8231_data *data = client->data; 
     576 
     577        if (operation == SENSORS_PROC_REAL_INFO) 
     578                *nrels_mag = 2; 
     579        else if (operation == SENSORS_PROC_REAL_READ) { 
     580                vt8231_update_client(client); 
     581                results[0] = IN5_FROM_REG(data->in_min[5]); 
     582                results[1] = IN5_FROM_REG(data->in_max[5]); 
     583                results[2] = IN5_FROM_REG(data->in[5]); 
     584                *nrels_mag = 3; 
     585        } else if (operation == SENSORS_PROC_REAL_WRITE) { 
     586                if (*nrels_mag >= 1) { 
     587                        data->in_min[5] = IN5_TO_REG(results[0]); 
     588                        vt8231_write_value(client, VT8231_REG_IN_MIN(5), 
     589                                            data->in_min[5]); 
     590                } 
     591                if (*nrels_mag >= 2) { 
     592                        data->in_max[5] = IN5_TO_REG(results[1]); 
     593                        vt8231_write_value(client, VT8231_REG_IN_MAX(5), 
     594                                            data->in_max[5]); 
    576595                } 
    577596        } 
     
    611630{ 
    612631        struct vt8231_data *data = client->data; 
    613         int nr = ctl_name - VT8231_SYSCTL_TEMP; 
    614632 
    615633        if (operation == SENSORS_PROC_REAL_INFO) 
     
    617635        else if (operation == SENSORS_PROC_REAL_READ) { 
    618636                vt8231_update_client(client); 
    619                 results[0] = TEMP_FROM_REG(data->temp_over[nr]); 
    620                 results[1] = TEMP_FROM_REG(data->temp_hyst[nr]); 
    621                 results[2] = TEMP_FROM_REG10(data->temp[nr]); 
     637                results[0] = TEMP_FROM_REG(data->temp_over[0]); 
     638                results[1] = TEMP_FROM_REG(data->temp_hyst[0]); 
     639                results[2] = TEMP_FROM_REG10(data->temp[0]); 
    622640                *nrels_mag = 3; 
    623641        } else if (operation == SENSORS_PROC_REAL_WRITE) { 
    624642                if (*nrels_mag >= 1) { 
    625                         data->temp_over[nr] = TEMP_TO_REG(results[0]); 
     643                        data->temp_over[0] = TEMP_TO_REG(results[0]); 
     644                        vt8231_write_value(client, 
     645                                            VT8231_REG_TEMP_OVER(1), 
     646                                            data->temp_over[0]); 
     647                } 
     648                if (*nrels_mag >= 2) { 
     649                        data->temp_hyst[0] = TEMP_TO_REG(results[1]); 
     650                        vt8231_write_value(client, 
     651                                            VT8231_REG_TEMP_HYST(1), 
     652                                            data->temp_hyst[0]); 
     653                } 
     654        } 
     655
     656 
     657void vt8231_therm(struct i2c_client *client, int operation, int ctl_name, 
     658                  int *nrels_mag, long *results) 
     659
     660        struct vt8231_data *data = client->data; 
     661        int nr = ctl_name - VT8231_SYSCTL_TEMP; 
     662 
     663        if (operation == SENSORS_PROC_REAL_INFO) 
     664                *nrels_mag = 2; 
     665        else if (operation == SENSORS_PROC_REAL_READ) { 
     666                vt8231_update_client(client); 
     667                results[0] = THERM_FROM_REG(data->temp_over[nr] * 4); 
     668                results[1] = THERM_FROM_REG(data->temp_hyst[nr] * 4); 
     669                results[2] = THERM_FROM_REG(data->temp[nr]); 
     670                *nrels_mag = 3; 
     671        } else if (operation == SENSORS_PROC_REAL_WRITE) { 
     672                if (*nrels_mag >= 1) { 
     673                        data->temp_over[nr] = THERM_TO_REG(results[0]); 
    626674                        vt8231_write_value(client, 
    627675                                            VT8231_REG_TEMP_OVER(nr + 1), 
     
    629677                } 
    630678                if (*nrels_mag >= 2) { 
    631                         data->temp_hyst[nr] = TEMP_TO_REG(results[1]); 
     679                        data->temp_hyst[nr] = THERM_TO_REG(results[1]); 
    632680                        vt8231_write_value(client, 
    633681                                            VT8231_REG_TEMP_HYST(nr + 1), 
  • lm-sensors/trunk/lib/chips.c

    r3170 r3194  
    49674967                             SENSORS_VT8231_FAN2, 
    49684968                             RW, VT8231_SYSCTL_FAN2, VALUE(1), 0 }, 
    4969     /* no temp1 */ 
     4969    { SENSORS_VT8231_TEMP, "temp1", NOMAP, NOMAP, 
     4970                         R, VT8231_SYSCTL_TEMP, VALUE(3), 1 }, 
     4971    { SENSORS_VT8231_TEMP_HYST, "temp1_hyst", SENSORS_VT8231_TEMP, 
     4972                              SENSORS_VT8231_TEMP, RW,  
     4973                              VT8231_SYSCTL_TEMP, VALUE(2), 1 }, 
     4974    { SENSORS_VT8231_TEMP_OVER, "temp1_over", SENSORS_VT8231_TEMP, 
     4975                              SENSORS_VT8231_TEMP, RW,  
     4976                              VT8231_SYSCTL_TEMP, VALUE(1), 1 }, 
    49704977    { SENSORS_VT8231_TEMP2, "temp2", NOMAP, NOMAP, 
    4971                          R, VT8231_SYSCTL_TEMP2, VALUE(3), 1 }, 
     4978                         R, VT8231_SYSCTL_TEMP2, VALUE(3), 2 }, 
    49724979    { SENSORS_VT8231_TEMP2_HYST, "temp2_hyst", SENSORS_VT8231_TEMP2, 
    49734980                              SENSORS_VT8231_TEMP2, RW,  
    4974                               VT8231_SYSCTL_TEMP2, VALUE(2), 1 }, 
     4981                              VT8231_SYSCTL_TEMP2, VALUE(2), 2 }, 
    49754982    { SENSORS_VT8231_TEMP2_OVER, "temp2_over", SENSORS_VT8231_TEMP2, 
    49764983                              SENSORS_VT8231_TEMP2, RW,  
    4977                               VT8231_SYSCTL_TEMP2, VALUE(1), 1 }, 
     4984                              VT8231_SYSCTL_TEMP2, VALUE(1), 2 }, 
    49784985    { SENSORS_VT8231_TEMP3, "temp3", NOMAP, NOMAP, 
    4979                          R, VT8231_SYSCTL_TEMP3, VALUE(3), 1 }, 
     4986                         R, VT8231_SYSCTL_TEMP3, VALUE(3), 2 }, 
    49804987    { SENSORS_VT8231_TEMP3_HYST, "temp3_hyst", SENSORS_VT8231_TEMP3, 
    49814988                              SENSORS_VT8231_TEMP3, RW,  
    4982                               VT8231_SYSCTL_TEMP3, VALUE(2), 1 }, 
     4989                              VT8231_SYSCTL_TEMP3, VALUE(2), 2 }, 
    49834990    { SENSORS_VT8231_TEMP3_OVER, "temp3_over", SENSORS_VT8231_TEMP3, 
    49844991                              SENSORS_VT8231_TEMP3, RW,  
    4985                               VT8231_SYSCTL_TEMP3, VALUE(1), 1 }, 
     4992                              VT8231_SYSCTL_TEMP3, VALUE(1), 2 }, 
    49864993    { SENSORS_VT8231_TEMP4, "temp4", NOMAP, NOMAP, 
    4987                          R, VT8231_SYSCTL_TEMP4, VALUE(3), 1 }, 
     4994                         R, VT8231_SYSCTL_TEMP4, VALUE(3), 2 }, 
    49884995    { SENSORS_VT8231_TEMP4_HYST, "temp4_hyst", SENSORS_VT8231_TEMP4, 
    49894996                              SENSORS_VT8231_TEMP4, RW,  
    4990                               VT8231_SYSCTL_TEMP4, VALUE(2), 1 }, 
     4997                              VT8231_SYSCTL_TEMP4, VALUE(2), 2 }, 
    49914998    { SENSORS_VT8231_TEMP4_OVER, "temp4_over", SENSORS_VT8231_TEMP4, 
    49924999                              SENSORS_VT8231_TEMP4, RW,  
    4993                               VT8231_SYSCTL_TEMP4, VALUE(1), 1 }, 
     5000                              VT8231_SYSCTL_TEMP4, VALUE(1), 2 }, 
    49945001    { SENSORS_VT8231_TEMP5, "temp5", NOMAP, NOMAP, 
    4995                          R, VT8231_SYSCTL_TEMP5, VALUE(3), 1 }, 
     5002                         R, VT8231_SYSCTL_TEMP5, VALUE(3), 2 }, 
    49965003    { SENSORS_VT8231_TEMP5_HYST, "temp5_hyst", SENSORS_VT8231_TEMP5, 
    49975004                              SENSORS_VT8231_TEMP5, RW,  
    4998                               VT8231_SYSCTL_TEMP5, VALUE(2), 1 }, 
     5005                              VT8231_SYSCTL_TEMP5, VALUE(2), 2 }, 
    49995006    { SENSORS_VT8231_TEMP5_OVER, "temp5_over", SENSORS_VT8231_TEMP5, 
    50005007                              SENSORS_VT8231_TEMP5, RW,  
    5001                               VT8231_SYSCTL_TEMP5, VALUE(1), 1 }, 
     5008                              VT8231_SYSCTL_TEMP5, VALUE(1), 2 }, 
    50025009    { SENSORS_VT8231_TEMP6, "temp6", NOMAP, NOMAP, 
    5003                          R, VT8231_SYSCTL_TEMP6, VALUE(3), 1 }, 
     5010                         R, VT8231_SYSCTL_TEMP6, VALUE(3), 2 }, 
    50045011    { SENSORS_VT8231_TEMP6_HYST, "temp6_hyst", SENSORS_VT8231_TEMP6, 
    50055012                              SENSORS_VT8231_TEMP6, RW,  
    5006                               VT8231_SYSCTL_TEMP6, VALUE(2), 1 }, 
     5013                              VT8231_SYSCTL_TEMP6, VALUE(2), 2 }, 
    50075014    { SENSORS_VT8231_TEMP6_OVER, "temp6_over", SENSORS_VT8231_TEMP6, 
    50085015                              SENSORS_VT8231_TEMP6, RW,  
    5009                               VT8231_SYSCTL_TEMP6, VALUE(1), 1 }, 
    5010     { SENSORS_VT8231_TEMP7, "temp7", NOMAP, NOMAP, 
    5011                          R, VT8231_SYSCTL_TEMP7, VALUE(3), 1 }, 
    5012     { SENSORS_VT8231_TEMP7_HYST, "temp7_hyst", SENSORS_VT8231_TEMP7, 
    5013                               SENSORS_VT8231_TEMP7, RW,  
    5014                               VT8231_SYSCTL_TEMP7, VALUE(2), 1 }, 
    5015     { SENSORS_VT8231_TEMP7_OVER, "temp7_over", SENSORS_VT8231_TEMP7, 
    5016                               SENSORS_VT8231_TEMP7, RW,  
    5017                               VT8231_SYSCTL_TEMP7, VALUE(1), 1 }, 
     5016                              VT8231_SYSCTL_TEMP6, VALUE(1), 2 }, 
    50185017    { SENSORS_VT8231_FAN1_DIV, "fan1_div", SENSORS_VT8231_FAN1, 
    50195018                             NOMAP, 
  • lm-sensors/trunk/lib/chips.h

    r3169 r3194  
    18651865#define SENSORS_VT8231_IN4 5 /* R */ 
    18661866#define SENSORS_VT8231_IN5 6 /* R */ 
    1867 #define SENSORS_VT8231_IN6 7 /* R */ 
    18681867#define SENSORS_VT8231_IN0_MIN 11 /* RW */ 
    18691868#define SENSORS_VT8231_IN1_MIN 12 /* RW */ 
     
    18721871#define SENSORS_VT8231_IN4_MIN 15 /* RW */ 
    18731872#define SENSORS_VT8231_IN5_MIN 16 /* RW */ 
    1874 #define SENSORS_VT8231_IN6_MIN 17 /* RW */ 
    18751873#define SENSORS_VT8231_IN0_MAX 21 /* RW */ 
    18761874#define SENSORS_VT8231_IN1_MAX 22 /* RW */ 
     
    18791877#define SENSORS_VT8231_IN4_MAX 25 /* RW */ 
    18801878#define SENSORS_VT8231_IN5_MAX 26 /* RW */ 
    1881 #define SENSORS_VT8231_IN6_MAX 27 /* RW */ 
    18821879#define SENSORS_VT8231_FAN1 31 /* R */ 
    18831880#define SENSORS_VT8231_FAN2 32 /* R */ 
     
    19021899#define SENSORS_VT8231_TEMP6_HYST 67 /* RW */ 
    19031900#define SENSORS_VT8231_TEMP6_OVER 68 /* RW */ 
    1904 #define SENSORS_VT8231_TEMP7 69 /* R */ 
    1905 #define SENSORS_VT8231_TEMP7_HYST 70 /* RW */ 
    1906 #define SENSORS_VT8231_TEMP7_OVER 71 /* RW */ 
    19071901#define SENSORS_VT8231_FAN1_DIV 75 /* RW */ 
    19081902#define SENSORS_VT8231_FAN2_DIV 76 /* RW */ 
  • lm-sensors/trunk/prog/sensors/chips.c

    r3169 r3194  
    46504650             cur,min,max,alarms&VT8231_ALARM_IN0?"ALARM":""); 
    46514651    } 
    4652   } else 
    4653     printf("ERROR: Can't get IN0 data!\n"); 
     4652  } 
    46544653  free(label); 
    46554654  if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_IN1,&label,&valid) && 
     
    46624661             cur,min,max,alarms&VT8231_ALARM_IN1?"ALARM":""); 
    46634662    } 
    4664   } else 
    4665     printf("ERROR: Can't get IN1 data!\n"); 
     4663  } 
    46664664  free(label); 
    46674665  if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_IN2,&label,&valid) && 
     
    46744672             cur,min,max,alarms&VT8231_ALARM_IN2?"ALARM":""); 
    46754673    } 
    4676   } else 
    4677     printf("ERROR: Can't get IN2 data!\n"); 
     4674  } 
    46784675  free(label); 
    46794676  if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_IN3,&label,&valid) && 
     
    46864683             cur,min,max,alarms&VT8231_ALARM_IN3?"ALARM":""); 
    46874684    } 
    4688   } else 
    4689     printf("ERROR: Can't get IN3 data!\n"); 
     4685  } 
    46904686  free(label); 
    46914687  if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_IN4,&label,&valid) && 
     
    46984694             cur,min,max,alarms&VT8231_ALARM_IN4?"ALARM":""); 
    46994695    } 
    4700   } else 
    4701     printf("ERROR: Can't get IN4 data!\n"); 
     4696  } 
    47024697  free(label); 
    47034698  if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_IN5,&label,&valid) && 
     
    47394734  free(label); 
    47404735 
    4741   /* no temp 1 */ 
     4736  if (!sensors_get_label_and_valid(*name, SENSORS_VT8231_TEMP, 
     4737                                   &label, &valid) && 
     4738      !sensors_get_feature(*name, SENSORS_VT8231_TEMP, &cur) && 
     4739      !sensors_get_feature(*name, SENSORS_VT8231_TEMP_HYST, &min) && 
     4740      !sensors_get_feature(*name, SENSORS_VT8231_TEMP_OVER, &max)) { 
     4741    if (valid) { 
     4742      print_label(label, 10); 
     4743      print_temp_info(cur, max, min, HYST, 1, 0); 
     4744      printf(" %s\n", alarms & VT8231_ALARM_TEMP ? "ALARM" : ""); 
     4745    } 
     4746  } else 
     4747