Skip to content

Commit

Permalink
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Linus Torvalds committed Jul 25, 2011
2 parents d3ec484 + 156e2d1 commit 750e069
Show file tree
Hide file tree
Showing 16 changed files with 1,285 additions and 468 deletions.
3 changes: 2 additions & 1 deletion Documentation/hwmon/it87
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ IT8718F, IT8720F, IT8721F, IT8726F, IT8758E and SiS950 chips.
These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
joysticks and other miscellaneous stuff. For hardware monitoring, they
include an 'environment controller' with 3 temperature sensors, 3 fan
rotation speed sensors, 8 voltage sensors, and associated alarms.
rotation speed sensors, 8 voltage sensors, associated alarms, and chassis
intrusion detection.

The IT8712F and IT8716F additionally feature VID inputs, used to report
the Vcore voltage of the processor. The early IT8712F have 5 VID pins,
Expand Down
3 changes: 2 additions & 1 deletion Documentation/hwmon/lm78
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Supported chips:
Datasheet: Publicly available at the National Semiconductor website
http://www.national.com/

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

Description
-----------
Expand Down
31 changes: 31 additions & 0 deletions Documentation/hwmon/sch5636
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Kernel driver sch5636
=====================

Supported chips:
* SMSC SCH5636
Prefix: 'sch5636'
Addresses scanned: none, address read from Super I/O config space

Author: Hans de Goede <hdegoede@redhat.com>


Description
-----------

SMSC SCH5636 Super I/O chips include an embedded microcontroller for
hardware monitoring solutions, allowing motherboard manufacturers to create
their own custom hwmon solution based upon the SCH5636.

Currently the sch5636 driver only supports the Fujitsu Theseus SCH5636 based
hwmon solution. The sch5636 driver runs a sanity check on loading to ensure
it is dealing with a Fujitsu Theseus and not with another custom SCH5636 based
hwmon solution.

The Fujitsu Theseus can monitor up to 5 voltages, 8 fans and 16
temperatures. Note that the driver detects how many fan headers /
temperature sensors are actually implemented on the motherboard, so you will
likely see fewer temperature and fan inputs.

An application note describing the Theseus' registers, as well as an
application note describing the protocol for communicating with the
microcontroller is available upon request. Please mail me if you want a copy.
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -3960,6 +3960,13 @@ L: lm-sensors@lm-sensors.org
S: Maintained
F: drivers/hwmon/lm73.c

LM78 HARDWARE MONITOR DRIVER
M: Jean Delvare <khali@linux-fr.org>
L: lm-sensors@lm-sensors.org
S: Maintained
F: Documentation/hwmon/lm78
F: drivers/hwmon/lm78.c

LM83 HARDWARE MONITOR DRIVER
M: Jean Delvare <khali@linux-fr.org>
L: lm-sensors@lm-sensors.org
Expand Down
21 changes: 21 additions & 0 deletions drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1041,15 +1041,35 @@ config SENSORS_SMSC47B397
This driver can also be built as a module. If so, the module
will be called smsc47b397.

config SENSORS_SCH56XX_COMMON
tristate
default n

config SENSORS_SCH5627
tristate "SMSC SCH5627"
select SENSORS_SCH56XX_COMMON
help
If you say yes here you get support for the hardware monitoring
features of the SMSC SCH5627 Super-I/O chip.

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

config SENSORS_SCH5636
tristate "SMSC SCH5636"
select SENSORS_SCH56XX_COMMON
help
SMSC SCH5636 Super I/O chips include an embedded microcontroller for
hardware monitoring solutions, allowing motherboard manufacturers to
create their own custom hwmon solution based upon the SCH5636.

Currently this driver only supports the Fujitsu Theseus SCH5636 based
hwmon solution. Say yes here if you want support for the Fujitsu
Theseus' hardware monitoring features.

This driver can also be built as a module. If so, the module
will be called sch5636.

config SENSORS_ADS1015
tristate "Texas Instruments ADS1015"
depends on I2C
Expand Down Expand Up @@ -1142,6 +1162,7 @@ config SENSORS_TWL4030_MADC
config SENSORS_VIA_CPUTEMP
tristate "VIA CPU temperature sensor"
depends on X86
select HWMON_VID
help
If you say yes here you get support for the temperature
sensor inside your CPU. Supported are all known variants of
Expand Down
2 changes: 2 additions & 0 deletions drivers/hwmon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ obj-$(CONFIG_SENSORS_PC87360) += pc87360.o
obj-$(CONFIG_SENSORS_PC87427) += pc87427.o
obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o
obj-$(CONFIG_SENSORS_S3C) += s3c-hwmon.o
obj-$(CONFIG_SENSORS_SCH56XX_COMMON)+= sch56xx-common.o
obj-$(CONFIG_SENSORS_SCH5627) += sch5627.o
obj-$(CONFIG_SENSORS_SCH5636) += sch5636.o
obj-$(CONFIG_SENSORS_SHT15) += sht15.o
obj-$(CONFIG_SENSORS_SHT21) += sht21.o
obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o
Expand Down
42 changes: 41 additions & 1 deletion drivers/hwmon/hwmon-vid.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ int vid_from_reg(int val, u8 vrm)
return(val & 0x10 ? 975 - (val & 0xF) * 25 :
1750 - val * 50);
case 13:
case 131:
val &= 0x3f;
/* Exception for Eden ULV 500 MHz */
if (vrm == 131 && val == 0x3f)
val++;
return(1708 - val * 16);
case 14: /* Intel Core */
/* compute in uV, round to mV */
Expand Down Expand Up @@ -205,11 +209,45 @@ static struct vrm_model vrm_models[] = {
{X86_VENDOR_CENTAUR, 0x6, 0x9, 0x7, 85}, /* Nehemiah */
{X86_VENDOR_CENTAUR, 0x6, 0x9, ANY, 17}, /* C3-M, Eden-N */
{X86_VENDOR_CENTAUR, 0x6, 0xA, 0x7, 0}, /* No information */
{X86_VENDOR_CENTAUR, 0x6, 0xA, ANY, 13}, /* C7, Esther */
{X86_VENDOR_CENTAUR, 0x6, 0xA, ANY, 13}, /* C7-M, C7, Eden (Esther) */
{X86_VENDOR_CENTAUR, 0x6, 0xD, ANY, 134}, /* C7-D, C7-M, C7, Eden (Esther) */

{X86_VENDOR_UNKNOWN, ANY, ANY, ANY, 0} /* stop here */
};

/*
* Special case for VIA model D: there are two different possible
* VID tables, so we have to figure out first, which one must be
* used. This resolves temporary drm value 134 to 14 (Intel Core
* 7-bit VID), 13 (Pentium M 6-bit VID) or 131 (Pentium M 6-bit VID
* + quirk for Eden ULV 500 MHz).
* Note: something similar might be needed for model A, I'm not sure.
*/
static u8 get_via_model_d_vrm(void)
{
unsigned int vid, brand, dummy;
static const char *brands[4] = {
"C7-M", "C7", "Eden", "C7-D"
};

rdmsr(0x198, dummy, vid);
vid &= 0xff;

rdmsr(0x1154, brand, dummy);
brand = ((brand >> 4) ^ (brand >> 2)) & 0x03;

if (vid > 0x3f) {
pr_info("Using %d-bit VID table for VIA %s CPU\n",
7, brands[brand]);
return 14;
} else {
pr_info("Using %d-bit VID table for VIA %s CPU\n",
6, brands[brand]);
/* Enable quirk for Eden */
return brand == 2 ? 131 : 13;
}
}

static u8 find_vrm(u8 eff_family, u8 eff_model, u8 eff_stepping, u8 vendor)
{
int i = 0;
Expand Down Expand Up @@ -247,6 +285,8 @@ u8 vid_which_vrm(void)
eff_model += ((eax & 0x000F0000)>>16)<<4;
}
vrm_ret = find_vrm(eff_family, eff_model, eff_stepping, c->x86_vendor);
if (vrm_ret == 134)
vrm_ret = get_via_model_d_vrm();
if (vrm_ret == 0)
pr_info("Unknown VRM version of your x86 CPU\n");
return vrm_ret;
Expand Down
29 changes: 29 additions & 0 deletions drivers/hwmon/it87.c
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,32 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
struct it87_data *data = it87_update_device(dev);
return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
}

static ssize_t clear_intrusion(struct device *dev, struct device_attribute
*attr, const char *buf, size_t count)
{
struct it87_data *data = dev_get_drvdata(dev);
long val;
int config;

if (strict_strtol(buf, 10, &val) < 0 || val != 0)
return -EINVAL;

mutex_lock(&data->update_lock);
config = it87_read_value(data, IT87_REG_CONFIG);
if (config < 0) {
count = config;
} else {
config |= 1 << 5;
it87_write_value(data, IT87_REG_CONFIG, config);
/* Invalidate cache to force re-read */
data->valid = 0;
}
mutex_unlock(&data->update_lock);

return count;
}

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);
Expand All @@ -1188,6 +1214,8 @@ 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 SENSOR_DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR,
show_alarm, clear_intrusion, 4);

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

&dev_attr_alarms.attr,
&sensor_dev_attr_intrusion0_alarm.dev_attr.attr,
&dev_attr_name.attr,
NULL
};
Expand Down
Loading

0 comments on commit 750e069

Please sign in to comment.