Changeset 940

Show
Ignore:
Timestamp:
11/30/00 03:44:47 (12 years ago)
Author:
mds
Message:

(mds) add remote temp support (temp2) to adm1025

(also in prog/sensors/chips.c),
rename /proc entries to in[0-5] and temp[1-2], fix negative
temperature reporting.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r935 r940  
    20202.5.5 (2000????) 
    2121  Chip modules (all): Update mutex definition (works now for new 2.2 kernels) 
    22   File sensors.conf.eg: Add mtp008 entries 
     22  File sensors.conf.eg: Add mtp008 entries, adm1025 entries 
    2323  Library: Add ds1621, mtp008 support 
    2424  Module adm1021: Add support for adm1021a / adm1023 
     25  Module adm1025: Add support for remote temp; rename /proc entries to 
     26                  in[0-5] and temp[1-2]; fix negative temp readings 
    2527  Module ddcmon: allow force and force_ddcmon parameters 
    2628  Module ds1621: new 
     
    3133  Module w83781d: fix beep setting via /proc 
    3234  Program mkpatch.pl: more fixes 
    33   Program sensors: Add ds1621, mtp008 support, add -f (Fahrenheit) option 
    34   Program sensors-detect: Add ds1621, mtp008 detection 
     35  Program sensors: Add ds1621, mtp008 support; add -f (Fahrenheit) option; 
     36                   add adm1025 temp2; report temp limits correctly as 
     37                   min/max or limit/hysteresis 
     38  Program sensors-detect: Add ds1621, mtp008 detection; 
     39                          add ServerWorks detection (no driver yet) 
    3540 
    36412.5.4 (20001012) 
  • lm-sensors/trunk/kernel/chips/adm1025.c

    r933 r940  
    33               monitoring 
    44    Add by Gordon Wu <gwu@esoft.com> according to the adm9240.c written by 
    5  
    65    Frodo Looijaard <frodol@dds.nl> 
    76    and Philip Edelbrock <phil@netroedge.com> 
     
    2221*/ 
    2322 
    24 /* Supports ADM10250. See doc/chips/adm9240 for details */ 
     23/* Supports the Analog Devices ADM1025. See doc/chips/adm1025 for details */ 
    2524 
    2625#include <linux/version.h> 
     
    108107#define IN_FROM_REG(val,nr) (val) 
    109108 
    110 /* #define TEMP_FROM_REG(temp) \ 
    111    ((temp)<256?((((temp)&0x1fe) >> 1) * 10)      + ((temp) & 1) * 5:  \ 
    112                ((((temp)&0x1fe) >> 1) -255) * 10 - ((temp) & 1) * 5)  \ 
    113 */ 
    114 #define TEMP_FROM_REG(temp) (((temp)>0x7f?(-temp):(temp))*10) 
    115  
    116 #define TEMP_LIMIT_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*10) 
    117  
     109#define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*10) 
     110#define TEMP_LIMIT_FROM_REG(val) TEMP_FROM_REG(val) 
    118111#define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT(((val)<0?(((val)-5)/10):\ 
    119                                                       ((val)+5)/10), \ 
    120                                              0,255) 
     112                                                      ((val)+5)/10), 0, 255) 
    121113 
    122114#define ALARMS_FROM_REG(val) (val) 
    123  
    124115 
    125116#define VID_FROM_REG(val) ((val)==0x1f?0:(val)>=0x10?510-(val)*10:\ 
     
    162153 
    163154#define ADM1025_INIT_RTEMP_MAX 600 
    164 #define ADM1025_INIT_RTEMP_MIN 500 
     155#define ADM1025_INIT_RTEMP_MIN 0 
    165156#define ADM1025_INIT_TEMP_MAX 600 
    166 #define ADM1025_INIT_TEMP_MIN 500 
     157#define ADM1025_INIT_TEMP_MIN 0 
    167158 
    168159#ifdef MODULE 
     
    186177        u8 in_max[6];           /* Register value */ 
    187178        u8 in_min[6];           /* Register value */ 
    188         int rtemp;              /* Register value */ 
     179        u8 rtemp;               /* Register value */ 
    189180        u8 rtemp_max;           /* Register value */ 
    190         u8 rtemp_min;           /* Register encoding, shifted right */ 
    191         int temp;               /* Temp, shifted right */ 
     181        u8 rtemp_min;           /* Register value */ 
     182        u8 temp;                /* Register value */ 
    192183        u8 temp_max;            /* Register value */ 
    193184        u8 temp_min;            /* Register value */ 
     
    225216                       int ctl_name, int *nrels_mag, long *results); 
    226217static void adm1025_temp(struct i2c_client *client, int operation, 
     218                         int ctl_name, int *nrels_mag, long *results); 
     219static void adm1025_rm_temp(struct i2c_client *client, int operation, 
    227220                         int ctl_name, int *nrels_mag, long *results); 
    228221static void adm1025_alarms(struct i2c_client *client, int operation, 
     
    260253   when a new copy is allocated. */ 
    261254static ctl_table adm1025_dir_table_template[] = { 
    262         {ADM1025_SYSCTL_IN0, "2.5V", NULL, 0, 0644, NULL, &sensors_proc_real, 
     255        {ADM1025_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &sensors_proc_real, 
    263256         &sensors_sysctl_real, NULL, &adm1025_in}, 
    264         {ADM1025_SYSCTL_IN1, "Vccp1", NULL, 0, 0644, NULL, &sensors_proc_real, 
     257        {ADM1025_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &sensors_proc_real, 
    265258         &sensors_sysctl_real, NULL, &adm1025_in}, 
    266         {ADM1025_SYSCTL_IN2, "3.3V", NULL, 0, 0644, NULL, &sensors_proc_real, 
     259        {ADM1025_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &sensors_proc_real, 
    267260         &sensors_sysctl_real, NULL, &adm1025_in}, 
    268         {ADM1025_SYSCTL_IN3, "5V", NULL, 0, 0644, NULL, &sensors_proc_real, 
     261        {ADM1025_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &sensors_proc_real, 
    269262         &sensors_sysctl_real, NULL, &adm1025_in}, 
    270         {ADM1025_SYSCTL_IN4, "12V", NULL, 0, 0644, NULL, &sensors_proc_real, 
     263        {ADM1025_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &sensors_proc_real, 
    271264         &sensors_sysctl_real, NULL, &adm1025_in}, 
    272         {ADM1025_SYSCTL_IN5, "Vcc", NULL, 0, 0644, NULL, &sensors_proc_real, 
     265        {ADM1025_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &sensors_proc_real, 
    273266         &sensors_sysctl_real, NULL, &adm1025_in}, 
    274         /*{ADM1025_SYSCTL_RTEMP, "Remote_temp", NULL, 0, 0644, NULL, &sensors_proc_real, 
    275          &sensors_sysctl_real, NULL, &adm1025_rm_temp},*/ 
    276         {ADM1025_SYSCTL_TEMP, "Local_temp", NULL, 0, 0644, NULL, &sensors_proc_real, 
     267        {ADM1025_SYSCTL_RTEMP, "temp2", NULL, 0, 0644, NULL, &sensors_proc_real, 
     268         &sensors_sysctl_real, NULL, &adm1025_rm_temp}, 
     269        {ADM1025_SYSCTL_TEMP, "temp1", NULL, 0, 0644, NULL, &sensors_proc_real, 
    277270         &sensors_sysctl_real, NULL, &adm1025_temp}, 
    278271        {ADM1025_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &sensors_proc_real, 
     
    524517                data->temp = 
    525518                    adm1025_read_value(client, ADM1025_REG_TEMP); 
     519                data->rtemp = 
     520                    adm1025_read_value(client, ADM1025_REG_RTEMP); 
    526521#ifdef DEBUG 
    527522                printk("The temp is %2x\n",data->temp); 
     
    531526                data->temp_min = 
    532527                    adm1025_read_value(client, ADM1025_REG_TEMP_LOW); 
     528                data->rtemp_max = 
     529                    adm1025_read_value(client, ADM1025_REG_RTEMP_HIGH); 
     530                data->rtemp_min = 
     531                    adm1025_read_value(client, ADM1025_REG_RTEMP_LOW); 
    533532 
    534533                i = adm1025_read_value(client, ADM1025_REG_VID); 
     
    627626} 
    628627 
     628void adm1025_rm_temp(struct i2c_client *client, int operation, int ctl_name, 
     629                  int *nrels_mag, long *results) 
     630{ 
     631        struct adm1025_data *data = client->data; 
     632        if (operation == SENSORS_PROC_REAL_INFO) 
     633                *nrels_mag = 1; 
     634        else if (operation == SENSORS_PROC_REAL_READ) { 
     635                adm1025_update_client(client); 
     636                results[0] = TEMP_LIMIT_FROM_REG(data->rtemp_max); 
     637                results[1] = TEMP_LIMIT_FROM_REG(data->rtemp_min); 
     638                results[2] = TEMP_FROM_REG(data->rtemp); 
     639                *nrels_mag = 3; 
     640        } else if (operation == SENSORS_PROC_REAL_WRITE) { 
     641                if (*nrels_mag >= 1) { 
     642                        data->temp_max = TEMP_LIMIT_TO_REG(results[0]); 
     643                        adm1025_write_value(client, ADM1025_REG_RTEMP_HIGH, 
     644                                            data->rtemp_max); 
     645                } 
     646                if (*nrels_mag >= 2) { 
     647                        data->temp_min = TEMP_LIMIT_TO_REG(results[1]); 
     648                        adm1025_write_value(client, ADM1025_REG_RTEMP_LOW, 
     649                                            data->rtemp_min); 
     650                } 
     651        } 
     652} 
     653 
    629654void adm1025_alarms(struct i2c_client *client, int operation, int ctl_name, 
    630655                    int *nrels_mag, long *results)