2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 22:35:23 +00:00

Enhance w83791d support. Add output for in7, in8, in9, fan4 and fan5.

Also update to display the (beep) properly due to the fact that the
w83791d beep enable mask is different than the alarm mask.
Patch from Sven Anders and Charles Spirakis.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4096 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2006-08-18 16:06:55 +00:00
parent 0d15763f81
commit 2396d5cab7
3 changed files with 105 additions and 9 deletions

View File

@@ -30,6 +30,7 @@ lm_sensors CHANGES file
Module i2c-viapro: Fix compilation with kernels < 2.4.21
Module lm83: Add LM82 support (2.6 backport)
Module w83781d: Use real-time alarm registers when possible (2.6 backport)
Add specific alarm and beep defines for the W83791D
Module w83792d: Fix PWM range (2.6 backport)
Program decode-dimms.pl: Decode depending on the memory type
Decode the manufacturing date to an ISO8601 date
@@ -47,6 +48,7 @@ lm_sensors CHANGES file
Fix memory leak when printing an unknown chip
Add it8716 and it8718 support
Make each it87 fan and fan div optional
Print missing w83791d values
Program sensors-detect: Add ServerWorks HT-1000 SMBus detection
Add ATI IXP200/300/400 SMBus detection
Prevent warning on 64-bit PCI addresses

View File

@@ -135,7 +135,7 @@ MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization");
#define W83781D_REG_CHIPMAN 0x4F
#define W83781D_REG_PIN 0x4B
/* 782D/783S only */
/* 782D/783S/791D only */
#define W83781D_REG_VBAT 0x5D
/* PWM 782D (1-4) and 783S (1-2) only */
@@ -387,14 +387,24 @@ static struct i2c_driver w83781d_driver = {
#define W83781D_ALARM_IN6 0x0400
#define W83782D_ALARM_IN7 0x10000
#define W83782D_ALARM_IN8 0x20000
#define W83791D_ALARM_IN7 0x080000 /* 791D only */
#define W83791D_ALARM_IN8 0x100000 /* 791D only */
#define W83791D_ALARM_IN9 0x004000 /* 791D only */
#define W83781D_ALARM_FAN1 0x0040
#define W83781D_ALARM_FAN2 0x0080
#define W83781D_ALARM_FAN3 0x0800
#define W83791D_ALARM_FAN4 0x200000 /* 791D only */
#define W83791D_ALARM_FAN5 0x400000 /* 791D only */
#define W83781D_ALARM_TEMP1 0x0010
#define W83781D_ALARM_TEMP23 0x0020 /* 781D only */
#define W83781D_ALARM_TEMP2 0x0020 /* 782D/783S */
#define W83781D_ALARM_TEMP3 0x2000 /* 782D only */
#define W83781D_ALARM_CHAS 0x1000
#define W83781D_ALARM_TEMP2 0x0020 /* 782D/783S/791D */
#define W83781D_ALARM_TEMP3 0x2000 /* 782D/791D */
#define W83781D_ALARM_CHAS 0x1000 /* 782D/791D */
#define W83791D_BEEP_IN1 0x002000 /* 791D only */
#define W83791D_BEEP_IN7 0x010000 /* 791D only */
#define W83791D_BEEP_IN8 0x020000 /* 791D only */
#define W83791D_BEEP_TEMP3 0x000002 /* 791D only */
/* -- SENSORS SYSCTL END -- */

View File

@@ -2187,7 +2187,8 @@ void print_w83781d(const sensors_chip_name *name)
char *label;
double cur,min,max,fdiv,sens;
int alarms,beeps;
int is81d, is82d, is83s, is697hf, is627thf, valid;
int beep_mask;
int is81d, is82d, is83s, is91d, is697hf, is627thf, valid;
is81d = !strcmp(name->prefix,"w83781d");
is82d = (!strcmp(name->prefix,"w83782d")) ||
@@ -2196,6 +2197,7 @@ void print_w83781d(const sensors_chip_name *name)
(!strcmp(name->prefix, "w83627thf")) ||
(!strcmp(name->prefix, "w83687thf"));
is83s = !strcmp(name->prefix,"w83783s");
is91d = !strcmp(name->prefix,"w83791d");
is627thf = (!strcmp(name->prefix,"w83627thf")) ||
(!strcmp(name->prefix, "w83637hf")) ||
(!strcmp(name->prefix, "w83687thf"));
@@ -2234,10 +2236,16 @@ void print_w83781d(const sensors_chip_name *name)
!sensors_get_feature(*name,SENSORS_W83781D_IN1_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_W83781D_IN1_MAX,&max)) {
if (valid) {
/* for the w83791d, beep mask is different than the alarm mask */
if (is91d)
beep_mask = W83791D_BEEP_IN1;
else
beep_mask = W83781D_ALARM_IN1;
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n",
cur,min,max,alarms&W83781D_ALARM_IN1?"ALARM":" ",
beeps&W83781D_ALARM_IN1?"(beep)":"");
beeps&beep_mask?"(beep)":"");
}
} else
printf("ERROR: Can't get IN1 data!\n");
@@ -2339,6 +2347,48 @@ void print_w83781d(const sensors_chip_name *name)
free(label);
}
if (is91d) {
if (!sensors_get_label_and_valid(*name,SENSORS_W83791D_IN7,&label,&valid) &&
!sensors_get_feature(*name,SENSORS_W83791D_IN7,&cur) &&
!sensors_get_feature(*name,SENSORS_W83791D_IN7_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_W83791D_IN7_MAX,&max)) {
if (valid) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n",
cur,min,max,alarms&W83791D_ALARM_IN7?"ALARM":" ",
beeps&W83791D_BEEP_IN7?"(beep)":"");
}
} else
printf("ERROR: Can't get IN7 data!\n");
free(label);
if (!sensors_get_label_and_valid(*name,SENSORS_W83791D_IN8,&label,&valid) &&
!sensors_get_feature(*name,SENSORS_W83791D_IN8,&cur) &&
!sensors_get_feature(*name,SENSORS_W83791D_IN8_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_W83791D_IN8_MAX,&max)) {
if (valid) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n",
cur,min,max,alarms&W83791D_ALARM_IN8?"ALARM":" ",
beeps&W83791D_BEEP_IN8?"(beep)":"");
}
} else
printf("ERROR: Can't get IN8 data!\n");
free(label);
if (!sensors_get_label_and_valid(*name,SENSORS_W83791D_IN9,&label,&valid) &&
!sensors_get_feature(*name,SENSORS_W83791D_IN9,&cur) &&
!sensors_get_feature(*name,SENSORS_W83791D_IN9_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_W83791D_IN9_MAX,&max)) {
if (valid) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n",
cur,min,max,alarms&W83791D_ALARM_IN9?"ALARM":" ",
beeps&W83791D_ALARM_IN9?"(beep)":"");
}
} else
printf("ERROR: Can't get IN9 data!\n");
free(label);
}
if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_FAN1,&label,&valid) &&
!sensors_get_feature(*name,SENSORS_W83781D_FAN1,&cur) &&
!sensors_get_feature(*name,SENSORS_W83781D_FAN1_DIV,&fdiv) &&
@@ -2382,6 +2432,35 @@ void print_w83781d(const sensors_chip_name *name)
free(label);
}
if(is91d) {
if (!sensors_get_label_and_valid(*name,SENSORS_W83791D_FAN4,&label,&valid) &&
!sensors_get_feature(*name,SENSORS_W83791D_FAN4,&cur) &&
!sensors_get_feature(*name,SENSORS_W83791D_FAN4_DIV,&fdiv) &&
!sensors_get_feature(*name,SENSORS_W83791D_FAN4_MIN,&min)) {
if (valid) {
print_label(label,10);
printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s %s\n",
cur,min,fdiv, alarms&W83791D_ALARM_FAN4?"ALARM":" ",
beeps&W83791D_ALARM_FAN4?"(beep)":"");
}
} else
printf("ERROR: Can't get FAN4 data!\n");
free(label);
if (!sensors_get_label_and_valid(*name,SENSORS_W83791D_FAN5,&label,&valid) &&
!sensors_get_feature(*name,SENSORS_W83791D_FAN5,&cur) &&
!sensors_get_feature(*name,SENSORS_W83791D_FAN5_DIV,&fdiv) &&
!sensors_get_feature(*name,SENSORS_W83791D_FAN5_MIN,&min)) {
if (valid) {
print_label(label,10);
printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s %s\n",
cur,min,fdiv, alarms&W83791D_ALARM_FAN5?"ALARM":" ",
beeps&W83791D_ALARM_FAN5?"(beep)":"");
}
} else
printf("ERROR: Can't get FAN5 data!\n");
free(label);
}
if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_TEMP1,&label,&valid) &&
!sensors_get_feature(*name,SENSORS_W83781D_TEMP1,&cur) &&
!sensors_get_feature(*name,SENSORS_W83781D_TEMP1_HYST,&min) &&
@@ -2453,10 +2532,15 @@ void print_w83781d(const sensors_chip_name *name)
if(!is82d) {
print_label(label,10);
print_temp_info( cur, max, min, HYST, 1, 0);
if (!is81d)
if (!is81d) {
/* for the w83791d, beep mask is different than the alarm mask */
if (is91d)
beep_mask = W83791D_BEEP_TEMP3;
else
beep_mask = W83781D_ALARM_TEMP3;
printf(" %s %s\n", alarms&W83781D_ALARM_TEMP3?"ALARM":" ",
beeps&W83781D_ALARM_TEMP3?"(beep)":"");
else
beeps&beep_mask?"(beep)":"");
} else
printf(" %s %s\n", alarms&W83781D_ALARM_TEMP23?"ALARM":" ",
beeps&W83781D_ALARM_TEMP23?"(beep)":"");
} else {