(jrm): New driver and other support for the Maxim MAX6650 and MAX6651 chips.

Mainly targetted (and tested) with the 6651, but should work with
       the MAX6550.

       See doc/chips/max6650 for notes, bugs, assumptions, etc.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1987 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
John Morris committed 2003-08-31 20:45:12 +00:00
1 parent ebb1dc9a20
commit 45576fb3fd
11 files changed
+786 -2

No files matched your search

+35 -1
View File
@@ -776,7 +776,7 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
fscscy_detect pcf8591_detect arp_detect ipmi_kcs_detect
ipmi_smic_detect via8231_isa_detect lm85_detect smartbatt_detect
adm1026_detect w83l785ts_detect lm83_detect lm90_detect
saa1064_detect w83l784r_detect mozart_detect);
saa1064_detect w83l784r_detect mozart_detect max6650_detect);
# This is a list of all recognized chips.
# Each entry must have the following fields:
@@ -1060,6 +1060,12 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e],
i2c_detect => sub { adm1021_detect 3, @_ },
},
{
name => "Maxim MAX6650/MAX6651",
driver => "max6650",
i2c_addrs => [0x1b,0x1f,0x48,0x4b],
i2c_detect => sub { max6650_detect 0, @_ },
},
{
name => "TI THMC10",
driver => "adm1021",
@@ -3400,6 +3406,34 @@ sub w83l785ts_detect
return (8);
}
# $_[0]: Chip to detect. Always zero for now, but available for future use
# if somebody finds a way to distinguish MAX6650 and MAX6651.
# $_[1]: A reference to the file descriptor to access this chip.
# We may assume an i2c_set_slave_addr was already done.
# $_[2]: Address
# Returns: undef if not detected, 4 if detected.
#
# The max6650 has no device ID register. However, a few registers have
# spare bits, which are documented as being always zero on read. We read
# all of these registers check the spare bits. Any non-zero means this
# is not a max6650/1.
#
# The always zero bits are:
# configuration byte register (0x02) - top 2 bits
# gpio status register (0x14) - top 3 bits
# alarm enable register (0x08) - top 3 bits
# alarm status register (0x0A) - top 3 bits
# tachometer count time register (0x16) - top 6 bits
sub max6650_detect
{
my ($chip, $file) = @_;
return if i2c_smbus_read_byte_data($file,0x16) & 0xFC;
return if i2c_smbus_read_byte_data($file,0x0A) & 0xE0;
return if i2c_smbus_read_byte_data($file,0x08) & 0xE0;
return if i2c_smbus_read_byte_data($file,0x14) & 0xE0;
return if i2c_smbus_read_byte_data($file,0x02) & 0xC0;
return 4;
}
################
+49
View File
@@ -4511,6 +4511,55 @@ void print_xeontemp(const sensors_chip_name *name)
free_the_label(&label);
}
void print_max6650(const sensors_chip_name *name)
{
char *label = NULL;
double tach, speed;
int valid, i;
static const struct
{
int tag;
char *name;
}
tach_list[] =
{
{ SENSORS_MAX6650_FAN1_TACH, "FAN1" },
{ SENSORS_MAX6650_FAN2_TACH, "FAN2" },
{ SENSORS_MAX6650_FAN3_TACH, "FAN3" },
{ SENSORS_MAX6650_FAN4_TACH, "FAN4" }
};
/* Display full config for fan1, which is controlled */
if (!sensors_get_label_and_valid(*name,tach_list[0].tag,&label,&valid) &&
!sensors_get_feature(*name,tach_list[0].tag,&tach) &&
!sensors_get_feature(*name,SENSORS_MAX6650_SPEED,&speed)) {
if (valid) {
print_label(label,10);
printf("configured %4.0f RPM, actual %4.0f RPM.\n", speed, tach);
}
} else
printf("ERROR: Can't get %s data!\n", tach_list[i].name);
free_the_label(&label);
/* Just display the measured speed for the other three, uncontrolled fans */
for (i = 1; i < 4; i++)
{
if (!sensors_get_label_and_valid(*name,tach_list[i].tag,&label,&valid) &&
!sensors_get_feature(*name,tach_list[i].tag,&tach)) {
if (valid) {
print_label(label,10);
printf("%4.0f RPM \n", tach);
}
} else
printf("ERROR: Can't get %s data!\n", tach_list[i].name);
free_the_label(&label);
}
}
void print_unknown_chip(const sensors_chip_name *name)
{
int a,b,valid;
+1
View File
@@ -55,5 +55,6 @@ extern void print_bmc(const sensors_chip_name *name);
extern void print_lm83(const sensors_chip_name *name);
extern void print_lm90(const sensors_chip_name *name);
extern void print_xeontemp(const sensors_chip_name *name);
extern void print_max6650(const sensors_chip_name *name);
#endif /* def PROG_SENSORS_CHIPS_H */
+2
View File
@@ -380,6 +380,8 @@ void do_a_print(sensors_chip_name name)
print_lm90(&name);
else if (!strcmp(name.prefix,"xeontemp"))
print_xeontemp(&name);
else if (!strcmp(name.prefix,"max6650"))
print_max6650(&name);
else
print_unknown_chip(&name);
printf("\n");