mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-21 19:51:45 +00:00
(mds) add ds1621 driver from Christian Zuckschwerdt (zany@triq.net)
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@935 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
bd1b923045
commit
bb4b723e68
14 files changed
+694
-6
No files matched your search
@@ -360,7 +360,7 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
|
||||
adm9240_detect adm1021_detect sis5595_isa_detect eeprom_detect
|
||||
via686a_isa_detect adm1022_detect ltc1710_detect gl525sm_detect
|
||||
lm87_detect ite_detect ite_isa_detect ite_alias_detect
|
||||
ddcmonitor_detect);
|
||||
ddcmonitor_detect ds1621_detect);
|
||||
|
||||
# This is a list of all recognized chips.
|
||||
# Each entry must have the following fields:
|
||||
@@ -520,6 +520,12 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect
|
||||
i2c_addrs => [0x2c..0x2f],
|
||||
i2c_detect => sub { adm9240_detect 0, @_ }
|
||||
},
|
||||
{
|
||||
name => "Dallas Semiconductor DS1621",
|
||||
driver => "ds1621",
|
||||
i2c_addrs => [0x48..0x4f],
|
||||
i2c_detect => sub { ds1621_detect @_},
|
||||
} ,
|
||||
{
|
||||
name => "Dallas Semiconductor DS1780",
|
||||
driver => "adm9240",
|
||||
@@ -1566,6 +1572,26 @@ sub lm75_detect
|
||||
return (3);
|
||||
}
|
||||
|
||||
# $_[0]: A reference to the file descriptor to access this chip.
|
||||
# We may assume an i2c_set_slave_addr was already done.
|
||||
# $_[1]: Address
|
||||
# Returns: undef if not detected, (3) if detected,
|
||||
# (6) or (9) if even more bits match.
|
||||
# Registers used:
|
||||
# 0xAC: Configuration
|
||||
# Detection is weak. We check if Bit 3 is set and Bit 2 is clear.
|
||||
# The DS1621 will aways have a config like 0x????10??. A even better
|
||||
# match would be 0x0??01000.
|
||||
sub ds1621_detect
|
||||
{
|
||||
my $i;
|
||||
my ($file,$addr) = @_;
|
||||
my $conf = i2c_smbus_read_byte_data($file,0xAC);
|
||||
return (9) if ($conf & 0x9F) == 0x98;
|
||||
return (6) if ($conf & 0x0F) == 0x08;
|
||||
return (3) if ($conf & 0x0C) == 0x08;
|
||||
return ;
|
||||
}
|
||||
|
||||
# $_[0]: A reference to the file descriptor to access this chip.
|
||||
# We may assume an i2c_set_slave_addr was already done.
|
||||
|
||||
@@ -105,6 +105,43 @@ int sensors_get_label_and_valid(sensors_chip_name name, int feature, char **labe
|
||||
return err;
|
||||
}
|
||||
|
||||
void print_ds1621(const sensors_chip_name *name)
|
||||
{
|
||||
char *label;
|
||||
double cur,hyst,over;
|
||||
int alarms, valid;
|
||||
|
||||
if (!sensors_get_feature(*name,SENSORS_LM78_ALARMS,&cur))
|
||||
alarms = cur + 0.5;
|
||||
else {
|
||||
printf("ERROR: Can't get alarm data!\n");
|
||||
alarms = 0;
|
||||
}
|
||||
|
||||
if (!sensors_get_label_and_valid(*name,SENSORS_DS1621_TEMP,&label,&valid) &&
|
||||
!sensors_get_feature(*name,SENSORS_DS1621_TEMP,&cur) &&
|
||||
!sensors_get_feature(*name,SENSORS_DS1621_TEMP_HYST,&hyst) &&
|
||||
!sensors_get_feature(*name,SENSORS_DS1621_TEMP_OVER,&over)) {
|
||||
if (valid) {
|
||||
print_label(label,10);
|
||||
printf("%6.1f C (high limit: %6.1f C, low limit: %6.1f C) ",
|
||||
cur,over,hyst);
|
||||
if (alarms & (DS1621_ALARM_TEMP_HIGH | DS1621_ALARM_TEMP_LOW)) {
|
||||
printf("ALARM (");
|
||||
if (alarms & DS1621_ALARM_TEMP_LOW) {
|
||||
printf("LOW");
|
||||
}
|
||||
if (alarms & DS1621_ALARM_TEMP_HIGH)
|
||||
printf("%sHIGH",(alarms & DS1621_ALARM_TEMP_LOW)?",":"");
|
||||
printf(")");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
} else
|
||||
printf("ERROR: Can't get temperature data!\n");
|
||||
free_the_label(&label);
|
||||
}
|
||||
|
||||
void print_lm75(const sensors_chip_name *name)
|
||||
{
|
||||
char *label;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
extern void print_unknown_chip(const sensors_chip_name *name);
|
||||
|
||||
extern void print_ds1621(const sensors_chip_name *name);
|
||||
extern void print_mtp008(const sensors_chip_name *name);
|
||||
extern void print_lm75(const sensors_chip_name *name);
|
||||
extern void print_adm1021(const sensors_chip_name *name);
|
||||
|
||||
@@ -260,6 +260,8 @@ void do_a_print(sensors_chip_name name)
|
||||
printf(" ERROR: Can't get adapter or algorithm?!?\n");
|
||||
if (do_unknown)
|
||||
print_unknown_chip(&name);
|
||||
else if (!strcmp(name.prefix,"ds1621"))
|
||||
print_ds1621(&name);
|
||||
else if (!strcmp(name.prefix,"lm75"))
|
||||
print_lm75(&name);
|
||||
else if (!strcmp(name.prefix,"adm1021") || !strcmp(name.prefix,"max1617") ||
|
||||
|
||||
Reference in new issue
Block a user