2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 14:25:39 +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:
Mark D. Studebaker
2000-11-26 23:07:17 +00:00
parent bd1b923045
commit bb4b723e68
14 changed files with 694 additions and 6 deletions

View File

@@ -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.