diff --git a/doc/chips/w83781d b/doc/chips/w83781d index bd49c268..289e849e 100644 --- a/doc/chips/w83781d +++ b/doc/chips/w83781d @@ -195,8 +195,8 @@ One user has reported problems with fans stopping occasionally. Note that the individual beep bits are inverted from the other chips. -That is, in the second entry in the 'beep' file, a '1' bit means -disable, not enable. This may be changed in the future. +The driver now takes care of this so that user-space applications +don't have to know about it. Known problems: - Problems with diode/thermistor settings (supported?) diff --git a/kernel/chips/w83781d.c b/kernel/chips/w83781d.c index d176d5e7..4e6d9439 100644 --- a/kernel/chips/w83781d.c +++ b/kernel/chips/w83781d.c @@ -207,8 +207,8 @@ static inline u8 FAN_TO_REG(long rpm, int div) #define ALARMS_FROM_REG(val) (val) #define PWM_FROM_REG(val) (val) #define PWM_TO_REG(val) (SENSORS_LIMIT((val),0,255)) -#define BEEPS_FROM_REG(val) (val) -#define BEEPS_TO_REG(val) ((val) & 0xffffff) +#define BEEPS_FROM_REG(val,type) ((type)==as99127f?(val)^0x7FFF:(val)) +#define BEEPS_TO_REG(val,type) ((type)==as99127f?(~(val))&0x7FFF:(val)&0xffffff) #define BEEP_ENABLE_TO_REG(val) ((val)?1:0) #define BEEP_ENABLE_FROM_REG(val) ((val)?1:0) @@ -1711,11 +1711,11 @@ void w83781d_beep(struct i2c_client *client, int operation, int ctl_name, else if (operation == SENSORS_PROC_REAL_READ) { w83781d_update_client(client); results[0] = BEEP_ENABLE_FROM_REG(data->beep_enable); - results[1] = BEEPS_FROM_REG(data->beeps); + results[1] = BEEPS_FROM_REG(data->beeps, data->type); *nrels_mag = 2; } else if (operation == SENSORS_PROC_REAL_WRITE) { if (*nrels_mag >= 2) { - data->beeps = BEEPS_TO_REG(results[1]); + data->beeps = BEEPS_TO_REG(results[1], data->type); w83781d_write_value(client, W83781D_REG_BEEP_INTS1, data->beeps & 0xff); if ((data->type != w83781d) && diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index d2d484e4..fa74f8f0 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -2100,9 +2100,6 @@ void print_w83781d(const sensors_chip_name *name) if (!sensors_get_feature(*name,SENSORS_W83781D_BEEPS,&cur)) { beeps = cur + 0.5; - /* strangely, as99127f beep bits are inverted */ - if (!strcmp(name->prefix,"as99127f")) - beeps = ~beeps; } else { printf("ERROR: Can't get beep data!\n"); beeps = 0;