Changeset 150

Show
Ignore:
Timestamp:
01/08/99 21:21:32 (10 years ago)
Author:
frodo
Message:

GL518SM fixes

* Better VDD internal computation, as described in the data sheet;
* Fixed the config file to reflect the above change;
* The library read the wrong file to get its gl518sm alarm data.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/trunk/CHANGES

    r149 r150  
    16162.1.2 (199801??) 
    1717  Modules lm80.o, w83781d.o: fan-related Segmentation fault corrected 
     18  Module gl518sm.o: yet more bug fixes. It should at long last be usable now 
    1819 
    19202.1.1 (19990107) 
  • lm-sensors/trunk/doc/progs

    r139 r150  
    88  and prints to stdout `bus' statements reflecting the currently detected 
    99  adapters. 
     10* prog/dump/isadump (written in C, not installed) 
     11  This program helps to dump the registers of LM78-like chips, or more 
     12  exactly, chips which use an I/O-port for its address and one as its 
     13  data register. Usual syntax:  
     14     ./isadump 0x295 0x296 
    1015* prog/eeprom/decode-dimms.pl (written in Perl 5, not installed) 
    1116  This program decodes the information generated by the `eeprom.o' module. 
  • lm-sensors/trunk/etc/sensors.conf.eg

    r139 r150  
    202202# chips are typically used. Please contact us if you own one. 
    203203  label vdd "+5V" 
    204   compute vdd @ * 2.5, @ / 2.5 
    205  
    206  
    207204 
    208205chip "lm80-*" 
  • lm-sensors/trunk/kernel/chips/gl518sm.c

    r145 r150  
    6464#define IN_FROM_REG(val) (((val)*19)/10) 
    6565 
     66#define VDD_TO_REG(val) ((((val)*10+11)/23) & 0xff) 
     67#define VDD_FROM_REG(val) (((val)*23)/10) 
     68 
    6669#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1) 
    6770#define DIV_FROM_REG(val) (1 << (val)) 
     
    8588#define GL518_INIT_VIN_2 300 
    8689#define GL518_INIT_VIN_3 300 
    87 #define GL518_INIT_VDD 300 
     90#define GL518_INIT_VDD 500 
    8891 
    8992#define GL518_INIT_PERCENTAGE 10 
     
    314317                      IN_TO_REG(GL518_INIT_VIN_MIN_3)); 
    315318    gl518_write_value(new_client,GL518_REG_VDD_LIMIT, 
    316                       (IN_TO_REG(GL518_INIT_VDD_MAX) << 8) | 
    317                       IN_TO_REG(GL518_INIT_VDD_MIN)); 
     319                      (VDD_TO_REG(GL518_INIT_VDD_MAX) << 8) | 
     320                      VDD_TO_REG(GL518_INIT_VDD_MIN)); 
    318321    /* Clear status register (bit 5=1), start (bit6=1) */ 
    319322    gl518_write_value(new_client,GL518_REG_CONF,0x24); 
     
    505508  else if (operation == SENSORS_PROC_REAL_READ) { 
    506509    gl518_update_client(client); 
    507     results[0] = IN_FROM_REG(data->voltage_min[nr]); 
    508     results[1] = IN_FROM_REG(data->voltage_max[nr]); 
     510    results[0] = nr?IN_FROM_REG(data->voltage_min[nr]): 
     511                     VDD_FROM_REG(data->voltage_min[nr]); 
     512    results[1] = nr?IN_FROM_REG(data->voltage_max[nr]): 
     513                     VDD_FROM_REG(data->voltage_max[nr]); 
    509514    if ((data->revision == 0x00) && (nr != 3)) 
    510515      results[2] = 0; 
    511516    else 
    512       results[2] = IN_FROM_REG(data->voltage[nr]); 
     517      results[2] = nr?IN_FROM_REG(data->voltage[nr]): 
     518                      VDD_FROM_REG(data->voltage[nr]); 
    513519    *nrels_mag = 3; 
    514520  } else if (operation == SENSORS_PROC_REAL_WRITE) { 
     
    518524      old = gl518_read_value(client,regnr) & 0xff00; 
    519525    if (*nrels_mag >= 2) { 
    520       data->voltage_max[nr] = IN_TO_REG(results[1]); 
     526      data->voltage_max[nr] = nr?IN_TO_REG(results[1]):VDD_TO_REG(results[1]); 
    521527      old = data->voltage_max[nr] << 8; 
    522528    } 
    523529    if (*nrels_mag >= 1) { 
    524       data->voltage_min[nr] = IN_TO_REG(results[0]); 
     530      data->voltage_min[nr] = nr?IN_TO_REG(results[0]):VDD_TO_REG(results[0]); 
    525531      old |= data->voltage_min[nr]; 
    526532      gl518_write_value(client,regnr,old); 
  • lm-sensors/trunk/lib/chips.c

    r145 r150  
    435435    { SENSORS_GL518R80_ALARMS, "alarms", SENSORS_NO_MAPPING, 
    436436                               SENSORS_NO_MAPPING, SENSORS_MODE_R, 
    437                                GL518_SYSCTL_FAN_DIV, VALUE(3), 0 }, 
     437                               GL518_SYSCTL_ALARMS, VALUE(1), 0 }, 
    438438    { SENSORS_GL518R80_BEEP_ENABLE, "beep_enable", SENSORS_GL518R80_ALARMS, 
    439439                               SENSORS_NO_MAPPING, SENSORS_MODE_RW, 
  • lm-sensors/trunk/src/gl518sm.c

    r145 r150  
    6464#define IN_FROM_REG(val) (((val)*19)/10) 
    6565 
     66#define VDD_TO_REG(val) ((((val)*10+11)/23) & 0xff) 
     67#define VDD_FROM_REG(val) (((val)*23)/10) 
     68 
    6669#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1) 
    6770#define DIV_FROM_REG(val) (1 << (val)) 
     
    8588#define GL518_INIT_VIN_2 300 
    8689#define GL518_INIT_VIN_3 300 
    87 #define GL518_INIT_VDD 300 
     90#define GL518_INIT_VDD 500 
    8891 
    8992#define GL518_INIT_PERCENTAGE 10 
     
    314317                      IN_TO_REG(GL518_INIT_VIN_MIN_3)); 
    315318    gl518_write_value(new_client,GL518_REG_VDD_LIMIT, 
    316                       (IN_TO_REG(GL518_INIT_VDD_MAX) << 8) | 
    317                       IN_TO_REG(GL518_INIT_VDD_MIN)); 
     319                      (VDD_TO_REG(GL518_INIT_VDD_MAX) << 8) | 
     320                      VDD_TO_REG(GL518_INIT_VDD_MIN)); 
    318321    /* Clear status register (bit 5=1), start (bit6=1) */ 
    319322    gl518_write_value(new_client,GL518_REG_CONF,0x24); 
     
    505508  else if (operation == SENSORS_PROC_REAL_READ) { 
    506509    gl518_update_client(client); 
    507     results[0] = IN_FROM_REG(data->voltage_min[nr]); 
    508     results[1] = IN_FROM_REG(data->voltage_max[nr]); 
     510    results[0] = nr?IN_FROM_REG(data->voltage_min[nr]): 
     511                     VDD_FROM_REG(data->voltage_min[nr]); 
     512    results[1] = nr?IN_FROM_REG(data->voltage_max[nr]): 
     513                     VDD_FROM_REG(data->voltage_max[nr]); 
    509514    if ((data->revision == 0x00) && (nr != 3)) 
    510515      results[2] = 0; 
    511516    else 
    512       results[2] = IN_FROM_REG(data->voltage[nr]); 
     517      results[2] = nr?IN_FROM_REG(data->voltage[nr]): 
     518                      VDD_FROM_REG(data->voltage[nr]); 
    513519    *nrels_mag = 3; 
    514520  } else if (operation == SENSORS_PROC_REAL_WRITE) { 
     
    518524      old = gl518_read_value(client,regnr) & 0xff00; 
    519525    if (*nrels_mag >= 2) { 
    520       data->voltage_max[nr] = IN_TO_REG(results[1]); 
     526      data->voltage_max[nr] = nr?IN_TO_REG(results[1]):VDD_TO_REG(results[1]); 
    521527      old = data->voltage_max[nr] << 8; 
    522528    } 
    523529    if (*nrels_mag >= 1) { 
    524       data->voltage_min[nr] = IN_TO_REG(results[0]); 
     530      data->voltage_min[nr] = nr?IN_TO_REG(results[0]):VDD_TO_REG(results[0]); 
    525531      old |= data->voltage_min[nr]; 
    526532      gl518_write_value(client,regnr,old);