All of lore.kernel.org
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: linux-kernel@vger.kernel.org, sensors@Stimpy.netroedge.com
Cc: jmunsin@iki.fi
Subject: [PATCH] I2C: fix it87 sensor driver stops CPU fan
Date: Thu, 19 May 2005 06:25:31 +0000	[thread overview]
Message-ID: <11059983961494@kroah.com> (raw)
In-Reply-To: <1105998395257@kroah.com>

ChangeSet 1.2329.2.7, 2005/01/14 14:43:30-08:00, jmunsin@iki.fi

[PATCH] I2C: fix it87 sensor driver stops CPU fan

> 2* I would then add a check to the it87 driver, which completely disables
> the fan speed control interface if the initial configuration looks weird
> (all fans supposedly stopped and polarity set to "active low"). This
> should protect users of the driver who have a faulty BIOS.
>
> When a bogus configuration is detected, we would of course complain in
> the logs and invite the user to complain to his/her motherboard maker
> too.

Here is it87.c_2.6.10-jm4-detect_broken_bios_20050112.diff implementing
this. It goes on top of the previous patch.

- detects broken bioses, disables the pwm for them and prints a message
- fixes an unrelated minor bug in set_fan_div()

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jonas Munsin <jmunsin@iki.fi>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/i2c/chips/it87.c |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)


diff -Nru a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c
--- a/drivers/i2c/chips/it87.c	2005-01-17 13:20:25 -08:00
+++ b/drivers/i2c/chips/it87.c	2005-01-17 13:20:25 -08:00
@@ -500,7 +500,7 @@
 		else
 			data->fan_div[nr] = 3;
 	}
-	val = old & 0x100;
+	val = old & 0x80;
 	val |= (data->fan_div[0] & 0x07);
 	val |= (data->fan_div[1] & 0x07) << 3;
 	if (data->fan_div[2] = 3)
@@ -703,6 +703,8 @@
 	int err = 0;
 	const char *name = "";
 	int is_isa = i2c_is_isa_adapter(adapter);
+	int enable_pwm_interface;
+	int tmp;
 
 	if (!is_isa && 
 	    !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
@@ -812,6 +814,17 @@
 	/* Initialize the IT87 chip */
 	it87_init_client(new_client, data);
 
+	/* Some BIOSes fail to correctly configure the IT87 fans. All fans off
+	 * and polarity set to active low is sign that this is the case so we
+	 * disable pwm control to protect the user. */
+	enable_pwm_interface = 1;
+	tmp = it87_read_value(new_client, IT87_REG_FAN_CTL);
+	if ((tmp & 0x87) = 0) {
+		enable_pwm_interface = 0;
+		dev_info(&new_client->dev,
+			"detected broken BIOS defaults, disabling pwm interface");
+	}
+
 	/* Register sysfs hooks */
 	device_create_file(&new_client->dev, &dev_attr_in0_input);
 	device_create_file(&new_client->dev, &dev_attr_in1_input);
@@ -860,12 +873,14 @@
 	device_create_file(&new_client->dev, &dev_attr_fan2_div);
 	device_create_file(&new_client->dev, &dev_attr_fan3_div);
 	device_create_file(&new_client->dev, &dev_attr_alarms);
-	device_create_file(&new_client->dev, &dev_attr_pwm1_enable);
-	device_create_file(&new_client->dev, &dev_attr_pwm2_enable);
-	device_create_file(&new_client->dev, &dev_attr_pwm3_enable);
-	device_create_file(&new_client->dev, &dev_attr_pwm1);
-	device_create_file(&new_client->dev, &dev_attr_pwm2);
-	device_create_file(&new_client->dev, &dev_attr_pwm3);
+	if (enable_pwm_interface) {
+		device_create_file(&new_client->dev, &dev_attr_pwm1_enable);
+		device_create_file(&new_client->dev, &dev_attr_pwm2_enable);
+		device_create_file(&new_client->dev, &dev_attr_pwm3_enable);
+		device_create_file(&new_client->dev, &dev_attr_pwm1);
+		device_create_file(&new_client->dev, &dev_attr_pwm2);
+		device_create_file(&new_client->dev, &dev_attr_pwm3);
+	}
 
 	if (data->type = it8712) {
 		device_create_file_vrm(new_client);


WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, sensors@Stimpy.netroedge.com
Cc: jmunsin@iki.fi
Subject: [PATCH] I2C: fix it87 sensor driver stops CPU fan
Date: Mon, 17 Jan 2005 13:46:36 -0800	[thread overview]
Message-ID: <11059983961494@kroah.com> (raw)
In-Reply-To: <1105998395257@kroah.com>

ChangeSet 1.2329.2.7, 2005/01/14 14:43:30-08:00, jmunsin@iki.fi

[PATCH] I2C: fix it87 sensor driver stops CPU fan

> 2* I would then add a check to the it87 driver, which completely disables
> the fan speed control interface if the initial configuration looks weird
> (all fans supposedly stopped and polarity set to "active low"). This
> should protect users of the driver who have a faulty BIOS.
>
> When a bogus configuration is detected, we would of course complain in
> the logs and invite the user to complain to his/her motherboard maker
> too.

Here is it87.c_2.6.10-jm4-detect_broken_bios_20050112.diff implementing
this. It goes on top of the previous patch.

- detects broken bioses, disables the pwm for them and prints a message
- fixes an unrelated minor bug in set_fan_div()

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jonas Munsin <jmunsin@iki.fi>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/i2c/chips/it87.c |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)


diff -Nru a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c
--- a/drivers/i2c/chips/it87.c	2005-01-17 13:20:25 -08:00
+++ b/drivers/i2c/chips/it87.c	2005-01-17 13:20:25 -08:00
@@ -500,7 +500,7 @@
 		else
 			data->fan_div[nr] = 3;
 	}
-	val = old & 0x100;
+	val = old & 0x80;
 	val |= (data->fan_div[0] & 0x07);
 	val |= (data->fan_div[1] & 0x07) << 3;
 	if (data->fan_div[2] == 3)
@@ -703,6 +703,8 @@
 	int err = 0;
 	const char *name = "";
 	int is_isa = i2c_is_isa_adapter(adapter);
+	int enable_pwm_interface;
+	int tmp;
 
 	if (!is_isa && 
 	    !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
@@ -812,6 +814,17 @@
 	/* Initialize the IT87 chip */
 	it87_init_client(new_client, data);
 
+	/* Some BIOSes fail to correctly configure the IT87 fans. All fans off
+	 * and polarity set to active low is sign that this is the case so we
+	 * disable pwm control to protect the user. */
+	enable_pwm_interface = 1;
+	tmp = it87_read_value(new_client, IT87_REG_FAN_CTL);
+	if ((tmp & 0x87) == 0) {
+		enable_pwm_interface = 0;
+		dev_info(&new_client->dev,
+			"detected broken BIOS defaults, disabling pwm interface");
+	}
+
 	/* Register sysfs hooks */
 	device_create_file(&new_client->dev, &dev_attr_in0_input);
 	device_create_file(&new_client->dev, &dev_attr_in1_input);
@@ -860,12 +873,14 @@
 	device_create_file(&new_client->dev, &dev_attr_fan2_div);
 	device_create_file(&new_client->dev, &dev_attr_fan3_div);
 	device_create_file(&new_client->dev, &dev_attr_alarms);
-	device_create_file(&new_client->dev, &dev_attr_pwm1_enable);
-	device_create_file(&new_client->dev, &dev_attr_pwm2_enable);
-	device_create_file(&new_client->dev, &dev_attr_pwm3_enable);
-	device_create_file(&new_client->dev, &dev_attr_pwm1);
-	device_create_file(&new_client->dev, &dev_attr_pwm2);
-	device_create_file(&new_client->dev, &dev_attr_pwm3);
+	if (enable_pwm_interface) {
+		device_create_file(&new_client->dev, &dev_attr_pwm1_enable);
+		device_create_file(&new_client->dev, &dev_attr_pwm2_enable);
+		device_create_file(&new_client->dev, &dev_attr_pwm3_enable);
+		device_create_file(&new_client->dev, &dev_attr_pwm1);
+		device_create_file(&new_client->dev, &dev_attr_pwm2);
+		device_create_file(&new_client->dev, &dev_attr_pwm3);
+	}
 
 	if (data->type == it8712) {
 		device_create_file_vrm(new_client);


  reply	other threads:[~2005-05-19  6:25 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-17 21:45 [BK PATCH] I2C fixes for 2.6.11-rc1 Greg KH
2005-05-19  6:25 ` Greg KH
2005-01-17 21:46 ` [PATCH] I2C: add MODULE_DEVICE_TABLE to via686a.c driver Greg KH
2005-05-19  6:25   ` Greg KH
2005-01-17 21:46   ` [PATCH] I2C support for Intel ICH7 - 2.6.10 - resubmit Greg KH
2005-05-19  6:25     ` Greg KH
2005-01-17 21:46     ` [PATCH] I2C: it87 fan update Greg KH
2005-05-19  6:25       ` Greg KH
2005-01-17 21:46       ` [PATCH] I2C: adm1026.c fixes Greg KH
2005-05-19  6:25         ` Greg KH
2005-01-17 21:46         ` [PATCH] I2C: Fix bogus bitmask in lm63 debug message Greg KH
2005-05-19  6:25           ` Greg KH
2005-01-17 21:46           ` [PATCH] I2C: Cleanups to the eeprom driver Greg KH
2005-05-19  6:25             ` Greg KH
2005-01-17 21:46             ` Greg KH [this message]
2005-05-19  6:25               ` [PATCH] I2C: fix it87 sensor driver stops CPU fan Greg KH
2005-01-17 21:46               ` [PATCH] I2C: add EMC6D100 support in lm85 driver Greg KH
2005-05-19  6:25                 ` Greg KH
2005-01-17 21:46                 ` [PATCH] I2C: Improve it87 super-i/o detection Greg KH
2005-05-19  6:25                   ` Greg KH
2005-01-17 21:46                   ` [PATCH] I2C-MPC: use wait_event_interruptible_timeout between transactions Greg KH
2005-05-19  6:25                     ` [PATCH] I2C-MPC: use wait_event_interruptible_timeout between Greg KH
2005-01-17 21:46                     ` [PATCH] I2C-MPC: Convert to platform_device driver Greg KH
2005-05-19  6:25                       ` Greg KH
2005-01-17 22:12 ` [BK PATCH] I2C fixes for 2.6.11-rc1 Greg KH
2005-05-19  6:25   ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2005-05-19  6:25 [PATCH] I2C-MPC: use wait_event_interruptible_timeout Kumar Gala
2005-05-19  6:25 ` Kumar Gala
2005-05-19  6:25 ` Greg KH
2005-01-14  3:35 [PATCH] I2C-MPC: Convert to platform_device driver Kumar Gala
2005-05-19  6:25 ` Kumar Gala
2005-01-14  3:35 ` Kumar Gala
2005-01-14 18:42 ` Greg KH
2005-05-19  6:25   ` Greg KH
2005-01-14 18:42   ` Greg KH
2005-01-14  0:21 [PATCH] I2C-MPC: use wait_event_interruptible_timeout between transactions Kumar Gala
2005-05-19  6:25 ` [PATCH] I2C-MPC: use wait_event_interruptible_timeout between Kumar Gala
2005-01-14  0:21 ` [PATCH] I2C-MPC: use wait_event_interruptible_timeout between transactions Kumar Gala
2005-01-14 18:41 ` Greg KH
2005-05-19  6:25   ` [PATCH] I2C-MPC: use wait_event_interruptible_timeout between Greg KH
2005-01-14 18:41   ` [PATCH] I2C-MPC: use wait_event_interruptible_timeout between transactions Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11059983961494@kroah.com \
    --to=greg@kroah.com \
    --cc=jmunsin@iki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sensors@Stimpy.netroedge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.