Skip to contentSkip to conversation

lm85: fix PWM control on SMSC EMC2300 &

RFC PATCH In review Steve Glendinning 2 participants 3 messages Jun 17, 2011 – Aug 5, 2011 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 lm85: fix PWM control on SMSC EMC2300 &

This patch works around a quirk of the hardware's implementation to allow raw PWM fan drive values to be set. Without it the device never leaves auto control mode so the PWM output request is ignored.

I'm not sure if this is the right place for the workaround, comments?

---
 drivers/hwmon/lm85.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/hwmon/lm85.c +13 -0
index da72dc1..f4e124b 100644
@@ -1146,8 +1146,21 @@ static const struct attribute_group lm85_group_in567 = {
 
 static void lm85_init_client(struct i2c_client *client)
 {
+	struct lm85_data *data = i2c_get_clientdata(client);
 	int value;
 
+	/* For emc2300 & emc6d103s when auto temp min is the default value,
+	 * pwm can never be controlled manually, so change this */
+	if (data->type = emc6d103s) {
+		int nr;
+
+		for (nr = 0; nr < 3; nr++) {
+			data->zone[nr].limit = TEMP_TO_REG(-127000);
+			lm85_write_value(client, LM85_REG_AFAN_LIMIT(nr),
+				data->zone[nr].limit);
+		}
+	}
+
 	/* Start monitoring if needed */
 	value = lm85_read_value(client, LM85_REG_CONFIG);
 	if (!(value & 0x01)) {
Signature · 7 lines
1.7.4.1


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

RFC PATCH 1/1 lm85: fix PWM control on SMSC EMC2300 &

This patch works around a quirk of the hardware's implementation to allow raw PWM fan drive values to be set. Without it the device never leaves auto control mode so the PWM output request is ignored.

I'm not sure if this is the right place for the workaround, comments?

---
 drivers/hwmon/lm85.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/hwmon/lm85.c +13 -0
index da72dc1..f4e124b 100644
@@ -1146,8 +1146,21 @@ static const struct attribute_group lm85_group_in567 = {
 
 static void lm85_init_client(struct i2c_client *client)
 {
+	struct lm85_data *data = i2c_get_clientdata(client);
 	int value;
 
+	/* For emc2300 & emc6d103s when auto temp min is the default value,
+	 * pwm can never be controlled manually, so change this */
+	if (data->type = emc6d103s) {
+		int nr;
+
+		for (nr = 0; nr < 3; nr++) {
+			data->zone[nr].limit = TEMP_TO_REG(-127000);
+			lm85_write_value(client, LM85_REG_AFAN_LIMIT(nr),
+				data->zone[nr].limit);
+		}
+	}
+
 	/* Start monitoring if needed */
 	value = lm85_read_value(client, LM85_REG_CONFIG);
 	if (!(value & 0x01)) {
Signature · 7 lines
1.7.4.1


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

Re: [lm-sensors] [PATCH] [RFC] lm85: fix PWM control on SMSC

In reply to Steve Glendinning
Quoted 6 lines · Steve Glendinning

This patch works around a quirk of the hardware's implementation to allow raw PWM fan drive values to be set. Without it the device never leaves auto control mode so the PWM output request is ignored.

I'm not sure if this is the right place for the workaround, comments?

Problem is that your changes are unconditional, meaning any BIOS side automatic fan control settings would be overwritten and might cause unpredictable and undesired results.

It would probably make more sense to have this kind of code in set_pwm_enable(), and only execute it if manual pwm control is selected. Similar, if automatic pwm control is selected, it might be necessary to reset the limit to the default to actually enable auto-pwm.

Either case, I think we will have to wait for feedback from Jean, since he knows the driver much better than me.

Thanks,
Guenter

Quoted 21 lines
---
 drivers/hwmon/lm85.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/hwmon/lm85.c +6 -0
index da72dc1..f4e124b 100644
@@ -1146,8 +1146,21 @@ static const struct attribute_group lm85_group_in567 = {
 
 static void lm85_init_client(struct i2c_client *client)
 {
+	struct lm85_data *data = i2c_get_clientdata(client);
 	int value;
 
+	/* For emc2300 & emc6d103s when auto temp min is the default value,
+	 * pwm can never be controlled manually, so change this */
+	if (data->type = emc6d103s) {
+		int nr;
+

drivers/hwmon/lm85.c static const struct attribute_group lm85_group_in567 = { · line 1166

Quoted 10 lines
drivers/hwmon/lm85.c +7 -0
+		for (nr = 0; nr < 3; nr++) {
+			data->zone[nr].limit = TEMP_TO_REG(-127000);
+			lm85_write_value(client, LM85_REG_AFAN_LIMIT(nr),
+				data->zone[nr].limit);
+		}
+	}
+
 	/* Start monitoring if needed */
 	value = lm85_read_value(client, LM85_REG_CONFIG);
 	if (!(value & 0x01)) {

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