2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-30 13:57:41 +00:00

sensors-detect: Add detection of NCT7802Y

This commit is contained in:
Guenter Roeck 2014-06-26 14:37:22 +00:00
parent 778c8486c8
commit a5f0ead1ae
2 changed files with 47 additions and 0 deletions

View File

@ -13,6 +13,7 @@ SVN HEAD
Add detection of ITE IT8620E and IT8623E
Add detection of TMP441, TMP442, LM95233, LM95234,
and LM95235
Add detection of NCT7802Y
3.3.5 "Happy Birthday Beddy" (2014-01-22)
libsensors: Improve documentation of two functions

View File

@ -732,6 +732,11 @@ use vars qw(@i2c_adapter_names);
driver => "w83795",
i2c_addrs => [0x2c..0x2f],
i2c_detect => sub { w83795_detect(@_); },
}, {
name => "Nuvoton NCT7802Y",
driver => "to-be-written",
i2c_addrs => [0x28..0x2f],
i2c_detect => sub { nct7802_detect(@_); },
}, {
name => "Winbond W83627HF",
driver => "use-isa-instead",
@ -5482,6 +5487,47 @@ sub w83795_detect
return 8;
}
# Registers used:
# 0x00: Bank selection (Bank 0, 1)
# 0x05: Temperature readout register LSB (Bank 0)
# 0x08: PECI temperature readout register LSB (Bank 0)
# 0x0f: Voltage readout register LSB (Bank 0)
# 0xfd: Vendor ID (Bank 0)
# 0xfe: Device ID (Bank 0)
# 0xff: Device Revision (Bank 0)
#
# Note that identification registers are not accessible in bank 1,
# and there is no usable other means to identify the chip if bank 1
# is selected. Only detect chip if bank 0 is selected.
sub nct7802_detect
{
my ($bank, $reg);
my ($file, $addr) = @_;
$bank = i2c_smbus_read_byte_data($file, 0x00);
return unless $bank == 0x00;
$reg = i2c_smbus_read_byte_data($file, 0xfd);
return unless $reg == 0x50;
$reg = i2c_smbus_read_byte_data($file, 0xfe);
return unless $reg == 0xc3;
$reg = i2c_smbus_read_byte_data($file, 0xff);
return unless ($reg & 0xf0) == 0x20;
$reg = i2c_smbus_read_byte_data($file, 0x05);
return unless ($reg & 0x1f) == 0x00;
$reg = i2c_smbus_read_byte_data($file, 0x08);
return unless ($reg & 0x3f) == 0x00;
$reg = i2c_smbus_read_byte_data($file, 0x0f);
return unless ($reg & 0x3f) == 0x00;
return 8;
}
# Registers used:
# 0x48: Full I2C Address
# 0x4e: Vendor ID byte selection