Changeset 5417
- Timestamp:
- 11/24/08 16:27:26 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/branches/lm-sensors-3.0.0/prog/detect/sensors-detect
r5416 r5417 660 660 driver => "to-be-written", 661 661 i2c_addrs => [0x4c], 662 i2c_detect => sub { andigilog_aSC7511_detect( 0,@_); },662 i2c_detect => sub { andigilog_aSC7511_detect(@_); }, 663 663 }, 664 664 { … … 738 738 driver => "w83793", 739 739 i2c_addrs => [0x2c..0x2f], 740 i2c_detect => sub { w83793_detect( 0,@_); },740 i2c_detect => sub { w83793_detect(@_); }, 741 741 }, 742 742 { … … 822 822 driver => "w83l785ts", 823 823 i2c_addrs => [0x2e], 824 i2c_detect => sub { w83l785ts_detect( 0,@_); },824 i2c_detect => sub { w83l785ts_detect(@_); }, 825 825 }, 826 826 { … … 876 876 driver => "adm1026", 877 877 i2c_addrs => [0x2c, 0x2d, 0x2e], 878 i2c_detect => sub { adm1026_detect( 0,@_); },878 i2c_detect => sub { adm1026_detect(@_); }, 879 879 }, 880 880 { … … 936 936 driver => "max6650", 937 937 i2c_addrs => [0x1b, 0x1f, 0x48, 0x4b], 938 i2c_detect => sub { max6650_detect( 0,@_); },938 i2c_detect => sub { max6650_detect(@_); }, 939 939 }, 940 940 { … … 942 942 driver => "max6655", 943 943 i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 944 i2c_detect => sub { max6655_detect( 0,@_); },944 i2c_detect => sub { max6655_detect(@_); }, 945 945 }, 946 946 { … … 984 984 driver => "lm83", 985 985 i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 986 i2c_detect => sub { lm83_detect( 0,@_); },986 i2c_detect => sub { lm83_detect(@_); }, 987 987 }, 988 988 { … … 1130 1130 driver => "adm1029", 1131 1131 i2c_addrs => [0x28..0x2f], 1132 i2c_detect => sub { adm1029_detect( 0,@_); },1132 i2c_detect => sub { adm1029_detect(@_); }, 1133 1133 }, 1134 1134 { … … 1184 1184 driver => "use-isa-instead", 1185 1185 i2c_addrs => [0x2d], 1186 i2c_detect => sub { vt1211_i2c_detect( 0,@_); },1186 i2c_detect => sub { vt1211_i2c_detect(@_); }, 1187 1187 }, 1188 1188 { … … 1190 1190 driver => "it87", 1191 1191 i2c_addrs => [0x28..0x2f], 1192 i2c_detect => sub { it e_detect(0,@_); },1192 i2c_detect => sub { it8712_detect(@_); }, 1193 1193 }, 1194 1194 { … … 3759 3759 } 3760 3760 3761 # $_[0]: Chip to detect 3762 # (0 = LM82/LM83) 3763 # $_[1]: A reference to the file descriptor to access this chip. 3764 # $_[2]: Address 3761 # $_[0]: A reference to the file descriptor to access this chip. 3762 # $_[1]: Address 3765 3763 # Returns: undef if not detected, 4 to 8 if detected. 3766 3764 # Registers used: … … 3781 3779 sub lm83_detect 3782 3780 { 3783 my ($ chip, $file) = @_;3781 my ($file, $addr) = @_; 3784 3782 return if i2c_smbus_read_byte_data($file, 0xfe) != 0x01; 3785 3783 my $chipid = i2c_smbus_read_byte_data($file, 0xff); … … 4016 4014 } 4017 4015 4018 # $_[0]: Chip to detect 4019 # (0 = ADM1029) 4020 # $_[1]: A reference to the file descriptor to access this chip. 4021 # $_[2]: Address (unused) 4016 # $_[0]: A reference to the file descriptor to access this chip. 4017 # $_[1]: Address (unused) 4022 4018 # Returns: undef if not detected, 6 if detected. 4023 4019 # Registers used: … … 4029 4025 sub adm1029_detect 4030 4026 { 4031 my ($ chip, $file, $addr) = @_;4027 my ($file, $addr) = @_; 4032 4028 my $mid = i2c_smbus_read_byte_data($file, 0x0d); 4033 4029 my $cid = i2c_smbus_read_byte_data($file, 0x0e); 4034 4030 my $cfg; 4035 4031 4036 if ($chip == 0) { 4037 return unless $mid == 0x41; # Analog Devices 4038 return unless ($cid & 0xF0) == 0x00; # ADM1029 4039 4040 # Extra check on unused bits 4041 $cfg = i2c_smbus_read_byte_data($file, 0x02); 4042 return unless $cfg == 0x03; 4043 $cfg = i2c_smbus_read_byte_data($file, 0x06); 4044 return unless ($cfg & 0xF9) == 0x01; 4045 foreach my $reg (0x03, 0x07, 0x08, 0x09) { 4046 $cfg = i2c_smbus_read_byte_data($file, $reg); 4047 return unless ($cfg & 0xFC) == 0x00; 4048 } 4049 4050 return 7; 4051 } 4052 return; 4032 return unless $mid == 0x41; # Analog Devices 4033 return unless ($cid & 0xF0) == 0x00; # ADM1029 4034 4035 # Extra check on unused bits 4036 $cfg = i2c_smbus_read_byte_data($file, 0x02); 4037 return unless $cfg == 0x03; 4038 $cfg = i2c_smbus_read_byte_data($file, 0x06); 4039 return unless ($cfg & 0xF9) == 0x01; 4040 foreach my $reg (0x03, 0x07, 0x08, 0x09) { 4041 $cfg = i2c_smbus_read_byte_data($file, $reg); 4042 return unless ($cfg & 0xFC) == 0x00; 4043 } 4044 4045 return 7; 4053 4046 } 4054 4047 … … 4254 4247 } 4255 4248 4256 # $_[0]: Chip to detect 4257 # (0 = aSC7511) 4258 # $_[1]: A reference to the file descriptor to access this chip. 4259 # $_[2]: Address (unused) 4249 # $_[0]: A reference to the file descriptor to access this chip. 4250 # $_[1]: Address (unused) 4260 4251 # Returns: undef if not detected, 1 if detected. 4261 4252 # Registers used: … … 4264 4255 sub andigilog_aSC7511_detect 4265 4256 { 4266 my ($ chip, $file, $addr) = @_;4257 my ($file, $addr) = @_; 4267 4258 my $mid = i2c_smbus_read_byte_data($file, 0xfe); 4268 4259 my $die = i2c_smbus_read_byte_data($file, 0xff); 4269 4260 4270 if ($chip == 0) { 4271 return if $mid != 0x61; # Andigilog 4272 if ($die == 0x0) { 4273 return 3; 4274 } else { 4275 return 1; 4276 } 4277 } 4278 return; 4261 return if $mid != 0x61; # Andigilog 4262 if ($die == 0x0) { 4263 return 3; 4264 } else { 4265 return 1; 4266 } 4279 4267 } 4280 4268 … … 4425 4413 } 4426 4414 4427 # $_[0]: Chip to detect (0 = W83793) 4428 # $_[1]: A reference to the file descriptor to access this chip. 4429 # $_[2]: Address 4415 # $_[0]: A reference to the file descriptor to access this chip. 4416 # $_[1]: Address 4430 4417 # Returns: undef if not detected 4431 4418 # 6 if detected and bank different from 0 … … 4441 4428 { 4442 4429 my ($bank, $reg, @res); 4443 my ($ chip, $file, $addr) = @_;4430 my ($file, $addr) = @_; 4444 4431 4445 4432 $bank = i2c_smbus_read_byte_data($file, 0x00); … … 4450 4437 4451 4438 $reg = i2c_smbus_read_byte_data($file, 0x0e); 4452 return if $ chip == 0 and $reg != 0x7b;4439 return if $reg != 0x7b; 4453 4440 4454 4441 # If bank 0 is selected, we can do more checks … … 4684 4671 } 4685 4672 4686 # $_[0]: Chip to detect (0 = ADM1026) 4687 # $_[1]: A reference to the file descriptor to access this chip. 4688 # $_[2]: Address 4673 # $_[0]: A reference to the file descriptor to access this chip. 4674 # $_[1]: Address 4689 4675 # Returns: undef if not detected, (8) if detected. 4690 4676 # Registers used: … … 4694 4680 { 4695 4681 my $reg; 4696 my ($ chip, $file, $addr) = @_;4682 my ($file, $addr) = @_; 4697 4683 $reg = i2c_smbus_read_byte_data($file, 0x16); 4698 4684 return unless ($reg == 0x41); … … 4863 4849 } 4864 4850 4865 # $_[0]: Chip to detect (0 = IT8712F) 4866 # $_[1]: A reference to the file descriptor to access this chip. 4867 # $_[2]: Address 4851 # $_[0]: A reference to the file descriptor to access this chip. 4852 # $_[1]: Address 4868 4853 # Returns: undef if not detected, 7 or 8 if detected (tops LM78). 4869 4854 # Registers used: … … 4871 4856 # 0x48: Full I2C Address 4872 4857 # 0x58: Mfr ID 4873 # 0x5b: Device ID (not on IT8705)4874 sub it e_detect4858 # 0x5b: Device ID 4859 sub it8712_detect 4875 4860 { 4876 4861 my $reg; 4877 my ($ chip, $file, $addr) = @_;4862 my ($file, $addr) = @_; 4878 4863 return unless i2c_smbus_read_byte_data($file, 0x48) == $addr; 4879 4864 return unless (i2c_smbus_read_byte_data($file, 0x00) & 0x90) == 0x10; 4880 4865 return unless i2c_smbus_read_byte_data($file, 0x58) == 0x90; 4881 return if $chip == 0 andi2c_smbus_read_byte_data($file, 0x5b) != 0x12;4866 return if i2c_smbus_read_byte_data($file, 0x5b) != 0x12; 4882 4867 return (7 + ($addr == 0x2d)); 4883 4868 } … … 5160 5145 } 5161 5146 5162 # $_[0]: Chip to detect (0 = W83L785TS-S) 5163 # $_[1]: A reference to the file descriptor to access this chip. 5164 # $_[2]: Address 5147 # $_[0]: A reference to the file descriptor to access this chip. 5148 # $_[1]: Address 5165 5149 # Returns: undef if not detected, 8 if detected 5166 5150 # Registers used: … … 5168 5152 sub w83l785ts_detect 5169 5153 { 5170 my ($ chip, $file, $addr) = @_;5154 my ($file, $addr) = @_; 5171 5155 return unless i2c_smbus_read_byte_data($file, 0x4c) == 0xa3; 5172 5156 return unless i2c_smbus_read_byte_data($file, 0x4d) == 0x5c; … … 5175 5159 } 5176 5160 5177 # $_[0]: Chip to detect. Always zero for now, but available for future use 5178 # if somebody finds a way to distinguish MAX6650 and MAX6651. 5179 # $_[1]: A reference to the file descriptor to access this chip. 5180 # $_[2]: Address 5161 # $_[0]: A reference to the file descriptor to access this chip. 5162 # $_[1]: Address 5181 5163 # Returns: undef if not detected, 3 if detected. 5182 5164 # … … 5196 5178 sub max6650_detect 5197 5179 { 5198 my ($ chip, $file) = @_;5180 my ($file, $addr) = @_; 5199 5181 5200 5182 my $conf = i2c_smbus_read_byte_data($file, 0x02); … … 5209 5191 } 5210 5192 5211 # $_[0]: Chip to detect. Always zero. 5212 # $_[1]: A reference to the file descriptor to access this chip. 5213 # $_[2]: Address. 5193 # $_[0]: A reference to the file descriptor to access this chip. 5194 # $_[1]: Address. 5214 5195 # 5215 5196 # Returns: undef if not detected, 6 if detected. 5216 5197 sub max6655_detect 5217 5198 { 5218 my ($ chip, $file, $addr) = @_;5199 my ($file, $addr) = @_; 5219 5200 5220 5201 # checking RDID (Device ID) … … 5231 5212 } 5232 5213 5233 # $_[0]: Chip to detect (0 = VT1211) 5234 # $_[1]: A reference to the file descriptor to access this chip. 5235 # $_[2]: Address 5214 # $_[0]: A reference to the file descriptor to access this chip. 5215 # $_[1]: Address 5236 5216 # 5237 5217 # This isn't very good detection. … … 5241 5221 sub vt1211_i2c_detect 5242 5222 { 5243 my ($ chip, $file, $addr) = @_;5223 my ($file, $addr) = @_; 5244 5224 return unless (i2c_smbus_read_byte_data($file, 0x48) & 0x7f) == $addr; 5245 5225 return unless i2c_smbus_read_byte_data($file, 0x3f) == 0xb0;
