Add user-space support for the SMSC DME1737. Patch from Juerg Haefliger.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4355 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2007-03-27 15:46:14 +00:00
1 parent a3e5a4d228
commit df35b2d189
8 files changed
+323 -9

No files matched your search

+4
View File
@@ -2,10 +2,14 @@ lm_sensors CHANGES file
-----------------------
SVN HEAD
File sensors.conf.eg: Add a dme1737 section
Library: Clean up pwm symbol names translation
Add dme1737 support
Program isadump: Detect when address bit 7 is a busy flag
Program sensors: Drop ddcmon and eeprom support
Add dme1737 support
Program sensors-detect: Stop Super-I/O probe after first family success
Fix SMSC DME1737 detection
2.10.3 (20070319)
+67
View File
@@ -2813,3 +2813,70 @@ chip "k8temp-*"
label temp2 "Core0 Temp"
label temp3 "Core1 Temp"
label temp4 "Core1 Temp"
#
# Sample configuration for the SMSC DME1737 and ASUS A8000
#
chip "dme1737-*"
# Voltage inputs
label in0 "V5stby"
label in1 "Vccp"
label in2 "V3.3"
label in3 "V5"
label in4 "V12"
label in5 "V3.3stby"
label in6 "Vbat"
# Temperature inputs
label temp1 "RD1 Temp"
label temp2 "Int Temp"
label temp3 "CPU Temp"
# Fan inputs
label fan1 "CPU_Fan"
label fan2 "Fan2"
label fan3 "Fan3"
label fan4 "Fan4"
label fan5 "Fan5"
label fan6 "Fan6"
# PWM Outputs
label pwm1 "CPU_PWM"
label pwm2 "Fan2_PWM"
label pwm3 "Fan3_PWM"
label pwm5 "Fan5_PWM"
label pwm6 "Fan6_PWM"
# Set voltage limits
# set in0_min 5.0 * 0.95
# set in0_max 5.0 * 1.05
# set in1_min 1.4 * 0.95
# set in1_max 1.4 * 1.05
# set in2_min 3.3 * 0.95
# set in2_max 3.3 * 1.05
# set in3_min 5.0 * 0.95
# set in3_max 5.0 * 1.05
# set in4_min 12.0 * 0.95
# set in4_max 12.0 * 1.05
# set in5_min 3.3 * 0.95
# set in5_max 3.3 * 1.05
# set in6_min 3.0 * 0.95
# set in6_max 3.0 * 1.05
# Set Temp Limits
# set temp1_min 10
# set temp1_max 75
# set temp2_min 10
# set temp2_max 75
# set temp3_min 10
# set temp3_max 75
# Set Fan limits
# set fan1_min 1000
# set fan2_min 1000
# set fan3_min 1000
# set fan4_min 1000
# set fan5_min 1000
# set fan6_min 1000
+84
View File
@@ -5965,6 +5965,89 @@ static sensors_chip_feature coretemp_features[] =
{ { 0 }, 0 }
};
#define SENSORS_DME1737_IN_FEATURES(nr) \
{ { SENSORS_DME1737_IN(nr), "in" #nr, \
NOMAP, NOMAP, R }, \
NOSYSCTL, VALUE(3), 3 }, \
{ { SENSORS_DME1737_IN_MIN(nr), "in" #nr "_min", \
SENSORS_DME1737_IN(nr), SENSORS_DME1737_IN(nr), RW }, \
NOSYSCTL, VALUE(1), 3 }, \
{ { SENSORS_DME1737_IN_MAX(nr), "in" #nr "_max", \
SENSORS_DME1737_IN(nr), SENSORS_DME1737_IN(nr), RW }, \
NOSYSCTL, VALUE(2), 3 }, \
{ { SENSORS_DME1737_IN_ALARM(nr), "in" #nr "_alarm", \
SENSORS_DME1737_IN(nr), NOMAP, R }, \
NOSYSCTL, VALUE(1), 0 }
#define SENSORS_DME1737_TEMP_FEATURES(nr) \
{ { SENSORS_DME1737_TEMP(nr), "temp" #nr, \
NOMAP, NOMAP, R }, \
NOSYSCTL, VALUE(3), 3 }, \
{ { SENSORS_DME1737_TEMP_MIN(nr), "temp" #nr "_min", \
SENSORS_DME1737_TEMP(nr), SENSORS_DME1737_TEMP(nr), RW }, \
NOSYSCTL, VALUE(2), 3 }, \
{ { SENSORS_DME1737_TEMP_MAX(nr), "temp" #nr "_max", \
SENSORS_DME1737_TEMP(nr), SENSORS_DME1737_TEMP(nr), RW }, \
NOSYSCTL, VALUE(1), 3 }, \
{ { SENSORS_DME1737_TEMP_ALARM(nr), "temp" #nr "_alarm", \
SENSORS_DME1737_TEMP(nr), NOMAP, R }, \
NOSYSCTL, VALUE(1), 0 }, \
{ { SENSORS_DME1737_TEMP_FAULT(nr), "temp" #nr "_fault", \
SENSORS_DME1737_TEMP(nr), NOMAP, R }, \
NOSYSCTL, VALUE(2), 0 }
#define SENSORS_DME1737_FAN_FEATURES(nr) \
{ { SENSORS_DME1737_FAN(nr), "fan" #nr, \
NOMAP, NOMAP, R }, \
NOSYSCTL, VALUE(2), 0 }, \
{ { SENSORS_DME1737_FAN_MIN(nr), "fan" #nr "_min", \
SENSORS_DME1737_FAN(nr), SENSORS_DME1737_FAN(nr), RW }, \
NOSYSCTL, VALUE(1), 0 }, \
{ { SENSORS_DME1737_FAN_ALARM(nr), "fan" #nr "_alarm", \
SENSORS_DME1737_FAN(nr), NOMAP, R }, \
NOSYSCTL, VALUE(1), 0 }
#define SENSORS_DME1737_PWM_FEATURES(nr) \
{ { SENSORS_DME1737_PWM(nr), "pwm" #nr, \
NOMAP, NOMAP, RW }, \
NOSYSCTL, VALUE(1), 0 }, \
{ { SENSORS_DME1737_PWM_ENABLE(nr), "pwm" #nr "_enable", \
SENSORS_DME1737_PWM(nr), SENSORS_DME1737_PWM(nr), RW }, \
NOSYSCTL, VALUE(2), 0 }, \
{ { SENSORS_DME1737_PWM_FREQ(nr), "pwm" #nr "_freq", \
SENSORS_DME1737_PWM(nr), SENSORS_DME1737_PWM(nr), RW }, \
NOSYSCTL, VALUE(3), 0 }
static sensors_chip_feature dme1737_features[] =
{
SENSORS_DME1737_IN_FEATURES(0),
SENSORS_DME1737_IN_FEATURES(1),
SENSORS_DME1737_IN_FEATURES(2),
SENSORS_DME1737_IN_FEATURES(3),
SENSORS_DME1737_IN_FEATURES(4),
SENSORS_DME1737_IN_FEATURES(5),
SENSORS_DME1737_IN_FEATURES(6),
SENSORS_DME1737_TEMP_FEATURES(1),
SENSORS_DME1737_TEMP_FEATURES(2),
SENSORS_DME1737_TEMP_FEATURES(3),
SENSORS_DME1737_FAN_FEATURES(1),
SENSORS_DME1737_FAN_FEATURES(2),
SENSORS_DME1737_FAN_FEATURES(3),
SENSORS_DME1737_FAN_FEATURES(4),
SENSORS_DME1737_FAN_FEATURES(5),
SENSORS_DME1737_FAN_FEATURES(6),
SENSORS_DME1737_PWM_FEATURES(1),
SENSORS_DME1737_PWM_FEATURES(2),
SENSORS_DME1737_PWM_FEATURES(3),
SENSORS_DME1737_PWM_FEATURES(5),
SENSORS_DME1737_PWM_FEATURES(6),
{ { SENSORS_DME1737_VID, "cpu0_vid", NOMAP, NOMAP, R },
NOSYSCTL, VALUE(1), 3 },
{ { SENSORS_DME1737_VRM, "vrm", NOMAP, NOMAP, RW },
NOSYSCTL, VALUE(1), 1 },
{ { 0 }, 0 }
};
sensors_chip_features sensors_chip_features_list[] =
{
{ SENSORS_LM78_PREFIX, lm78_features },
@@ -6077,5 +6160,6 @@ sensors_chip_features sensors_chip_features_list[] =
{ SENSORS_ABITUGURU_PREFIX, abituguru_features },
{ SENSORS_K8TEMP_PREFIX, k8temp_features },
{ SENSORS_CORETEMP_PREFIX, coretemp_features },
{ SENSORS_DME1737_PREFIX, dme1737_features },
{ 0 }
};
+30
View File
@@ -2262,4 +2262,34 @@
#define SENSORS_CORETEMP_TEMP1_CRIT 0x02 /* R */
#define SENSORS_CORETEMP_TEMP1_CRIT_ALARM 0x03 /* R */
/* DME1737 */
#define SENSORS_DME1737_PREFIX "dme1737"
/* in n from 0 to 6 */
#define SENSORS_DME1737_IN(n) (0x01 + (n)) /* R */
#define SENSORS_DME1737_IN_MIN(n) (0x11 + (n)) /* RW */
#define SENSORS_DME1737_IN_MAX(n) (0x21 + (n)) /* RW */
#define SENSORS_DME1737_IN_ALARM(n) (0x31 + (n)) /* R */
/* temp n from 1 to 3*/
#define SENSORS_DME1737_TEMP(n) (0x41 + (n)) /* R */
#define SENSORS_DME1737_TEMP_MIN(n) (0x51 + (n)) /* RW */
#define SENSORS_DME1737_TEMP_MAX(n) (0x61 + (n)) /* RW */
#define SENSORS_DME1737_TEMP_ALARM(n) (0x71 + (n)) /* R */
#define SENSORS_DME1737_TEMP_FAULT(n) (0x81 + (n)) /* R */
/* fan n from 1 to 6 */
#define SENSORS_DME1737_FAN(n) (0x91 + (n)) /* R */
#define SENSORS_DME1737_FAN_MIN(n) (0xa1 + (n)) /* RW */
#define SENSORS_DME1737_FAN_ALARM(n) (0xb1 + (n)) /* R */
/* pwm n from 1 to 3 and 5 to 6 */
#define SENSORS_DME1737_PWM(n) (0xc1 + (n)) /* RW */
#define SENSORS_DME1737_PWM_ENABLE(n) (0xd1 + (n)) /* RW */
#define SENSORS_DME1737_PWM_FREQ(n) (0xe1 + (n)) /* RW */
#define SENSORS_DME1737_VID (0xf0) /* R */
#define SENSORS_DME1737_VRM (0xf1) /* RW */
#endif /* def LIB_SENSORS_CHIPS_H */
+21 -9
View File
@@ -1425,7 +1425,7 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x);
},
{
name => "SMSC DME1737",
driver => "to-be-written",
driver => "dme1737",
i2c_addrs => [0x2c..0x2e],
i2c_detect => sub { dme1737_detect(@_); },
},
@@ -1558,6 +1558,8 @@ $chip_kern26_w83791d = {
# Put in "not-a-sensor" if the chip doesn't have hardware monitoring
# capabilities (listing such chips here removes the need of manual
# lookup when people report them).
# Put in exactly "via-smbus-only" if this is a Super-I/O chip whose
# hardware monitoring registers can only be accessed via the SMBus.
# devid: The device ID(s) we have to match (base device)
# devid_mask (optional): Bitmask to apply before checking the device ID
# logdev: The logical device containing the sensors
@@ -1791,9 +1793,17 @@ $chip_kern26_w83791d = {
{
name => "SMSC DME1737 Super IO",
# Hardware monitoring features are accessed on the SMBus
driver => "not-a-sensor",
driver => "via-smbus-only",
devid => 0x78,
},
{
name => "SMSC DME1737 Super IO",
# The DME1737 shows up twice in this list because it can return either
# 0x78 or 0x77 as its device ID.
# Hardware monitoring features are accessed on the SMBus
driver => "via-smbus-only",
devid => 0x77,
},
],
},
{
@@ -3110,6 +3120,10 @@ sub probe_superio($$$)
print "\n (no hardware monitoring capabilities)\n";
return;
}
if ($chip->{driver} eq "via-smbus-only") {
print "\n (hardware monitoring capabilities accessible via SMBus only)\n";
return;
}
# Switch to the sensor logical device
outb($addrreg, $superio{logdevreg});
@@ -4845,17 +4859,15 @@ sub smsc47m192_detect
# Registers used:
# 0x3E: Manufacturer ID
# 0x3F: Version/Stepping
# 0x40: Configuration (2 reserved bits)
# 0x42: Interrupt Status 2 (1 reserved bit)
# 0x43: VID (2 reserved bits)
# 0x73: Read-only test register (4 test bits)
# 0x8A: Read-only test register (7 test bits)
sub dme1737_detect
{
my ($file, $addr) = @_;
return unless i2c_smbus_read_byte_data($file, 0x3E) == 0x55
return unless i2c_smbus_read_byte_data($file, 0x3E) == 0x5c
and (i2c_smbus_read_byte_data($file, 0x3F) & 0xF8) == 0x88
and (i2c_smbus_read_byte_data($file, 0x40) & 0xC4) == 0x04
and (i2c_smbus_read_byte_data($file, 0x42) & 0x02) == 0x00
and (i2c_smbus_read_byte_data($file, 0x43) & 0xC0) == 0x00;
and (i2c_smbus_read_byte_data($file, 0x73) & 0x0F) == 0x09
and (i2c_smbus_read_byte_data($file, 0x8A) & 0x7F) == 0x4D;
return ($addr == 0x2e ? 6 : 5);
}
+115
View File
@@ -5926,6 +5926,121 @@ void print_coretemp(const sensors_chip_name *name)
free(label);
}
static void print_dme1737_in(const sensors_chip_name *name, int i)
{
char *label;
double cur, min, max, alarm;
int valid;
if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_IN(i), &label,
&valid) &&
!sensors_get_feature(*name, SENSORS_DME1737_IN(i), &cur) &&
!sensors_get_feature(*name, SENSORS_DME1737_IN_MIN(i), &min) &&
!sensors_get_feature(*name, SENSORS_DME1737_IN_MAX(i), &max) &&
!sensors_get_feature(*name, SENSORS_DME1737_IN_ALARM(i), &alarm)) {
if (valid) {
print_label(label, 10);
printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n",
cur, min, max, alarm ? "ALARM" : "");
}
} else {
printf("ERROR: Can't get in%d data!\n", i);
}
free(label);
}
static void print_dme1737_temp(const sensors_chip_name *name, int i)
{
char *label;
double cur, min, max, alarm, fault;
int valid;
if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_TEMP(i), &label,
&valid) &&
!sensors_get_feature(*name, SENSORS_DME1737_TEMP(i), &cur) &&
!sensors_get_feature(*name, SENSORS_DME1737_TEMP_MIN(i), &min) &&
!sensors_get_feature(*name, SENSORS_DME1737_TEMP_MAX(i), &max) &&
!sensors_get_feature(*name, SENSORS_DME1737_TEMP_ALARM(i), &alarm) &&
!sensors_get_feature(*name, SENSORS_DME1737_TEMP_FAULT(i), &fault)) {
if (valid) {
print_label(label, 10);
print_temp_info(cur, max, min, MINMAX, 0, 0);
printf("%s %s\n", fault ? "FAULT" : "", alarm ? "ALARM" : "");
}
} else {
printf("ERROR: Can't get temp%d data!\n", i);
}
free(label);
}
static void print_dme1737_fan(const sensors_chip_name *name, int i)
{
char *label;
double cur, min, alarm;
int valid;
if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_FAN(i), &label,
&valid) &&
!sensors_get_feature(*name, SENSORS_DME1737_FAN(i), &cur) &&
!sensors_get_feature(*name, SENSORS_DME1737_FAN_MIN(i), &min) &&
!sensors_get_feature(*name, SENSORS_DME1737_FAN_ALARM(i), &alarm)) {
if (valid) {
print_label(label, 10);
printf("%4.0f RPM (min = %4.0f RPM) %s\n",
cur, min, alarm ? "ALARM" : "");
}
} else {
printf("ERROR: Can't get fan%d data!\n", i);
}
free(label);
}
static void print_dme1737_pwm(const sensors_chip_name *name, int i)
{
char *label;
double cur, enable, freq;
int valid;
if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_PWM(i), &label,
&valid) &&
!sensors_get_feature(*name, SENSORS_DME1737_PWM(i), &cur) &&
!sensors_get_feature(*name, SENSORS_DME1737_PWM_ENABLE(i), &enable) &&
!sensors_get_feature(*name, SENSORS_DME1737_PWM_FREQ(i), &freq)) {
if (valid) {
print_label(label, 10);
printf("%4.0f (enable = %1.0f, freq = %6.0f Hz)\n", cur, enable, freq);
}
} else {
printf("ERROR: Can't get pwm%d data!\n", i);
}
free(label);
}
void print_dme1737(const sensors_chip_name *name)
{
int i;
for (i = 0; i < 7; i++) {
print_dme1737_in(name, i);
}
for (i = 1; i < 4; i++) {
print_dme1737_temp(name, i);
}
for (i = 1; i < 7; i++) {
print_dme1737_fan(name, i);
}
for (i = 1; i < 7; i++) {
if (i == 4)
continue;
print_dme1737_pwm(name, i);
}
print_vid_info(name, SENSORS_DME1737_VID, SENSORS_DME1737_VRM);
}
void print_unknown_chip(const sensors_chip_name *name)
{
int a,b,valid;
+1
View File
@@ -76,5 +76,6 @@ extern void print_f71805f(const sensors_chip_name *name);
extern void print_abituguru(const sensors_chip_name *name);
extern void print_k8temp(const sensors_chip_name *name);
extern void print_coretemp(const sensors_chip_name *name);
extern void print_dme1737(const sensors_chip_name *name);
#endif /* def PROG_SENSORS_CHIPS_H */
+1
View File
@@ -421,6 +421,7 @@ struct match matches[] = {
{ "abituguru", print_abituguru },
{ "k8temp", print_k8temp },
{ "coretemp", print_coretemp },
{ "dme1737", print_dme1737 },
{ NULL, NULL }
};