Commit 98dd22c3 authored by Jean Delvare's avatar Jean Delvare Committed by Jean Delvare

hwmon: (it87) Prevent power-off on Shuttle SN68PT

On the Shuttle SN68PT, FAN_CTL2 is apparently not connected to a fan,
but to something else. One user has reported instant system power-off
when changing the PWM2 duty cycle, so we disable it.

I use the board name string as the trigger in case the same board is
ever used in other systems.

This closes lm-sensors ticket #2349:
pwmconfig causes a hard poweroff
http://www.lm-sensors.org/ticket/2349Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 04dcd84b
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
#include <linux/string.h>
#include <linux/dmi.h>
#include <asm/io.h> #include <asm/io.h>
#define DRVNAME "it87" #define DRVNAME "it87"
...@@ -236,6 +238,8 @@ struct it87_sio_data { ...@@ -236,6 +238,8 @@ struct it87_sio_data {
/* Values read from Super-I/O config space */ /* Values read from Super-I/O config space */
u8 revision; u8 revision;
u8 vid_value; u8 vid_value;
/* Values set based on DMI strings */
u8 skip_pwm;
}; };
/* For each registered chip, we need to keep some data in memory. /* For each registered chip, we need to keep some data in memory.
...@@ -964,6 +968,7 @@ static int __init it87_find(unsigned short *address, ...@@ -964,6 +968,7 @@ static int __init it87_find(unsigned short *address,
{ {
int err = -ENODEV; int err = -ENODEV;
u16 chip_type; u16 chip_type;
const char *board_vendor, *board_name;
superio_enter(); superio_enter();
chip_type = force_id ? force_id : superio_inw(DEVID); chip_type = force_id ? force_id : superio_inw(DEVID);
...@@ -1022,6 +1027,24 @@ static int __init it87_find(unsigned short *address, ...@@ -1022,6 +1027,24 @@ static int __init it87_find(unsigned short *address,
pr_info("it87: in7 is VCCH (+5V Stand-By)\n"); pr_info("it87: in7 is VCCH (+5V Stand-By)\n");
} }
/* Disable specific features based on DMI strings */
board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
board_name = dmi_get_system_info(DMI_BOARD_NAME);
if (board_vendor && board_name) {
if (strcmp(board_vendor, "nVIDIA") == 0
&& strcmp(board_name, "FN68PT") == 0) {
/* On the Shuttle SN68PT, FAN_CTL2 is apparently not
connected to a fan, but to something else. One user
has reported instant system power-off when changing
the PWM2 duty cycle, so we disable it.
I use the board name string as the trigger in case
the same board is ever used in other systems. */
pr_info("it87: Disabling pwm2 due to "
"hardware constraints\n");
sio_data->skip_pwm = (1 << 1);
}
}
exit: exit:
superio_exit(); superio_exit();
return err; return err;
...@@ -1168,26 +1191,34 @@ static int __devinit it87_probe(struct platform_device *pdev) ...@@ -1168,26 +1191,34 @@ static int __devinit it87_probe(struct platform_device *pdev)
} }
if (enable_pwm_interface) { if (enable_pwm_interface) {
if (!(sio_data->skip_pwm & (1 << 0))) {
if ((err = device_create_file(dev, if ((err = device_create_file(dev,
&sensor_dev_attr_pwm1_enable.dev_attr)) &sensor_dev_attr_pwm1_enable.dev_attr))
|| (err = device_create_file(dev,
&sensor_dev_attr_pwm2_enable.dev_attr))
|| (err = device_create_file(dev,
&sensor_dev_attr_pwm3_enable.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_pwm1.dev_attr)) &sensor_dev_attr_pwm1.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_pwm2.dev_attr)) &dev_attr_pwm1_freq)))
goto ERROR4;
}
if (!(sio_data->skip_pwm & (1 << 1))) {
if ((err = device_create_file(dev,
&sensor_dev_attr_pwm2_enable.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_pwm3.dev_attr)) &sensor_dev_attr_pwm2.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&dev_attr_pwm1_freq)) &dev_attr_pwm2_freq)))
goto ERROR4;
}
if (!(sio_data->skip_pwm & (1 << 2))) {
if ((err = device_create_file(dev,
&sensor_dev_attr_pwm3_enable.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&dev_attr_pwm2_freq)) &sensor_dev_attr_pwm3.dev_attr))
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&dev_attr_pwm3_freq))) &dev_attr_pwm3_freq)))
goto ERROR4; goto ERROR4;
} }
}
if (data->type == it8712 || data->type == it8716 if (data->type == it8712 || data->type == it8716
|| data->type == it8718) { || data->type == it8718) {
...@@ -1546,6 +1577,7 @@ static int __init sm_it87_init(void) ...@@ -1546,6 +1577,7 @@ static int __init sm_it87_init(void)
unsigned short isa_address=0; unsigned short isa_address=0;
struct it87_sio_data sio_data; struct it87_sio_data sio_data;
memset(&sio_data, 0, sizeof(struct it87_sio_data));
err = it87_find(&isa_address, &sio_data); err = it87_find(&isa_address, &sio_data);
if (err) if (err)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment