From 9ad518071b615e8e2a4862542c55e5b9e96365c7 Mon Sep 17 00:00:00 2001 From: groeck Date: Tue, 3 Mar 2015 16:48:20 +0000 Subject: sensors-detect: Nuvoton chip updates Document driver support for NCT7802Y. Add detection of NCT7904D. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6277 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 2 ++ prog/detect/sensors-detect | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 905e0590..3d710c02 100644 --- a/CHANGES +++ b/CHANGES @@ -33,6 +33,8 @@ SVN HEAD Add detection of Intel 5500/5520/X58 Loosen detection rules for TS3000/TSE2002 Add detection of TSE2004 and TS3001 + Document driver support for NCT7802Y + Add detection of NCT7904D 3.3.5 "Happy Birthday Beddy" (2014-01-22) libsensors: Improve documentation of two functions diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 8fb1ae3c..436cf956 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -734,9 +734,14 @@ use vars qw(@i2c_adapter_names); i2c_detect => sub { w83795_detect(@_); }, }, { name => "Nuvoton NCT7802Y", - driver => "to-be-written", + driver => "nct7802", i2c_addrs => [0x28..0x2f], i2c_detect => sub { nct7802_detect(@_); }, + }, { + name => "Nuvoton NCT7904D", + driver => "nct7904", + i2c_addrs => [0x2d..0x2e], + i2c_detect => sub { nct7904_detect(@_); }, }, { name => "Winbond W83627HF", driver => "use-isa-instead", @@ -5634,6 +5639,32 @@ sub nct7802_detect return 8; } +# Registers used: +# 0x7a: Vendor ID +# 0x7b: Chip ID +# 0x7c: Device ID +# 0xff: Bank Select +# +sub nct7904_detect +{ + my ($reg); + my ($file, $addr) = @_; + + $reg = i2c_smbus_read_byte_data($file, 0x7a); + return unless $reg == 0x50; + + $reg = i2c_smbus_read_byte_data($file, 0x7b); + return unless $reg == 0xc5; + + $reg = i2c_smbus_read_byte_data($file, 0x7c); + return unless ($reg & 0xf0) == 0x50; + + $reg = i2c_smbus_read_byte_data($file, 0xff); + return unless ($reg & 0xf8) == 0x00; + + return 8; +} + # Registers used: # 0x48: Full I2C Address # 0x4e: Vendor ID byte selection -- cgit v1.2.1