Skip to content

Commit 750e069

Browse files
committed
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: hwmon: (lm78) Become the maintainer hwmon: (lm78) Make ISA interface depend on CONFIG_ISA hwmon: (lm78) Avoid forward declarations hwmon: (sht15) Correct a comment mistake hwmon: (max1111) Avoid extra memory allocations hwmon: (it87) Add chassis intrusion detection support hwmon: (via-cputemp) Add VID reporting support hwmon-vid: Add support for VIA family 6 model D CPU hwmon: New driver sch5636 hwmon: (sch5627) Factor out some code shared with sch5636 driver
2 parents d3ec484 + 156e2d1 commit 750e069

16 files changed

Lines changed: 1285 additions & 468 deletions

File tree

‎Documentation/hwmon/it87‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ IT8718F, IT8720F, IT8721F, IT8726F, IT8758E and SiS950 chips.
7676
These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
7777
joysticks and other miscellaneous stuff. For hardware monitoring, they
7878
include an 'environment controller' with 3 temperature sensors, 3 fan
79-
rotation speed sensors, 8 voltage sensors, and associated alarms.
79+
rotation speed sensors, 8 voltage sensors, associated alarms, and chassis
80+
intrusion detection.
8081

8182
The IT8712F and IT8716F additionally feature VID inputs, used to report
8283
the Vcore voltage of the processor. The early IT8712F have 5 VID pins,

‎Documentation/hwmon/lm78‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Supported chips:
1313
Datasheet: Publicly available at the National Semiconductor website
1414
http://www.national.com/
1515

16-
Author: Frodo Looijaard <frodol@dds.nl>
16+
Authors: Frodo Looijaard <frodol@dds.nl>
17+
Jean Delvare <khali@linux-fr.org>
1718

1819
Description
1920
-----------

‎Documentation/hwmon/sch5636‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Kernel driver sch5636
2+
=====================
3+
4+
Supported chips:
5+
* SMSC SCH5636
6+
Prefix: 'sch5636'
7+
Addresses scanned: none, address read from Super I/O config space
8+
9+
Author: Hans de Goede <hdegoede@redhat.com>
10+
11+
12+
Description
13+
-----------
14+
15+
SMSC SCH5636 Super I/O chips include an embedded microcontroller for
16+
hardware monitoring solutions, allowing motherboard manufacturers to create
17+
their own custom hwmon solution based upon the SCH5636.
18+
19+
Currently the sch5636 driver only supports the Fujitsu Theseus SCH5636 based
20+
hwmon solution. The sch5636 driver runs a sanity check on loading to ensure
21+
it is dealing with a Fujitsu Theseus and not with another custom SCH5636 based
22+
hwmon solution.
23+
24+
The Fujitsu Theseus can monitor up to 5 voltages, 8 fans and 16
25+
temperatures. Note that the driver detects how many fan headers /
26+
temperature sensors are actually implemented on the motherboard, so you will
27+
likely see fewer temperature and fan inputs.
28+
29+
An application note describing the Theseus' registers, as well as an
30+
application note describing the protocol for communicating with the
31+
microcontroller is available upon request. Please mail me if you want a copy.

‎MAINTAINERS‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3960,6 +3960,13 @@ L: lm-sensors@lm-sensors.org
39603960
S: Maintained
39613961
F: drivers/hwmon/lm73.c
39623962

3963+
LM78 HARDWARE MONITOR DRIVER
3964+
M: Jean Delvare <khali@linux-fr.org>
3965+
L: lm-sensors@lm-sensors.org
3966+
S: Maintained
3967+
F: Documentation/hwmon/lm78
3968+
F: drivers/hwmon/lm78.c
3969+
39633970
LM83 HARDWARE MONITOR DRIVER
39643971
M: Jean Delvare <khali@linux-fr.org>
39653972
L: lm-sensors@lm-sensors.org

‎drivers/hwmon/Kconfig‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,15 +1041,35 @@ config SENSORS_SMSC47B397
10411041
This driver can also be built as a module. If so, the module
10421042
will be called smsc47b397.
10431043

1044+
config SENSORS_SCH56XX_COMMON
1045+
tristate
1046+
default n
1047+
10441048
config SENSORS_SCH5627
10451049
tristate "SMSC SCH5627"
1050+
select SENSORS_SCH56XX_COMMON
10461051
help
10471052
If you say yes here you get support for the hardware monitoring
10481053
features of the SMSC SCH5627 Super-I/O chip.
10491054

10501055
This driver can also be built as a module. If so, the module
10511056
will be called sch5627.
10521057

1058+
config SENSORS_SCH5636
1059+
tristate "SMSC SCH5636"
1060+
select SENSORS_SCH56XX_COMMON
1061+
help
1062+
SMSC SCH5636 Super I/O chips include an embedded microcontroller for
1063+
hardware monitoring solutions, allowing motherboard manufacturers to
1064+
create their own custom hwmon solution based upon the SCH5636.
1065+
1066+
Currently this driver only supports the Fujitsu Theseus SCH5636 based
1067+
hwmon solution. Say yes here if you want support for the Fujitsu
1068+
Theseus' hardware monitoring features.
1069+
1070+
This driver can also be built as a module. If so, the module
1071+
will be called sch5636.
1072+
10531073
config SENSORS_ADS1015
10541074
tristate "Texas Instruments ADS1015"
10551075
depends on I2C
@@ -1142,6 +1162,7 @@ config SENSORS_TWL4030_MADC
11421162
config SENSORS_VIA_CPUTEMP
11431163
tristate "VIA CPU temperature sensor"
11441164
depends on X86
1165+
select HWMON_VID
11451166
help
11461167
If you say yes here you get support for the temperature
11471168
sensor inside your CPU. Supported are all known variants of

‎drivers/hwmon/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ obj-$(CONFIG_SENSORS_PC87360) += pc87360.o
9595
obj-$(CONFIG_SENSORS_PC87427) += pc87427.o
9696
obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o
9797
obj-$(CONFIG_SENSORS_S3C) += s3c-hwmon.o
98+
obj-$(CONFIG_SENSORS_SCH56XX_COMMON)+= sch56xx-common.o
9899
obj-$(CONFIG_SENSORS_SCH5627) += sch5627.o
100+
obj-$(CONFIG_SENSORS_SCH5636) += sch5636.o
99101
obj-$(CONFIG_SENSORS_SHT15) += sht15.o
100102
obj-$(CONFIG_SENSORS_SHT21) += sht21.o
101103
obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o

‎drivers/hwmon/hwmon-vid.c‎

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ int vid_from_reg(int val, u8 vrm)
140140
return(val & 0x10 ? 975 - (val & 0xF) * 25 :
141141
1750 - val * 50);
142142
case 13:
143+
case 131:
143144
val &= 0x3f;
145+
/* Exception for Eden ULV 500 MHz */
146+
if (vrm == 131 && val == 0x3f)
147+
val++;
144148
return(1708 - val * 16);
145149
case 14: /* Intel Core */
146150
/* compute in uV, round to mV */
@@ -205,11 +209,45 @@ static struct vrm_model vrm_models[] = {
205209
{X86_VENDOR_CENTAUR, 0x6, 0x9, 0x7, 85}, /* Nehemiah */
206210
{X86_VENDOR_CENTAUR, 0x6, 0x9, ANY, 17}, /* C3-M, Eden-N */
207211
{X86_VENDOR_CENTAUR, 0x6, 0xA, 0x7, 0}, /* No information */
208-
{X86_VENDOR_CENTAUR, 0x6, 0xA, ANY, 13}, /* C7, Esther */
212+
{X86_VENDOR_CENTAUR, 0x6, 0xA, ANY, 13}, /* C7-M, C7, Eden (Esther) */
213+
{X86_VENDOR_CENTAUR, 0x6, 0xD, ANY, 134}, /* C7-D, C7-M, C7, Eden (Esther) */
209214

210215
{X86_VENDOR_UNKNOWN, ANY, ANY, ANY, 0} /* stop here */
211216
};
212217

218+
/*
219+
* Special case for VIA model D: there are two different possible
220+
* VID tables, so we have to figure out first, which one must be
221+
* used. This resolves temporary drm value 134 to 14 (Intel Core
222+
* 7-bit VID), 13 (Pentium M 6-bit VID) or 131 (Pentium M 6-bit VID
223+
* + quirk for Eden ULV 500 MHz).
224+
* Note: something similar might be needed for model A, I'm not sure.
225+
*/
226+
static u8 get_via_model_d_vrm(void)
227+
{
228+
unsigned int vid, brand, dummy;
229+
static const char *brands[4] = {
230+
"C7-M", "C7", "Eden", "C7-D"
231+
};
232+
233+
rdmsr(0x198, dummy, vid);
234+
vid &= 0xff;
235+
236+
rdmsr(0x1154, brand, dummy);
237+
brand = ((brand >> 4) ^ (brand >> 2)) & 0x03;
238+
239+
if (vid > 0x3f) {
240+
pr_info("Using %d-bit VID table for VIA %s CPU\n",
241+
7, brands[brand]);
242+
return 14;
243+
} else {
244+
pr_info("Using %d-bit VID table for VIA %s CPU\n",
245+
6, brands[brand]);
246+
/* Enable quirk for Eden */
247+
return brand == 2 ? 131 : 13;
248+
}
249+
}
250+
213251
static u8 find_vrm(u8 eff_family, u8 eff_model, u8 eff_stepping, u8 vendor)
214252
{
215253
int i = 0;
@@ -247,6 +285,8 @@ u8 vid_which_vrm(void)
247285
eff_model += ((eax & 0x000F0000)>>16)<<4;
248286
}
249287
vrm_ret = find_vrm(eff_family, eff_model, eff_stepping, c->x86_vendor);
288+
if (vrm_ret == 134)
289+
vrm_ret = get_via_model_d_vrm();
250290
if (vrm_ret == 0)
251291
pr_info("Unknown VRM version of your x86 CPU\n");
252292
return vrm_ret;

‎drivers/hwmon/it87.c‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,32 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
11721172
struct it87_data *data = it87_update_device(dev);
11731173
return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
11741174
}
1175+
1176+
static ssize_t clear_intrusion(struct device *dev, struct device_attribute
1177+
*attr, const char *buf, size_t count)
1178+
{
1179+
struct it87_data *data = dev_get_drvdata(dev);
1180+
long val;
1181+
int config;
1182+
1183+
if (strict_strtol(buf, 10, &val) < 0 || val != 0)
1184+
return -EINVAL;
1185+
1186+
mutex_lock(&data->update_lock);
1187+
config = it87_read_value(data, IT87_REG_CONFIG);
1188+
if (config < 0) {
1189+
count = config;
1190+
} else {
1191+
config |= 1 << 5;
1192+
it87_write_value(data, IT87_REG_CONFIG, config);
1193+
/* Invalidate cache to force re-read */
1194+
data->valid = 0;
1195+
}
1196+
mutex_unlock(&data->update_lock);
1197+
1198+
return count;
1199+
}
1200+
11751201
static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 8);
11761202
static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 9);
11771203
static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 10);
@@ -1188,6 +1214,8 @@ static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 6);
11881214
static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 16);
11891215
static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 17);
11901216
static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 18);
1217+
static SENSOR_DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR,
1218+
show_alarm, clear_intrusion, 4);
11911219

11921220
static ssize_t show_beep(struct device *dev, struct device_attribute *attr,
11931221
char *buf)
@@ -1350,6 +1378,7 @@ static struct attribute *it87_attributes[] = {
13501378
&sensor_dev_attr_temp3_alarm.dev_attr.attr,
13511379

13521380
&dev_attr_alarms.attr,
1381+
&sensor_dev_attr_intrusion0_alarm.dev_attr.attr,
13531382
&dev_attr_name.attr,
13541383
NULL
13551384
};

0 commit comments

Comments
 (0)