Commit 7e92214b authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6

* 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
  hwmon: (abituguru3) Fix CONFIG_DMI=n fallback to probe
  hwmon: (abituguru3) Enable DMI probing feature on IN9 32X MAX
  hwmon: (abituguru3) Match partial DMI board name strings
  hwmon: Add a driver for the ADT7475 hardware monitoring chip
  hwmon: (k8temp) Fix temperature reporting for (most) K8 RevG CPUs
  hwmon: (k8temp) Fix wrong sensor selection for AMD K8 RevF/RevG CPUs
  hwmon: (k8temp) Warn about fam F rev F errata
parents 6364853d 46a5f173
This describes the interface for the ADT7475 driver:
(there are 4 fans, numbered fan1 to fan4):
fanX_input Read the current speed of the fan (in RPMs)
fanX_min Read/write the minimum speed of the fan. Dropping
below this sets an alarm.
(there are three PWMs, numbered pwm1 to pwm3):
pwmX Read/write the current duty cycle of the PWM. Writes
only have effect when auto mode is turned off (see
below). Range is 0 - 255.
pwmX_enable Fan speed control method:
0 - No control (fan at full speed)
1 - Manual fan speed control (using pwm[1-*])
2 - Automatic fan speed control
pwmX_auto_channels_temp Select which channels affect this PWM
1 - TEMP1 controls PWM
2 - TEMP2 controls PWM
4 - TEMP3 controls PWM
6 - TEMP2 and TEMP3 control PWM
7 - All three inputs control PWM
pwmX_freq Read/write the PWM frequency in Hz. The number
should be one of the following:
11 Hz
14 Hz
22 Hz
29 Hz
35 Hz
44 Hz
58 Hz
88 Hz
pwmX_auto_point1_pwm Read/write the minimum PWM duty cycle in automatic mode
pwmX_auto_point2_pwm Read/write the maximum PWM duty cycle in automatic mode
(there are three temperature settings numbered temp1 to temp3):
tempX_input Read the current temperature. The value is in milli
degrees of Celsius.
tempX_max Read/write the upper temperature limit - exceeding this
will cause an alarm.
tempX_min Read/write the lower temperature limit - exceeding this
will cause an alarm.
tempX_offset Read/write the temperature adjustment offset
tempX_crit Read/write the THERM limit for remote1.
tempX_crit_hyst Set the temperature value below crit where the
fans will stay on - this helps drive the temperature
low enough so it doesn't stay near the edge and
cause THERM to keep tripping.
tempX_auto_point1_temp Read/write the minimum temperature where the fans will
turn on in automatic mode.
tempX_auto_point2_temp Read/write the maximum temperature over which the fans
will run in automatic mode. tempX_auto_point1_temp
and tempX_auto_point2_temp together define the
range of automatic control.
tempX_alarm Read a 1 if the max/min alarm is set
tempX_fault Read a 1 if either temp1 or temp3 diode has a fault
(There are two voltage settings, in1 and in2):
inX_input Read the current voltage on VCC. Value is in
millivolts.
inX_min read/write the minimum voltage limit.
Dropping below this causes an alarm.
inX_max read/write the maximum voltage limit.
Exceeding this causes an alarm.
inX_alarm Read a 1 if the max/min alarm is set.
...@@ -189,6 +189,16 @@ config SENSORS_ADT7473 ...@@ -189,6 +189,16 @@ config SENSORS_ADT7473
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 adt7473. will be called adt7473.
config SENSORS_ADT7475
tristate "Analog Devices ADT7475"
depends on I2C && EXPERIMENTAL
help
If you say yes here you get support for the Analog Devices
ADT7475 hardware monitoring chips.
This driver can also be build as a module. If so, the module
will be called adt7475.
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
......
...@@ -28,6 +28,8 @@ obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o ...@@ -28,6 +28,8 @@ obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o
obj-$(CONFIG_SENSORS_ADT7462) += adt7462.o obj-$(CONFIG_SENSORS_ADT7462) += adt7462.o
obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o
obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o
obj-$(CONFIG_SENSORS_ADT7475) += adt7475.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
......
...@@ -279,7 +279,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { ...@@ -279,7 +279,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
{ "OTES1 Fan", 36, 2, 60, 1, 0 }, { "OTES1 Fan", 36, 2, 60, 1, 0 },
{ NULL, 0, 0, 0, 0, 0 } } { NULL, 0, 0, 0, 0, 0 } }
}, },
{ 0x0011, "AT8 32X(ATI RD580-ULI M1575)", { { 0x0011, "AT8 32X", {
{ "CPU Core", 0, 0, 10, 1, 0 }, { "CPU Core", 0, 0, 10, 1, 0 },
{ "DDR", 1, 0, 20, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 },
{ "DDR VTT", 2, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
...@@ -402,7 +402,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { ...@@ -402,7 +402,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
{ "AUX3 Fan", 36, 2, 60, 1, 0 }, { "AUX3 Fan", 36, 2, 60, 1, 0 },
{ NULL, 0, 0, 0, 0, 0 } } { NULL, 0, 0, 0, 0, 0 } }
}, },
{ 0x0016, "AW9D-MAX (Intel i975-ICH7)", { { 0x0016, "AW9D-MAX", {
{ "CPU Core", 0, 0, 10, 1, 0 }, { "CPU Core", 0, 0, 10, 1, 0 },
{ "DDR2", 1, 0, 20, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 },
{ "DDR2 VTT", 2, 0, 10, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
...@@ -482,7 +482,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { ...@@ -482,7 +482,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
{ "AUX3 Fan", 36, 2, 60, 1, 0 }, { "AUX3 Fan", 36, 2, 60, 1, 0 },
{ NULL, 0, 0, 0, 0, 0 } } { NULL, 0, 0, 0, 0, 0 } }
}, },
{ 0x0019, NULL /* Unknown, need DMI string */, { { 0x0019, "IN9 32X MAX", {
{ "CPU Core", 7, 0, 10, 1, 0 }, { "CPU Core", 7, 0, 10, 1, 0 },
{ "DDR2", 13, 0, 20, 1, 0 }, { "DDR2", 13, 0, 20, 1, 0 },
{ "DDR2 VTT", 14, 0, 10, 1, 0 }, { "DDR2 VTT", 14, 0, 10, 1, 0 },
...@@ -509,7 +509,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { ...@@ -509,7 +509,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
{ "AUX3 FAN", 36, 2, 60, 1, 0 }, { "AUX3 FAN", 36, 2, 60, 1, 0 },
{ NULL, 0, 0, 0, 0, 0 } } { NULL, 0, 0, 0, 0, 0 } }
}, },
{ 0x001A, "IP35 Pro(Intel P35-ICH9R)", { { 0x001A, "IP35 Pro", {
{ "CPU Core", 0, 0, 10, 1, 0 }, { "CPU Core", 0, 0, 10, 1, 0 },
{ "DDR2", 1, 0, 20, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 },
{ "DDR2 VTT", 2, 0, 10, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
...@@ -1128,6 +1128,7 @@ static int __init abituguru3_dmi_detect(void) ...@@ -1128,6 +1128,7 @@ static int __init abituguru3_dmi_detect(void)
{ {
const char *board_vendor, *board_name; const char *board_vendor, *board_name;
int i, err = (force) ? 1 : -ENODEV; int i, err = (force) ? 1 : -ENODEV;
size_t sublen;
board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
if (!board_vendor || strcmp(board_vendor, "http://www.abit.com.tw/")) if (!board_vendor || strcmp(board_vendor, "http://www.abit.com.tw/"))
...@@ -1137,9 +1138,20 @@ static int __init abituguru3_dmi_detect(void) ...@@ -1137,9 +1138,20 @@ static int __init abituguru3_dmi_detect(void)
if (!board_name) if (!board_name)
return err; return err;
/* At the moment, we don't care about the part of the vendor
* DMI string contained in brackets. Truncate the string at
* the first occurrence of a bracket. Trim any trailing space
* from the substring.
*/
sublen = strcspn(board_name, "(");
while (sublen > 0 && board_name[sublen - 1] == ' ')
sublen--;
for (i = 0; abituguru3_motherboards[i].id; i++) { for (i = 0; abituguru3_motherboards[i].id; i++) {
const char *dmi_name = abituguru3_motherboards[i].dmi_name; const char *dmi_name = abituguru3_motherboards[i].dmi_name;
if (dmi_name && !strcmp(dmi_name, board_name)) if (!dmi_name || strlen(dmi_name) != sublen)
continue;
if (!strncasecmp(board_name, dmi_name, sublen))
break; break;
} }
...@@ -1153,7 +1165,7 @@ static int __init abituguru3_dmi_detect(void) ...@@ -1153,7 +1165,7 @@ static int __init abituguru3_dmi_detect(void)
static inline int abituguru3_dmi_detect(void) static inline int abituguru3_dmi_detect(void)
{ {
return -ENODEV; return 1;
} }
#endif /* CONFIG_DMI */ #endif /* CONFIG_DMI */
......
This diff is collapsed.
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/hwmon-sysfs.h> #include <linux/hwmon-sysfs.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <asm/processor.h>
#define TEMP_FROM_REG(val) (((((val) >> 16) & 0xff) - 49) * 1000) #define TEMP_FROM_REG(val) (((((val) >> 16) & 0xff) - 49) * 1000)
#define REG_TEMP 0xe4 #define REG_TEMP 0xe4
...@@ -47,6 +48,8 @@ struct k8temp_data { ...@@ -47,6 +48,8 @@ struct k8temp_data {
/* registers values */ /* registers values */
u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */ u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */
u32 temp[2][2]; /* core, place */ u32 temp[2][2]; /* core, place */
u8 swap_core_select; /* meaning of SEL_CORE is inverted */
u32 temp_offset;
}; };
static struct k8temp_data *k8temp_update_device(struct device *dev) static struct k8temp_data *k8temp_update_device(struct device *dev)
...@@ -114,10 +117,15 @@ static ssize_t show_temp(struct device *dev, ...@@ -114,10 +117,15 @@ static ssize_t show_temp(struct device *dev,
to_sensor_dev_attr_2(devattr); to_sensor_dev_attr_2(devattr);
int core = attr->nr; int core = attr->nr;
int place = attr->index; int place = attr->index;
int temp;
struct k8temp_data *data = k8temp_update_device(dev); struct k8temp_data *data = k8temp_update_device(dev);
return sprintf(buf, "%d\n", if (data->swap_core_select)
TEMP_FROM_REG(data->temp[core][place])); core = core ? 0 : 1;
temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset;
return sprintf(buf, "%d\n", temp);
} }
/* core, place */ /* core, place */
...@@ -141,20 +149,49 @@ static int __devinit k8temp_probe(struct pci_dev *pdev, ...@@ -141,20 +149,49 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
int err; int err;
u8 scfg; u8 scfg;
u32 temp; u32 temp;
u8 model, stepping;
struct k8temp_data *data; struct k8temp_data *data;
u32 cpuid = cpuid_eax(1);
/* this feature should be available since SH-C0 core */
if ((cpuid == 0xf40) || (cpuid == 0xf50) || (cpuid == 0xf51)) {
err = -ENODEV;
goto exit;
}
if (!(data = kzalloc(sizeof(struct k8temp_data), GFP_KERNEL))) { if (!(data = kzalloc(sizeof(struct k8temp_data), GFP_KERNEL))) {
err = -ENOMEM; err = -ENOMEM;
goto exit; goto exit;
} }
model = boot_cpu_data.x86_model;
stepping = boot_cpu_data.x86_mask;
switch (boot_cpu_data.x86) {
case 0xf:
/* feature available since SH-C0, exclude older revisions */
if (((model == 4) && (stepping == 0)) ||
((model == 5) && (stepping <= 1))) {
err = -ENODEV;
goto exit_free;
}
/*
* AMD NPT family 0fh, i.e. RevF and RevG:
* meaning of SEL_CORE bit is inverted
*/
if (model >= 0x40) {
data->swap_core_select = 1;
dev_warn(&pdev->dev, "Temperature readouts might be "
"wrong - check erratum #141\n");
}
if ((model >= 0x69) &&
!(model == 0xc1 || model == 0x6c || model == 0x7c)) {
/*
* RevG desktop CPUs (i.e. no socket S1G1 parts)
* need additional offset, otherwise reported
* temperature is below ambient temperature
*/
data->temp_offset = 21000;
}
break;
}
pci_read_config_byte(pdev, REG_TEMP, &scfg); pci_read_config_byte(pdev, REG_TEMP, &scfg);
scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */ scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */
pci_write_config_byte(pdev, REG_TEMP, scfg); pci_write_config_byte(pdev, REG_TEMP, scfg);
......
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