Skip to contentSkip to conversation

initialize fan_mins in w83781d, asb100 and lm78

PATCH New Jean Delvare 3 participants 3 messages May 19, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 initialize fan_mins in w83781d, asb100 and lm78

Quoting myself:

Quoted 4 lines

While testing, I found a corner case that isn't handled properly. It doesn't seem to be handled by the lm78 and the asb100 either. Setting fanN_div before ever reading from the chip or setting fanN_min will make use of fanN_min while it was never initialized.

The following patch addesses the issue. Tested to work on my AS99127F rev.1 (which means that only the changes to the w83781d driver were actually tested). Testers welcome.

Mark, can you confirm it works for your ASB100 as well? Thanks.

Please apply,
Thanks.

drivers/i2c/chips/asb100.c renamed from drivers/i2c/chips.orig/asb100.c +5 -0
diff -ru linux-2.6.5-rc1/drivers/i2c/chips.orig/asb100.c linux-2.6.5-rc1/drivers/i2c/chips/asb100.c
@@ -807,6 +807,11 @@
 	/* Initialize the chip */
 	asb100_init_client(new_client);
 
+	/* A few vars need to be filled upon startup */
+	data->fan_min[0] = asb100_read_value(new_client, ASB100_REG_FAN_MIN(0));
+	data->fan_min[1] = asb100_read_value(new_client, ASB100_REG_FAN_MIN(1));
+	data->fan_min[2] = asb100_read_value(new_client, ASB100_REG_FAN_MIN(2));
+
 	/* Register sysfs hooks */
 	device_create_file_in(new_client, 0);
 	device_create_file_in(new_client, 1);
drivers/i2c/chips/lm78.c renamed from drivers/i2c/chips.orig/lm78.c +6 -0
diff -ru linux-2.6.5-rc1/drivers/i2c/chips.orig/lm78.c linux-2.6.5-rc1/drivers/i2c/chips/lm78.c
@@ -625,6 +625,12 @@
 	/* Initialize the LM78 chip */
 	lm78_init_client(new_client);
 
+	/* A few vars need to be filled upon startup */
+	for (i = 0; i < 3; i++) {
+		data->fan_min[i] = lm78_read_value(new_client,
+					LM78_REG_FAN_MIN(i));
+	}
+
 	/* Register sysfs hooks */
 	device_create_file(&new_client->dev, &dev_attr_in0_input);
 	device_create_file(&new_client->dev, &dev_attr_in0_min);
drivers/i2c/chips/w83781d.c renamed from drivers/i2c/chips.orig/w83781d.c +6 -0
diff -ru linux-2.6.5-rc1/drivers/i2c/chips.orig/w83781d.c linux-2.6.5-rc1/drivers/i2c/chips/w83781d.c
@@ -1252,6 +1252,12 @@
 	/* Initialize the chip */
 	w83781d_init_client(new_client);
 
+	/* A few vars need to be filled upon startup */
+	for (i = 1; i <= 3; i++) {
+		data->fan_min[i - 1] = w83781d_read_value(new_client,
+					W83781D_REG_FAN_MIN(i));
+	}
+
 	/* Register sysfs hooks */
 	device_create_file_in(new_client, 0);
 	if (kind != w83783s && kind != w83697hf)
Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#1 lore raw

PATCH 1/1 initialize fan_mins in w83781d, asb100 and lm78

Quoted 10 lines · Jean Delvare

Quoting myself:

Quoted 4 lines

While testing, I found a corner case that isn't handled properly. It doesn't seem to be handled by the lm78 and the asb100 either. Setting fanN_div before ever reading from the chip or setting fanN_min will make use of fanN_min while it was never initialized.

The following patch addesses the issue. Tested to work on my AS99127F rev.1 (which means that only the changes to the w83781d driver were actually tested). Testers welcome.

Looks sane to me, applied, thanks.

greg k-h

#2 lore raw

PATCH 1/1 initialize fan_mins in w83781d, asb100 and lm78

In reply to Jean Delvare
Quoted 7 lines · Jean Delvare

Quoting myself:

Quoted 4 lines

While testing, I found a corner case that isn't handled properly. It doesn't seem to be handled by the lm78 and the asb100 either. Setting fanN_div before ever reading from the chip or setting fanN_min will make use of fanN_min while it was never initialized.

Quoted 5 lines

The following patch addesses the issue. Tested to work on my AS99127F rev.1 (which means that only the changes to the w83781d driver were actually tested). Testers welcome.

Mark, can you confirm it works for your ASB100 as well? Thanks.

Yes, this works. Here is what I did exactly, in case you had something else in mind:

modprobe asb100

echo "2000" > .../fan1_min

rmmod asb100

modprobe asb100

sensors -s (which sets fan1_div but not fan1_min)

sensors (which correctly shows fan1 min of 2000)

Regards,

Signature · 2 lines
Mark M. Hoffman
[email protected]