Skip to contentSkip to conversation

PATCH: hwmon-f71882fg-17-printout-fan-modes.patch

lm-sensors Applied Hans de Goede 2 participants 2 messages Dec 15, 2008 – Dec 16, 2008 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

Hi Jean,

Print the mode (duty-cycle or RPM) of each fan on driver load (to match the documentation from the previous patch which references this mode printout).

Thanks & Regards,

Hans

p.s.

This is the very last patch of the f8000 work, or so I hope :)

Print the mode (duty-cycle or RPM) of each fan on driver load.

drivers/hwmon/f71882fg.c renamed from drivers/hwmon/f71882fg.c.16-applied +9 -4
@@ -1711,7 +1711,7 @@
 {
 	struct f71882fg_data *data;
 	struct f71882fg_sio_data *sio_data = pdev->dev.platform_data;
-	int err;
+	int err, i, nr_fans = (sio_data->type == f71882fg) ? 4 : 3;
 	u8 start_reg;
 
 	data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL);
@@ -1735,14 +1735,14 @@
 		goto exit_free;
 	}
 
+	data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE);
 	/* If it is a 71862 and the fan / pwm part is enabled sanity check
 	   the pwm settings */
 	if (data->type == f71862fg && (start_reg & 0x02)) {
-		u8 reg = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE);
-		if ((reg & 0x15) != 0x15) {
+		if ((data->pwm_enable & 0x15) != 0x15) {
 			dev_err(&pdev->dev,
 				"Invalid (reserved) pwm settings: 0x%02x\n",
-				(unsigned int)reg);
+				(unsigned int)data->pwm_enable);
 			err = -ENODEV;
 			goto exit_free;
 		}
@@ -1802,6 +1802,11 @@
 		}
 		if (err)
 			goto exit_unregister_sysfs;
+
+		for (i = 0; i < nr_fans; i++)
+			dev_info(&pdev->dev, "Fan: %d is in %s mode\n", i + 1,
+				 (data->pwm_enable & (1 << 2 * i)) ?
+				 "duty-cycle" : "RPM");
 	}
 
 	data->hwmon_dev = hwmon_device_register(&pdev->dev);

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

Applied
#1 lore raw
Quoted 6 lines · Hans de Goede

Hi Jean,

Print the mode (duty-cycle or RPM) of each fan on driver load (to match the documentation from the previous patch which references this mode printout).

Applied, thanks.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors