Changeset 2603

Show
Ignore:
Timestamp:
06/19/04 23:54:08 (9 years ago)
Author:
khali
Message:

Add VID support to the pc87360 driver.

Location:
lm-sensors/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/doc/chips/pc87360

    r2556 r2603  
    152152triggers an alarm when crossed. 
    153153 
     154When available, VID inputs are used to provide the nominal CPU Core voltage. 
     155The driver will default to VRM 9.0, but this can be changed from user-space. 
     156The chipsets can handle two sets of VID inputs (on dual-CPU systems), but 
     157the driver will only export one for now. This may change later if there is 
     158a need. 
     159 
    154160 
    155161General Remarks 
  • lm-sensors/trunk/etc/sensors.conf.eg

    r2583 r2603  
    20702070# Voltage inputs 
    20712071 
     2072# Set VRM version (default 9.0) 
     2073#   set vrm     9.0 
     2074 
    20722075   label in7   "Vsb" 
    20732076   label in8   "Vdd" 
  • lm-sensors/trunk/kernel/chips/pc87360.c

    r2595 r2603  
    4242#include <asm/io.h> 
    4343#include "version.h" 
     44#include "sensors_vid.h" 
    4445 
    4546static unsigned short normal_i2c[] = { SENSORS_I2C_END }; 
     
    5051static u8 devid; 
    5152static unsigned int extra_isa[] = { 0x0000, 0x0000, 0x0000 }; 
    52 static u8 confreg[3]; 
     53static u8 confreg[4]; 
    5354 
    5455enum chips { any_chip, pc87360, pc87363, pc87364, pc87365, pc87366 }; 
     
    169170#define PC87365_REG_IN_ALARMS1          0x00 
    170171#define PC87365_REG_IN_ALARMS2          0x01 
     172#define PC87365_REG_VID                 0x06 
    171173 
    172174#define IN_FROM_REG(val,ref)            (((val) * (ref) + 128) / 256) 
     
    216218        u8 in_status[14];       /* Register value */ 
    217219        u16 in_alarms;          /* Register values, combined, masked */ 
     220        u8 vid_conf;            /* Configuration register value */ 
     221        u8 vrm; 
     222        u8 vid;                 /* Register value */ 
    218223 
    219224        u8 temp[3];             /* Register value */ 
     
    256261void pc87365_in_status(struct i2c_client *client, int operation, int ctl_name, 
    257262                       int *nrels_mag, long *results); 
     263void pc87365_vid(struct i2c_client *client, int operation, int ctl_name, 
     264                 int *nrels_mag, long *results); 
     265void pc87365_vrm(struct i2c_client *client, int operation, int ctl_name, 
     266                 int *nrels_mag, long *results); 
    258267 
    259268void pc87365_temp(struct i2c_client *client, int operation, int ctl_name, 
     
    319328#define PC87365_SYSCTL_TEMP5_STATUS     2312 /* not for PC87365 */ 
    320329#define PC87365_SYSCTL_TEMP6_STATUS     2313 /* not for PC87365 */ 
     330 
     331#define PC87365_SYSCTL_VID              2400 
     332#define PC87365_SYSCTL_VRM              2401 
    321333 
    322334#define PC87365_STATUS_IN_MIN           0x02 
     
    452464        {PC87365_SYSCTL_TEMP6_STATUS, "temp6_status", NULL, 0, 0444, NULL, 
    453465         &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, 
     466        {PC87365_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, 
     467         &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_vid}, 
     468        {PC87365_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, 
     469         &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_vrm}, 
    454470        {0} 
    455471}; 
     
    526542                        /* Are we using thermistors? */ 
    527543                        if (*devid == 0xE9) { /* PC87366 */ 
    528                                 /* This register is not logical-device 
    529                                    specific, just that we won't need it if we 
    530                                    don't use the VLM device */ 
     544                                /* These registers are not logical-device 
     545                                   specific, just that we won't need them if 
     546                                   we don't use the VLM device */ 
    531547                                confreg[2] = superio_inb(0x2B); 
     548                                confreg[3] = superio_inb(0x25); 
    532549 
    533550                                if (confreg[2] & 0x40) { 
     
    536553                                               "monitoring\n"); 
    537554                                } 
     555 
     556#ifdef DEBUG 
     557                                if (confreg[3] & 0xE0) { 
     558                                        printk(KERN_INFO "pc87360.o: VID " 
     559                                               "inputs routed (mode %d)\n", 
     560                                                confreg[3] & 0xE0); 
     561                                } 
     562#endif 
    538563                        } 
    539564                } 
     
    645670                       (i&0x02) ? "external" : "internal"); 
    646671#endif 
     672 
     673                data->vid_conf = confreg[3]; 
     674                data->vrm = 90; 
    647675        } 
    648676 
     
    961989                                            NO_BANK, PC87365_REG_IN_ALARMS2) 
    962990                                            & 0x07) << 8); 
     991                        data->vid = (data->vid_conf & 0xE0) ? 
     992                                    pc87360_read_value(data, LD_IN, 
     993                                    NO_BANK, PC87365_REG_VID) : 0x1F; 
    963994                } 
    964995 
     
    11821213} 
    11831214 
     1215void pc87365_vid(struct i2c_client *client, int operation, int ctl_name, 
     1216                 int *nrels_mag, long *results) 
     1217{ 
     1218        struct pc87360_data *data = client->data; 
     1219        if (operation == SENSORS_PROC_REAL_INFO) 
     1220                *nrels_mag = 3; 
     1221        else if (operation == SENSORS_PROC_REAL_READ) { 
     1222                pc87360_update_client(client); 
     1223                results[0] = vid_from_reg(data->vid & 0x1f, data->vrm); 
     1224                *nrels_mag = 1; 
     1225        } 
     1226} 
     1227 
     1228void pc87365_vrm(struct i2c_client *client, int operation, int ctl_name, 
     1229                 int *nrels_mag, long *results) 
     1230{ 
     1231        struct pc87360_data *data = client->data; 
     1232        if (operation == SENSORS_PROC_REAL_INFO) 
     1233                *nrels_mag = 1; 
     1234        else if (operation == SENSORS_PROC_REAL_READ) { 
     1235                results[0] = data->vrm; 
     1236                *nrels_mag = 1; 
     1237        } else if (operation == SENSORS_PROC_REAL_WRITE) { 
     1238                if (*nrels_mag >= 1) 
     1239                        data->vrm = results[0]; 
     1240        } 
     1241} 
     1242 
    11841243void pc87365_temp(struct i2c_client *client, int operation, int ctl_name, 
    11851244                  int *nrels_mag, long *results) 
  • lm-sensors/trunk/lib/chips.c

    r2595 r2603  
    46184618    { SENSORS_PC87360_TEMP6_STATUS, "temp6_status", SENSORS_PC87360_TEMP6, 
    46194619                NOMAP, R, PC87365_SYSCTL_TEMP6_STATUS, VALUE(1), 0 }, 
     4620    { SENSORS_PC87360_VID, "vid", NOMAP, NOMAP,  
     4621                R, PC87365_SYSCTL_VID, VALUE(1), 3 }, 
     4622    { SENSORS_PC87360_VRM, "vrm", NOMAP, NOMAP,  
     4623                RW, PC87365_SYSCTL_VRM, VALUE(1), 1 }, 
    46204624    { 0 } 
    46214625  }; 
  • lm-sensors/trunk/lib/chips.h

    r2573 r2603  
    17501750#define SENSORS_PC87360_TEMP6_STATUS    216     /* R */ 
    17511751 
     1752#define SENSORS_PC87360_VID             240     /* R */ 
     1753#define SENSORS_PC87360_VRM             241     /* RW */ 
     1754 
    17521755#define SENSORS_LM92_PREFIX "lm92" 
    17531756