Changeset 2197

Show
Ignore:
Timestamp:
12/31/03 22:30:43 (9 years ago)
Author:
khali
Message:

Add support for the Linux 2.6 version of the lm90 driver.

Location:
lm-sensors/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/etc/sensors.conf.eg

    r2195 r2197  
    16291629 
    16301630# change the hysteresis value to fit your needs 
    1631 # relative value, applies to both critical thresholds 
     1631# This is a little bit tricky. Under Linux 2.4, this is a relative value 
     1632# and applies to both critical thresholds. This is a direct representation 
     1633# of the chipset register. 
    16321634#   set hyst 5 
     1635# Under Linux 2.6 however, this is an absolute value and applies to 
     1636# tcrit2. Keep in mind that this is still internally represented as a 
     1637# relative, common value (because there's a single register, holding a 
     1638# relative value, in the chipset itself) so it is important to set it 
     1639# *after* setting tcrit2 (i.e. don't change the set lines order). 
     1640#   set hyst 80 
     1641# Tcrit1 hysteresis value will be set automatically, with the same delta. 
     1642# In this example (with tcrit1=75 and tcrit2=85), the internal register 
     1643# would be set to 5, and the hysteresis temperature for tcrit1 would be 70. 
     1644# Note that the internal register cannot hold values greater than 31, so 
     1645# the delta between critical temperatures and respective absolute hysteresis 
     1646# can never exceed this value. 
    16331647 
    16341648chip "vt1211-*" "vt8231-*" 
  • lm-sensors/trunk/lib/chips.c

    r2181 r2197  
    730730    { SENSORS_LM90_TCRIT_HYST, "hyst", 
    731731      NOMAP, NOMAP, 
    732       RW, LM90_SYSCTL_HYST, VALUE(1), 0 }, 
     732      RW, LM90_SYSCTL_HYST, VALUE(1), 0, "temp_hyst2", 3 }, 
    733733    { SENSORS_LM90_ALARMS, "alarms", 
    734734      NOMAP, NOMAP, 
  • lm-sensors/trunk/lib/proc.c

    r2196 r2197  
    412412        First looks for a sysfs name and magnitude in the feature structure. 
    413413        These should be added in chips.c for all non-standard feature names. 
    414         If that fails, converts common /proc feature names 
     414        If that fails, converts common /proc feature names 
    415415        to their sysfs equivalent, and uses common sysfs magnitude. 
    416416        Common magnitudes are #defined above. 
     
    425425                temp%d_hyst -> temp_min%d ("") 
    426426                temp%d_max -> temp_max%d 
     427                temp%d_high -> temp_max%d 
    427428                temp%d_min -> temp_min%d 
     429                temp%d_low -> temp_min%d 
    428430                temp%d -> temp_input%d 
     431                tcrit%d -> temp_crit%d 
    429432        AND all conversions listed in the matches[] structure below. 
    430433 
     
    451454                { "beeps", "beep_mask", 0 }, 
    452455                { "pwm", "pwm1", 0 }, 
    453                 { "rempte_temp", "temp_input2", TEMPMAG }, 
     456                { "remote_temp", "temp_input2", TEMPMAG }, 
    454457                { "remote_temp_hyst", "temp_hyst2", TEMPMAG }, 
    455458                { "remote_temp_low", "temp_min2", TEMPMAG }, 
     
    542545                return 0; 
    543546        } 
     547        if(sscanf(name, "temp%d_lo%c%c", &num, &last, &check) == 2 && last == 'w') { 
     548                sprintf(sysname, "temp_min%d", num); 
     549                *sysmag = TEMPMAG; 
     550                return 0; 
     551        } 
    544552        if(sscanf(name, "temp%d_ma%c%c", &num, &last, &check) == 2 && last == 'x') { 
    545553                sprintf(sysname, "temp_max%d", num); 
     554                *sysmag = TEMPMAG; 
     555                return 0; 
     556        } 
     557        if(sscanf(name, "temp%d_hig%c%c", &num, &last, &check) == 2 && last == 'h') { 
     558                sprintf(sysname, "temp_max%d", num); 
     559                *sysmag = TEMPMAG; 
     560                return 0; 
     561        } 
     562        if(sscanf(name, "tcrit%d%c", &num, &check) == 1) { 
     563                sprintf(sysname, "temp_crit%d", num); 
    546564                *sysmag = TEMPMAG; 
    547565                return 0; 
  • lm-sensors/trunk/prog/sensors/chips.c

    r2181 r2197  
    45374537{ 
    45384538  char *label; 
    4539   double cur, high, low; 
     4539  double cur, high, low, hyst; 
    45404540  int valid, alarms; 
    45414541 
     
    45804580  free_the_label(&label); 
    45814581 
     4582  /* 2.6 tweak: 
     4583   * In 2.4 there is only one, relative hyst value, (default 10). 
     4584   * In 2.6 there are two, absolute values. 
     4585   * The library will link hyst (2.4) to temp_hyst2 (2.6) and we have 
     4586   * to compute the relative value from temp_hyst2 and temp_crit2. 
     4587   * We detect that using the following rules: 
     4588   *  - if hyst is not in the range 0..31, it is absolute (2.6); 
     4589   *  - if hyst exceeds tcrit1 or tcrit2, it is absolute (2.6); 
     4590   *  - if hyst is greater than it would be if considered absolute, 
     4591   *    it is absolute (heuristic); 
     4592   *  - else it is relative (2.4). 
     4593   * Also note that the use of low and high right below is 
     4594   * arbitrary, only to reuse previously defined variables, at the 
     4595   * admitted cost of a lower readability. 
     4596   */ 
     4597  if (!sensors_get_feature(*name, SENSORS_LM90_TCRIT_HYST, &hyst) 
     4598   && !sensors_get_feature(*name, SENSORS_LM90_LOCAL_TCRIT, &low) 
     4599   && !sensors_get_feature(*name, SENSORS_LM90_REMOTE_TCRIT, &high)) { 
     4600    if (hyst<=-0.5 || hyst>=31.5 || hyst>low || hyst>high || hyst>high-hyst) 
     4601      hyst = high-hyst; 
     4602  } else { 
     4603    printf("ERROR: Can't get hyst data!\n"); 
     4604    hyst = 10; 
     4605  } 
     4606 
    45824607  if (!sensors_get_label_and_valid(*name, SENSORS_LM90_LOCAL_TCRIT, 
    4583       &label, &valid) 
    4584    && !sensors_get_feature(*name, SENSORS_LM90_LOCAL_TCRIT, &high) 
    4585    && !sensors_get_feature(*name, SENSORS_LM90_TCRIT_HYST, &low)) { 
     4608      &label, &valid)) { 
    45864609    if (valid) { 
    45874610      print_label(label, 10); 
    4588       print_temp_info(high, high-low, 0, HYSTONLY, 0, 0); 
     4611      print_temp_info(low, low-hyst, 0, HYSTONLY, 0, 0); 
    45894612      printf("\n"); 
    45904613    } 
     
    45944617 
    45954618  if (!sensors_get_label_and_valid(*name, SENSORS_LM90_REMOTE_TCRIT, 
    4596       &label, &valid) 
    4597    && !sensors_get_feature(*name, SENSORS_LM90_REMOTE_TCRIT, &high) 
    4598    && !sensors_get_feature(*name, SENSORS_LM90_TCRIT_HYST, &low)) { 
     4619      &label, &valid)) { 
    45994620    if (valid) { 
    46004621      print_label(label, 10); 
    4601       print_temp_info(high, high-low, 0, HYSTONLY, 0, 0); 
     4622      print_temp_info(high, high-hyst, 0, HYSTONLY, 0, 0); 
    46024623      printf("\n"); 
    46034624    }