(mds) Limit the as99127f fan_div values to 8. The as99127f apparently

does not support the extended fan_div bits like the w83782d
      does. This should fix fan2 so it defaults to a divisor
      of 2 instead of 32.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@871 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker committed 2000-09-10 23:28:51 +00:00
1 parent 4695a1fbb2
commit ea5430f3f7
2 files changed
+15 -12

No files matched your search

+1
View File
@@ -19,6 +19,7 @@ ask CVS about it:
Module i2c-i801: add i2c block write support, fix smbus block bugs
(requires i2c 2.5.3 package)
Module i2c-i810: support Intel 82815
Module w83781d: limit fan divisors to 8 max. for as99127f
Program i2cdump: Add smbus block read support
Programs i2cdetect, i2cdump: Improve error reporting
Program sensors: new switch -u (--unknown)
+14 -12
View File
@@ -208,7 +208,8 @@ extern inline u8 AS_FAN_TO_REG(long rpm, int div)
extern inline u8 DIV_TO_REG(long val, enum chips type)
{
int i;
val = SENSORS_LIMIT(val, 1, ((type == w83781d) ? 8 : 128)) >> 1;
val = SENSORS_LIMIT(val, 1,
((type == w83781d || type == as99127f) ? 8 : 128)) >> 1;
for (i = 0; i < 6; i++) {
if (val == 0)
break;
@@ -1457,7 +1458,7 @@ void w83781d_update_client(struct i2c_client *client)
data->fan_div[2] = (w83781d_read_value(client,
W83781D_REG_PIN) >>
6) & 0x03;
if (data->type != w83781d) {
if ((data->type != w83781d) && (data->type != as99127f)) {
i = w83781d_read_value(client, W83781D_REG_VBAT);
data->fan_div[0] |= (i >> 3) & 0x04;
data->fan_div[1] |= (i >> 4) & 0x04;
@@ -1733,7 +1734,8 @@ void w83781d_fan_div(struct i2c_client *client, int operation,
*nrels_mag = 3;
} else if (operation == SENSORS_PROC_REAL_WRITE) {
old = w83781d_read_value(client, W83781D_REG_VID_FANDIV);
if (data->type != w83781d) {
/* w83781d and as99127f don't have extended divisor bits */
if ((data->type != w83781d) && data->type != as99127f) {
old3 =
w83781d_read_value(client, W83781D_REG_VBAT);
}
@@ -1742,10 +1744,10 @@ void w83781d_fan_div(struct i2c_client *client, int operation,
DIV_TO_REG(results[2], data->type);
old2 = w83781d_read_value(client, W83781D_REG_PIN);
old2 =
(old2 & 0x3f) | ((data->fan_div[2] & 0x03) <<
6);
(old2 & 0x3f) | ((data->fan_div[2] & 0x03) << 6);
w83781d_write_value(client, W83781D_REG_PIN, old2);
if (data->type != w83781d) {
if ((data->type != w83781d) &&
(data->type != as99127f)) {
old3 =
(old3 & 0x7f) |
((data->fan_div[2] & 0x04) << 5);
@@ -1755,9 +1757,9 @@ void w83781d_fan_div(struct i2c_client *client, int operation,
data->fan_div[1] =
DIV_TO_REG(results[1], data->type);
old =
(old & 0x3f) | ((data->fan_div[1] & 0x03) <<
6);
if (data->type != w83781d) {
(old & 0x3f) | ((data->fan_div[1] & 0x03) << 6);
if ((data->type != w83781d) &&
(data->type != as99127f)) {
old3 =
(old3 & 0xbf) |
((data->fan_div[1] & 0x04) << 4);
@@ -1767,11 +1769,11 @@ void w83781d_fan_div(struct i2c_client *client, int operation,
data->fan_div[0] =
DIV_TO_REG(results[0], data->type);
old =
(old & 0xcf) | ((data->fan_div[0] & 0x03) <<
4);
(old & 0xcf) | ((data->fan_div[0] & 0x03) << 4);
w83781d_write_value(client, W83781D_REG_VID_FANDIV,
old);
if (data->type != w83781d) {
if ((data->type != w83781d) &&
(data->type != as99127f)) {
old3 =
(old3 & 0xdf) |
((data->fan_div[0] & 0x04) << 3);