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

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2197 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2003-12-31 21:30:43 +00:00
1 parent 5ced89019d
commit cc6c1a12a4
4 files changed
+66 -13

No files matched your search

+15 -1
View File
@@ -1628,8 +1628,22 @@ chip "lm90-*" "adm1032-*"
# set tcrit2 85
# change the hysteresis value to fit your needs
# relative value, applies to both critical thresholds
# This is a little bit tricky. Under Linux 2.4, this is a relative value
# and applies to both critical thresholds. This is a direct representation
# of the chipset register.
# set hyst 5
# Under Linux 2.6 however, this is an absolute value and applies to
# tcrit2. Keep in mind that this is still internally represented as a
# relative, common value (because there's a single register, holding a
# relative value, in the chipset itself) so it is important to set it
# *after* setting tcrit2 (i.e. don't change the set lines order).
# set hyst 80
# Tcrit1 hysteresis value will be set automatically, with the same delta.
# In this example (with tcrit1=75 and tcrit2=85), the internal register
# would be set to 5, and the hysteresis temperature for tcrit1 would be 70.
# Note that the internal register cannot hold values greater than 31, so
# the delta between critical temperatures and respective absolute hysteresis
# can never exceed this value.
chip "vt1211-*" "vt8231-*"
#
+1 -1
View File
@@ -729,7 +729,7 @@ static sensors_chip_feature lm90_features[] =
RW, LM90_SYSCTL_REMOTE_TCRIT, VALUE(1), 0 },
{ SENSORS_LM90_TCRIT_HYST, "hyst",
NOMAP, NOMAP,
RW, LM90_SYSCTL_HYST, VALUE(1), 0 },
RW, LM90_SYSCTL_HYST, VALUE(1), 0, "temp_hyst2", 3 },
{ SENSORS_LM90_ALARMS, "alarms",
NOMAP, NOMAP,
R, LM90_SYSCTL_ALARMS, VALUE(1), 0 },
+20 -2
View File
@@ -411,7 +411,7 @@ int sensors_write_proc(sensors_chip_name name, int feature, double value)
Returns the sysfs name and magnitude for a given feature.
First looks for a sysfs name and magnitude in the feature structure.
These should be added in chips.c for all non-standard feature names.
If that fails, converts common /proc feature names
If that fails, converts common /proc feature names
to their sysfs equivalent, and uses common sysfs magnitude.
Common magnitudes are #defined above.
Common conversions are as follows:
@@ -424,8 +424,11 @@ int sensors_write_proc(sensors_chip_name name, int feature, double value)
temp%d_over -> temp_max%d (to be changed after kernel patch)
temp%d_hyst -> temp_min%d ("")
temp%d_max -> temp_max%d
temp%d_high -> temp_max%d
temp%d_min -> temp_min%d
temp%d_low -> temp_min%d
temp%d -> temp_input%d
tcrit%d -> temp_crit%d
AND all conversions listed in the matches[] structure below.
If that fails, returns old /proc feature name and magnitude.
@@ -450,7 +453,7 @@ int getsysname(const sensors_chip_feature *feature, char *sysname, int *sysmag)
struct match matches[] = {
{ "beeps", "beep_mask", 0 },
{ "pwm", "pwm1", 0 },
{ "rempte_temp", "temp_input2", TEMPMAG },
{ "remote_temp", "temp_input2", TEMPMAG },
{ "remote_temp_hyst", "temp_hyst2", TEMPMAG },
{ "remote_temp_low", "temp_min2", TEMPMAG },
{ "remote_temp_over", "temp_max2", TEMPMAG },
@@ -541,11 +544,26 @@ int getsysname(const sensors_chip_feature *feature, char *sysname, int *sysmag)
*sysmag = TEMPMAG;
return 0;
}
if(sscanf(name, "temp%d_lo%c%c", &num, &last, &check) == 2 && last == 'w') {
sprintf(sysname, "temp_min%d", num);
*sysmag = TEMPMAG;
return 0;
}
if(sscanf(name, "temp%d_ma%c%c", &num, &last, &check) == 2 && last == 'x') {
sprintf(sysname, "temp_max%d", num);
*sysmag = TEMPMAG;
return 0;
}
if(sscanf(name, "temp%d_hig%c%c", &num, &last, &check) == 2 && last == 'h') {
sprintf(sysname, "temp_max%d", num);
*sysmag = TEMPMAG;
return 0;
}
if(sscanf(name, "tcrit%d%c", &num, &check) == 1) {
sprintf(sysname, "temp_crit%d", num);
*sysmag = TEMPMAG;
return 0;
}
if(sscanf(name, "temp%d%c", &num, &check) == 1) {
sprintf(sysname, "temp_input%d", num);
*sysmag = TEMPMAG;
+30 -9
View File
@@ -4536,7 +4536,7 @@ void print_lm83(const sensors_chip_name *name)
void print_lm90(const sensors_chip_name *name)
{
char *label;
double cur, high, low;
double cur, high, low, hyst;
int valid, alarms;
if (!sensors_get_feature(*name, SENSORS_LM90_ALARMS, &cur))
@@ -4579,13 +4579,36 @@ void print_lm90(const sensors_chip_name *name)
printf("ERROR: Can't get remote temperature data!\n");
free_the_label(&label);
/* 2.6 tweak:
* In 2.4 there is only one, relative hyst value, (default 10).
* In 2.6 there are two, absolute values.
* The library will link hyst (2.4) to temp_hyst2 (2.6) and we have
* to compute the relative value from temp_hyst2 and temp_crit2.
* We detect that using the following rules:
* - if hyst is not in the range 0..31, it is absolute (2.6);
* - if hyst exceeds tcrit1 or tcrit2, it is absolute (2.6);
* - if hyst is greater than it would be if considered absolute,
* it is absolute (heuristic);
* - else it is relative (2.4).
* Also note that the use of low and high right below is
* arbitrary, only to reuse previously defined variables, at the
* admitted cost of a lower readability.
*/
if (!sensors_get_feature(*name, SENSORS_LM90_TCRIT_HYST, &hyst)
&& !sensors_get_feature(*name, SENSORS_LM90_LOCAL_TCRIT, &low)
&& !sensors_get_feature(*name, SENSORS_LM90_REMOTE_TCRIT, &high)) {
if (hyst<=-0.5 || hyst>=31.5 || hyst>low || hyst>high || hyst>high-hyst)
hyst = high-hyst;
} else {
printf("ERROR: Can't get hyst data!\n");
hyst = 10;
}
if (!sensors_get_label_and_valid(*name, SENSORS_LM90_LOCAL_TCRIT,
&label, &valid)
&& !sensors_get_feature(*name, SENSORS_LM90_LOCAL_TCRIT, &high)
&& !sensors_get_feature(*name, SENSORS_LM90_TCRIT_HYST, &low)) {
&label, &valid)) {
if (valid) {
print_label(label, 10);
print_temp_info(high, high-low, 0, HYSTONLY, 0, 0);
print_temp_info(low, low-hyst, 0, HYSTONLY, 0, 0);
printf("\n");
}
} else
@@ -4593,12 +4616,10 @@ void print_lm90(const sensors_chip_name *name)
free_the_label(&label);
if (!sensors_get_label_and_valid(*name, SENSORS_LM90_REMOTE_TCRIT,
&label, &valid)
&& !sensors_get_feature(*name, SENSORS_LM90_REMOTE_TCRIT, &high)
&& !sensors_get_feature(*name, SENSORS_LM90_TCRIT_HYST, &low)) {
&label, &valid)) {
if (valid) {
print_label(label, 10);
print_temp_info(high, high-low, 0, HYSTONLY, 0, 0);
print_temp_info(high, high-hyst, 0, HYSTONLY, 0, 0);
printf("\n");
}
} else