Changeset 5935
- Timestamp:
- 02/24/11 10:49:17 (2 years ago)
- Location:
- lm-sensors/trunk
- Files:
-
- 2 modified
-
CHANGES (modified) (1 diff)
-
prog/detect/sensors-detect (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/CHANGES
r5934 r5935 30 30 Add detection of AMD family 12h and 14h thermal sensors 31 31 Add detection of EMC6D103S 32 Add detection of National Semiconductor LM75A 32 33 33 34 3.2.0 (2010-10-10) -
lm-sensors/trunk/prog/detect/sensors-detect
r5934 r5935 503 503 i2c_detect => sub { lm75_detect(@_, 0); }, 504 504 }, { 505 name => "National Semiconductor LM75A", 506 driver => "lm75", 507 i2c_addrs => [0x48..0x4f], 508 i2c_detect => sub { lm75_detect(@_, 2); }, 509 }, { 505 510 name => "Dallas Semiconductor DS75", 506 511 driver => "lm75", … … 3840 3845 } 3841 3846 3842 # Chip to detect: 0 = LM75, 1 = DS75 3847 # Chip to detect: 0 = LM75, 1 = DS75, 2 = LM75A 3843 3848 # Registers used: 3844 3849 # 0x00: Temperature … … 3847 3852 # 0x03: Overtemperature Shutdown 3848 3853 # 0x04-0x07: No registers 3854 # 0x07: Device ID (LM75A only) 3849 3855 # The first detection step is based on the fact that the LM75 has only 3850 3856 # four registers, and cycles addresses over 8-byte boundaries. We use the … … 3856 3862 # all register addresses from 0x04 to 0x0f behave like 0x04-0x07 do for 3857 3863 # the LM75. 3864 # And the LM75A is again different, it cycles over 8-byte boundaries, but 3865 # registers 0x04-0x06 return 0xff. Thankfully it has a device ID register 3866 # at 0x07. 3858 3867 # Not all devices enjoy SMBus read word transactions, so we use read byte 3859 3868 # transactions even for the 16-bit registers. The low bits aren't very … … 3865 3874 my $cur = i2c_smbus_read_byte_data($file, 0x00); 3866 3875 my $conf = i2c_smbus_read_byte_data($file, 0x01); 3867 3868 my $hyst = i2c_smbus_read_byte_data($file, 0x02, NO_CACHE); 3869 my $maxreg = $chip == 1 ? 0x0f : 0x07; 3870 for $i (0x04 .. $maxreg) { 3871 return if i2c_smbus_read_byte_data($file, $i, NO_CACHE) != $hyst; 3872 } 3873 3874 my $os = i2c_smbus_read_byte_data($file, 0x03, NO_CACHE); 3875 for $i (0x04 .. $maxreg) { 3876 return if i2c_smbus_read_byte_data($file, $i, NO_CACHE) != $os; 3877 } 3878 3879 if ($chip == 0) { 3876 my ($maxreg, $hyst, $os, $dev_id); 3877 3878 if ($chip == 2) { # LM75A 3879 $dev_id = i2c_smbus_read_byte_data($file, 0x07); 3880 return if $dev_id != 0xA1; 3881 3882 $hyst = i2c_smbus_read_byte_data($file, 0x02); 3883 $os = i2c_smbus_read_byte_data($file, 0x03); 3884 3885 for $i (0x04 .. 0x06) { 3886 return if i2c_smbus_read_byte_data($file, $i) != 0xff; 3887 } 3888 } else { # LM75 or DS75 3889 $maxreg = $chip == 1 ? 0x0f : 0x07; 3890 $hyst = i2c_smbus_read_byte_data($file, 0x02, NO_CACHE); 3891 for $i (0x04 .. $maxreg) { 3892 return if i2c_smbus_read_byte_data($file, $i, NO_CACHE) != $hyst; 3893 } 3894 3895 $os = i2c_smbus_read_byte_data($file, 0x03, NO_CACHE); 3896 for $i (0x04 .. $maxreg) { 3897 return if i2c_smbus_read_byte_data($file, $i, NO_CACHE) != $os; 3898 } 3899 } 3900 3901 if ($chip != 1) { # LM75 or LM75A 3880 3902 for ($i = 8; $i <= 248; $i += 40) { 3881 3903 return if i2c_smbus_read_byte_data($file, $i + 0x01) != $conf 3882 3904 or i2c_smbus_read_byte_data($file, $i + 0x02) != $hyst 3883 3905 or i2c_smbus_read_byte_data($file, $i + 0x03) != $os; 3906 return if $chip == 2 3907 and i2c_smbus_read_byte_data($file, $i + 0x07) != $dev_id; 3884 3908 } 3885 3909 } … … 3889 3913 3890 3914 # Unused bits 3891 return if $chip == 0and ($conf & 0xe0);3915 return if $chip != 1 and ($conf & 0xe0); 3892 3916 return if $chip == 1 and ($conf & 0x80); 3893 3917
