Commit bfe38ccf authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6

* 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6:
  hwmon: normal_i2c arrays should be const
  hwmon: New driver for Analog Devices ADT7473 sensor chip
  hwmon: (coretemp) Add Penryn CPU to coretemp
  hwmon: (coretemp) Add TjMax detection for mobile CPUs
  hwmon: (applesmc) sensors set for MacBook2
  hwmon: (thmc50) Storage class should be before const qualifier
  hwmon: (coretemp) fix section mismatch warning
  hwmon: (coretemp) Add maximum cooling temperature readout
  hwmon: (adm1026) Properly terminate sysfs groups
  hwmon: (vt8231) Update maintainer email address
  hwmon: (vt8231) Add individual alarm files
  hwmon: (via686a) Add individual alarm files
  hwmon: (smsc47m1) Add individual alarm files
  hwmon: (max1619) Add individual alarm and fault files
  hwmon: (lm92) Add individual alarm files
parents 20f8d2a4 25e9c86d
Kernel driver adt7473
======================
Supported chips:
* Analog Devices ADT7473
Prefix: 'adt7473'
Addresses scanned: I2C 0x2C, 0x2D, 0x2E
Datasheet: Publicly available at the Analog Devices website
Author: Darrick J. Wong
Description
-----------
This driver implements support for the Analog Devices ADT7473 chip family.
The LM85 uses the 2-wire interface compatible with the SMBUS 2.0
specification. Using an analog to digital converter it measures three (3)
temperatures and two (2) voltages. It has three (3) 16-bit counters for
measuring fan speed. There are three (3) PWM outputs that can be used
to control fan speed.
A sophisticated control system for the PWM outputs is designed into the
LM85 that allows fan speed to be adjusted automatically based on any of the
three temperature sensors. Each PWM output is individually adjustable and
programmable. Once configured, the ADT7473 will adjust the PWM outputs in
response to the measured temperatures without further host intervention.
This feature can also be disabled for manual control of the PWM's.
Each of the measured inputs (voltage, temperature, fan speed) has
corresponding high/low limit values. The ADT7473 will signal an ALARM if
any measured value exceeds either limit.
The ADT7473 samples all inputs continuously. The driver will not read
the registers more often than once every other second. Further,
configuration data is only read once per minute.
Special Features
----------------
The ADT7473 have a 10-bit ADC and can therefore measure temperatures
with 0.25 degC resolution. Temperature readings can be configured either
for twos complement format or "Offset 64" format, wherein 63 is subtracted
from the raw value to get the temperature value.
The Analog Devices datasheet is very detailed and describes a procedure for
determining an optimal configuration for the automatic PWM control.
Hardware Configurations
-----------------------
The ADT7473 chips have an optional SMBALERT output that can be used to
signal the chipset in case a limit is exceeded or the temperature sensors
fail. Individual sensor interrupts can be masked so they won't trigger
SMBALERT. The SMBALERT output if configured replaces the PWM2 function.
Configuration Notes
-------------------
Besides standard interfaces driver adds the following:
* PWM Control
* pwm#_auto_point1_pwm and pwm#_auto_point1_temp and
* pwm#_auto_point2_pwm and pwm#_auto_point2_temp -
point1: Set the pwm speed at a lower temperature bound.
point2: Set the pwm speed at a higher temperature bound.
The ADT7473 will scale the pwm between the lower and higher pwm speed when
the temperature is between the two temperature boundaries. PWM values range
from 0 (off) to 255 (full speed).
Notes
-----
The NVIDIA binary driver presents an ADT7473 chip via an on-card i2c bus.
Unfortunately, they fail to set the i2c adapter class, so this driver may
fail to find the chip until the nvidia driver is patched.
...@@ -4,9 +4,10 @@ Kernel driver coretemp ...@@ -4,9 +4,10 @@ Kernel driver coretemp
Supported chips: Supported chips:
* All Intel Core family * All Intel Core family
Prefix: 'coretemp' Prefix: 'coretemp'
CPUID: family 0x6, models 0xe, 0xf, 0x16 CPUID: family 0x6, models 0xe, 0xf, 0x16, 0x17
Datasheet: Intel 64 and IA-32 Architectures Software Developer's Manual Datasheet: Intel 64 and IA-32 Architectures Software Developer's Manual
Volume 3A: System Programming Guide Volume 3A: System Programming Guide
http://softwarecommunity.intel.com/Wiki/Mobility/720.htm
Author: Rudolf Marek Author: Rudolf Marek
...@@ -25,6 +26,7 @@ may be raised, if the temperature grows enough (more than TjMax) to trigger ...@@ -25,6 +26,7 @@ may be raised, if the temperature grows enough (more than TjMax) to trigger
the Out-Of-Spec bit. Following table summarizes the exported sysfs files: the Out-Of-Spec bit. Following table summarizes the exported sysfs files:
temp1_input - Core temperature (in millidegrees Celsius). temp1_input - Core temperature (in millidegrees Celsius).
temp1_max - All cooling devices should be turned on (on Core2).
temp1_crit - Maximum junction temperature (in millidegrees Celsius). temp1_crit - Maximum junction temperature (in millidegrees Celsius).
temp1_crit_alarm - Set when Out-of-spec bit is set, never clears. temp1_crit_alarm - Set when Out-of-spec bit is set, never clears.
Correct CPU operation is no longer guaranteed. Correct CPU operation is no longer guaranteed.
......
...@@ -4261,7 +4261,7 @@ S: Maintained ...@@ -4261,7 +4261,7 @@ S: Maintained
VT8231 HARDWARE MONITOR DRIVER VT8231 HARDWARE MONITOR DRIVER
P: Roger Lucas P: Roger Lucas
M: roger@planbit.co.uk M: vt8231@hiddenengine.co.uk
L: lm-sensors@lm-sensors.org L: lm-sensors@lm-sensors.org
S: Maintained S: Maintained
......
...@@ -143,6 +143,16 @@ config SENSORS_ADT7470 ...@@ -143,6 +143,16 @@ config SENSORS_ADT7470
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called adt7470. will be called adt7470.
config SENSORS_ADT7473
tristate "Analog Devices ADT7473"
depends on I2C && EXPERIMENTAL
help
If you say yes here you get support for the Analog Devices
ADT7473 temperature monitoring chips.
This driver can also be built as a module. If so, the module
will be called adt7473.
config SENSORS_K8TEMP config SENSORS_K8TEMP
tristate "AMD Athlon64/FX or Opteron temperature sensor" tristate "AMD Athlon64/FX or Opteron temperature sensor"
depends on X86 && PCI && EXPERIMENTAL depends on X86 && PCI && EXPERIMENTAL
......
...@@ -24,6 +24,7 @@ obj-$(CONFIG_SENSORS_ADM1031) += adm1031.o ...@@ -24,6 +24,7 @@ obj-$(CONFIG_SENSORS_ADM1031) += adm1031.o
obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o
obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o
obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o
obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o
obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o
obj-$(CONFIG_SENSORS_AMS) += ams/ obj-$(CONFIG_SENSORS_AMS) += ams/
obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#define DRV_VERSION "0.3" #define DRV_VERSION "0.3"
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x28, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x28, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_3(ad7416, ad7417, ad7418); I2C_CLIENT_INSMOD_3(ad7416, ad7417, ad7418);
......
...@@ -31,10 +31,8 @@ ...@@ -31,10 +31,8 @@
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, static const unsigned short normal_i2c[] = {
0x29, 0x2a, 0x2b, 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
0x4c, 0x4d, 0x4e,
I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_8(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm, I2C_CLIENT_INSMOD_8(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm,
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
* NE1619 has two possible addresses: 0x2c and 0x2d. * NE1619 has two possible addresses: 0x2c and 0x2d.
*/ */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
/* /*
* Insmod parameters * Insmod parameters
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_1(adm1026); I2C_CLIENT_INSMOD_1(adm1026);
...@@ -1624,6 +1624,7 @@ static struct attribute *adm1026_attributes_temp3[] = { ...@@ -1624,6 +1624,7 @@ static struct attribute *adm1026_attributes_temp3[] = {
&dev_attr_temp3_crit_enable.attr, &dev_attr_temp3_crit_enable.attr,
&dev_attr_temp3_auto_point1_pwm.attr, &dev_attr_temp3_auto_point1_pwm.attr,
&dev_attr_temp3_auto_point2_pwm.attr, &dev_attr_temp3_auto_point2_pwm.attr,
NULL
}; };
static const struct attribute_group adm1026_group_temp3 = { static const struct attribute_group adm1026_group_temp3 = {
...@@ -1639,6 +1640,7 @@ static struct attribute *adm1026_attributes_in8_9[] = { ...@@ -1639,6 +1640,7 @@ static struct attribute *adm1026_attributes_in8_9[] = {
&sensor_dev_attr_in9_max.dev_attr.attr, &sensor_dev_attr_in9_max.dev_attr.attr,
&sensor_dev_attr_in9_min.dev_attr.attr, &sensor_dev_attr_in9_min.dev_attr.attr,
&sensor_dev_attr_in9_alarm.dev_attr.attr, &sensor_dev_attr_in9_alarm.dev_attr.attr,
NULL
}; };
static const struct attribute_group adm1026_group_in8_9 = { static const struct attribute_group adm1026_group_in8_9 = {
......
...@@ -39,9 +39,7 @@ ...@@ -39,9 +39,7 @@
* Addresses to scan * Addresses to scan
*/ */
static unsigned short normal_i2c[] = { static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
0x28, 0x29, 0x2a,
0x2b, 0x2c, 0x2d,
0x2e, 0x2f, I2C_CLIENT_END 0x2e, 0x2f, I2C_CLIENT_END
}; };
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
#define ADM1031_CONF2_TEMP_ENABLE(chan) (0x10 << (chan)) #define ADM1031_CONF2_TEMP_ENABLE(chan) (0x10 << (chan))
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_2(adm1030, adm1031); I2C_CLIENT_INSMOD_2(adm1030, adm1031);
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
I2C_CLIENT_END }; I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#define ADS7828_INT_VREF_MV 2500 /* Internal vref is 2.5V, 2500mV */ #define ADS7828_INT_VREF_MV 2500 /* Internal vref is 2.5V, 2500mV */
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b,
I2C_CLIENT_END }; I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <linux/log2.h> #include <linux/log2.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_1(adt7470); I2C_CLIENT_INSMOD_1(adt7470);
......
This diff is collapsed.
...@@ -84,12 +84,15 @@ static const char* temperature_sensors_sets[][36] = { ...@@ -84,12 +84,15 @@ static const char* temperature_sensors_sets[][36] = {
/* Set 0: Macbook Pro */ /* Set 0: Macbook Pro */
{ "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H", { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H",
"Th1H", "Tm0P", "Ts0P", "Ts1P", NULL }, "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL },
/* Set 1: Macbook set */ /* Set 1: Macbook2 set */
{ "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "TTF0", "Th0H",
"Th0S", "Th1H", NULL },
/* Set 2: Macbook set */
{ "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S", { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S",
"Th1H", "Ts0P", NULL }, "Th1H", "Ts0P", NULL },
/* Set 2: Macmini set */ /* Set 3: Macmini set */
{ "TC0D", "TC0P", NULL }, { "TC0D", "TC0P", NULL },
/* Set 3: Mac Pro (2 x Quad-Core) */ /* Set 4: Mac Pro (2 x Quad-Core) */
{ "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P", { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P",
"TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P", "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P",
"TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S", "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S",
...@@ -1212,12 +1215,14 @@ static void applesmc_release_accelerometer(void) ...@@ -1212,12 +1215,14 @@ static void applesmc_release_accelerometer(void)
static __initdata struct dmi_match_data applesmc_dmi_data[] = { static __initdata struct dmi_match_data applesmc_dmi_data[] = {
/* MacBook Pro: accelerometer, backlight and temperature set 0 */ /* MacBook Pro: accelerometer, backlight and temperature set 0 */
{ .accelerometer = 1, .light = 1, .temperature_set = 0 }, { .accelerometer = 1, .light = 1, .temperature_set = 0 },
/* MacBook: accelerometer and temperature set 1 */ /* MacBook2: accelerometer and temperature set 1 */
{ .accelerometer = 1, .light = 0, .temperature_set = 1 }, { .accelerometer = 1, .light = 0, .temperature_set = 1 },
/* MacMini: temperature set 2 */ /* MacBook: accelerometer and temperature set 2 */
{ .accelerometer = 0, .light = 0, .temperature_set = 2 }, { .accelerometer = 1, .light = 0, .temperature_set = 2 },
/* MacPro: temperature set 3 */ /* MacMini: temperature set 3 */
{ .accelerometer = 0, .light = 0, .temperature_set = 3 }, { .accelerometer = 0, .light = 0, .temperature_set = 3 },
/* MacPro: temperature set 4 */
{ .accelerometer = 0, .light = 0, .temperature_set = 4 },
}; };
/* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
...@@ -1229,16 +1234,20 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = { ...@@ -1229,16 +1234,20 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
(void*)&applesmc_dmi_data[0]}, (void*)&applesmc_dmi_data[0]},
{ applesmc_dmi_match, "Apple MacBook", { { applesmc_dmi_match, "Apple MacBook", {
DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") }, DMI_MATCH(DMI_PRODUCT_NAME,"MacBook2") },
(void*)&applesmc_dmi_data[1]}, (void*)&applesmc_dmi_data[1]},
{ applesmc_dmi_match, "Apple MacBook", {
DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") },
(void*)&applesmc_dmi_data[2]},
{ applesmc_dmi_match, "Apple Macmini", { { applesmc_dmi_match, "Apple Macmini", {
DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") }, DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") },
(void*)&applesmc_dmi_data[2]}, (void*)&applesmc_dmi_data[3]},
{ applesmc_dmi_match, "Apple MacPro2", { { applesmc_dmi_match, "Apple MacPro2", {
DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") },
(void*)&applesmc_dmi_data[3]}, (void*)&applesmc_dmi_data[4]},
{ .ident = NULL } { .ident = NULL }
}; };
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#include "lm75.h" #include "lm75.h"
/* I2C addresses to scan */ /* I2C addresses to scan */
static unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_1(asb100); I2C_CLIENT_INSMOD_1(asb100);
......
...@@ -42,7 +42,7 @@ MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>"); ...@@ -42,7 +42,7 @@ MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>");
#define ATXP1_VIDMASK 0x1f #define ATXP1_VIDMASK 0x1f
#define ATXP1_GPIO1MASK 0x0f #define ATXP1_GPIO1MASK 0x0f
static unsigned short normal_i2c[] = { 0x37, 0x4e, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x37, 0x4e, I2C_CLIENT_END };
I2C_CLIENT_INSMOD_1(atxp1); I2C_CLIENT_INSMOD_1(atxp1);
......
...@@ -38,7 +38,8 @@ ...@@ -38,7 +38,8 @@
#define DRVNAME "coretemp" #define DRVNAME "coretemp"
typedef enum { SHOW_TEMP, SHOW_TJMAX, SHOW_LABEL, SHOW_NAME } SHOW; typedef enum { SHOW_TEMP, SHOW_TJMAX, SHOW_TTARGET, SHOW_LABEL,
SHOW_NAME } SHOW;
/* /*
* Functions declaration * Functions declaration
...@@ -55,6 +56,7 @@ struct coretemp_data { ...@@ -55,6 +56,7 @@ struct coretemp_data {
unsigned long last_updated; /* in jiffies */ unsigned long last_updated; /* in jiffies */
int temp; int temp;
int tjmax; int tjmax;
int ttarget;
u8 alarm; u8 alarm;
}; };
...@@ -93,9 +95,10 @@ static ssize_t show_temp(struct device *dev, ...@@ -93,9 +95,10 @@ static ssize_t show_temp(struct device *dev,
if (attr->index == SHOW_TEMP) if (attr->index == SHOW_TEMP)
err = data->valid ? sprintf(buf, "%d\n", data->temp) : -EAGAIN; err = data->valid ? sprintf(buf, "%d\n", data->temp) : -EAGAIN;
else else if (attr->index == SHOW_TJMAX)
err = sprintf(buf, "%d\n", data->tjmax); err = sprintf(buf, "%d\n", data->tjmax);
else
err = sprintf(buf, "%d\n", data->ttarget);
return err; return err;
} }
...@@ -103,6 +106,8 @@ static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, ...@@ -103,6 +106,8 @@ static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL,
SHOW_TEMP); SHOW_TEMP);
static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp, NULL, static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp, NULL,
SHOW_TJMAX); SHOW_TJMAX);
static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp, NULL,
SHOW_TTARGET);
static DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL); static DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL);
static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL); static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL);
static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, SHOW_NAME); static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, SHOW_NAME);
...@@ -147,6 +152,56 @@ static struct coretemp_data *coretemp_update_device(struct device *dev) ...@@ -147,6 +152,56 @@ static struct coretemp_data *coretemp_update_device(struct device *dev)
return data; return data;
} }
static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
{
/* The 100C is default for both mobile and non mobile CPUs */
int tjmax = 100000;
int ismobile = 1;
int err;
u32 eax, edx;
/* Early chips have no MSR for TjMax */
if ((c->x86_model == 0xf) && (c->x86_mask < 4)) {
ismobile = 0;
}
if ((c->x86_model > 0xe) && (ismobile)) {
/* Now we can detect the mobile CPU using Intel provided table
http://softwarecommunity.intel.com/Wiki/Mobility/720.htm
For Core2 cores, check MSR 0x17, bit 28 1 = Mobile CPU
*/
err = rdmsr_safe_on_cpu(id, 0x17, &eax, &edx);
if (err) {
dev_warn(dev,
"Unable to access MSR 0x17, assuming desktop"
" CPU\n");
ismobile = 0;
} else if (!(eax & 0x10000000)) {
ismobile = 0;
}
}
if (ismobile) {
err = rdmsr_safe_on_cpu(id, 0xee, &eax, &edx);
if (err) {
dev_warn(dev,
"Unable to access MSR 0xEE, for Tjmax, left"
" at default");
} else if (eax & 0x40000000) {
tjmax = 85000;
}
} else {
dev_warn(dev, "Using relative temperature scale!\n");
}
return tjmax;
}
static int __devinit coretemp_probe(struct platform_device *pdev) static int __devinit coretemp_probe(struct platform_device *pdev)
{ {
struct coretemp_data *data; struct coretemp_data *data;
...@@ -163,8 +218,6 @@ static int __devinit coretemp_probe(struct platform_device *pdev) ...@@ -163,8 +218,6 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
data->id = pdev->id; data->id = pdev->id;
data->name = "coretemp"; data->name = "coretemp";
mutex_init(&data->update_lock); mutex_init(&data->update_lock);
/* Tjmax default is 100 degrees C */
data->tjmax = 100000;
/* test if we can access the THERM_STATUS MSR */ /* test if we can access the THERM_STATUS MSR */
err = rdmsr_safe_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx); err = rdmsr_safe_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx);
...@@ -191,40 +244,29 @@ static int __devinit coretemp_probe(struct platform_device *pdev) ...@@ -191,40 +244,29 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
} }
} }
/* Some processors have Tjmax 85 following magic should detect it data->tjmax = adjust_tjmax(c, data->id, &pdev->dev);
Intel won't disclose the information without signed NDA, but platform_set_drvdata(pdev, data);
individuals cannot sign it. Catch(ed) 22.
*/ /* read the still undocumented IA32_TEMPERATURE_TARGET it exists
on older CPUs but not in this register */
if (((c->x86_model == 0xf) && (c->x86_mask > 3)) || if (c->x86_model > 0xe) {
(c->x86_model == 0xe)) { err = rdmsr_safe_on_cpu(data->id, 0x1a2, &eax, &edx);
err = rdmsr_safe_on_cpu(data->id, 0xee, &eax, &edx);
if (err) { if (err) {
dev_warn(&pdev->dev, dev_warn(&pdev->dev, "Unable to read"
"Unable to access MSR 0xEE, Tjmax left at %d " " IA32_TEMPERATURE_TARGET MSR\n");
"degrees C\n", data->tjmax/1000); } else {
} else if (eax & 0x40000000) { data->ttarget = data->tjmax -
data->tjmax = 85000; (((eax >> 8) & 0xff) * 1000);
} err = device_create_file(&pdev->dev,
&sensor_dev_attr_temp1_max.dev_attr);
if (err)
goto exit_free;
} }
/* Intel says that above should not work for desktop Core2 processors,
but it seems to work. There is no other way how get the absolute
readings. Warn the user about this. First check if are desktop,
bit 50 of MSR_IA32_PLATFORM_ID should be 0.
*/
rdmsr_safe_on_cpu(data->id, MSR_IA32_PLATFORM_ID, &eax, &edx);
if ((c->x86_model == 0xf) && (!(edx & 0x00040000))) {
dev_warn(&pdev->dev, "Using undocumented features, absolute "
"temperature might be wrong!\n");
} }
platform_set_drvdata(pdev, data);
if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group))) if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group)))
goto exit_free; goto exit_dev;
data->hwmon_dev = hwmon_device_register(&pdev->dev); data->hwmon_dev = hwmon_device_register(&pdev->dev);
if (IS_ERR(data->hwmon_dev)) { if (IS_ERR(data->hwmon_dev)) {
...@@ -238,6 +280,8 @@ static int __devinit coretemp_probe(struct platform_device *pdev) ...@@ -238,6 +280,8 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
exit_class: exit_class:
sysfs_remove_group(&pdev->dev.kobj, &coretemp_group); sysfs_remove_group(&pdev->dev.kobj, &coretemp_group);
exit_dev:
device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr);
exit_free: exit_free:
kfree(data); kfree(data);
exit: exit:
...@@ -250,6 +294,7 @@ static int __devexit coretemp_remove(struct platform_device *pdev) ...@@ -250,6 +294,7 @@ static int __devexit coretemp_remove(struct platform_device *pdev)
hwmon_device_unregister(data->hwmon_dev); hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&pdev->dev.kobj, &coretemp_group); sysfs_remove_group(&pdev->dev.kobj, &coretemp_group);
device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr);
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
kfree(data); kfree(data);
return 0; return 0;
...@@ -330,7 +375,7 @@ static void coretemp_device_remove(unsigned int cpu) ...@@ -330,7 +375,7 @@ static void coretemp_device_remove(unsigned int cpu)
mutex_unlock(&pdev_list_mutex); mutex_unlock(&pdev_list_mutex);
} }
static int coretemp_cpu_callback(struct notifier_block *nfb, static int __cpuinit coretemp_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu) unsigned long action, void *hcpu)
{ {
unsigned int cpu = (unsigned long) hcpu; unsigned int cpu = (unsigned long) hcpu;
...@@ -347,7 +392,7 @@ static int coretemp_cpu_callback(struct notifier_block *nfb, ...@@ -347,7 +392,7 @@ static int coretemp_cpu_callback(struct notifier_block *nfb,
return NOTIFY_OK; return NOTIFY_OK;
} }
static struct notifier_block coretemp_cpu_notifier = { static struct notifier_block coretemp_cpu_notifier __refdata = {
.notifier_call = coretemp_cpu_callback, .notifier_call = coretemp_cpu_callback,
}; };
#endif /* !CONFIG_HOTPLUG_CPU */ #endif /* !CONFIG_HOTPLUG_CPU */
...@@ -368,10 +413,10 @@ static int __init coretemp_init(void) ...@@ -368,10 +413,10 @@ static int __init coretemp_init(void)
for_each_online_cpu(i) { for_each_online_cpu(i) {
struct cpuinfo_x86 *c = &cpu_data(i); struct cpuinfo_x86 *c = &cpu_data(i);
/* check if family 6, models e, f, 16 */ /* check if family 6, models 0xe, 0xf, 0x16, 0x17 */
if ((c->cpuid_level < 0) || (c->x86 != 0x6) || if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
!((c->x86_model == 0xe) || (c->x86_model == 0xf) || !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
(c->x86_model == 0x16))) { (c->x86_model == 0x16) || (c->x86_model == 0x17))) {
/* supported CPU not found, but report the unknown /* supported CPU not found, but report the unknown
family 6 CPU */ family 6 CPU */
......
...@@ -49,7 +49,7 @@ module_param(force_id, ushort, 0); ...@@ -49,7 +49,7 @@ module_param(force_id, ushort, 0);
MODULE_PARM_DESC(force_id, "Override the detected device ID"); MODULE_PARM_DESC(force_id, "Override the detected device ID");
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END}; static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END};
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_1(dme1737); I2C_CLIENT_INSMOD_1(dme1737);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "lm75.h" #include "lm75.h"
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; 0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <linux/f75375s.h> #include <linux/f75375s.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_2(f75373, f75375); I2C_CLIENT_INSMOD_2(f75373, f75375);
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
* Addresses to scan * Addresses to scan
*/ */
static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
/* /*
* Insmod parameters * Insmod parameters
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#include <linux/dmi.h> #include <linux/dmi.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd); I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd);
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
/* /*
* Addresses to scan * Addresses to scan
*/ */
static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
/* /*
* Insmod parameters * Insmod parameters
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#include <linux/sysfs.h> #include <linux/sysfs.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_2(gl518sm_r00, gl518sm_r80); I2C_CLIENT_INSMOD_2(gl518sm_r00, gl518sm_r80);
......
...@@ -39,7 +39,7 @@ module_param(extra_sensor_type, ushort, 0); ...@@ -39,7 +39,7 @@ module_param(extra_sensor_type, ushort, 0);
MODULE_PARM_DESC(extra_sensor_type, "Type of extra sensor (0=autodetect, 1=temperature, 2=voltage)"); MODULE_PARM_DESC(extra_sensor_type, "Type of extra sensor (0=autodetect, 1=temperature, 2=voltage)");
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_1(gl520sm); I2C_CLIENT_INSMOD_1(gl520sm);
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
* Address is fully defined internally and cannot be changed. * Address is fully defined internally and cannot be changed.
*/ */
static unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END };
/* /*
* Insmod parameters * Insmod parameters
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; 0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
......
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
#include <linux/mutex.h> #include <linux/mutex.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b,
I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_1(lm77); I2C_CLIENT_INSMOD_1(lm77);
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
static struct platform_device *pdev; static struct platform_device *pdev;
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
0x2e, 0x2f, I2C_CLIENT_END }; 0x2e, 0x2f, I2C_CLIENT_END };
static unsigned short isa_address = 0x290; static unsigned short isa_address = 0x290;
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#include <linux/mutex.h> #include <linux/mutex.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; 0x2e, 0x2f, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_1(lm80); I2C_CLIENT_INSMOD_1(lm80);
......
...@@ -48,10 +48,8 @@ ...@@ -48,10 +48,8 @@
* addresses. * addresses.
*/ */
static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, static const unsigned short normal_i2c[] = {
0x29, 0x2a, 0x2b, 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
0x4c, 0x4d, 0x4e,
I2C_CLIENT_END };
/* /*
* Insmod parameters * Insmod parameters
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102); I2C_CLIENT_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102);
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
* LM87 has three possible addresses: 0x2c, 0x2d and 0x2e. * LM87 has three possible addresses: 0x2c, 0x2d and 0x2e.
*/ */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
/* /*
* Insmod parameters * Insmod parameters
......
...@@ -101,10 +101,8 @@ ...@@ -101,10 +101,8 @@
* 0x4c, 0x4d or 0x4e. * 0x4c, 0x4d or 0x4e.
*/ */
static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, static const unsigned short normal_i2c[] = {
0x29, 0x2a, 0x2b, 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
0x4c, 0x4d, 0x4e,
I2C_CLIENT_END };
/* /*
* Insmod parameters * Insmod parameters
......
...@@ -45,12 +45,13 @@ ...@@ -45,12 +45,13 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/hwmon.h> #include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/mutex.h> #include <linux/mutex.h>
/* The LM92 and MAX6635 have 2 two-state pins for address selection, /* The LM92 and MAX6635 have 2 two-state pins for address selection,
resulting in 4 possible addresses. */ resulting in 4 possible addresses. */
static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b,
I2C_CLIENT_END }; I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
...@@ -209,6 +210,14 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch ...@@ -209,6 +210,14 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch
return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->temp1_input)); return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->temp1_input));
} }
static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
char *buf)
{
int bitnr = to_sensor_dev_attr(attr)->index;
struct lm92_data *data = lm92_update_device(dev);
return sprintf(buf, "%d\n", (data->temp1_input >> bitnr) & 1);
}
static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1_input, NULL); static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1_input, NULL);
static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp1_crit, static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp1_crit,
set_temp1_crit); set_temp1_crit);
...@@ -221,6 +230,9 @@ static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp1_max, ...@@ -221,6 +230,9 @@ static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp1_max,
set_temp1_max); set_temp1_max);
static DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_temp1_max_hyst, NULL); static DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_temp1_max_hyst, NULL);
static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 2);
static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 0);
static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 1);
/* /*
...@@ -297,7 +309,9 @@ static struct attribute *lm92_attributes[] = { ...@@ -297,7 +309,9 @@ static struct attribute *lm92_attributes[] = {
&dev_attr_temp1_max.attr, &dev_attr_temp1_max.attr,
&dev_attr_temp1_max_hyst.attr, &dev_attr_temp1_max_hyst.attr,
&dev_attr_alarms.attr, &dev_attr_alarms.attr,
&sensor_dev_attr_temp1_crit_alarm.dev_attr.attr,
&sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
&sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
NULL NULL
}; };
......
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
I2C_FUNC_SMBUS_WORD_DATA) I2C_FUNC_SMBUS_WORD_DATA)
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_1(lm93); I2C_CLIENT_INSMOD_1(lm93);
......
...@@ -32,14 +32,13 @@ ...@@ -32,14 +32,13 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/hwmon.h> #include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, static const unsigned short normal_i2c[] = {
0x29, 0x2a, 0x2b, 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
0x4c, 0x4d, 0x4e,
I2C_CLIENT_END };
/* /*
* Insmod parameters * Insmod parameters
...@@ -161,6 +160,14 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch ...@@ -161,6 +160,14 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch
return sprintf(buf, "%d\n", data->alarms); return sprintf(buf, "%d\n", data->alarms);
} }
static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
char *buf)
{
int bitnr = to_sensor_dev_attr(attr)->index;
struct max1619_data *data = max1619_update_device(dev);
return sprintf(buf, "%d\n", (data->alarms >> bitnr) & 1);
}
static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input1, NULL); static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input1, NULL);
static DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input2, NULL); static DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input2, NULL);
static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_low2, static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_low2,
...@@ -172,6 +179,10 @@ static DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp_crit2, ...@@ -172,6 +179,10 @@ static DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp_crit2,
static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2, static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2,
set_temp_hyst2); set_temp_hyst2);
static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 1);
static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2);
static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3);
static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4);
static struct attribute *max1619_attributes[] = { static struct attribute *max1619_attributes[] = {
&dev_attr_temp1_input.attr, &dev_attr_temp1_input.attr,
...@@ -182,6 +193,10 @@ static struct attribute *max1619_attributes[] = { ...@@ -182,6 +193,10 @@ static struct attribute *max1619_attributes[] = {
&dev_attr_temp2_crit_hyst.attr, &dev_attr_temp2_crit_hyst.attr,
&dev_attr_alarms.attr, &dev_attr_alarms.attr,
&sensor_dev_attr_temp2_crit_alarm.dev_attr.attr,
&sensor_dev_attr_temp2_fault.dev_attr.attr,
&sensor_dev_attr_temp2_min_alarm.dev_attr.attr,
&sensor_dev_attr_temp2_max_alarm.dev_attr.attr,
NULL NULL
}; };
......
...@@ -44,7 +44,8 @@ ...@@ -44,7 +44,8 @@
* Addresses to scan. There are four disjoint possibilities, by pin config. * Addresses to scan. There are four disjoint possibilities, by pin config.
*/ */
static unsigned short normal_i2c[] = {0x1b, 0x1f, 0x48, 0x4b, I2C_CLIENT_END}; static const unsigned short normal_i2c[] = {0x1b, 0x1f, 0x48, 0x4b,
I2C_CLIENT_END};
/* /*
* Insmod parameters * Insmod parameters
......
...@@ -198,6 +198,14 @@ static ssize_t get_fan_div(struct device *dev, struct device_attribute ...@@ -198,6 +198,14 @@ static ssize_t get_fan_div(struct device *dev, struct device_attribute
return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index])); return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index]));
} }
static ssize_t get_fan_alarm(struct device *dev, struct device_attribute
*devattr, char *buf)
{
int bitnr = to_sensor_dev_attr(devattr)->index;
struct smsc47m1_data *data = smsc47m1_update_device(dev, 0);
return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
}
static ssize_t get_pwm(struct device *dev, struct device_attribute static ssize_t get_pwm(struct device *dev, struct device_attribute
*devattr, char *buf) *devattr, char *buf)
{ {
...@@ -347,6 +355,8 @@ static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ ...@@ -347,6 +355,8 @@ static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
get_fan_min, set_fan_min, offset - 1); \ get_fan_min, set_fan_min, offset - 1); \
static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \
get_fan_div, set_fan_div, offset - 1); \ get_fan_div, set_fan_div, offset - 1); \
static SENSOR_DEVICE_ATTR(fan##offset##_alarm, S_IRUGO, get_fan_alarm, \
NULL, offset - 1); \
static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \ static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \
get_pwm, set_pwm, offset - 1); \ get_pwm, set_pwm, offset - 1); \
static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \ static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \
...@@ -374,12 +384,15 @@ static struct attribute *smsc47m1_attributes[] = { ...@@ -374,12 +384,15 @@ static struct attribute *smsc47m1_attributes[] = {
&sensor_dev_attr_fan1_input.dev_attr.attr, &sensor_dev_attr_fan1_input.dev_attr.attr,
&sensor_dev_attr_fan1_min.dev_attr.attr, &sensor_dev_attr_fan1_min.dev_attr.attr,
&sensor_dev_attr_fan1_div.dev_attr.attr, &sensor_dev_attr_fan1_div.dev_attr.attr,
&sensor_dev_attr_fan1_alarm.dev_attr.attr,
&sensor_dev_attr_fan2_input.dev_attr.attr, &sensor_dev_attr_fan2_input.dev_attr.attr,
&sensor_dev_attr_fan2_min.dev_attr.attr, &sensor_dev_attr_fan2_min.dev_attr.attr,
&sensor_dev_attr_fan2_div.dev_attr.attr, &sensor_dev_attr_fan2_div.dev_attr.attr,
&sensor_dev_attr_fan2_alarm.dev_attr.attr,
&sensor_dev_attr_fan3_input.dev_attr.attr, &sensor_dev_attr_fan3_input.dev_attr.attr,
&sensor_dev_attr_fan3_min.dev_attr.attr, &sensor_dev_attr_fan3_min.dev_attr.attr,
&sensor_dev_attr_fan3_div.dev_attr.attr, &sensor_dev_attr_fan3_div.dev_attr.attr,
&sensor_dev_attr_fan3_alarm.dev_attr.attr,
&sensor_dev_attr_pwm1.dev_attr.attr, &sensor_dev_attr_pwm1.dev_attr.attr,
&sensor_dev_attr_pwm1_enable.dev_attr.attr, &sensor_dev_attr_pwm1_enable.dev_attr.attr,
...@@ -533,7 +546,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev) ...@@ -533,7 +546,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev)
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan1_min.dev_attr)) &sensor_dev_attr_fan1_min.dev_attr))
|| (err = device_create_file(dev, || (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 error_remove_files; goto error_remove_files;
} else } else
dev_dbg(dev, "Fan 1 not enabled by hardware, skipping\n"); dev_dbg(dev, "Fan 1 not enabled by hardware, skipping\n");
...@@ -544,7 +559,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev) ...@@ -544,7 +559,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev)
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan2_min.dev_attr)) &sensor_dev_attr_fan2_min.dev_attr))
|| (err = device_create_file(dev, || (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 error_remove_files; goto error_remove_files;
} else } else
dev_dbg(dev, "Fan 2 not enabled by hardware, skipping\n"); dev_dbg(dev, "Fan 2 not enabled by hardware, skipping\n");
...@@ -555,7 +572,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev) ...@@ -555,7 +572,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev)
|| (err = device_create_file(dev, || (err = device_create_file(dev,
&sensor_dev_attr_fan3_min.dev_attr)) &sensor_dev_attr_fan3_min.dev_attr))
|| (err = device_create_file(dev, || (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 error_remove_files; goto error_remove_files;
} else if (data->type == smsc47m2) } else if (data->type == smsc47m2)
dev_dbg(dev, "Fan 3 not enabled by hardware, skipping\n"); dev_dbg(dev, "Fan 3 not enabled by hardware, skipping\n");
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_1(smsc47m192); I2C_CLIENT_INSMOD_1(smsc47m192);
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_2(thmc50, adm1022); I2C_CLIENT_INSMOD_2(thmc50, adm1022);
...@@ -52,9 +52,9 @@ I2C_CLIENT_MODULE_PARM(adm1022_temp3, "List of adapter,address pairs " ...@@ -52,9 +52,9 @@ I2C_CLIENT_MODULE_PARM(adm1022_temp3, "List of adapter,address pairs "
*/ */
#define THMC50_REG_INTR 0x41 #define THMC50_REG_INTR 0x41
const static u8 THMC50_REG_TEMP[] = { 0x27, 0x26, 0x20 }; static const u8 THMC50_REG_TEMP[] = { 0x27, 0x26, 0x20 };
const static u8 THMC50_REG_TEMP_MIN[] = { 0x3A, 0x38, 0x2C }; static const u8 THMC50_REG_TEMP_MIN[] = { 0x3A, 0x38, 0x2C };
const static u8 THMC50_REG_TEMP_MAX[] = { 0x39, 0x37, 0x2B }; static const u8 THMC50_REG_TEMP_MAX[] = { 0x39, 0x37, 0x2B };
#define THMC50_REG_CONF_nFANOFF 0x20 #define THMC50_REG_CONF_nFANOFF 0x20
......
...@@ -533,6 +533,24 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch ...@@ -533,6 +533,24 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch
} }
static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 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 via686a_data *data = via686a_update_device(dev);
return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
}
static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0);
static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1);
static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2);
static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3);
static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8);
static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4);
static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 11);
static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 15);
static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6);
static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7);
static ssize_t show_name(struct device *dev, struct device_attribute static ssize_t show_name(struct device *dev, struct device_attribute
*devattr, char *buf) *devattr, char *buf)
{ {
...@@ -557,6 +575,11 @@ static struct attribute *via686a_attributes[] = { ...@@ -557,6 +575,11 @@ static struct attribute *via686a_attributes[] = {
&sensor_dev_attr_in2_max.dev_attr.attr, &sensor_dev_attr_in2_max.dev_attr.attr,
&sensor_dev_attr_in3_max.dev_attr.attr, &sensor_dev_attr_in3_max.dev_attr.attr,
&sensor_dev_attr_in4_max.dev_attr.attr, &sensor_dev_attr_in4_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_temp1_input.dev_attr.attr, &sensor_dev_attr_temp1_input.dev_attr.attr,
&sensor_dev_attr_temp2_input.dev_attr.attr, &sensor_dev_attr_temp2_input.dev_attr.attr,
...@@ -567,6 +590,9 @@ static struct attribute *via686a_attributes[] = { ...@@ -567,6 +590,9 @@ static struct attribute *via686a_attributes[] = {
&sensor_dev_attr_temp1_max_hyst.dev_attr.attr, &sensor_dev_attr_temp1_max_hyst.dev_attr.attr,
&sensor_dev_attr_temp2_max_hyst.dev_attr.attr, &sensor_dev_attr_temp2_max_hyst.dev_attr.attr,
&sensor_dev_attr_temp3_max_hyst.dev_attr.attr, &sensor_dev_attr_temp3_max_hyst.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,
&sensor_dev_attr_fan1_input.dev_attr.attr, &sensor_dev_attr_fan1_input.dev_attr.attr,
&sensor_dev_attr_fan2_input.dev_attr.attr, &sensor_dev_attr_fan2_input.dev_attr.attr,
...@@ -574,6 +600,8 @@ static struct attribute *via686a_attributes[] = { ...@@ -574,6 +600,8 @@ static struct attribute *via686a_attributes[] = {
&sensor_dev_attr_fan2_min.dev_attr.attr, &sensor_dev_attr_fan2_min.dev_attr.attr,
&sensor_dev_attr_fan1_div.dev_attr.attr, &sensor_dev_attr_fan1_div.dev_attr.attr,
&sensor_dev_attr_fan2_div.dev_attr.attr, &sensor_dev_attr_fan2_div.dev_attr.attr,
&sensor_dev_attr_fan1_alarm.dev_attr.attr,
&sensor_dev_attr_fan2_alarm.dev_attr.attr,
&dev_attr_alarms.attr, &dev_attr_alarms.attr,
&dev_attr_name.attr, &dev_attr_name.attr,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
vt8231.c - Part of lm_sensors, Linux kernel modules vt8231.c - Part of lm_sensors, Linux kernel modules
for hardware monitoring for hardware monitoring
Copyright (c) 2005 Roger Lucas <roger@planbit.co.uk> Copyright (c) 2005 Roger Lucas <vt8231@hiddenengine.co.uk>
Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com> Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com>
Aaron M. Marsh <amarsh@sdf.lonestar.org> Aaron M. Marsh <amarsh@sdf.lonestar.org>
...@@ -541,6 +541,28 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ...@@ -541,6 +541,28 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr,
} }
static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 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 vt8231_data *data = vt8231_update_device(dev);
return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
}
static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4);
static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 11);
static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 0);
static SENSOR_DEVICE_ATTR(temp4_alarm, S_IRUGO, show_alarm, NULL, 1);
static SENSOR_DEVICE_ATTR(temp5_alarm, S_IRUGO, show_alarm, NULL, 3);
static SENSOR_DEVICE_ATTR(temp6_alarm, S_IRUGO, show_alarm, NULL, 8);
static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 11);
static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 0);
static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 1);
static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3);
static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8);
static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 2);
static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6);
static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7);
static ssize_t show_name(struct device *dev, struct device_attribute static ssize_t show_name(struct device *dev, struct device_attribute
*devattr, char *buf) *devattr, char *buf)
{ {
...@@ -549,36 +571,42 @@ static ssize_t show_name(struct device *dev, struct device_attribute ...@@ -549,36 +571,42 @@ static ssize_t show_name(struct device *dev, struct device_attribute
} }
static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
static struct attribute *vt8231_attributes_temps[6][4] = { static struct attribute *vt8231_attributes_temps[6][5] = {
{ {
&dev_attr_temp1_input.attr, &dev_attr_temp1_input.attr,
&dev_attr_temp1_max_hyst.attr, &dev_attr_temp1_max_hyst.attr,
&dev_attr_temp1_max.attr, &dev_attr_temp1_max.attr,
&sensor_dev_attr_temp1_alarm.dev_attr.attr,
NULL NULL
}, { }, {
&sensor_dev_attr_temp2_input.dev_attr.attr, &sensor_dev_attr_temp2_input.dev_attr.attr,
&sensor_dev_attr_temp2_max_hyst.dev_attr.attr, &sensor_dev_attr_temp2_max_hyst.dev_attr.attr,
&sensor_dev_attr_temp2_max.dev_attr.attr, &sensor_dev_attr_temp2_max.dev_attr.attr,
&sensor_dev_attr_temp2_alarm.dev_attr.attr,
NULL NULL
}, { }, {
&sensor_dev_attr_temp3_input.dev_attr.attr, &sensor_dev_attr_temp3_input.dev_attr.attr,
&sensor_dev_attr_temp3_max_hyst.dev_attr.attr, &sensor_dev_attr_temp3_max_hyst.dev_attr.attr,
&sensor_dev_attr_temp3_max.dev_attr.attr, &sensor_dev_attr_temp3_max.dev_attr.attr,
&sensor_dev_attr_temp3_alarm.dev_attr.attr,
NULL NULL
}, { }, {
&sensor_dev_attr_temp4_input.dev_attr.attr, &sensor_dev_attr_temp4_input.dev_attr.attr,
&sensor_dev_attr_temp4_max_hyst.dev_attr.attr, &sensor_dev_attr_temp4_max_hyst.dev_attr.attr,
&sensor_dev_attr_temp4_max.dev_attr.attr, &sensor_dev_attr_temp4_max.dev_attr.attr,
&sensor_dev_attr_temp4_alarm.dev_attr.attr,
NULL NULL
}, { }, {
&sensor_dev_attr_temp5_input.dev_attr.attr, &sensor_dev_attr_temp5_input.dev_attr.attr,
&sensor_dev_attr_temp5_max_hyst.dev_attr.attr, &sensor_dev_attr_temp5_max_hyst.dev_attr.attr,
&sensor_dev_attr_temp5_max.dev_attr.attr, &sensor_dev_attr_temp5_max.dev_attr.attr,
&sensor_dev_attr_temp5_alarm.dev_attr.attr,
NULL NULL
}, { }, {
&sensor_dev_attr_temp6_input.dev_attr.attr, &sensor_dev_attr_temp6_input.dev_attr.attr,
&sensor_dev_attr_temp6_max_hyst.dev_attr.attr, &sensor_dev_attr_temp6_max_hyst.dev_attr.attr,
&sensor_dev_attr_temp6_max.dev_attr.attr, &sensor_dev_attr_temp6_max.dev_attr.attr,
&sensor_dev_attr_temp6_alarm.dev_attr.attr,
NULL NULL
} }
}; };
...@@ -592,36 +620,42 @@ static const struct attribute_group vt8231_group_temps[6] = { ...@@ -592,36 +620,42 @@ static const struct attribute_group vt8231_group_temps[6] = {
{ .attrs = vt8231_attributes_temps[5] }, { .attrs = vt8231_attributes_temps[5] },
}; };
static struct attribute *vt8231_attributes_volts[6][4] = { static struct attribute *vt8231_attributes_volts[6][5] = {
{ {
&sensor_dev_attr_in0_input.dev_attr.attr, &sensor_dev_attr_in0_input.dev_attr.attr,
&sensor_dev_attr_in0_min.dev_attr.attr, &sensor_dev_attr_in0_min.dev_attr.attr,
&sensor_dev_attr_in0_max.dev_attr.attr, &sensor_dev_attr_in0_max.dev_attr.attr,
&sensor_dev_attr_in0_alarm.dev_attr.attr,
NULL NULL
}, { }, {
&sensor_dev_attr_in1_input.dev_attr.attr, &sensor_dev_attr_in1_input.dev_attr.attr,
&sensor_dev_attr_in1_min.dev_attr.attr, &sensor_dev_attr_in1_min.dev_attr.attr,
&sensor_dev_attr_in1_max.dev_attr.attr, &sensor_dev_attr_in1_max.dev_attr.attr,
&sensor_dev_attr_in1_alarm.dev_attr.attr,
NULL NULL
}, { }, {
&sensor_dev_attr_in2_input.dev_attr.attr, &sensor_dev_attr_in2_input.dev_attr.attr,
&sensor_dev_attr_in2_min.dev_attr.attr, &sensor_dev_attr_in2_min.dev_attr.attr,
&sensor_dev_attr_in2_max.dev_attr.attr, &sensor_dev_attr_in2_max.dev_attr.attr,
&sensor_dev_attr_in2_alarm.dev_attr.attr,
NULL NULL
}, { }, {
&sensor_dev_attr_in3_input.dev_attr.attr, &sensor_dev_attr_in3_input.dev_attr.attr,
&sensor_dev_attr_in3_min.dev_attr.attr, &sensor_dev_attr_in3_min.dev_attr.attr,
&sensor_dev_attr_in3_max.dev_attr.attr, &sensor_dev_attr_in3_max.dev_attr.attr,
&sensor_dev_attr_in3_alarm.dev_attr.attr,
NULL NULL
}, { }, {
&sensor_dev_attr_in4_input.dev_attr.attr, &sensor_dev_attr_in4_input.dev_attr.attr,
&sensor_dev_attr_in4_min.dev_attr.attr, &sensor_dev_attr_in4_min.dev_attr.attr,
&sensor_dev_attr_in4_max.dev_attr.attr, &sensor_dev_attr_in4_max.dev_attr.attr,
&sensor_dev_attr_in4_alarm.dev_attr.attr,
NULL NULL
}, { }, {
&dev_attr_in5_input.attr, &dev_attr_in5_input.attr,
&dev_attr_in5_min.attr, &dev_attr_in5_min.attr,
&dev_attr_in5_max.attr, &dev_attr_in5_max.attr,
&sensor_dev_attr_in5_alarm.dev_attr.attr,
NULL NULL
} }
}; };
...@@ -642,6 +676,8 @@ static struct attribute *vt8231_attributes[] = { ...@@ -642,6 +676,8 @@ static struct attribute *vt8231_attributes[] = {
&sensor_dev_attr_fan2_min.dev_attr.attr, &sensor_dev_attr_fan2_min.dev_attr.attr,
&sensor_dev_attr_fan1_div.dev_attr.attr, &sensor_dev_attr_fan1_div.dev_attr.attr,
&sensor_dev_attr_fan2_div.dev_attr.attr, &sensor_dev_attr_fan2_div.dev_attr.attr,
&sensor_dev_attr_fan1_alarm.dev_attr.attr,
&sensor_dev_attr_fan2_alarm.dev_attr.attr,
&dev_attr_alarms.attr, &dev_attr_alarms.attr,
&dev_attr_name.attr, &dev_attr_name.attr,
NULL NULL
...@@ -963,7 +999,7 @@ static void __exit sm_vt8231_exit(void) ...@@ -963,7 +999,7 @@ static void __exit sm_vt8231_exit(void)
} }
} }
MODULE_AUTHOR("Roger Lucas <roger@planbit.co.uk>"); MODULE_AUTHOR("Roger Lucas <vt8231@hiddenengine.co.uk>");
MODULE_DESCRIPTION("VT8231 sensors"); MODULE_DESCRIPTION("VT8231 sensors");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
static struct platform_device *pdev; static struct platform_device *pdev;
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
0x2e, 0x2f, I2C_CLIENT_END }; 0x2e, 0x2f, I2C_CLIENT_END };
static unsigned short isa_address = 0x290; static unsigned short isa_address = 0x290;
......
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
#define NUMBER_OF_TEMPIN 3 #define NUMBER_OF_TEMPIN 3
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_1(w83791d); I2C_CLIENT_INSMOD_1(w83791d);
......
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
#include <linux/sysfs.h> #include <linux/sysfs.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_1(w83792d); I2C_CLIENT_INSMOD_1(w83792d);
......
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
#include <linux/mutex.h> #include <linux/mutex.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_1(w83793); I2C_CLIENT_INSMOD_1(w83793);
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
* Address is fully defined internally and cannot be changed. * Address is fully defined internally and cannot be changed.
*/ */
static unsigned short normal_i2c[] = { 0x2e, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2e, I2C_CLIENT_END };
/* /*
* Insmod parameters * Insmod parameters
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
/* Addresses to scan */ /* Addresses to scan */
static unsigned short normal_i2c[] = { 0x2e, 0x2f, I2C_CLIENT_END }; static const unsigned short normal_i2c[] = { 0x2e, 0x2f, I2C_CLIENT_END };
/* Insmod parameters */ /* Insmod parameters */
I2C_CLIENT_INSMOD_1(w83l786ng); I2C_CLIENT_INSMOD_1(w83l786ng);
......
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