2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 14:25:39 +00:00

merge it87 separate alarms_* /proc entries to single alarms entry to standardize

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1202 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker
2001-10-14 15:18:37 +00:00
parent 7bd97f4667
commit e836047a83
5 changed files with 45 additions and 105 deletions

View File

@@ -65,7 +65,7 @@ static unsigned int normal_isa[] = { 0x0290, SENSORS_ISA_END };
static unsigned int normal_isa_range[] = { SENSORS_ISA_END };
/* Insmod parameters */
SENSORS_INSMOD_1(it87);
SENSORS_INSMOD_4(it87, it8705, it8712, sis950);
/* Update battery voltage after every reading if true */
@@ -232,9 +232,7 @@ struct it87_data {
u8 temp_low[3]; /* Register value */
u8 fan_div[3]; /* Register encoding, shifted right */
u8 vid; /* Register encoding, combined */
u8 alarms_fan; /* Register value */
u8 alarms_vin; /* Register value */
u8 alarms_temp; /* Register value */
u32 alarms; /* Register encoding, combined */
};
@@ -270,11 +268,7 @@ static void it87_temp(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static void it87_vid(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static void it87_alarms_fan(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static void it87_alarms_vin(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static void it87_alarms_temp(struct i2c_client *client, int operation,
static void it87_alarms(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static void it87_fan_div(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
@@ -336,12 +330,8 @@ static ctl_table it87_dir_table_template[] = {
&i2c_sysctl_real, NULL, &it87_vid},
{IT87_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &it87_fan_div},
{IT87_SYSCTL_ALARMS_FAN, "alarms_fan", NULL, 0, 0444, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &it87_alarms_fan},
{IT87_SYSCTL_ALARMS_VIN, "alarms_vin", NULL, 0, 0444, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &it87_alarms_vin},
{IT87_SYSCTL_ALARMS_TEMP, "alarms_temp", NULL, 0, 0444, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &it87_alarms_temp},
{IT87_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &it87_alarms},
{0}
};
@@ -727,12 +717,10 @@ void it87_update_client(struct i2c_client *client)
data->fan_div[1] = (i >> 3) & 0x07;
data->fan_div[2] = 1;
data->alarms_fan =
it87_read_value(client, IT87_REG_ALARM1) & 0x7;
data->alarms_vin =
it87_read_value(client, IT87_REG_ALARM2) & 0xff;
data->alarms_temp =
it87_read_value(client, IT87_REG_ALARM3) & 0x7;
data->alarms =
it87_read_value(client, IT87_REG_ALARM1) |
(it87_read_value(client, IT87_REG_ALARM2) << 8) |
(it87_read_value(client, IT87_REG_ALARM3) << 16);
data->last_updated = jiffies;
data->valid = 1;
@@ -855,7 +843,7 @@ void it87_vid(struct i2c_client *client, int operation, int ctl_name,
}
}
void it87_alarms_fan(struct i2c_client *client, int operation,
void it87_alarms(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results)
{
struct it87_data *data = client->data;
@@ -863,33 +851,7 @@ void it87_alarms_fan(struct i2c_client *client, int operation,
*nrels_mag = 0;
else if (operation == SENSORS_PROC_REAL_READ) {
it87_update_client(client);
results[0] = ALARMS_FROM_REG(data->alarms_fan);
*nrels_mag = 1;
}
}
void it87_alarms_vin(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results)
{
struct it87_data *data = client->data;
if (operation == SENSORS_PROC_REAL_INFO)
*nrels_mag = 0;
else if (operation == SENSORS_PROC_REAL_READ) {
it87_update_client(client);
results[0] = ALARMS_FROM_REG(data->alarms_vin);
*nrels_mag = 1;
}
}
void it87_alarms_temp(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results)
{
struct it87_data *data = client->data;
if (operation == SENSORS_PROC_REAL_INFO)
*nrels_mag = 0;
else if (operation == SENSORS_PROC_REAL_READ) {
it87_update_client(client);
results[0] = ALARMS_FROM_REG(data->alarms_temp);
results[0] = ALARMS_FROM_REG(data->alarms);
*nrels_mag = 1;
}
}

View File

@@ -487,24 +487,22 @@
#define IT87_SYSCTL_TEMP3 1202 /* Degrees Celcius * 10 */
#define IT87_SYSCTL_VID 1300 /* Volts * 100 */
#define IT87_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define IT87_SYSCTL_ALARMS_FAN 2001 /* bitvector */
#define IT87_SYSCTL_ALARMS_VIN 2002 /* bitvector */
#define IT87_SYSCTL_ALARMS_TEMP 2003 /* bitvector */
#define IT87_SYSCTL_ALARMS 2004 /* bitvector */
#define IT87_ALARM_IN0 0x0001
#define IT87_ALARM_IN1 0x0002
#define IT87_ALARM_IN2 0x0004
#define IT87_ALARM_IN3 0x0008
#define IT87_ALARM_IN4 0x0010
#define IT87_ALARM_IN5 0x0020
#define IT87_ALARM_IN6 0x0040
#define IT87_ALARM_IN7 0x0080
#define IT87_ALARM_IN0 0x000100
#define IT87_ALARM_IN1 0x000200
#define IT87_ALARM_IN2 0x000400
#define IT87_ALARM_IN3 0x000800
#define IT87_ALARM_IN4 0x001000
#define IT87_ALARM_IN5 0x002000
#define IT87_ALARM_IN6 0x004000
#define IT87_ALARM_IN7 0x008000
#define IT87_ALARM_FAN1 0x0001
#define IT87_ALARM_FAN2 0x0002
#define IT87_ALARM_FAN3 0x0004
#define IT87_ALARM_TEMP1 0x0001
#define IT87_ALARM_TEMP2 0x0002
#define IT87_ALARM_TEMP3 0x0004
#define IT87_ALARM_TEMP1 0x00010000
#define IT87_ALARM_TEMP2 0x00020000
#define IT87_ALARM_TEMP3 0x00040000
#define FSCPOS_SYSCTL_VOLT0 1000 /* 12 volt supply */
#define FSCPOS_SYSCTL_VOLT1 1001 /* 5 volt supply */

View File

@@ -2227,12 +2227,8 @@ static sensors_chip_feature it87_features[] =
{ SENSORS_IT87_FAN3_DIV, "fan3_div", SENSORS_IT87_FAN3, SENSORS_NO_MAPPING,
SENSORS_MODE_R, IT87_SYSCTL_FAN_DIV, VALUE(3),
0 },
{ SENSORS_IT87_ALARMS_FAN, "alarms_fan", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
SENSORS_MODE_R, IT87_SYSCTL_ALARMS_FAN, VALUE(1), 0 },
{ SENSORS_IT87_ALARMS_VIN, "alarms_vin", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
SENSORS_MODE_R, IT87_SYSCTL_ALARMS_VIN, VALUE(1), 0 },
{ SENSORS_IT87_ALARMS_TEMP, "alarms_temp", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
SENSORS_MODE_R, IT87_SYSCTL_ALARMS_TEMP, VALUE(1), 0 },
{ SENSORS_IT87_ALARMS, "alarms", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING,
SENSORS_MODE_R, IT87_SYSCTL_ALARMS, VALUE(1), 0 },
{ 0 }
};

View File

@@ -1020,6 +1020,7 @@
#define SENSORS_IT87_ALARMS_FAN 81 /* R */
#define SENSORS_IT87_ALARMS_VIN 82 /* R */
#define SENSORS_IT87_ALARMS_TEMP 83 /* R */
#define SENSORS_IT87_ALARMS 84 /* R */
/* fsc poseidon chip */

View File

@@ -2430,33 +2430,16 @@ void print_it87(const sensors_chip_name *name)
{
char *label = NULL;
double cur, min, max, fdiv;
int alarms_fan, alarms_vin, alarms_temp, valid;
int alarms, valid;
if (!sensors_get_feature(*name,SENSORS_IT87_ALARMS_FAN, &cur)) {
alarms_fan = cur + 0.5;
if (!sensors_get_feature(*name,SENSORS_IT87_ALARMS, &cur)) {
alarms = cur + 0.5;
}
else {
printf("ERROR: Can't get fan alarm data!\n");
alarms_fan = 0;
printf("ERROR: Can't get alarm data!\n");
alarms = 0;
}
if (!sensors_get_feature(*name,SENSORS_IT87_ALARMS_VIN, &cur)) {
alarms_vin = cur + 0.5;
}
else {
printf("ERROR: Can't get vin alarm data!\n");
alarms_vin = 0;
}
if (!sensors_get_feature(*name,SENSORS_IT87_ALARMS_TEMP, &cur)) {
alarms_temp = cur + 0.5;
}
else {
printf("ERROR: Can't get temp alarm data!\n");
alarms_temp = 0;
}
if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN0,&label,&valid) &&
!sensors_get_feature(*name,SENSORS_IT87_IN0,&cur) &&
!sensors_get_feature(*name,SENSORS_IT87_IN0_MIN,&min) &&
@@ -2464,7 +2447,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur,min,max,alarms_vin&IT87_ALARM_IN0?"ALARM":"");
cur,min,max,alarms&IT87_ALARM_IN0?"ALARM":"");
}
} else
printf("ERROR: Can't get IN0 data!\n");
@@ -2476,7 +2459,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur,min,max,alarms_vin&IT87_ALARM_IN1?"ALARM":"");
cur,min,max,alarms&IT87_ALARM_IN1?"ALARM":"");
}
} else
printf("ERROR: Can't get IN1 data!\n");
@@ -2488,7 +2471,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur,min,max,alarms_vin&IT87_ALARM_IN2?"ALARM":"");
cur,min,max,alarms&IT87_ALARM_IN2?"ALARM":"");
}
} else
printf("ERROR: Can't get IN2 data!\n");
@@ -2500,7 +2483,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur,min,max,alarms_vin&IT87_ALARM_IN3?"ALARM":"");
cur,min,max,alarms&IT87_ALARM_IN3?"ALARM":"");
}
} else
printf("ERROR: Can't get IN3 data!\n");
@@ -2512,7 +2495,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur,min,max,alarms_vin&IT87_ALARM_IN4?"ALARM":"");
cur,min,max,alarms&IT87_ALARM_IN4?"ALARM":"");
}
} else
printf("ERROR: Can't get IN4 data!\n");
@@ -2524,7 +2507,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur,min,max,alarms_vin&IT87_ALARM_IN5?"ALARM":"");
cur,min,max,alarms&IT87_ALARM_IN5?"ALARM":"");
}
} else
printf("ERROR: Can't get IN5 data!\n");
@@ -2536,7 +2519,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur,min,max,alarms_vin&IT87_ALARM_IN6?"ALARM":"");
cur,min,max,alarms&IT87_ALARM_IN6?"ALARM":"");
}
} else
printf("ERROR: Can't get IN6 data!\n");
@@ -2548,7 +2531,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur,min,max,alarms_vin&IT87_ALARM_IN7?"ALARM":"");
cur,min,max,alarms&IT87_ALARM_IN7?"ALARM":"");
}
} else
printf("ERROR: Can't get IN7 data!\n");
@@ -2570,7 +2553,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n",
cur,min,fdiv, alarms_fan&IT87_ALARM_FAN1?"ALARM":"");
cur,min,fdiv, alarms&IT87_ALARM_FAN1?"ALARM":"");
}
} else
printf("ERROR: Can't get FAN1 data!\n");
@@ -2582,7 +2565,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n",
cur,min,fdiv, alarms_fan&IT87_ALARM_FAN2?"ALARM":"");
cur,min,fdiv, alarms&IT87_ALARM_FAN2?"ALARM":"");
}
} else
printf("ERROR: Can't get FAN2 data!\n");
@@ -2594,7 +2577,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n",
cur,min,fdiv, alarms_fan&IT87_ALARM_FAN3?"ALARM":"");
cur,min,fdiv, alarms&IT87_ALARM_FAN3?"ALARM":"");
}
} else
printf("ERROR: Can't get FAN3 data!\n");
@@ -2607,7 +2590,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
print_temp_info( cur, max, min, MINMAX, 0, 0);
printf( " %s\n", alarms_temp & IT87_ALARM_TEMP1 ? "ALARM" : "" );
printf( " %s\n", alarms & IT87_ALARM_TEMP1 ? "ALARM" : "" );
}
} else
printf("ERROR: Can't get TEMP1 data!\n");
@@ -2619,7 +2602,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
print_temp_info( cur, max, min, MINMAX, 0, 0);
printf( " %s\n", alarms_temp & IT87_ALARM_TEMP2 ? "ALARM" : "" );
printf( " %s\n", alarms & IT87_ALARM_TEMP2 ? "ALARM" : "" );
}
} else
printf("ERROR: Can't get TEMP2 data!\n");
@@ -2631,7 +2614,7 @@ void print_it87(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
print_temp_info( cur, max, min, MINMAX, 0, 0);
printf( " %s\n", alarms_temp & IT87_ALARM_TEMP3 ? "ALARM" : "" );
printf( " %s\n", alarms & IT87_ALARM_TEMP3 ? "ALARM" : "" );
}
} else
printf("ERROR: Can't get TEMP3 data!\n");