Skip to contentSkip to conversation

I2C: Enable w83781d and w83627hf temperature channels

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 I2C: Enable w83781d and w83627hf temperature channels

Hi Greg,

The chips supported by the w83781d and w83627hf drivers might come up with their temperature channels disabled. Currently, the w83781d driver does so for temp3 but omits temp2, while the w83627hf driver omits both. The following patch fixes that, and prints warning messages when the driver has to enable the channels (normally the BIOS should do it for us). We also skip this initialization step for the AS99127F chips, for which we have no documentation.

This should hopefully solve the problem reported here:
http://archives.andrew.net.au/lm-sensors/msg29150.html

Thanks,

drivers/i2c/chips/w83781d.c renamed from drivers/i2c/chips/w83781d.c.orig +20 -3
@@ -1562,11 +1562,28 @@
 	}
 #endif				/* W83781D_RT */
 
-	if (init) {
+	if (init && type != as99127f) {
+		/* Enable temp2 */
+		tmp = w83781d_read_value(client, W83781D_REG_TEMP2_CONFIG);
+		if (tmp & 0x01) {
+			dev_warn(&client->dev, "Enabling temp2, readings "
+				 "might not make sense\n");
+			w83781d_write_value(client, W83781D_REG_TEMP2_CONFIG,
+				tmp & 0xfe);
+		}
+
+		/* Enable temp3 */
 		if (type != w83783s && type != w83697hf) {
-			w83781d_write_value(client, W83781D_REG_TEMP3_CONFIG,
-					    0x00);
+			tmp = w83781d_read_value(client,
+				W83781D_REG_TEMP3_CONFIG);
+			if (tmp & 0x01) {
+				dev_warn(&client->dev, "Enabling temp3, "
+					 "readings might not make sense\n");
+				w83781d_write_value(client,
+					W83781D_REG_TEMP3_CONFIG, tmp & 0xfe);
+			}
 		}
+
 		if (type != w83781d) {
 			/* enable comparator mode for temp2 and temp3 so
 			   alarm indication will work correctly */
drivers/i2c/chips/w83627hf.c renamed from drivers/i2c/chips/w83627hf.c.orig +21 -0
@@ -1321,6 +1321,27 @@
 	data->pwmenable[2] = 1;
 
 	if(init) {
+		/* Enable temp2 */
+		tmp = w83627hf_read_value(client, W83781D_REG_TEMP2_CONFIG);
+		if (tmp & 0x01) {
+			dev_warn(&client->dev, "Enabling temp2, readings "
+				 "might not make sense\n");
+			w83627hf_write_value(client, W83781D_REG_TEMP2_CONFIG,
+				tmp & 0xfe);
+		}
+
+		/* Enable temp3 */
+		if (type != w83697hf) {
+			tmp = w83627hf_read_value(client,
+				W83781D_REG_TEMP3_CONFIG);
+			if (tmp & 0x01) {
+				dev_warn(&client->dev, "Enabling temp3, "
+					 "readings might not make sense\n");
+				w83627hf_write_value(client,
+					W83781D_REG_TEMP3_CONFIG, tmp & 0xfe);
+			}
+		}
+
 		if (type = w83627hf) {
 			/* enable PWM2 control (can't hurt since PWM reg
 		           should have been reset to 0xff) */
Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/
Applied
#1 lore raw

PATCH 1/1 I2C: Enable w83781d and w83627hf temperature channels

Quoted 10 lines · Jean Delvare

Hi Greg,

The chips supported by the w83781d and w83627hf drivers might come up with their temperature channels disabled. Currently, the w83781d driver does so for temp3 but omits temp2, while the w83627hf driver omits both. The following patch fixes that, and prints warning messages when the driver has to enable the channels (normally the BIOS should do it for us). We also skip this initialization step for the AS99127F chips, for which we have no documentation.

Quoted 2 lines

This should hopefully solve the problem reported here:
http://archives.andrew.net.au/lm-sensors/msg29150.html

Applied, thanks.

greg k-h