mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 14:25:39 +00:00
Add detection of STMicroelectronics STTS424 (JEDEC JC42.4-compliant
memory-module temperature sensors.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5850 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -1184,6 +1184,11 @@ use vars qw(@i2c_adapter_names);
|
||||
driver => "to-be-written", # emc1403
|
||||
i2c_addrs => [0x18, 0x2a, 0x4c, 0x4d],
|
||||
i2c_detect => sub { emc1403_detect(@_, 1); },
|
||||
}, {
|
||||
name => "ST STTS424",
|
||||
driver => "to-be-written",
|
||||
i2c_addrs => [0x18..0x1f],
|
||||
i2c_detect => sub { jedec_JC42_4_detect(@_, 0); },
|
||||
}, {
|
||||
name => "Smart Battery",
|
||||
driver => "sbs", # ACPI driver, not sure if it always works
|
||||
@@ -5304,6 +5309,52 @@ sub max6655_detect
|
||||
return 6;
|
||||
}
|
||||
|
||||
# Chip to detect: 0 = STTS424
|
||||
# Registers used:
|
||||
# 0x00: Capabilities
|
||||
# 0x01: Configuration
|
||||
# 0x06: Manufacturer ID
|
||||
# 0x07: Device ID
|
||||
sub jedec_JC42_4_detect
|
||||
{
|
||||
my ($file, $addr, $chip) = @_;
|
||||
my ($reg, $manid, $devid);
|
||||
|
||||
# We test the MSB only at first, because not all chips enjoy
|
||||
# word access.
|
||||
|
||||
# Check for unused bits
|
||||
$reg = i2c_smbus_read_byte_data($file, 0x00);
|
||||
return if $reg & 0xff;
|
||||
$reg = i2c_smbus_read_byte_data($file, 0x01);
|
||||
return if $reg & 0xf8;
|
||||
|
||||
# Check for manufacturer and device ID
|
||||
$manid = i2c_smbus_read_byte_data($file, 0x06);
|
||||
$devid = i2c_smbus_read_byte_data($file, 0x07);
|
||||
if ($chip == 0) {
|
||||
return unless $manid == 0x10; # STMicrolectronics
|
||||
return unless $devid == 0x00; # STTS424
|
||||
}
|
||||
|
||||
# Now, do it all again with words. Note that we get
|
||||
# the MSB first, so all value checks are byte-swapped.
|
||||
|
||||
# Check for unused bits
|
||||
$reg = i2c_smbus_read_word_data($file, 0x00);
|
||||
return if $reg < 0 || $reg & 0xc0ff;
|
||||
|
||||
$manid = i2c_smbus_read_word_data($file, 0x06);
|
||||
$devid = i2c_smbus_read_word_data($file, 0x07);
|
||||
return if $manid < 0 || $devid < 0;
|
||||
if ($chip == 0) {
|
||||
return unless $manid == 0x4a10; # STMicrolectronics
|
||||
return unless ($devid & 0xfeff) == 0x0000; # STTS424
|
||||
}
|
||||
|
||||
return 5;
|
||||
}
|
||||
|
||||
# This isn't very good detection.
|
||||
# Verify the i2c address, and the stepping ID (which is 0xb0 on
|
||||
# my chip but could be different for others...
|
||||
|
Reference in New Issue
Block a user