2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-30 13:57:41 +00:00

Added 'beep' file for GL518SM chips

This file consists of two numbers: the first is either 0 (global sound
alarm disable) or 1 (enable), the second is in the same encoding as the
'alarm' file and determines for which alarms the speaker will sound.

The new file was added to the module, the library and the sensors application.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@112 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Frodo Looijaard 1998-12-24 23:17:55 +00:00
parent 55f5652a9a
commit f3cfdfa7a5
8 changed files with 205 additions and 74 deletions

View File

@ -31,6 +31,11 @@ Within each LM78 directory, you can find the following files:
- LM78_ALARM_FAN[1-2]
Gets triggered when the corresponding FAN value drops below its limit.
If accessed through sysctl, this value is a long.
* beep (GL518_SYSCTL_BEEP)
Two numbers. The first is 0 if all sound signals are disabled; it is 1 if
they are enabled. The second number determines which alarms will cause
a sound signal, if the first number is set to 1. The encoding of the
second number is the same as that in alarms.
* fan[1-2] (GL518_SYSCTL_FAN[1-2])
A list of two numbers. The first is the minimum fan rotation limit; the
second is the current fan rotation speed. Both are in RPM (rotation per

View File

@ -66,6 +66,12 @@
#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1)
#define DIV_FROM_REG(val) (1 << (val))
#define BEEP_ENABLE_TO_REG(val) ((val)?0:1)
#define BEEP_ENABLE_FROM_REG(val) ((val)?0:1)
#define BEEPS_TO_REG(val) ((val) & 0x7f)
#define BEEPS_FROM_REG(val) (val)
/* Initial values */
#define GL518_INIT_TEMP_OVER 600
#define GL518_INIT_TEMP_HYST 500
@ -116,8 +122,9 @@ struct gl518_data {
u8 temp; /* Register values */
u8 temp_over; /* Register values */
u8 temp_hyst; /* Register values */
u8 alarms; /* Register value */
u8 alarms,beeps; /* Register value */
u8 fan_div[2]; /* Register encoding, shifted right */
u8 beep_enable; /* Boolean */
};
#ifdef MODULE
@ -148,6 +155,8 @@ static void gl518_fan_div(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static void gl518_alarms(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static void gl518_beep(struct i2c_client *client, int operation, int ctl_name,
int *nrels_mag, long *results);
/* This is the driver that will be inserted */
static struct i2c_driver gl518_driver = {
@ -185,6 +194,8 @@ static ctl_table gl518_dir_table_template[] = {
&sensors_sysctl_real, NULL, &gl518_fan_div },
{ GL518_SYSCTL_ALARMS, "alarms", NULL, 0, 0644, NULL, &sensors_proc_real,
&sensors_sysctl_real, NULL, &gl518_alarms },
{ GL518_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &sensors_proc_real,
&sensors_sysctl_real, NULL, &gl518_beep },
{ 0 }
};
@ -279,6 +290,8 @@ int gl518_attach_adapter(struct i2c_adapter *adapter)
/* No noisy output (bit 2=1), Comparator mode (bit 3=0), two fans (bit4=0),
standby mode (bit6=0) */
gl518_write_value(new_client,GL518_REG_CONF,0x04);
/* Never interrupts */
gl518_write_value(new_client,GL518_REG_MASK,0x00);
gl518_write_value(new_client,GL518_REG_TEMP_HYST,
TEMP_TO_REG(GL518_INIT_TEMP_HYST));
gl518_write_value(new_client,GL518_REG_TEMP_OVER,
@ -438,11 +451,13 @@ void gl518_update_client(struct i2c_client *client)
data->temp_over = gl518_read_value(client,GL518_REG_TEMP_OVER);
data->temp_hyst = gl518_read_value(client,GL518_REG_TEMP_HYST);
data->alarms = gl518_read_value(client,GL518_REG_ALARM);
data->alarms = gl518_read_value(client,GL518_REG_INT);
data->beeps = gl518_read_value(client,GL518_REG_ALARM);
val = gl518_read_value(client,GL518_REG_MISC);
data->fan_div[0] = (val >> 4) & 0x03;
data->fan_div[1] = (val >> 6) & 0x03;
data->beep_enable = (gl518_read_value(client,GL518_REG_CONF) >> 2) & 1;
data->last_updated = jiffies;
data->valid = 1;
@ -555,6 +570,31 @@ void gl518_alarms(struct i2c_client *client, int operation, int ctl_name,
}
}
void gl518_beep(struct i2c_client *client, int operation, int ctl_name,
int *nrels_mag, long *results)
{
struct gl518_data *data = client->data;
if (operation == SENSORS_PROC_REAL_INFO)
*nrels_mag = 0;
else if (operation == SENSORS_PROC_REAL_READ) {
gl518_update_client(client);
results[0] = BEEP_ENABLE_FROM_REG(data->beep_enable);
results[1] = BEEPS_FROM_REG(data->beeps);
*nrels_mag = 2;
} else if (operation == SENSORS_PROC_REAL_WRITE) {
if (*nrels_mag >= 1) {
data->beep_enable = BEEP_ENABLE_TO_REG(results[0]);
gl518_write_value(client,GL518_REG_CONF,
(gl518_read_value(client,GL518_REG_CONF) & 0xfb) |
(data->beep_enable << 2));
}
if (*nrels_mag >= 2) {
data->beeps = BEEPS_TO_REG(results[1]);
gl518_write_value(client,GL518_REG_ALARM,data->beeps);
}
}
}
void gl518_fan_div(struct i2c_client *client, int operation, int ctl_name,
int *nrels_mag, long *results)
{

View File

@ -179,6 +179,7 @@ struct sensors_chips_data {
#define GL518_SYSCTL_VID 1300
#define GL518_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define GL518_SYSCTL_ALARMS 2001 /* bitvector */
#define GL518_SYSCTL_BEEP 2002 /* bitvector */
#define GL518_ALARM_VDD 0x01
#define GL518_ALARM_VIN1 0x02

View File

@ -360,6 +360,12 @@ static sensors_chip_feature gl518r00_features[] =
{ SENSORS_GL518R00_ALARMS, "alarms", SENSORS_NO_MAPPING,
SENSORS_NO_MAPPING, SENSORS_MODE_R,
GL518_SYSCTL_FAN_DIV, VALUE(3), 0 },
{ SENSORS_GL518R00_BEEP_ENABLE, "beep_enable", SENSORS_GL518R00_ALARMS,
SENSORS_NO_MAPPING, SENSORS_MODE_RW,
GL518_SYSCTL_BEEP, VALUE(1), 0 },
{ SENSORS_GL518R00_BEEPS, "beeps", SENSORS_GL518R00_ALARMS,
SENSORS_GL518R00_ALARMS, SENSORS_MODE_RW,
GL518_SYSCTL_BEEP, VALUE(2), 0 },
{ 0 }
};
@ -429,6 +435,12 @@ static sensors_chip_feature gl518r80_features[] =
{ SENSORS_GL518R80_ALARMS, "alarms", SENSORS_NO_MAPPING,
SENSORS_NO_MAPPING, SENSORS_MODE_R,
GL518_SYSCTL_FAN_DIV, VALUE(3), 0 },
{ SENSORS_GL518R80_BEEP_ENABLE, "beep_enable", SENSORS_GL518R80_ALARMS,
SENSORS_NO_MAPPING, SENSORS_MODE_RW,
GL518_SYSCTL_BEEP, VALUE(1), 0 },
{ SENSORS_GL518R80_BEEPS, "beeps", SENSORS_GL518R80_ALARMS,
SENSORS_GL518R80_ALARMS, SENSORS_MODE_RW,
GL518_SYSCTL_BEEP, VALUE(2), 0 },
{ 0 }
};

View File

@ -196,34 +196,38 @@
#define SENSORS_GL518R00_FAN1_DIV 71 /* RW */
#define SENSORS_GL518R00_FAN2_DIV 72 /* RW */
#define SENSORS_GL518R00_ALARMS 81 /* R */
#define SENSORS_GL518R00_BEEP_ENABLE 82 /* RW */
#define SENSORS_GL518R00_BEEPS 83 /* RW */
/* GL518SM revision 0x80 chips. */
#define SENSORS_GL518R80_PREFIX "gl518sm-r80"
#define SENSORS_GL518R80_VDD 1
#define SENSORS_GL518R80_VIN1 2
#define SENSORS_GL518R80_VIN2 3
#define SENSORS_GL518R80_VIN3 4
#define SENSORS_GL518R80_VDD_MIN 11
#define SENSORS_GL518R80_VIN1_MIN 12
#define SENSORS_GL518R80_VIN2_MIN 13
#define SENSORS_GL518R80_VIN3_MIN 14
#define SENSORS_GL518R80_VDD_MAX 21
#define SENSORS_GL518R80_VIN1_MAX 22
#define SENSORS_GL518R80_VIN2_MAX 23
#define SENSORS_GL518R80_VIN3_MAX 24
#define SENSORS_GL518R80_FAN1 31
#define SENSORS_GL518R80_FAN2 32
#define SENSORS_GL518R80_FAN1_MIN 41
#define SENSORS_GL518R80_FAN2_MIN 42
#define SENSORS_GL518R80_TEMP 51
#define SENSORS_GL518R80_TEMP_HYST 52
#define SENSORS_GL518R80_TEMP_OVER 53
#define SENSORS_GL518R80_VID 61
#define SENSORS_GL518R80_FAN1_DIV 71
#define SENSORS_GL518R80_FAN2_DIV 72
#define SENSORS_GL518R80_VDD 1 /* R */
#define SENSORS_GL518R80_VIN1 2 /* R */
#define SENSORS_GL518R80_VIN2 3 /* R */
#define SENSORS_GL518R80_VIN3 4 /* R */
#define SENSORS_GL518R80_VDD_MIN 11 /* RW */
#define SENSORS_GL518R80_VIN1_MIN 12 /* RW */
#define SENSORS_GL518R80_VIN2_MIN 13 /* RW */
#define SENSORS_GL518R80_VIN3_MIN 14 /* RW */
#define SENSORS_GL518R80_VDD_MAX 21 /* RW */
#define SENSORS_GL518R80_VIN1_MAX 22 /* RW */
#define SENSORS_GL518R80_VIN2_MAX 23 /* RW */
#define SENSORS_GL518R80_VIN3_MAX 24 /* RW */
#define SENSORS_GL518R80_FAN1 31 /* R */
#define SENSORS_GL518R80_FAN2 32 /* R */
#define SENSORS_GL518R80_FAN1_MIN 41 /* RW */
#define SENSORS_GL518R80_FAN2_MIN 42 /* RW */
#define SENSORS_GL518R80_TEMP 51 /* R */
#define SENSORS_GL518R80_TEMP_HYST 52 /* RW */
#define SENSORS_GL518R80_TEMP_OVER 53 /* RW */
#define SENSORS_GL518R80_VID 61 /* R */
#define SENSORS_GL518R80_FAN1_DIV 71 /* RW */
#define SENSORS_GL518R80_FAN2_DIV 72 /* RW */
#define SENSORS_GL518R80_ALARMS 81 /* R */
#define SENSORS_GL518R80_BEEP_ENABLE 82 /* RW */
#define SENSORS_GL518R80_BEEPS 83 /* RW */
#endif /* def LIB_SENSORS_CHIPS_H */

View File

@ -222,7 +222,7 @@ void print_gl518(const sensors_chip_name *name)
{
char *label = NULL;
double cur,min,max,fdiv;
int alarms;
int alarms,beeps;
int is_r00;
is_r00 = !strcmp(name->prefix,"gl518sm-r00");
@ -232,57 +232,67 @@ void print_gl518(const sensors_chip_name *name)
printf("ERROR: Can't get alarm data!\n");
alarms = 0;
}
if (!sensors_get_feature(*name,SENSORS_GL518R00_BEEPS,&cur))
beeps = cur + 0.5;
else {
printf("ERROR: Can't get beep data!\n");
beeps = 0;
}
if (!sensors_get_label(*name,SENSORS_GL518R00_VDD,&label) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VDD,&cur) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VDD_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VDD_MAX,&max)) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur,min,max,alarms&GL518_ALARM_VDD?"ALARM":"");
} else
printf("ERROR: Can't get VDD data!\n");
free_the_label(&label);
/* We need special treatment for the R00 chips, because they can't display
actual readings! We hardcode this, as this is the easiest way. */
if (is_r00) {
if (!sensors_get_label(*name,SENSORS_GL518R00_VDD,&label) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VDD_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VDD_MAX,&max)) {
print_label(label,10);
printf(" (min = %+6.2f V, max = %+6.2f V) %s %s\n",
min,max,alarms&GL518_ALARM_VDD?"ALARM":"",
beeps&GL518_ALARM_VDD?"(beep)":"");
} else
printf("ERROR: Can't get VDD data!\n");
free_the_label(&label);
if (!sensors_get_label(*name,SENSORS_GL518R00_VIN1,&label) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN1_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN1_MAX,&max)) {
print_label(label,10);
printf(" (min = %+6.2f V, max = %+6.2f V) %s\n",
min,max,alarms&GL518_ALARM_VIN1?"ALARM":"");
printf(" (min = %+6.2f V, max = %+6.2f V) %s %s\n",
min,max,alarms&GL518_ALARM_VIN1?"ALARM":"",
beeps&GL518_ALARM_VIN1?"(beep)":"");
} else
printf("ERROR: Can't get VIN1 data!\n");
free_the_label(&label);
if (!sensors_get_label(*name,SENSORS_GL518R00_VIN2,&label) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN2_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN2_MAX,&max)) {
print_label(label,10);
printf(" (min = %+6.2f V, max = %+6.2f V) %s\n",
min,max,alarms&GL518_ALARM_VIN2?"ALARM":"");
printf(" (min = %+6.2f V, max = %+6.2f V) %s %s\n",
min,max,alarms&GL518_ALARM_VIN2?"ALARM":"",
beeps&GL518_ALARM_VIN2?"(beep)":"");
} else
printf("ERROR: Can't get VIN2 data!\n");
free_the_label(&label);
if (!sensors_get_label(*name,SENSORS_GL518R00_VIN3,&label) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN3_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN3_MAX,&max)) {
print_label(label,10);
printf(" (min = %+6.2f V, max = %+6.2f V) %s\n",
min,max,alarms&GL518_ALARM_VIN3?"ALARM":"");
} else
printf("ERROR: Can't get IN3 data!\n");
printf("ERROR: Can't get IN2 data!\n");
free_the_label(&label);
} else {
if (!sensors_get_label(*name,SENSORS_GL518R00_VDD,&label) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VDD,&cur) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VDD_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VDD_MAX,&max)) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n",
cur,min,max,alarms&GL518_ALARM_VDD?"ALARM":"",
beeps&GL518_ALARM_VDD?"(beep)":"");
} else
printf("ERROR: Can't get VDD data!\n");
free_the_label(&label);
if (!sensors_get_label(*name,SENSORS_GL518R00_VIN1,&label) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN1,&cur) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN1_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN1_MAX,&max)) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur,min,max,alarms&GL518_ALARM_VIN1?"ALARM":"");
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n",
cur,min,max,alarms&GL518_ALARM_VIN1?"ALARM":"",
beeps&GL518_ALARM_VIN1?"(beep)":"");
} else
printf("ERROR: Can't get VIN1 data!\n");
free_the_label(&label);
@ -291,30 +301,35 @@ void print_gl518(const sensors_chip_name *name)
!sensors_get_feature(*name,SENSORS_GL518R00_VIN2_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN2_MAX,&max)) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur,min,max,alarms&GL518_ALARM_VIN2?"ALARM":"");
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n",
cur,min,max,alarms&GL518_ALARM_VIN2?"ALARM":"",
beeps&GL518_ALARM_VIN2?"(beep)":"");
} else
printf("ERROR: Can't get VIN2 data!\n");
free_the_label(&label);
if (!sensors_get_label(*name,SENSORS_GL518R00_VIN3,&label) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN3,&cur) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN3_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN3_MAX,&max)) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur,min,max,alarms&GL518_ALARM_VIN3?"ALARM":"");
} else
printf("ERROR: Can't get IN3 data!\n");
printf("ERROR: Can't get IN2 data!\n");
free_the_label(&label);
}
if (!sensors_get_label(*name,SENSORS_GL518R00_VIN3,&label) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN3,&cur) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN3_MIN,&min) &&
!sensors_get_feature(*name,SENSORS_GL518R00_VIN3_MAX,&max)) {
print_label(label,10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n",
cur,min,max,alarms&GL518_ALARM_VIN3?"ALARM":"",
beeps&GL518_ALARM_VIN3?"(beep)":"");
} else
printf("ERROR: Can't get VIN3 data!\n");
free_the_label(&label);
if (!sensors_get_label(*name,SENSORS_GL518R00_FAN1,&label) &&
!sensors_get_feature(*name,SENSORS_GL518R00_FAN1,&cur) &&
!sensors_get_feature(*name,SENSORS_GL518R00_FAN1_DIV,&fdiv) &&
!sensors_get_feature(*name,SENSORS_GL518R00_FAN1_MIN,&min)) {
print_label(label,10);
printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n",
cur,min,fdiv, alarms&GL518_ALARM_FAN1?"ALARM":"");
printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s %s\n",
cur,min,fdiv, alarms&GL518_ALARM_FAN1?"ALARM":"",
beeps&GL518_ALARM_FAN1?"(beep)":"");
} else
printf("ERROR: Can't get FAN1 data!\n");
free_the_label(&label);
@ -323,8 +338,9 @@ void print_gl518(const sensors_chip_name *name)
!sensors_get_feature(*name,SENSORS_GL518R00_FAN2_DIV,&fdiv) &&
!sensors_get_feature(*name,SENSORS_GL518R00_FAN2_MIN,&min)) {
print_label(label,10);
printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n",
cur,min,fdiv, alarms&GL518_ALARM_FAN2?"ALARM":"");
printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s %s\n",
cur,min,fdiv, alarms&GL518_ALARM_FAN2?"ALARM":"",
beeps&GL518_ALARM_FAN2?"(beep)":"");
} else
printf("ERROR: Can't get FAN2 data!\n");
free_the_label(&label);
@ -334,11 +350,23 @@ void print_gl518(const sensors_chip_name *name)
!sensors_get_feature(*name,SENSORS_GL518R00_TEMP_HYST,&min) &&
!sensors_get_feature(*name,SENSORS_GL518R00_TEMP_OVER,&max)) {
print_label(label,10);
printf("%+3.0f C (limit = %+3.0f C, hysteris = %+3.0f C) %s\n",
cur,max,min, alarms&GL518_ALARM_TEMP?"ALARM":"");
printf("%+3.0f C (limit = %+3.0f C, hysteris = %+3.0f C) %s %s\n",
cur,max,min, alarms&GL518_ALARM_TEMP?"ALARM":"",
beeps&GL518_ALARM_TEMP?"(beep)":"");
} else
printf("ERROR: Can't get TEMP data!\n");
free_the_label(&label);
if (!sensors_get_label(*name,SENSORS_GL518R00_BEEP_ENABLE,&label) &&
!sensors_get_feature(*name,SENSORS_GL518R00_BEEP_ENABLE,&cur)) {
print_label(label,10);
if (cur < 0.5)
printf("Sound alarm disabled\n");
else
printf("Sound alarm enabled\n");
} else
printf("ERROR: Can't get BEEP data!\n");
free_the_label(&label);
}
void print_unknown_chip(const sensors_chip_name *name)

View File

@ -66,6 +66,12 @@
#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1)
#define DIV_FROM_REG(val) (1 << (val))
#define BEEP_ENABLE_TO_REG(val) ((val)?0:1)
#define BEEP_ENABLE_FROM_REG(val) ((val)?0:1)
#define BEEPS_TO_REG(val) ((val) & 0x7f)
#define BEEPS_FROM_REG(val) (val)
/* Initial values */
#define GL518_INIT_TEMP_OVER 600
#define GL518_INIT_TEMP_HYST 500
@ -116,8 +122,9 @@ struct gl518_data {
u8 temp; /* Register values */
u8 temp_over; /* Register values */
u8 temp_hyst; /* Register values */
u8 alarms; /* Register value */
u8 alarms,beeps; /* Register value */
u8 fan_div[2]; /* Register encoding, shifted right */
u8 beep_enable; /* Boolean */
};
#ifdef MODULE
@ -148,6 +155,8 @@ static void gl518_fan_div(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static void gl518_alarms(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results);
static void gl518_beep(struct i2c_client *client, int operation, int ctl_name,
int *nrels_mag, long *results);
/* This is the driver that will be inserted */
static struct i2c_driver gl518_driver = {
@ -185,6 +194,8 @@ static ctl_table gl518_dir_table_template[] = {
&sensors_sysctl_real, NULL, &gl518_fan_div },
{ GL518_SYSCTL_ALARMS, "alarms", NULL, 0, 0644, NULL, &sensors_proc_real,
&sensors_sysctl_real, NULL, &gl518_alarms },
{ GL518_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &sensors_proc_real,
&sensors_sysctl_real, NULL, &gl518_beep },
{ 0 }
};
@ -279,6 +290,8 @@ int gl518_attach_adapter(struct i2c_adapter *adapter)
/* No noisy output (bit 2=1), Comparator mode (bit 3=0), two fans (bit4=0),
standby mode (bit6=0) */
gl518_write_value(new_client,GL518_REG_CONF,0x04);
/* Never interrupts */
gl518_write_value(new_client,GL518_REG_MASK,0x00);
gl518_write_value(new_client,GL518_REG_TEMP_HYST,
TEMP_TO_REG(GL518_INIT_TEMP_HYST));
gl518_write_value(new_client,GL518_REG_TEMP_OVER,
@ -438,11 +451,13 @@ void gl518_update_client(struct i2c_client *client)
data->temp_over = gl518_read_value(client,GL518_REG_TEMP_OVER);
data->temp_hyst = gl518_read_value(client,GL518_REG_TEMP_HYST);
data->alarms = gl518_read_value(client,GL518_REG_ALARM);
data->alarms = gl518_read_value(client,GL518_REG_INT);
data->beeps = gl518_read_value(client,GL518_REG_ALARM);
val = gl518_read_value(client,GL518_REG_MISC);
data->fan_div[0] = (val >> 4) & 0x03;
data->fan_div[1] = (val >> 6) & 0x03;
data->beep_enable = (gl518_read_value(client,GL518_REG_CONF) >> 2) & 1;
data->last_updated = jiffies;
data->valid = 1;
@ -555,6 +570,31 @@ void gl518_alarms(struct i2c_client *client, int operation, int ctl_name,
}
}
void gl518_beep(struct i2c_client *client, int operation, int ctl_name,
int *nrels_mag, long *results)
{
struct gl518_data *data = client->data;
if (operation == SENSORS_PROC_REAL_INFO)
*nrels_mag = 0;
else if (operation == SENSORS_PROC_REAL_READ) {
gl518_update_client(client);
results[0] = BEEP_ENABLE_FROM_REG(data->beep_enable);
results[1] = BEEPS_FROM_REG(data->beeps);
*nrels_mag = 2;
} else if (operation == SENSORS_PROC_REAL_WRITE) {
if (*nrels_mag >= 1) {
data->beep_enable = BEEP_ENABLE_TO_REG(results[0]);
gl518_write_value(client,GL518_REG_CONF,
(gl518_read_value(client,GL518_REG_CONF) & 0xfb) |
(data->beep_enable << 2));
}
if (*nrels_mag >= 2) {
data->beeps = BEEPS_TO_REG(results[1]);
gl518_write_value(client,GL518_REG_ALARM,data->beeps);
}
}
}
void gl518_fan_div(struct i2c_client *client, int operation, int ctl_name,
int *nrels_mag, long *results)
{

View File

@ -179,6 +179,7 @@ struct sensors_chips_data {
#define GL518_SYSCTL_VID 1300
#define GL518_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
#define GL518_SYSCTL_ALARMS 2001 /* bitvector */
#define GL518_SYSCTL_BEEP 2002 /* bitvector */
#define GL518_ALARM_VDD 0x01
#define GL518_ALARM_VIN1 0x02