diff options
Diffstat (limited to 'drivers/hwmon/it87.c')
-rw-r--r-- | drivers/hwmon/it87.c | 88 |
1 files changed, 76 insertions, 12 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index ad6c8a31990..e12c132ff83 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -17,8 +17,8 @@ IT8726F Super I/O chip w/LPC interface Sis950 A clone of the IT8705F - Copyright (C) 2001 Chris Gauthron <chrisg@0-in.com> - Copyright (C) 2005-2006 Jean Delvare <khali@linux-fr.org> + Copyright (C) 2001 Chris Gauthron + Copyright (C) 2005-2007 Jean Delvare <khali@linux-fr.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,6 +52,10 @@ enum chips { it87, it8712, it8716, it8718 }; +static unsigned short force_id; +module_param(force_id, ushort, 0); +MODULE_PARM_DESC(force_id, "Override the detected device ID"); + static struct platform_device *pdev; #define REG 0x2e /* The register to read/write */ @@ -776,6 +780,30 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch } static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); +static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, + char *buf) +{ + int bitnr = to_sensor_dev_attr(attr)->index; + struct it87_data *data = it87_update_device(dev); + return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); +} +static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 8); +static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 9); +static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 10); +static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 11); +static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 12); +static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 13); +static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 14); +static SENSOR_DEVICE_ATTR(in7_alarm, S_IRUGO, show_alarm, NULL, 15); +static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 0); +static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 1); +static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 2); +static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL, 3); +static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 6); +static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 16); +static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 17); +static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 18); + static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) { @@ -837,6 +865,14 @@ static struct attribute *it87_attributes[] = { &sensor_dev_attr_in5_max.dev_attr.attr, &sensor_dev_attr_in6_max.dev_attr.attr, &sensor_dev_attr_in7_max.dev_attr.attr, + &sensor_dev_attr_in0_alarm.dev_attr.attr, + &sensor_dev_attr_in1_alarm.dev_attr.attr, + &sensor_dev_attr_in2_alarm.dev_attr.attr, + &sensor_dev_attr_in3_alarm.dev_attr.attr, + &sensor_dev_attr_in4_alarm.dev_attr.attr, + &sensor_dev_attr_in5_alarm.dev_attr.attr, + &sensor_dev_attr_in6_alarm.dev_attr.attr, + &sensor_dev_attr_in7_alarm.dev_attr.attr, &sensor_dev_attr_temp1_input.dev_attr.attr, &sensor_dev_attr_temp2_input.dev_attr.attr, @@ -850,6 +886,9 @@ static struct attribute *it87_attributes[] = { &sensor_dev_attr_temp1_type.dev_attr.attr, &sensor_dev_attr_temp2_type.dev_attr.attr, &sensor_dev_attr_temp3_type.dev_attr.attr, + &sensor_dev_attr_temp1_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_alarm.dev_attr.attr, &dev_attr_alarms.attr, &dev_attr_name.attr, @@ -882,12 +921,21 @@ static struct attribute *it87_attributes_opt[] = { &sensor_dev_attr_fan3_min.dev_attr.attr, &sensor_dev_attr_fan3_div.dev_attr.attr, + &sensor_dev_attr_fan1_alarm.dev_attr.attr, + &sensor_dev_attr_fan2_alarm.dev_attr.attr, + &sensor_dev_attr_fan3_alarm.dev_attr.attr, + &sensor_dev_attr_fan4_alarm.dev_attr.attr, + &sensor_dev_attr_fan5_alarm.dev_attr.attr, + &sensor_dev_attr_pwm1_enable.dev_attr.attr, &sensor_dev_attr_pwm2_enable.dev_attr.attr, &sensor_dev_attr_pwm3_enable.dev_attr.attr, &sensor_dev_attr_pwm1.dev_attr.attr, &sensor_dev_attr_pwm2.dev_attr.attr, &sensor_dev_attr_pwm3.dev_attr.attr, + &dev_attr_pwm1_freq.attr, + &dev_attr_pwm2_freq.attr, + &dev_attr_pwm3_freq.attr, &dev_attr_vrm.attr, &dev_attr_cpu0_vid.attr, @@ -906,7 +954,7 @@ static int __init it87_find(unsigned short *address, u16 chip_type; superio_enter(); - chip_type = superio_inw(DEVID); + chip_type = force_id ? force_id : superio_inw(DEVID); switch (chip_type) { case IT8705F_DEVID: @@ -1027,35 +1075,45 @@ static int __devinit it87_probe(struct platform_device *pdev) if ((err = device_create_file(dev, &sensor_dev_attr_fan1_input16.dev_attr)) || (err = device_create_file(dev, - &sensor_dev_attr_fan1_min16.dev_attr))) + &sensor_dev_attr_fan1_min16.dev_attr)) + || (err = device_create_file(dev, + &sensor_dev_attr_fan1_alarm.dev_attr))) goto ERROR4; } if (data->has_fan & (1 << 1)) { if ((err = device_create_file(dev, &sensor_dev_attr_fan2_input16.dev_attr)) || (err = device_create_file(dev, - &sensor_dev_attr_fan2_min16.dev_attr))) + &sensor_dev_attr_fan2_min16.dev_attr)) + || (err = device_create_file(dev, + &sensor_dev_attr_fan2_alarm.dev_attr))) goto ERROR4; } if (data->has_fan & (1 << 2)) { if ((err = device_create_file(dev, &sensor_dev_attr_fan3_input16.dev_attr)) || (err = device_create_file(dev, - &sensor_dev_attr_fan3_min16.dev_attr))) + &sensor_dev_attr_fan3_min16.dev_attr)) + || (err = device_create_file(dev, + &sensor_dev_attr_fan3_alarm.dev_attr))) goto ERROR4; } if (data->has_fan & (1 << 3)) { if ((err = device_create_file(dev, &sensor_dev_attr_fan4_input16.dev_attr)) || (err = device_create_file(dev, - &sensor_dev_attr_fan4_min16.dev_attr))) + &sensor_dev_attr_fan4_min16.dev_attr)) + || (err = device_create_file(dev, + &sensor_dev_attr_fan4_alarm.dev_attr))) goto ERROR4; } if (data->has_fan & (1 << 4)) { if ((err = device_create_file(dev, &sensor_dev_attr_fan5_input16.dev_attr)) || (err = device_create_file(dev, - &sensor_dev_attr_fan5_min16.dev_attr))) + &sensor_dev_attr_fan5_min16.dev_attr)) + || (err = device_create_file(dev, + &sensor_dev_attr_fan5_alarm.dev_attr))) goto ERROR4; } } else { @@ -1066,7 +1124,9 @@ static int __devinit it87_probe(struct platform_device *pdev) || (err = device_create_file(dev, &sensor_dev_attr_fan1_min.dev_attr)) || (err = device_create_file(dev, - &sensor_dev_attr_fan1_div.dev_attr))) + &sensor_dev_attr_fan1_div.dev_attr)) + || (err = device_create_file(dev, + &sensor_dev_attr_fan1_alarm.dev_attr))) goto ERROR4; } if (data->has_fan & (1 << 1)) { @@ -1075,7 +1135,9 @@ static int __devinit it87_probe(struct platform_device *pdev) || (err = device_create_file(dev, &sensor_dev_attr_fan2_min.dev_attr)) || (err = device_create_file(dev, - &sensor_dev_attr_fan2_div.dev_attr))) + &sensor_dev_attr_fan2_div.dev_attr)) + || (err = device_create_file(dev, + &sensor_dev_attr_fan2_alarm.dev_attr))) goto ERROR4; } if (data->has_fan & (1 << 2)) { @@ -1084,7 +1146,9 @@ static int __devinit it87_probe(struct platform_device *pdev) || (err = device_create_file(dev, &sensor_dev_attr_fan3_min.dev_attr)) || (err = device_create_file(dev, - &sensor_dev_attr_fan3_div.dev_attr))) + &sensor_dev_attr_fan3_div.dev_attr)) + || (err = device_create_file(dev, + &sensor_dev_attr_fan3_alarm.dev_attr))) goto ERROR4; } } @@ -1488,7 +1552,7 @@ static void __exit sm_it87_exit(void) } -MODULE_AUTHOR("Chris Gauthron <chrisg@0-in.com>, " +MODULE_AUTHOR("Chris Gauthron, " "Jean Delvare <khali@linux-fr.org>"); MODULE_DESCRIPTION("IT8705F/8712F/8716F/8718F/8726F, SiS950 driver"); module_param(update_vbat, bool, 0); |