| 1 | #!/usr/bin/perl -w |
|---|
| 2 | # |
|---|
| 3 | #Â Â sensors-detect - Detect hardware monitoring chips |
|---|
| 4 | #Â Â Copyright (C) 1998 - 2002Â Frodo Looijaard <frodol@dds.nl> |
|---|
| 5 | #Â Â Copyright (C) 2004 - 2008Â Jean Delvare <khali@linux-fr.org> |
|---|
| 6 | # |
|---|
| 7 | #Â Â This program is free software; you can redistribute it and/or modify |
|---|
| 8 | #Â Â it under the terms of the GNU General Public License as published by |
|---|
| 9 | #Â Â the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | #Â Â (at your option) any later version. |
|---|
| 11 | # |
|---|
| 12 | #Â Â This program is distributed in the hope that it will be useful, |
|---|
| 13 | #Â Â but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | #Â Â GNU General Public License for more details. |
|---|
| 16 | # |
|---|
| 17 | #Â Â You should have received a copy of the GNU General Public License |
|---|
| 18 | #Â Â along with this program; if not, write to the Free Software |
|---|
| 19 | #Â Â Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|---|
| 20 | #Â Â MA 02110-1301 USA. |
|---|
| 21 | # |
|---|
| 22 | |
|---|
| 23 | require 5.004; |
|---|
| 24 | |
|---|
| 25 | use strict; |
|---|
| 26 | use Fcntl; |
|---|
| 27 | use POSIX; |
|---|
| 28 | use File::Basename; |
|---|
| 29 | |
|---|
| 30 | # We will call modprobe, which typically lives in either /sbin, |
|---|
| 31 | # /usr/sbin or /usr/local/bin. So make sure these are all in the PATH. |
|---|
| 32 | foreach ('/usr/sbin', '/usr/local/sbin', '/sbin') { |
|---|
| 33 | Â Â Â Â $ENV{PATH}Â =Â "$_:".$ENV{PATH} |
|---|
| 34 |         unless $ENV{PATH} =~ m/(^|:)$_\/?(:|$)/; |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | ######################### |
|---|
| 38 | # CONSTANT DECLARATIONS # |
|---|
| 39 | ######################### |
|---|
| 40 | |
|---|
| 41 | use constant NO_CACHE => 1; |
|---|
| 42 | use vars qw(@pci_adapters @chip_ids @ipmi_ifs @non_hwmon_chip_ids |
|---|
| 43 | Â Â Â Â Â Â $i2c_addresses_to_scan $revision @i2c_byte_cache); |
|---|
| 44 | |
|---|
| 45 | $revision = '$Revision$ ($Date$)'; |
|---|
| 46 | $revision =~ s/\$\w+: (.*?) \$/$1/g; |
|---|
| 47 | $revision =~ s/ \([^()]*\)//; |
|---|
| 48 | |
|---|
| 49 | # This is the list of SMBus or I2C adapters we recognize by their PCI |
|---|
| 50 | # signature. This is an easy and fast way to determine which SMBus or I2C |
|---|
| 51 | # adapters should be present. |
|---|
| 52 | # Each entry must have a vendid (Vendor ID), devid (Device ID) and |
|---|
| 53 | # procid (Device name) and driver (Device driver). |
|---|
| 54 | @pci_adapters = ( |
|---|
| 55 | Â Â Â Â { |
|---|
| 56 |         vendid => 0x8086, |
|---|
| 57 |         devid  => 0x7113, |
|---|
| 58 |         procid => "Intel 82371AB PIIX4 ACPI", |
|---|
| 59 |         driver => "i2c-piix4", |
|---|
| 60 |     }, { |
|---|
| 61 |         vendid => 0x8086, |
|---|
| 62 |         devid  => 0x7603, |
|---|
| 63 |         procid => "Intel 82372FB PIIX5 ACPI", |
|---|
| 64 |         driver => "to-be-tested", |
|---|
| 65 |     }, { |
|---|
| 66 |         vendid => 0x8086, |
|---|
| 67 |         devid  => 0x719b, |
|---|
| 68 |         procid => "Intel 82443MX Mobile", |
|---|
| 69 |         driver => "i2c-piix4", |
|---|
| 70 |     }, { |
|---|
| 71 |         vendid => 0x8086, |
|---|
| 72 |         devid  => 0x2413, |
|---|
| 73 |         procid => "Intel 82801AA ICH", |
|---|
| 74 |         driver => "i2c-i801", |
|---|
| 75 |     }, { |
|---|
| 76 |         vendid => 0x8086, |
|---|
| 77 |         devid  => 0x2423, |
|---|
| 78 |         procid => "Intel 82801AB ICH0", |
|---|
| 79 |         driver => "i2c-i801", |
|---|
| 80 |     }, { |
|---|
| 81 |         vendid => 0x8086, |
|---|
| 82 |         devid  => 0x2443, |
|---|
| 83 |         procid => "Intel 82801BA ICH2", |
|---|
| 84 |         driver => "i2c-i801", |
|---|
| 85 |     }, { |
|---|
| 86 |         vendid => 0x8086, |
|---|
| 87 |         devid  => 0x2483, |
|---|
| 88 |         procid => "Intel 82801CA/CAM ICH3", |
|---|
| 89 |         driver => "i2c-i801", |
|---|
| 90 |     }, { |
|---|
| 91 |         vendid => 0x8086, |
|---|
| 92 |         devid  => 0x24C3, |
|---|
| 93 |         procid => "Intel 82801DB ICH4", |
|---|
| 94 |         driver => "i2c-i801", |
|---|
| 95 |     }, { |
|---|
| 96 |         vendid => 0x8086, |
|---|
| 97 |         devid  => 0x24D3, |
|---|
| 98 |         procid => "Intel 82801EB ICH5", |
|---|
| 99 |         driver => "i2c-i801", |
|---|
| 100 |     }, { |
|---|
| 101 |         vendid => 0x8086, |
|---|
| 102 |         devid  => 0x25A4, |
|---|
| 103 |         procid => "Intel 6300ESB", |
|---|
| 104 |         driver => "i2c-i801", |
|---|
| 105 |     }, { |
|---|
| 106 |         vendid => 0x8086, |
|---|
| 107 |         devid  => 0x269B, |
|---|
| 108 |         procid => "Intel Enterprise Southbridge - ESB2", |
|---|
| 109 |         driver => "i2c-i801", |
|---|
| 110 |     }, { |
|---|
| 111 |         vendid => 0x8086, |
|---|
| 112 |         devid  => 0x266A, |
|---|
| 113 |         procid => "Intel 82801FB ICH6", |
|---|
| 114 |         driver => "i2c-i801", |
|---|
| 115 |     }, { |
|---|
| 116 |         vendid => 0x8086, |
|---|
| 117 |         devid  => 0x27DA, |
|---|
| 118 |         procid => "Intel 82801G ICH7", |
|---|
| 119 |         driver => "i2c-i801", |
|---|
| 120 |     }, { |
|---|
| 121 |         vendid => 0x8086, |
|---|
| 122 |         devid  => 0x283E, |
|---|
| 123 |         procid => "Intel 82801H ICH8", |
|---|
| 124 |         driver => "i2c-i801", |
|---|
| 125 |     }, { |
|---|
| 126 |         vendid => 0x8086, |
|---|
| 127 |         devid  => 0x2930, |
|---|
| 128 |         procid => "Intel ICH9", |
|---|
| 129 |         driver => "i2c-i801", |
|---|
| 130 |     }, { |
|---|
| 131 |         vendid => 0x8086, |
|---|
| 132 |         devid  => 0x5032, |
|---|
| 133 |         procid => "Intel Tolapai", |
|---|
| 134 |         driver => "i2c-i801", |
|---|
| 135 |     }, { |
|---|
| 136 |         vendid => 0x8086, |
|---|
| 137 |         devid  => 0x3A30, |
|---|
| 138 |         procid => "Intel ICH10", |
|---|
| 139 |         driver => "i2c-i801", |
|---|
| 140 |     }, { |
|---|
| 141 |         vendid => 0x8086, |
|---|
| 142 |         devid  => 0x3A60, |
|---|
| 143 |         procid => "Intel ICH10", |
|---|
| 144 |         driver => "i2c-i801", |
|---|
| 145 |     }, { |
|---|
| 146 |         vendid => 0x8086, |
|---|
| 147 |         devid  => 0x8119, |
|---|
| 148 |         procid => "Intel SCH", |
|---|
| 149 |         driver => "i2c-isch", |
|---|
| 150 |     }, { |
|---|
| 151 |         vendid => 0x1106, |
|---|
| 152 |         devid  => 0x3040, |
|---|
| 153 |         procid => "VIA Technologies VT82C586B Apollo ACPI", |
|---|
| 154 |         driver => "i2c-via", |
|---|
| 155 |     }, { |
|---|
| 156 |         vendid => 0x1106, |
|---|
| 157 |         devid  => 0x3050, |
|---|
| 158 |         procid => "VIA Technologies VT82C596 Apollo ACPI", |
|---|
| 159 |         driver => "i2c-viapro", |
|---|
| 160 |     }, { |
|---|
| 161 |         vendid => 0x1106, |
|---|
| 162 |         devid  => 0x3051, |
|---|
| 163 |         procid => "VIA Technologies VT82C596B ACPI", |
|---|
| 164 |         driver => "i2c-viapro", |
|---|
| 165 |     }, { |
|---|
| 166 |         vendid => 0x1106, |
|---|
| 167 |         devid  => 0x3057, |
|---|
| 168 |         procid => "VIA Technologies VT82C686 Apollo ACPI", |
|---|
| 169 |         driver => "i2c-viapro", |
|---|
| 170 |     }, { |
|---|
| 171 |         vendid => 0x1106, |
|---|
| 172 |         devid  => 0x3074, |
|---|
| 173 |         procid => "VIA Technologies VT8233 VLink South Bridge", |
|---|
| 174 |         driver => "i2c-viapro", |
|---|
| 175 |     }, { |
|---|
| 176 |         vendid => 0x1106, |
|---|
| 177 |         devid  => 0x3147, |
|---|
| 178 |         procid => "VIA Technologies VT8233A South Bridge", |
|---|
| 179 |         driver => "i2c-viapro", |
|---|
| 180 |     }, { |
|---|
| 181 |         vendid => 0x1106, |
|---|
| 182 |         devid  => 0x3177, |
|---|
| 183 |         procid => "VIA Technologies VT8233A/8235 South Bridge", |
|---|
| 184 |         driver => "i2c-viapro", |
|---|
| 185 |     }, { |
|---|
| 186 |         vendid => 0x1106, |
|---|
| 187 |         devid  => 0x3227, |
|---|
| 188 |         procid => "VIA Technologies VT8237 South Bridge", |
|---|
| 189 |         driver => "i2c-viapro", |
|---|
| 190 |     }, { |
|---|
| 191 |         vendid => 0x1106, |
|---|
| 192 |         devid  => 0x3337, |
|---|
| 193 |         procid => "VIA Technologies VT8237A South Bridge", |
|---|
| 194 |         driver => "i2c-viapro", |
|---|
| 195 |     }, { |
|---|
| 196 |         vendid => 0x1106, |
|---|
| 197 |         devid  => 0x8235, |
|---|
| 198 |         procid => "VIA Technologies VT8231 South Bridge", |
|---|
| 199 |         driver => "i2c-viapro", |
|---|
| 200 |     }, { |
|---|
| 201 |         vendid => 0x1106, |
|---|
| 202 |         devid  => 0x3287, |
|---|
| 203 |         procid => "VIA Technologies VT8251 South Bridge", |
|---|
| 204 |         driver => "i2c-viapro", |
|---|
| 205 |     }, { |
|---|
| 206 |         vendid => 0x1106, |
|---|
| 207 |         devid  => 0x8324, |
|---|
| 208 |         procid => "VIA Technologies CX700 South Bridge", |
|---|
| 209 |         driver => "i2c-viapro", |
|---|
| 210 |     }, { |
|---|
| 211 |         vendid => 0x1106, |
|---|
| 212 |         devid  => 0x8353, |
|---|
| 213 |         procid => "VIA Technologies VX800/VX820 South Bridge", |
|---|
| 214 |         driver => "i2c-viapro", |
|---|
| 215 |     }, { |
|---|
| 216 |         vendid => 0x1039, |
|---|
| 217 |         devid  => 0x0008, |
|---|
| 218 |         procid => "Silicon Integrated Systems SIS5595", |
|---|
| 219 |         driver => "i2c-sis5595", |
|---|
| 220 |     }, { |
|---|
| 221 |         vendid => 0x1039, |
|---|
| 222 |         devid  => 0x0630, |
|---|
| 223 |         procid => "Silicon Integrated Systems SIS630", |
|---|
| 224 |         driver => "i2c-sis630", |
|---|
| 225 |     }, { |
|---|
| 226 |         vendid => 0x1039, |
|---|
| 227 |         devid  => 0x0730, |
|---|
| 228 |         procid => "Silicon Integrated Systems SIS730", |
|---|
| 229 |         driver => "i2c-sis630", |
|---|
| 230 |     }, { |
|---|
| 231 |         vendid => 0x1039, |
|---|
| 232 |         devid  => 0x0016, |
|---|
| 233 |         procid => "Silicon Integrated Systems SMBus Controller", |
|---|
| 234 |         driver => "i2c-sis96x", |
|---|
| 235 |     }, { |
|---|
| 236 | Â Â Â Â Â Â Â Â # Both Ali chips below have same PCI ID. Can't be helped. Only one should load. |
|---|
| 237 |         vendid => 0x10b9, |
|---|
| 238 |         devid  => 0x7101, |
|---|
| 239 |         procid => "Acer Labs 1533/1543", |
|---|
| 240 |         driver => "i2c-ali15x3", |
|---|
| 241 |     }, { |
|---|
| 242 |         vendid => 0x10b9, |
|---|
| 243 |         devid  => 0x7101, |
|---|
| 244 |         procid => "Acer Labs 1535", |
|---|
| 245 |         driver => "i2c-ali1535", |
|---|
| 246 |     }, { |
|---|
| 247 |         vendid => 0x10b9, |
|---|
| 248 |         devid  => 0x1563, |
|---|
| 249 |         procid => "Acer Labs 1563", |
|---|
| 250 |         driver => "i2c-ali1563", |
|---|
| 251 |     }, { |
|---|
| 252 |         vendid => 0x1022, |
|---|
| 253 |         devid  => 0x740b, |
|---|
| 254 |         procid => "AMD-756 Athlon ACPI", |
|---|
| 255 |         driver => "i2c-amd756", |
|---|
| 256 |     }, { |
|---|
| 257 |         vendid => 0x1022, |
|---|
| 258 |         devid  => 0x7413, |
|---|
| 259 |         procid => "AMD-766 Athlon ACPI", |
|---|
| 260 |         driver => "i2c-amd756", |
|---|
| 261 |     }, { |
|---|
| 262 |         vendid => 0x1022, |
|---|
| 263 |         devid  => 0x7443, |
|---|
| 264 |         procid => "AMD-768 System Management", |
|---|
| 265 |         driver => "i2c-amd756", |
|---|
| 266 |     }, { |
|---|
| 267 |         vendid => 0x1022, |
|---|
| 268 |         devid  => 0x746b, |
|---|
| 269 |         procid => "AMD-8111 ACPI", |
|---|
| 270 |         driver => "i2c-amd756", |
|---|
| 271 |     }, { |
|---|
| 272 |         vendid => 0x1022, |
|---|
| 273 |         devid  => 0x746a, |
|---|
| 274 |         procid => "AMD-8111 SMBus 2.0", |
|---|
| 275 |         driver => "i2c-amd8111", |
|---|
| 276 |     }, { |
|---|
| 277 |         vendid => 0x10de, |
|---|
| 278 |         devid  => 0x01b4, |
|---|
| 279 |         procid => "nVidia nForce SMBus", |
|---|
| 280 |         driver => "i2c-amd756", |
|---|
| 281 |     }, { |
|---|
| 282 |         vendid => 0x10de, |
|---|
| 283 |         devid  => 0x0064, |
|---|
| 284 |         procid => "nVidia Corporation nForce2 SMBus (MCP)", |
|---|
| 285 |         driver => "i2c-nforce2", |
|---|
| 286 |     }, { |
|---|
| 287 |         vendid => 0x10de, |
|---|
| 288 |         devid  => 0x0084, |
|---|
| 289 |         procid => "nVidia Corporation nForce2 Ultra 400 SMBus (MCP)", |
|---|
| 290 |         driver => "i2c-nforce2", |
|---|
| 291 |     }, { |
|---|
| 292 |         vendid => 0x10de, |
|---|
| 293 |         devid  => 0x00D4, |
|---|
| 294 |         procid => "nVidia Corporation nForce3 Pro150 SMBus (MCP)", |
|---|
| 295 |         driver => "i2c-nforce2", |
|---|
| 296 |     }, { |
|---|
| 297 |         vendid => 0x10de, |
|---|
| 298 |         devid  => 0x00E4, |
|---|
| 299 |         procid => "nVidia Corporation nForce3 250Gb SMBus (MCP)", |
|---|
| 300 |         driver => "i2c-nforce2", |
|---|
| 301 |     }, { |
|---|
| 302 |         vendid => 0x10de, |
|---|
| 303 |         devid  => 0x0052, |
|---|
| 304 |         procid => "nVidia Corporation nForce4 SMBus (MCP)", |
|---|
| 305 |         driver => "i2c-nforce2", |
|---|
| 306 |     }, { |
|---|
| 307 |         vendid => 0x10de, |
|---|
| 308 |         devid  => 0x0034, |
|---|
| 309 |         procid => "nVidia Corporation nForce4 SMBus (MCP-04)", |
|---|
| 310 |         driver => "i2c-nforce2", |
|---|
| 311 |     }, { |
|---|
| 312 |         vendid => 0x10de, |
|---|
| 313 |         devid  => 0x0264, |
|---|
| 314 |         procid => "nVidia Corporation nForce4 SMBus (MCP51)", |
|---|
| 315 |         driver => "i2c-nforce2", |
|---|
| 316 |     }, { |
|---|
| 317 |         vendid => 0x10de, |
|---|
| 318 |         devid  => 0x0368, |
|---|
| 319 |         procid => "nVidia Corporation nForce4 SMBus (MCP55)", |
|---|
| 320 |         driver => "i2c-nforce2", |
|---|
| 321 |     }, { |
|---|
| 322 |         vendid => 0x10de, |
|---|
| 323 |         devid  => 0x03eb, |
|---|
| 324 |         procid => "nVidia Corporation nForce4 SMBus (MCP61)", |
|---|
| 325 |         driver => "i2c-nforce2", |
|---|
| 326 |     }, { |
|---|
| 327 |         vendid => 0x10de, |
|---|
| 328 |         devid  => 0x0446, |
|---|
| 329 |         procid => "nVidia Corporation nForce4 SMBus (MCP65)", |
|---|
| 330 |         driver => "i2c-nforce2", |
|---|
| 331 |     }, { |
|---|
| 332 |         vendid => 0x1166, |
|---|
| 333 |         devid  => 0x0200, |
|---|
| 334 |         procid => "ServerWorks OSB4 South Bridge", |
|---|
| 335 |         driver => "i2c-piix4", |
|---|
| 336 |     }, { |
|---|
| 337 |         vendid => 0x1055, |
|---|
| 338 |         devid  => 0x9463, |
|---|
| 339 |         procid => "SMSC Victory66 South Bridge", |
|---|
| 340 |         driver => "i2c-piix4", |
|---|
| 341 |     }, { |
|---|
| 342 |         vendid => 0x1166, |
|---|
| 343 |         devid  => 0x0201, |
|---|
| 344 |         procid => "ServerWorks CSB5 South Bridge", |
|---|
| 345 |         driver => "i2c-piix4", |
|---|
| 346 |     }, { |
|---|
| 347 |         vendid => 0x1166, |
|---|
| 348 |         devid  => 0x0203, |
|---|
| 349 |         procid => "ServerWorks CSB6 South Bridge", |
|---|
| 350 |         driver => "i2c-piix4", |
|---|
| 351 |     }, { |
|---|
| 352 |         vendid => 0x1166, |
|---|
| 353 |         devid  => 0x0205, |
|---|
| 354 |         procid => "ServerWorks HT-1000 South Bridge", |
|---|
| 355 |         driver => "i2c-piix4", |
|---|
| 356 |     }, { |
|---|
| 357 |         vendid => 0x1002, |
|---|
| 358 |         devid  => 0x4353, |
|---|
| 359 |         procid => "ATI Technologies Inc ATI SMBus", |
|---|
| 360 |         driver => "i2c-piix4", |
|---|
| 361 |     }, { |
|---|
| 362 |         vendid => 0x1002, |
|---|
| 363 |         devid  => 0x4363, |
|---|
| 364 |         procid => "ATI Technologies Inc ATI SMBus", |
|---|
| 365 |         driver => "i2c-piix4", |
|---|
| 366 |     }, { |
|---|
| 367 |         vendid => 0x1002, |
|---|
| 368 |         devid  => 0x4372, |
|---|
| 369 |         procid => "ATI Technologies Inc IXP SB400 SMBus Controller", |
|---|
| 370 |         driver => "i2c-piix4", |
|---|
| 371 |     }, { |
|---|
| 372 |         vendid => 0x1002, |
|---|
| 373 |         devid  => 0x4385, |
|---|
| 374 |         procid => "ATI Technologies Inc SB600 SMBus", |
|---|
| 375 |         driver => "i2c-piix4", |
|---|
| 376 |     }, { |
|---|
| 377 |         vendid => 0x100B, |
|---|
| 378 |         devid  => 0x0500, |
|---|
| 379 |         procid => "SCx200 Bridge", |
|---|
| 380 |         driver => "scx200_acb", |
|---|
| 381 |     }, { |
|---|
| 382 |         vendid => 0x100B, |
|---|
| 383 |         devid  => 0x0510, |
|---|
| 384 |         procid => "SC1100 Bridge", |
|---|
| 385 |         driver => "scx200_acb", |
|---|
| 386 |     }, { |
|---|
| 387 |         vendid => 0x100B, |
|---|
| 388 |         devid  => 0x002B, |
|---|
| 389 |         procid => "CS5535 ISA bridge", |
|---|
| 390 |         driver => "scx200_acb", |
|---|
| 391 |     }, { |
|---|
| 392 |         vendid => 0x1022, |
|---|
| 393 |         devid  => 0x2090, |
|---|
| 394 |         procid => "CS5536 [Geode companion] ISA", |
|---|
| 395 |         driver => "scx200_acb", |
|---|
| 396 | Â Â Â Â } |
|---|
| 397 | ); |
|---|
| 398 | |
|---|
| 399 | # Look-up table to find out an I2C bus' driver based on the bus name. |
|---|
| 400 | # The match field should contain a regular expression matching the I2C |
|---|
| 401 | # bus name as it would appear in /sys/class/i2c-adapter. |
|---|
| 402 | # Note that new drivers probably don't need to be added to this table |
|---|
| 403 | # if they bind to their device, as we will be able to get the driver name |
|---|
| 404 | # from sysfs directly. |
|---|
| 405 | use vars qw(@i2c_adapter_names); |
|---|
| 406 | @i2c_adapter_names = ( |
|---|
| 407 |     { driver => "i2c-piix4",    match => qr/^SMBus PIIX4 adapter at / }, |
|---|
| 408 |     { driver => "i2c-i801",     match => qr/^SMBus I801 adapter at / }, |
|---|
| 409 |     { driver => "i2c-via",     match => qr/^VIA i2c/ }, |
|---|
| 410 |     { driver => "i2c-viapro",    match => qr/^SMBus V(IA|ia) Pro adapter at / }, |
|---|
| 411 |     { driver => "i2c-sis5595",   match => qr/^SMBus SIS5595 adapter at / }, |
|---|
| 412 |     { driver => "i2c-sis630",    match => qr/^SMBus SIS630 adapter at / }, |
|---|
| 413 |     { driver => "i2c-sis96x",    match => qr/^SiS96x SMBus adapter at / }, |
|---|
| 414 |     { driver => "i2c-ali15x3",   match => qr/^SMBus ALI15X3 adapter at / }, |
|---|
| 415 |     { driver => "i2c-ali1535",   match => qr/^SMBus ALI1535 adapter at/ }, |
|---|
| 416 |     { driver => "i2c-ali1563",   match => qr/^SMBus ALi 1563 Adapter @ / }, |
|---|
| 417 |     { driver => "i2c-amd756",    match => qr/^SMBus (AMD756|AMD766|AMD768|AMD8111|nVidia nForce) adapter at / }, |
|---|
| 418 |     { driver => "i2c-amd8111",   match => qr/^SMBus2 AMD8111 adapter at / }, |
|---|
| 419 |     { driver => "i2c-nforce2",   match => qr/^SMBus nForce2 adapter at / }, |
|---|
| 420 |     { driver => "scx200_acb",    match => qr/^(NatSemi SCx200 ACCESS\.bus|SCx200 ACB\d+|CS553[56] ACB\d+)/ }, |
|---|
| 421 | ); |
|---|
| 422 | |
|---|
| 423 | # This is a list of all recognized I2C and ISA chips. |
|---|
| 424 | # Each entry must have the following fields: |
|---|
| 425 | #Â name: The full chip name |
|---|
| 426 | #Â driver: The driver name. Put in exactly: |
|---|
| 427 | #Â Â Â * "to-be-written" if it is not yet available |
|---|
| 428 | #Â Â Â * "use-isa-instead" if no i2c driver will be written |
|---|
| 429 | #Â i2c_addrs (optional): For I2C chips, the list of I2C addresses to |
|---|
| 430 | #Â Â Â probe. |
|---|
| 431 | #Â i2c_detect (optional): For I2C chips, the function to call to detect |
|---|
| 432 | #Â Â Â this chip. The function will be passed two parameters: an open file |
|---|
| 433 | #Â Â Â descriptor to access the bus, and the I2C address to probe. |
|---|
| 434 | #Â isa_addrs (optional): For ISA chips, the list of port addresses to |
|---|
| 435 | #Â Â Â probe. |
|---|
| 436 | #Â isa_detect (optional): For ISA chips, the function to call to detect |
|---|
| 437 | #Â Â Â this chip. The function will be passed one parameter: the ISA address |
|---|
| 438 | #Â Â Â to probe. |
|---|
| 439 | #Â alias_detect (optional): For chips which can be both on the ISA and the |
|---|
| 440 | #Â Â Â I2C bus, a function which detects whether two entries are the same. |
|---|
| 441 | #Â Â Â The function will be passed three parameters: the ISA address, an |
|---|
| 442 | #Â Â Â open file descriptor to access the I2C bus, and the I2C address. |
|---|
| 443 | @chip_ids = ( |
|---|
| 444 | Â Â Â Â { |
|---|
| 445 | Â Â Â Â Â Â Â Â name =>Â "Myson MTP008", |
|---|
| 446 | Â Â Â Â Â Â Â Â driver =>Â "mtp008", |
|---|
| 447 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 448 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â mtp008_detect(@_);Â }, |
|---|
| 449 |     }, { |
|---|
| 450 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM78", |
|---|
| 451 | Â Â Â Â Â Â Â Â driver =>Â "lm78", |
|---|
| 452 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x28..0x2f], |
|---|
| 453 |         i2c_detect => sub { lm78_detect(@_, 0); }, |
|---|
| 454 | Â Â Â Â Â Â Â Â isa_addrs =>Â [0x290], |
|---|
| 455 |         isa_detect => sub { lm78_isa_detect(@_, 0); }, |
|---|
| 456 |         alias_detect => sub { winbond_alias_detect(@_, 0x2b, 0x3d); }, |
|---|
| 457 |     }, { |
|---|
| 458 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM79", |
|---|
| 459 | Â Â Â Â Â Â Â Â driver =>Â "lm78", |
|---|
| 460 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x28..0x2f], |
|---|
| 461 |         i2c_detect => sub { lm78_detect(@_, 2); }, |
|---|
| 462 | Â Â Â Â Â Â Â Â isa_addrs =>Â [0x290], |
|---|
| 463 |         isa_detect => sub { lm78_isa_detect(@_, 2); }, |
|---|
| 464 |         alias_detect => sub { winbond_alias_detect(@_, 0x2b, 0x3d); }, |
|---|
| 465 |     }, { |
|---|
| 466 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM75", |
|---|
| 467 | Â Â Â Â Â Â Â Â driver =>Â "lm75", |
|---|
| 468 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x48..0x4f], |
|---|
| 469 |         i2c_detect => sub { lm75_detect(@_, 0); }, |
|---|
| 470 |     }, { |
|---|
| 471 | Â Â Â Â Â Â Â Â name =>Â "Dallas Semiconductor DS75", |
|---|
| 472 | Â Â Â Â Â Â Â Â driver =>Â "lm75", |
|---|
| 473 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x48..0x4f], |
|---|
| 474 |         i2c_detect => sub { lm75_detect(@_, 1); }, |
|---|
| 475 |     }, { |
|---|
| 476 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM77", |
|---|
| 477 | Â Â Â Â Â Â Â Â driver =>Â "lm77", |
|---|
| 478 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x48..0x4b], |
|---|
| 479 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â lm77_detect(@_);Â }, |
|---|
| 480 |     }, { |
|---|
| 481 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM80", |
|---|
| 482 | Â Â Â Â Â Â Â Â driver =>Â "lm80", |
|---|
| 483 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x28..0x2f], |
|---|
| 484 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â lm80_detect(@_);Â }, |
|---|
| 485 |     }, { |
|---|
| 486 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM85", |
|---|
| 487 | Â Â Â Â Â Â Â Â driver =>Â "lm85", |
|---|
| 488 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 489 |         i2c_detect => sub { lm85_detect(@_, 0); }, |
|---|
| 490 |     }, { |
|---|
| 491 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM96000 or PC8374L", |
|---|
| 492 | Â Â Â Â Â Â Â Â driver =>Â "lm85", |
|---|
| 493 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 494 |         i2c_detect => sub { lm85_detect(@_, 1); }, |
|---|
| 495 |     }, { |
|---|
| 496 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1027", |
|---|
| 497 | Â Â Â Â Â Â Â Â driver =>Â "lm85", |
|---|
| 498 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 499 |         i2c_detect => sub { lm85_detect(@_, 2); }, |
|---|
| 500 |     }, { |
|---|
| 501 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADT7460 or ADT7463", |
|---|
| 502 | Â Â Â Â Â Â Â Â driver =>Â "lm85", |
|---|
| 503 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 504 |         i2c_detect => sub { lm85_detect(@_, 3); }, |
|---|
| 505 |     }, { |
|---|
| 506 | Â Â Â Â Â Â Â Â name =>Â "SMSC EMC6D100 or EMC6D101", |
|---|
| 507 | Â Â Â Â Â Â Â Â driver =>Â "lm85", |
|---|
| 508 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 509 |         i2c_detect => sub { lm85_detect(@_, 4); }, |
|---|
| 510 |     }, { |
|---|
| 511 | Â Â Â Â Â Â Â Â name =>Â "SMSC EMC6D102", |
|---|
| 512 | Â Â Â Â Â Â Â Â driver =>Â "lm85", |
|---|
| 513 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 514 |         i2c_detect => sub { lm85_detect(@_, 5); }, |
|---|
| 515 |     }, { |
|---|
| 516 | Â Â Â Â Â Â Â Â name =>Â "SMSC EMC6D103", |
|---|
| 517 | Â Â Â Â Â Â Â Â driver =>Â "lm85", |
|---|
| 518 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 519 |         i2c_detect => sub { lm85_detect(@_, 6); }, |
|---|
| 520 |     }, { |
|---|
| 521 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADT7462", |
|---|
| 522 | Â Â Â Â Â Â Â Â driver =>Â "adt7462", |
|---|
| 523 |         i2c_addrs => [0x5c, 0x58], |
|---|
| 524 |         i2c_detect => sub { adt7467_detect(@_, 2); }, |
|---|
| 525 |     }, { |
|---|
| 526 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADT7466", |
|---|
| 527 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 528 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c], |
|---|
| 529 |         i2c_detect => sub { adt7467_detect(@_, 3); }, |
|---|
| 530 |     }, { |
|---|
| 531 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADT7467 or ADT7468", |
|---|
| 532 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 533 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2e], |
|---|
| 534 |         i2c_detect => sub { adt7467_detect(@_, 0); }, |
|---|
| 535 |     }, { |
|---|
| 536 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADT7470", |
|---|
| 537 | Â Â Â Â Â Â Â Â driver =>Â "adt7470", |
|---|
| 538 |         i2c_addrs => [0x2c, 0x2e, 0x2f], |
|---|
| 539 |         i2c_detect => sub { adt7467_detect(@_, 4); }, |
|---|
| 540 |     }, { |
|---|
| 541 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADT7473", |
|---|
| 542 | Â Â Â Â Â Â Â Â driver =>Â "adt7473", |
|---|
| 543 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2e], |
|---|
| 544 |         i2c_detect => sub { adt7473_detect(@_, 0); }, |
|---|
| 545 |     }, { |
|---|
| 546 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADT7475", |
|---|
| 547 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 548 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2e], |
|---|
| 549 |         i2c_detect => sub { adt7473_detect(@_, 1); }, |
|---|
| 550 |     }, { |
|---|
| 551 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADT7476", |
|---|
| 552 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 553 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 554 |         i2c_detect => sub { adt7467_detect(@_, 1); }, |
|---|
| 555 |     }, { |
|---|
| 556 | Â Â Â Â Â Â Â Â name =>Â "Andigilog aSC7511", |
|---|
| 557 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 558 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c], |
|---|
| 559 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â andigilog_aSC7511_detect(@_);Â }, |
|---|
| 560 |     }, { |
|---|
| 561 | Â Â Â Â Â Â Â Â name =>Â "Andigilog aSC7512", |
|---|
| 562 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 563 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x58], |
|---|
| 564 |         i2c_detect => sub { andigilog_detect(@_, 0); }, |
|---|
| 565 |     }, { |
|---|
| 566 | Â Â Â Â Â Â Â Â name =>Â "Andigilog aSC7611", |
|---|
| 567 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 568 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 569 |         i2c_detect => sub { andigilog_detect(@_, 1); }, |
|---|
| 570 |     }, { |
|---|
| 571 | Â Â Â Â Â Â Â Â name =>Â "Andigilog aSC7621", |
|---|
| 572 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 573 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 574 |         i2c_detect => sub { andigilog_detect(@_, 2); }, |
|---|
| 575 |     }, { |
|---|
| 576 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM87", |
|---|
| 577 | Â Â Â Â Â Â Â Â driver =>Â "lm87", |
|---|
| 578 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 579 |         i2c_detect => sub { lm87_detect(@_, 0); }, |
|---|
| 580 |     }, { |
|---|
| 581 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1024", |
|---|
| 582 | Â Â Â Â Â Â Â Â driver =>Â "lm87", |
|---|
| 583 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 584 |         i2c_detect => sub { lm87_detect(@_, 1); }, |
|---|
| 585 |     }, { |
|---|
| 586 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM93", |
|---|
| 587 | Â Â Â Â Â Â Â Â driver =>Â "lm93", |
|---|
| 588 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 589 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â lm93_detect(@_);Â }, |
|---|
| 590 |     }, { |
|---|
| 591 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83781D", |
|---|
| 592 | Â Â Â Â Â Â Â Â driver =>Â "w83781d", |
|---|
| 593 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x28..0x2f], |
|---|
| 594 |         i2c_detect => sub { w83781d_detect(@_, 0); }, |
|---|
| 595 | Â Â Â Â Â Â Â Â isa_addrs =>Â [0x290], |
|---|
| 596 |         isa_detect => sub { w83781d_isa_detect(@_, 0); }, |
|---|
| 597 |         alias_detect => sub { winbond_alias_detect(@_, 0x2b, 0x3d); }, |
|---|
| 598 |     }, { |
|---|
| 599 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83782D", |
|---|
| 600 | Â Â Â Â Â Â Â Â driver =>Â "w83781d", |
|---|
| 601 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x28..0x2f], |
|---|
| 602 |         i2c_detect => sub { w83781d_detect(@_, 1); }, |
|---|
| 603 | Â Â Â Â Â Â Â Â isa_addrs =>Â [0x290], |
|---|
| 604 |         isa_detect => sub { w83781d_isa_detect(@_, 1); }, |
|---|
| 605 |         alias_detect => sub { winbond_alias_detect(@_, 0x2b, 0x3d); }, |
|---|
| 606 |     }, { |
|---|
| 607 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83783S", |
|---|
| 608 | Â Â Â Â Â Â Â Â driver =>Â "w83781d", |
|---|
| 609 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2d], |
|---|
| 610 |         i2c_detect => sub { w83781d_detect(@_, 2); }, |
|---|
| 611 |     }, { |
|---|
| 612 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83791D", |
|---|
| 613 | Â Â Â Â Â Â Â Â driver =>Â "w83791d", |
|---|
| 614 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2f], |
|---|
| 615 |         i2c_detect => sub { w83781d_detect(@_, 7); }, |
|---|
| 616 |     }, { |
|---|
| 617 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83792D", |
|---|
| 618 | Â Â Â Â Â Â Â Â driver =>Â "w83792d", |
|---|
| 619 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2f], |
|---|
| 620 |         i2c_detect => sub { w83781d_detect(@_, 8); }, |
|---|
| 621 |     }, { |
|---|
| 622 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83793R/G", |
|---|
| 623 | Â Â Â Â Â Â Â Â driver =>Â "w83793", |
|---|
| 624 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2f], |
|---|
| 625 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â w83793_detect(@_);Â }, |
|---|
| 626 |     }, { |
|---|
| 627 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83627HF", |
|---|
| 628 | Â Â Â Â Â Â Â Â driver =>Â "use-isa-instead", |
|---|
| 629 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x28..0x2f], |
|---|
| 630 |         i2c_detect => sub { w83781d_detect(@_, 3); }, |
|---|
| 631 |     }, { |
|---|
| 632 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83627EHF", |
|---|
| 633 | Â Â Â Â Â Â Â Â driver =>Â "use-isa-instead", |
|---|
| 634 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x28..0x2f], |
|---|
| 635 |         i2c_detect => sub { w83781d_detect(@_, 9); }, |
|---|
| 636 |     }, { |
|---|
| 637 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83627DHG", |
|---|
| 638 | Â Â Â Â Â Â Â Â driver =>Â "use-isa-instead", |
|---|
| 639 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x28..0x2f], |
|---|
| 640 |         i2c_detect => sub { w83781d_detect(@_, 10); }, |
|---|
| 641 |     }, { |
|---|
| 642 | Â Â Â Â Â Â Â Â name =>Â "Asus AS99127F (rev.1)", |
|---|
| 643 | Â Â Â Â Â Â Â Â driver =>Â "w83781d", |
|---|
| 644 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x28..0x2f], |
|---|
| 645 |         i2c_detect => sub { w83781d_detect(@_, 4); }, |
|---|
| 646 |     }, { |
|---|
| 647 | Â Â Â Â Â Â Â Â name =>Â "Asus AS99127F (rev.2)", |
|---|
| 648 | Â Â Â Â Â Â Â Â driver =>Â "w83781d", |
|---|
| 649 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x28..0x2f], |
|---|
| 650 |         i2c_detect => sub { w83781d_detect(@_, 5); }, |
|---|
| 651 |     }, { |
|---|
| 652 | Â Â Â Â Â Â Â Â name =>Â "Asus ASB100 Bach", |
|---|
| 653 | Â Â Â Â Â Â Â Â driver =>Â "asb100", |
|---|
| 654 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x28..0x2f], |
|---|
| 655 |         i2c_detect => sub { w83781d_detect(@_, 6); }, |
|---|
| 656 |     }, { |
|---|
| 657 | Â Â Â Â Â Â Â Â name =>Â "Asus Mozart-2", |
|---|
| 658 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 659 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x77], |
|---|
| 660 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â mozart_detect(@_);Â }, |
|---|
| 661 |     }, { |
|---|
| 662 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83L784R/AR/G", |
|---|
| 663 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 664 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2d], |
|---|
| 665 |         i2c_detect => sub { w83l784r_detect(@_, 0); }, |
|---|
| 666 |     }, { |
|---|
| 667 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83L785R/G", |
|---|
| 668 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 669 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2d], |
|---|
| 670 |         i2c_detect => sub { w83l784r_detect(@_, 1); }, |
|---|
| 671 |     }, { |
|---|
| 672 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83L786NR/NG/R/G", |
|---|
| 673 | Â Â Â Â Â Â Â Â driver =>Â "w83l786ng", |
|---|
| 674 |         i2c_addrs => [0x2e, 0x2f], |
|---|
| 675 |         i2c_detect => sub { w83l784r_detect(@_, 2); }, |
|---|
| 676 |     }, { |
|---|
| 677 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83L785TS-S", |
|---|
| 678 | Â Â Â Â Â Â Â Â driver =>Â "w83l785ts", |
|---|
| 679 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2e], |
|---|
| 680 |         i2c_detect => sub { w83l784r_detect(@_, 3); }, |
|---|
| 681 |     }, { |
|---|
| 682 | Â Â Â Â Â Â Â Â name =>Â "Genesys Logic GL518SM", |
|---|
| 683 | Â Â Â Â Â Â Â Â driver =>Â "gl518sm", |
|---|
| 684 |         i2c_addrs => [0x2c, 0x2d], |
|---|
| 685 |         i2c_detect => sub { gl518sm_detect(@_, 0); }, |
|---|
| 686 |     }, { |
|---|
| 687 | Â Â Â Â Â Â Â Â name =>Â "Genesys Logic GL520SM", |
|---|
| 688 | Â Â Â Â Â Â Â Â driver =>Â "gl520sm", |
|---|
| 689 |         i2c_addrs => [0x2c, 0x2d], |
|---|
| 690 |         i2c_detect => sub { gl518sm_detect(@_, 1); }, |
|---|
| 691 |     }, { |
|---|
| 692 | Â Â Â Â Â Â Â Â name =>Â "Genesys Logic GL525SM", |
|---|
| 693 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 694 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2d], |
|---|
| 695 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â gl525sm_detect(@_);Â }, |
|---|
| 696 |     }, { |
|---|
| 697 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM9240", |
|---|
| 698 | Â Â Â Â Â Â Â Â driver =>Â "adm9240", |
|---|
| 699 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2f], |
|---|
| 700 |         i2c_detect => sub { adm9240_detect(@_, 0); }, |
|---|
| 701 |     }, { |
|---|
| 702 | Â Â Â Â Â Â Â Â name =>Â "Dallas Semiconductor DS1621/DS1631", |
|---|
| 703 | Â Â Â Â Â Â Â Â driver =>Â "ds1621", |
|---|
| 704 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x48..0x4f], |
|---|
| 705 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â ds1621_detect(@_);Â }, |
|---|
| 706 |     }, { |
|---|
| 707 | Â Â Â Â Â Â Â Â name =>Â "Dallas Semiconductor DS1780", |
|---|
| 708 | Â Â Â Â Â Â Â Â driver =>Â "adm9240", |
|---|
| 709 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2f], |
|---|
| 710 |         i2c_detect => sub { adm9240_detect(@_, 1); }, |
|---|
| 711 |     }, { |
|---|
| 712 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM81", |
|---|
| 713 | Â Â Â Â Â Â Â Â driver =>Â "adm9240", |
|---|
| 714 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2f], |
|---|
| 715 |         i2c_detect => sub { adm9240_detect(@_, 2); }, |
|---|
| 716 |     }, { |
|---|
| 717 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1026", |
|---|
| 718 | Â Â Â Â Â Â Â Â driver =>Â "adm1026", |
|---|
| 719 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 720 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â adm1026_detect(@_);Â }, |
|---|
| 721 |     }, { |
|---|
| 722 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1025", |
|---|
| 723 | Â Â Â Â Â Â Â Â driver =>Â "adm1025", |
|---|
| 724 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 725 |         i2c_detect => sub { adm1025_detect(@_, 0); }, |
|---|
| 726 |     }, { |
|---|
| 727 | Â Â Â Â Â Â Â Â name =>Â "Philips NE1619", |
|---|
| 728 | Â Â Â Â Â Â Â Â driver =>Â "adm1025", |
|---|
| 729 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2d], |
|---|
| 730 |         i2c_detect => sub { adm1025_detect(@_, 1); }, |
|---|
| 731 |     }, { |
|---|
| 732 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1021", |
|---|
| 733 | Â Â Â Â Â Â Â Â driver =>Â "adm1021", |
|---|
| 734 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 735 |         i2c_detect => sub { adm1021_detect(@_, 0); }, |
|---|
| 736 |     }, { |
|---|
| 737 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1021A/ADM1023", |
|---|
| 738 | Â Â Â Â Â Â Â Â driver =>Â "adm1021", |
|---|
| 739 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 740 |         i2c_detect => sub { adm1021_detect(@_, 1); }, |
|---|
| 741 |     }, { |
|---|
| 742 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX1617", |
|---|
| 743 | Â Â Â Â Â Â Â Â driver =>Â "adm1021", |
|---|
| 744 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 745 |         i2c_detect => sub { adm1021_detect(@_, 2); }, |
|---|
| 746 |     }, { |
|---|
| 747 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX1617A", |
|---|
| 748 | Â Â Â Â Â Â Â Â driver =>Â "adm1021", |
|---|
| 749 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 750 |         i2c_detect => sub { adm1021_detect(@_, 3); }, |
|---|
| 751 |     }, { |
|---|
| 752 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX1668", |
|---|
| 753 | Â Â Â Â Â Â Â Â driver =>Â "max1668", |
|---|
| 754 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 755 |         i2c_detect => sub { max1668_detect(@_, 0); }, |
|---|
| 756 |     }, { |
|---|
| 757 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX1805", |
|---|
| 758 | Â Â Â Â Â Â Â Â driver =>Â "max1668", |
|---|
| 759 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 760 |         i2c_detect => sub { max1668_detect(@_, 1); }, |
|---|
| 761 |     }, { |
|---|
| 762 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX1989", |
|---|
| 763 | Â Â Â Â Â Â Â Â driver =>Â "max1668", |
|---|
| 764 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 765 |         i2c_detect => sub { max1668_detect(@_, 2); }, |
|---|
| 766 |     }, { |
|---|
| 767 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX6650/MAX6651", |
|---|
| 768 | Â Â Â Â Â Â Â Â driver =>Â "max6650", |
|---|
| 769 |         i2c_addrs => [0x1b, 0x1f, 0x48, 0x4b], |
|---|
| 770 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â max6650_detect(@_);Â }, |
|---|
| 771 |     }, { |
|---|
| 772 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX6655/MAX6656", |
|---|
| 773 | Â Â Â Â Â Â Â Â driver =>Â "max6655", |
|---|
| 774 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 775 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â max6655_detect(@_);Â }, |
|---|
| 776 |     }, { |
|---|
| 777 | Â Â Â Â Â Â Â Â name =>Â "TI THMC10", |
|---|
| 778 | Â Â Â Â Â Â Â Â driver =>Â "adm1021", |
|---|
| 779 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 780 |         i2c_detect => sub { adm1021_detect(@_, 4); }, |
|---|
| 781 |     }, { |
|---|
| 782 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM84", |
|---|
| 783 | Â Â Â Â Â Â Â Â driver =>Â "adm1021", |
|---|
| 784 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 785 |         i2c_detect => sub { adm1021_detect(@_, 5); }, |
|---|
| 786 |     }, { |
|---|
| 787 | Â Â Â Â Â Â Â Â name =>Â "Genesys Logic GL523SM", |
|---|
| 788 | Â Â Â Â Â Â Â Â driver =>Â "adm1021", |
|---|
| 789 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 790 |         i2c_detect => sub { adm1021_detect(@_, 6); }, |
|---|
| 791 |     }, { |
|---|
| 792 | Â Â Â Â Â Â Â Â name =>Â "Onsemi MC1066", |
|---|
| 793 | Â Â Â Â Â Â Â Â driver =>Â "adm1021", |
|---|
| 794 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 795 |         i2c_detect => sub { adm1021_detect(@_, 7); }, |
|---|
| 796 |     }, { |
|---|
| 797 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX1618", |
|---|
| 798 | Â Â Â Â Â Â Â Â driver =>Â "max1619", |
|---|
| 799 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 800 |         i2c_detect => sub { max1619_detect(@_, 1); }, |
|---|
| 801 |     }, { |
|---|
| 802 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX1619", |
|---|
| 803 | Â Â Â Â Â Â Â Â driver =>Â "max1619", |
|---|
| 804 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 805 |         i2c_detect => sub { max1619_detect(@_, 0); }, |
|---|
| 806 |     }, { |
|---|
| 807 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM82/LM83", |
|---|
| 808 | Â Â Â Â Â Â Â Â driver =>Â "lm83", |
|---|
| 809 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 810 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â lm83_detect(@_);Â }, |
|---|
| 811 |     }, { |
|---|
| 812 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM90", |
|---|
| 813 | Â Â Â Â Â Â Â Â driver =>Â "lm90", |
|---|
| 814 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c], |
|---|
| 815 |         i2c_detect => sub { lm90_detect(@_, 0); }, |
|---|
| 816 |     }, { |
|---|
| 817 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM89/LM99", |
|---|
| 818 | Â Â Â Â Â Â Â Â driver =>Â "lm90", |
|---|
| 819 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c..0x4d], |
|---|
| 820 |         i2c_detect => sub { lm90_detect(@_, 1); }, |
|---|
| 821 |     }, { |
|---|
| 822 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM86", |
|---|
| 823 | Â Â Â Â Â Â Â Â driver =>Â "lm90", |
|---|
| 824 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c], |
|---|
| 825 |         i2c_detect => sub { lm90_detect(@_, 2); }, |
|---|
| 826 |     }, { |
|---|
| 827 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1032", |
|---|
| 828 | Â Â Â Â Â Â Â Â driver =>Â "lm90", |
|---|
| 829 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c..0x4d], |
|---|
| 830 |         i2c_detect => sub { lm90_detect(@_, 3); }, |
|---|
| 831 |     }, { |
|---|
| 832 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX6654/MAX6690", |
|---|
| 833 |         driver => "to-be-written", # probably lm90 |
|---|
| 834 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 835 |         i2c_detect => sub { lm90_detect(@_, 4); }, |
|---|
| 836 |     }, { |
|---|
| 837 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX6657/MAX6658/MAX6659", |
|---|
| 838 | Â Â Â Â Â Â Â Â driver =>Â "lm90", |
|---|
| 839 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c], |
|---|
| 840 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â max6657_detect(@_);Â }, |
|---|
| 841 |     }, { |
|---|
| 842 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX6659", |
|---|
| 843 | Â Â Â Â Â Â Â Â driver =>Â "lm90", |
|---|
| 844 |         i2c_addrs => [0x4d..0x4e], # 0x4c is handled above |
|---|
| 845 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â max6657_detect(@_);Â }, |
|---|
| 846 |     }, { |
|---|
| 847 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX6646", |
|---|
| 848 | Â Â Â Â Â Â Â Â driver =>Â "lm90", |
|---|
| 849 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4d], |
|---|
| 850 |         i2c_detect => sub { lm90_detect(@_, 6); }, |
|---|
| 851 |     }, { |
|---|
| 852 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX6647", |
|---|
| 853 | Â Â Â Â Â Â Â Â driver =>Â "lm90", |
|---|
| 854 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4e], |
|---|
| 855 |         i2c_detect => sub { lm90_detect(@_, 6); }, |
|---|
| 856 |     }, { |
|---|
| 857 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX6648/MAX6649/MAX6692", |
|---|
| 858 | Â Â Â Â Â Â Â Â driver =>Â "lm90", |
|---|
| 859 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c], |
|---|
| 860 |         i2c_detect => sub { lm90_detect(@_, 6); }, |
|---|
| 861 |     }, { |
|---|
| 862 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX6680/MAX6681", |
|---|
| 863 | Â Â Â Â Â Â Â Â driver =>Â "lm90", |
|---|
| 864 |         i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], |
|---|
| 865 |         i2c_detect => sub { lm90_detect(@_, 7); }, |
|---|
| 866 |     }, { |
|---|
| 867 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83L771W/G", |
|---|
| 868 | Â Â Â Â Â Â Â Â driver =>Â "lm90", |
|---|
| 869 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c], |
|---|
| 870 |         i2c_detect => sub { lm90_detect(@_, 8); }, |
|---|
| 871 |     }, { |
|---|
| 872 | Â Â Â Â Â Â Â Â name =>Â "Texas Instruments TMP401", |
|---|
| 873 | Â Â Â Â Â Â Â Â driver =>Â "tmp401", |
|---|
| 874 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c], |
|---|
| 875 |         i2c_detect => sub { lm90_detect(@_, 9); }, |
|---|
| 876 |     }, { |
|---|
| 877 | Â Â Â Â Â Â Â Â name =>Â "Texas Instruments TMP411", |
|---|
| 878 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 879 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c..0x4e], |
|---|
| 880 |         i2c_detect => sub { lm90_detect(@_, 10); }, |
|---|
| 881 |     }, { |
|---|
| 882 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM95231", |
|---|
| 883 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 884 |         i2c_addrs => [0x2b, 0x19, 0x2a], |
|---|
| 885 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â lm95231_detect(@_);Â }, |
|---|
| 886 |     }, { |
|---|
| 887 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM63", |
|---|
| 888 | Â Â Â Â Â Â Â Â driver =>Â "lm63", |
|---|
| 889 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c], |
|---|
| 890 |         i2c_detect => sub { lm63_detect(@_, 1); }, |
|---|
| 891 |     }, { |
|---|
| 892 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM64", |
|---|
| 893 |         driver => "to-be-written", # lm63 |
|---|
| 894 |         i2c_addrs => [0x18, 0x4e], |
|---|
| 895 |         i2c_detect => sub { lm63_detect(@_, 3); }, |
|---|
| 896 |     }, { |
|---|
| 897 | Â Â Â Â Â Â Â Â name =>Â "Fintek F75363SG", |
|---|
| 898 |         driver => "lm63", # Not yet |
|---|
| 899 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c], |
|---|
| 900 |         i2c_detect => sub { lm63_detect(@_, 2); }, |
|---|
| 901 |     }, { |
|---|
| 902 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM92", |
|---|
| 903 | Â Â Â Â Â Â Â Â driver =>Â "lm92", |
|---|
| 904 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x48..0x4b], |
|---|
| 905 |         i2c_detect => sub { lm92_detect(@_, 0); }, |
|---|
| 906 |     }, { |
|---|
| 907 | Â Â Â Â Â Â Â Â name =>Â "National Semiconductor LM76", |
|---|
| 908 | Â Â Â Â Â Â Â Â driver =>Â "lm92", |
|---|
| 909 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x48..0x4b], |
|---|
| 910 |         i2c_detect => sub { lm92_detect(@_, 1); }, |
|---|
| 911 |     }, { |
|---|
| 912 | Â Â Â Â Â Â Â Â name =>Â "Maxim MAX6633/MAX6634/MAX6635", |
|---|
| 913 | Â Â Â Â Â Â Â Â driver =>Â "lm92", |
|---|
| 914 |         i2c_addrs => [0x48..0x4f], # The MAX6633 can also use 0x40-0x47 but we |
|---|
| 915 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â # don't want to probe these addresses, it's |
|---|
| 916 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â # dangerous. |
|---|
| 917 |         i2c_detect => sub { lm92_detect(@_, 2); }, |
|---|
| 918 |     }, { |
|---|
| 919 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADT7461", |
|---|
| 920 | Â Â Â Â Â Â Â Â driver =>Â "lm90", |
|---|
| 921 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c..0x4d], |
|---|
| 922 |         i2c_detect => sub { lm90_detect(@_, 5); }, |
|---|
| 923 |     }, { |
|---|
| 924 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADT7481", |
|---|
| 925 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 926 |         i2c_addrs => [0x4c, 0x4b], |
|---|
| 927 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â adt7481_detect(@_);Â }, |
|---|
| 928 |     }, { |
|---|
| 929 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1029", |
|---|
| 930 | Â Â Â Â Â Â Â Â driver =>Â "adm1029", |
|---|
| 931 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x28..0x2f], |
|---|
| 932 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â adm1029_detect(@_);Â }, |
|---|
| 933 |     }, { |
|---|
| 934 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1030", |
|---|
| 935 | Â Â Â Â Â Â Â Â driver =>Â "adm1031", |
|---|
| 936 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 937 |         i2c_detect => sub { adm1031_detect(@_, 0); }, |
|---|
| 938 |     }, { |
|---|
| 939 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1031", |
|---|
| 940 | Â Â Â Â Â Â Â Â driver =>Â "adm1031", |
|---|
| 941 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 942 |         i2c_detect => sub { adm1031_detect(@_, 1); }, |
|---|
| 943 |     }, { |
|---|
| 944 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1033", |
|---|
| 945 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 946 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x50..0x53], |
|---|
| 947 |         i2c_detect => sub { adm1034_detect(@_, 0); }, |
|---|
| 948 |     }, { |
|---|
| 949 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1034", |
|---|
| 950 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 951 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x50..0x53], |
|---|
| 952 |         i2c_detect => sub { adm1034_detect(@_, 1); }, |
|---|
| 953 |     }, { |
|---|
| 954 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1022", |
|---|
| 955 | Â Â Â Â Â Â Â Â driver =>Â "thmc50", |
|---|
| 956 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 957 |         i2c_detect => sub { adm1022_detect(@_, 0); }, |
|---|
| 958 |     }, { |
|---|
| 959 | Â Â Â Â Â Â Â Â name =>Â "Texas Instruments THMC50", |
|---|
| 960 | Â Â Â Â Â Â Â Â driver =>Â "thmc50", |
|---|
| 961 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 962 |         i2c_detect => sub { adm1022_detect(@_, 1); }, |
|---|
| 963 |     }, { |
|---|
| 964 | Â Â Â Â Â Â Â Â name =>Â "Analog Devices ADM1028", |
|---|
| 965 | Â Â Â Â Â Â Â Â driver =>Â "thmc50", |
|---|
| 966 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2e], |
|---|
| 967 |         i2c_detect => sub { adm1022_detect(@_, 2); }, |
|---|
| 968 |     }, { |
|---|
| 969 | Â Â Â Â Â Â Â Â name =>Â "Texas Instruments THMC51", |
|---|
| 970 |         driver => "to-be-written", # thmc50 |
|---|
| 971 |         i2c_addrs => [0x2e], # At least (no datasheet) |
|---|
| 972 |         i2c_detect => sub { adm1022_detect(@_, 3); }, |
|---|
| 973 |     }, { |
|---|
| 974 | Â Â Â Â Â Â Â Â name =>Â "VIA VT1211 (I2C)", |
|---|
| 975 | Â Â Â Â Â Â Â Â driver =>Â "use-isa-instead", |
|---|
| 976 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2d], |
|---|
| 977 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â vt1211_i2c_detect(@_);Â }, |
|---|
| 978 |     }, { |
|---|
| 979 | Â Â Â Â Â Â Â Â name =>Â "ITE IT8712F", |
|---|
| 980 | Â Â Â Â Â Â Â Â driver =>Â "it87", |
|---|
| 981 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x28..0x2f], |
|---|
| 982 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â it8712_i2c_detect(@_);Â }, |
|---|
| 983 |     }, { |
|---|
| 984 | Â Â Â Â Â Â Â Â name =>Â "FSC Poseidon I", |
|---|
| 985 |         driver => sub { kernel_version_at_least(2, 6, 24) ? "fschmd" : "fscpos" }, |
|---|
| 986 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x73], |
|---|
| 987 |         i2c_detect => sub { fsc_detect(@_, 0); }, |
|---|
| 988 |     }, { |
|---|
| 989 | Â Â Â Â Â Â Â Â name =>Â "FSC Poseidon II", |
|---|
| 990 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 991 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x73], |
|---|
| 992 |         i2c_detect => sub { fsc_detect(@_, 1); }, |
|---|
| 993 |     }, { |
|---|
| 994 | Â Â Â Â Â Â Â Â name =>Â "FSC Scylla", |
|---|
| 995 | Â Â Â Â Â Â Â Â driver =>Â "fschmd", |
|---|
| 996 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x73], |
|---|
| 997 |         i2c_detect => sub { fsc_detect(@_, 2); }, |
|---|
| 998 |     }, { |
|---|
| 999 | Â Â Â Â Â Â Â Â name =>Â "FSC Hermes", |
|---|
| 1000 |         driver => sub { kernel_version_at_least(2, 6, 24) ? "fschmd" : "fscher" }, |
|---|
| 1001 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x73], |
|---|
| 1002 |         i2c_detect => sub { fsc_detect(@_, 3); }, |
|---|
| 1003 |     }, { |
|---|
| 1004 | Â Â Â Â Â Â Â Â name =>Â "FSC Heimdal", |
|---|
| 1005 | Â Â Â Â Â Â Â Â driver =>Â "fschmd", |
|---|
| 1006 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x73], |
|---|
| 1007 |         i2c_detect => sub { fsc_detect(@_, 4); }, |
|---|
| 1008 |     }, { |
|---|
| 1009 | Â Â Â Â Â Â Â Â name =>Â "FSC Heracles", |
|---|
| 1010 | Â Â Â Â Â Â Â Â driver =>Â "fschmd", |
|---|
| 1011 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x73], |
|---|
| 1012 |         i2c_detect => sub { fsc_detect(@_, 5); }, |
|---|
| 1013 |     }, { |
|---|
| 1014 | Â Â Â Â Â Â Â Â name =>Â "ALi M5879", |
|---|
| 1015 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1016 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2d], |
|---|
| 1017 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â m5879_detect(@_);Â }, |
|---|
| 1018 |     }, { |
|---|
| 1019 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47M15x/192/292/997", |
|---|
| 1020 | Â Â Â Â Â Â Â Â driver =>Â "smsc47m192", |
|---|
| 1021 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2d], |
|---|
| 1022 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â smsc47m192_detect(@_);Â }, |
|---|
| 1023 |     }, { |
|---|
| 1024 | Â Â Â Â Â Â Â Â name =>Â "SMSC DME1737", |
|---|
| 1025 | Â Â Â Â Â Â Â Â driver =>Â "dme1737", |
|---|
| 1026 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 1027 |         i2c_detect => sub { dme1737_detect(@_, 1); }, |
|---|
| 1028 |     }, { |
|---|
| 1029 | Â Â Â Â Â Â Â Â name =>Â "SMSC SCH5027D-NW", |
|---|
| 1030 | Â Â Â Â Â Â Â Â driver =>Â "dme1737", |
|---|
| 1031 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2e], |
|---|
| 1032 |         i2c_detect => sub { dme1737_detect(@_, 2); }, |
|---|
| 1033 |     }, { |
|---|
| 1034 | Â Â Â Â Â Â Â Â name =>Â "Fintek F75121R/F75122R/RG (VID+GPIO)", |
|---|
| 1035 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1036 |         i2c_addrs => [0x4e], # 0x37 not probed |
|---|
| 1037 |         i2c_detect => sub { fintek_detect(@_, 2); }, |
|---|
| 1038 |     }, { |
|---|
| 1039 | Â Â Â Â Â Â Â Â name =>Â "Fintek F75373S/SG", |
|---|
| 1040 | Â Â Â Â Â Â Â Â driver =>Â "f75375s", |
|---|
| 1041 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2d..0x2e], |
|---|
| 1042 |         i2c_detect => sub { fintek_detect(@_, 3); }, |
|---|
| 1043 |     }, { |
|---|
| 1044 | Â Â Â Â Â Â Â Â name =>Â "Fintek F75375S/SP", |
|---|
| 1045 | Â Â Â Â Â Â Â Â driver =>Â "f75375s", |
|---|
| 1046 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2d..0x2e], |
|---|
| 1047 |         i2c_detect => sub { fintek_detect(@_, 4); }, |
|---|
| 1048 |     }, { |
|---|
| 1049 | Â Â Â Â Â Â Â Â name =>Â "Fintek F75387SG/RG", |
|---|
| 1050 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1051 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2d..0x2e], |
|---|
| 1052 |         i2c_detect => sub { fintek_detect(@_, 5); }, |
|---|
| 1053 |     }, { |
|---|
| 1054 | Â Â Â Â Â Â Â Â name =>Â "Fintek F75383S/M", |
|---|
| 1055 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1056 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4c], |
|---|
| 1057 |         i2c_detect => sub { fintek_detect(@_, 6); }, |
|---|
| 1058 |     }, { |
|---|
| 1059 | Â Â Â Â Â Â Â Â name =>Â "Fintek F75384S/M", |
|---|
| 1060 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1061 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4d], |
|---|
| 1062 |         i2c_detect => sub { fintek_detect(@_, 6); }, |
|---|
| 1063 |     }, { |
|---|
| 1064 | Â Â Â Â Â Â Â Â name =>Â "Fintek custom power control IC", |
|---|
| 1065 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1066 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2f], |
|---|
| 1067 |         i2c_detect => sub { fintek_detect(@_, 7); }, |
|---|
| 1068 |     }, { |
|---|
| 1069 | Â Â Â Â Â Â Â Â name =>Â "Smart Battery", |
|---|
| 1070 |         driver => "sbs", # ACPI driver, not sure if it always works |
|---|
| 1071 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x0b], |
|---|
| 1072 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â smartbatt_detect(@_);Â }, |
|---|
| 1073 | Â Â Â Â } |
|---|
| 1074 | ); |
|---|
| 1075 | |
|---|
| 1076 | # IPMI interfaces have their own array now |
|---|
| 1077 | @ipmi_ifs = ( |
|---|
| 1078 | Â Â Â Â { |
|---|
| 1079 | Â Â Â Â Â Â Â Â name =>Â "IPMI BMC KCS", |
|---|
| 1080 | Â Â Â Â Â Â Â Â driver =>Â "ipmisensors", |
|---|
| 1081 | Â Â Â Â Â Â Â Â isa_addrs =>Â [0x0ca0], |
|---|
| 1082 | Â Â Â Â Â Â Â Â isa_detect =>Â sub {Â ipmi_detect(@_);Â }, |
|---|
| 1083 |     }, { |
|---|
| 1084 | Â Â Â Â Â Â Â Â name =>Â "IPMI BMC SMIC", |
|---|
| 1085 | Â Â Â Â Â Â Â Â driver =>Â "ipmisensors", |
|---|
| 1086 | Â Â Â Â Â Â Â Â isa_addrs =>Â [0x0ca8], |
|---|
| 1087 | Â Â Â Â Â Â Â Â isa_detect =>Â sub {Â ipmi_detect(@_);Â }, |
|---|
| 1088 | Â Â Â Â } |
|---|
| 1089 | ); |
|---|
| 1090 | |
|---|
| 1091 | # Here is a similar list, but for devices which are not hardware monitoring |
|---|
| 1092 | # chips. We only list popular devices which happen to live at the same I2C |
|---|
| 1093 | # address as recognized hardware monitoring chips. The idea is to make it |
|---|
| 1094 | # clear that the chip in question is of no interest for lm-sensors. |
|---|
| 1095 | @non_hwmon_chip_ids = ( |
|---|
| 1096 | Â Â Â Â { |
|---|
| 1097 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83791SD", |
|---|
| 1098 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x2c..0x2f], |
|---|
| 1099 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â w83791sd_detect(@_);Â }, |
|---|
| 1100 |     }, { |
|---|
| 1101 | Â Â Â Â Â Â Â Â name =>Â "Fintek F75111R/RG/N (GPIO)", |
|---|
| 1102 |         i2c_addrs => [0x37, 0x4e], |
|---|
| 1103 |         i2c_detect => sub { fintek_detect(@_, 1); }, |
|---|
| 1104 |     }, { |
|---|
| 1105 | Â Â Â Â Â Â Â Â name =>Â "ITE IT8201R/IT8203R/IT8206R/IT8266R", |
|---|
| 1106 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x4e], |
|---|
| 1107 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â ite_overclock_detect(@_);Â }, |
|---|
| 1108 |     }, { |
|---|
| 1109 | Â Â Â Â Â Â Â Â name =>Â "SPD EEPROM", |
|---|
| 1110 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x50..0x57], |
|---|
| 1111 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â eeprom_detect(@_);Â }, |
|---|
| 1112 |     }, { |
|---|
| 1113 | Â Â Â Â Â Â Â Â name =>Â "EDID EEPROM", |
|---|
| 1114 | Â Â Â Â Â Â Â Â i2c_addrs =>Â [0x50], |
|---|
| 1115 | Â Â Â Â Â Â Â Â i2c_detect =>Â sub {Â ddcmonitor_detect(@_);Â }, |
|---|
| 1116 | Â Â Â Â } |
|---|
| 1117 | ); |
|---|
| 1118 | |
|---|
| 1119 | # This is a list of all recognized superio chips. |
|---|
| 1120 | # Each entry must have the following fields: |
|---|
| 1121 | #Â name: The full chip name |
|---|
| 1122 | #Â driver: The driver name. Put in exactly: |
|---|
| 1123 | #Â Â Â * "to-be-written" if it is not yet available |
|---|
| 1124 | #Â Â Â * "not-a-sensor" if the chip doesn't have hardware monitoring |
|---|
| 1125 | #Â Â Â Â capabilities (listing such chips here removes the need of manual |
|---|
| 1126 | #Â Â Â Â lookup when people report them) |
|---|
| 1127 | #Â Â Â * "via-smbus-only" if this is a Super-I/O chip whose hardware |
|---|
| 1128 | #Â Â Â Â monitoring registers can only be accessed via the SMBus |
|---|
| 1129 | #Â devid: The device ID we have to match (base device) |
|---|
| 1130 | #Â devid_mask (optional): Bitmask to apply before checking the device ID |
|---|
| 1131 | #Â logdev: The logical device containing the sensors |
|---|
| 1132 | #Â features (optional): Features supported by this device, amongst: |
|---|
| 1133 | #Â Â Â * FEAT_IN |
|---|
| 1134 | #Â Â Â * FEAT_FAN |
|---|
| 1135 | #Â Â Â * FEAT_TEMP |
|---|
| 1136 | use vars qw(@superio_ids_natsemi @superio_ids_smsc @superio_ids_smsc_ns |
|---|
| 1137 | Â Â Â Â Â Â @superio_ids_winbond @superio_ids_ite @superio_ids); |
|---|
| 1138 | |
|---|
| 1139 | use constant FEAT_IN  => (1 << 0); |
|---|
| 1140 | use constant FEAT_FAN  => (1 << 1); |
|---|
| 1141 | use constant FEAT_TEMP => (1 << 2); |
|---|
| 1142 | use constant FEAT_SMBUS => (1 << 7); |
|---|
| 1143 | |
|---|
| 1144 | @superio_ids_natsemi = ( |
|---|
| 1145 | Â Â Â Â { |
|---|
| 1146 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC8374L Super IO Sensors", |
|---|
| 1147 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1148 | Â Â Â Â Â Â Â Â devid =>Â 0xf1, |
|---|
| 1149 | Â Â Â Â Â Â Â Â logdev =>Â 0x08, |
|---|
| 1150 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1151 |     }, { |
|---|
| 1152 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87351 Super IO Fan Sensors", |
|---|
| 1153 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1154 | Â Â Â Â Â Â Â Â devid =>Â 0xe2, |
|---|
| 1155 | Â Â Â Â Â Â Â Â logdev =>Â 0x08, |
|---|
| 1156 |     }, { |
|---|
| 1157 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87360 Super IO Fan Sensors", |
|---|
| 1158 | Â Â Â Â Â Â Â Â driver =>Â "pc87360", |
|---|
| 1159 | Â Â Â Â Â Â Â Â devid =>Â 0xe1, |
|---|
| 1160 | Â Â Â Â Â Â Â Â logdev =>Â 0x09, |
|---|
| 1161 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1162 |     }, { |
|---|
| 1163 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87363 Super IO Fan Sensors", |
|---|
| 1164 | Â Â Â Â Â Â Â Â driver =>Â "pc87360", |
|---|
| 1165 | Â Â Â Â Â Â Â Â devid =>Â 0xe8, |
|---|
| 1166 | Â Â Â Â Â Â Â Â logdev =>Â 0x09, |
|---|
| 1167 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1168 |     }, { |
|---|
| 1169 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87364 Super IO Fan Sensors", |
|---|
| 1170 | Â Â Â Â Â Â Â Â driver =>Â "pc87360", |
|---|
| 1171 | Â Â Â Â Â Â Â Â devid =>Â 0xe4, |
|---|
| 1172 | Â Â Â Â Â Â Â Â logdev =>Â 0x09, |
|---|
| 1173 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1174 |     }, { |
|---|
| 1175 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87365 Super IO Fan Sensors", |
|---|
| 1176 | Â Â Â Â Â Â Â Â driver =>Â "pc87360", |
|---|
| 1177 | Â Â Â Â Â Â Â Â devid =>Â 0xe5, |
|---|
| 1178 | Â Â Â Â Â Â Â Â logdev =>Â 0x09, |
|---|
| 1179 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1180 |     }, { |
|---|
| 1181 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87365 Super IO Voltage Sensors", |
|---|
| 1182 | Â Â Â Â Â Â Â Â driver =>Â "pc87360", |
|---|
| 1183 | Â Â Â Â Â Â Â Â devid =>Â 0xe5, |
|---|
| 1184 | Â Â Â Â Â Â Â Â logdev =>Â 0x0d, |
|---|
| 1185 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN, |
|---|
| 1186 |     }, { |
|---|
| 1187 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87365 Super IO Thermal Sensors", |
|---|
| 1188 | Â Â Â Â Â Â Â Â driver =>Â "pc87360", |
|---|
| 1189 | Â Â Â Â Â Â Â Â devid =>Â 0xe5, |
|---|
| 1190 | Â Â Â Â Â Â Â Â logdev =>Â 0x0e, |
|---|
| 1191 | Â Â Â Â Â Â Â Â features =>Â FEAT_TEMP, |
|---|
| 1192 |     }, { |
|---|
| 1193 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87366 Super IO Fan Sensors", |
|---|
| 1194 | Â Â Â Â Â Â Â Â driver =>Â "pc87360", |
|---|
| 1195 | Â Â Â Â Â Â Â Â devid =>Â 0xe9, |
|---|
| 1196 | Â Â Â Â Â Â Â Â logdev =>Â 0x09, |
|---|
| 1197 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1198 |     }, { |
|---|
| 1199 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87366 Super IO Voltage Sensors", |
|---|
| 1200 | Â Â Â Â Â Â Â Â driver =>Â "pc87360", |
|---|
| 1201 | Â Â Â Â Â Â Â Â devid =>Â 0xe9, |
|---|
| 1202 | Â Â Â Â Â Â Â Â logdev =>Â 0x0d, |
|---|
| 1203 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN, |
|---|
| 1204 |     }, { |
|---|
| 1205 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87366 Super IO Thermal Sensors", |
|---|
| 1206 | Â Â Â Â Â Â Â Â driver =>Â "pc87360", |
|---|
| 1207 | Â Â Â Â Â Â Â Â devid =>Â 0xe9, |
|---|
| 1208 | Â Â Â Â Â Â Â Â logdev =>Â 0x0e, |
|---|
| 1209 | Â Â Â Â Â Â Â Â features =>Â FEAT_TEMP, |
|---|
| 1210 |     }, { |
|---|
| 1211 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87372 Super IO Fan Sensors", |
|---|
| 1212 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1213 | Â Â Â Â Â Â Â Â devid =>Â 0xf0, |
|---|
| 1214 | Â Â Â Â Â Â Â Â logdev =>Â 0x09, |
|---|
| 1215 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1216 |     }, { |
|---|
| 1217 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87373 Super IO Fan Sensors", |
|---|
| 1218 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1219 | Â Â Â Â Â Â Â Â devid =>Â 0xf3, |
|---|
| 1220 | Â Â Â Â Â Â Â Â logdev =>Â 0x09, |
|---|
| 1221 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1222 |     }, { |
|---|
| 1223 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87591 Super IO", |
|---|
| 1224 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1225 | Â Â Â Â Â Â Â Â devid =>Â 0xec, |
|---|
| 1226 | Â Â Â Â Â Â Â Â logdev =>Â 0x0f, |
|---|
| 1227 |     }, { |
|---|
| 1228 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87317 Super IO", |
|---|
| 1229 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1230 | Â Â Â Â Â Â Â Â devid =>Â 0xd0, |
|---|
| 1231 |     }, { |
|---|
| 1232 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC97317 Super IO", |
|---|
| 1233 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1234 | Â Â Â Â Â Â Â Â devid =>Â 0xdf, |
|---|
| 1235 |     }, { |
|---|
| 1236 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC8739x Super IO", |
|---|
| 1237 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1238 | Â Â Â Â Â Â Â Â devid =>Â 0xea, |
|---|
| 1239 |     }, { |
|---|
| 1240 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC8741x Super IO", |
|---|
| 1241 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1242 | Â Â Â Â Â Â Â Â devid =>Â 0xee, |
|---|
| 1243 |     }, { |
|---|
| 1244 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87427 Super IO Fan Sensors", |
|---|
| 1245 | Â Â Â Â Â Â Â Â driver =>Â "pc87427", |
|---|
| 1246 | Â Â Â Â Â Â Â Â devid =>Â 0xf2, |
|---|
| 1247 | Â Â Â Â Â Â Â Â logdev =>Â 0x09, |
|---|
| 1248 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1249 |     }, { |
|---|
| 1250 | Â Â Â Â Â Â Â Â name =>Â "Nat. Semi. PC87427 Super IO Health Sensors", |
|---|
| 1251 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1252 | Â Â Â Â Â Â Â Â devid =>Â 0xf2, |
|---|
| 1253 | Â Â Â Â Â Â Â Â logdev =>Â 0x14, |
|---|
| 1254 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_TEMP, |
|---|
| 1255 | Â Â Â Â } |
|---|
| 1256 | ); |
|---|
| 1257 | |
|---|
| 1258 | @superio_ids_smsc = ( |
|---|
| 1259 | Â Â Â Â { |
|---|
| 1260 | Â Â Â Â Â Â Â Â name =>Â "SMSC DME1737 Super IO", |
|---|
| 1261 | Â Â Â Â Â Â Â Â # Hardware monitoring features are accessed on the SMBus |
|---|
| 1262 | Â Â Â Â Â Â Â Â driver =>Â "via-smbus-only", |
|---|
| 1263 | Â Â Â Â Â Â Â Â devid =>Â 0x78, |
|---|
| 1264 |     }, { |
|---|
| 1265 | Â Â Â Â Â Â Â Â name =>Â "SMSC DME1737 Super IO", |
|---|
| 1266 | Â Â Â Â Â Â Â Â # The DME1737 shows up twice in this list because it can return either |
|---|
| 1267 | Â Â Â Â Â Â Â Â # 0x78 or 0x77 as its device ID. |
|---|
| 1268 | Â Â Â Â Â Â Â Â # Hardware monitoring features are accessed on the SMBus |
|---|
| 1269 | Â Â Â Â Â Â Â Â driver =>Â "via-smbus-only", |
|---|
| 1270 | Â Â Â Â Â Â Â Â devid =>Â 0x77, |
|---|
| 1271 |     }, { |
|---|
| 1272 | Â Â Â Â Â Â Â Â name =>Â "SMSC EMC2700LPC Super IO", |
|---|
| 1273 | Â Â Â Â Â Â Â Â # no datasheet |
|---|
| 1274 | Â Â Â Â Â Â Â Â devid =>Â 0x67, |
|---|
| 1275 |     }, { |
|---|
| 1276 | Â Â Â Â Â Â Â Â name =>Â "SMSC FDC37B72x Super IO", |
|---|
| 1277 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1278 | Â Â Â Â Â Â Â Â devid =>Â 0x4c, |
|---|
| 1279 |     }, { |
|---|
| 1280 | Â Â Â Â Â Â Â Â name =>Â "SMSC FDC37B78x Super IO", |
|---|
| 1281 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1282 | Â Â Â Â Â Â Â Â devid =>Â 0x44, |
|---|
| 1283 |     }, { |
|---|
| 1284 | Â Â Â Â Â Â Â Â name =>Â "SMSC FDC37C672 Super IO", |
|---|
| 1285 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1286 | Â Â Â Â Â Â Â Â devid =>Â 0x40, |
|---|
| 1287 |     }, { |
|---|
| 1288 | Â Â Â Â Â Â Â Â name =>Â "SMSC FDC37M707 Super IO", |
|---|
| 1289 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1290 | Â Â Â Â Â Â Â Â devid =>Â 0x42, |
|---|
| 1291 |     }, { |
|---|
| 1292 | Â Â Â Â Â Â Â Â name =>Â "SMSC FDC37M81x Super IO", |
|---|
| 1293 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1294 | Â Â Â Â Â Â Â Â devid =>Â 0x4d, |
|---|
| 1295 |     }, { |
|---|
| 1296 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47B27x Super IO Fan Sensors", |
|---|
| 1297 | Â Â Â Â Â Â Â Â driver =>Â "smsc47m1", |
|---|
| 1298 | Â Â Â Â Â Â Â Â devid =>Â 0x51, |
|---|
| 1299 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1300 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1301 |     }, { |
|---|
| 1302 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47B34x Super IO", |
|---|
| 1303 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1304 | Â Â Â Â Â Â Â Â devid =>Â 0x56, |
|---|
| 1305 |     }, { |
|---|
| 1306 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47B357/M967 Super IO", |
|---|
| 1307 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1308 | Â Â Â Â Â Â Â Â devid =>Â 0x5d, |
|---|
| 1309 |     }, { |
|---|
| 1310 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47B367-NC Super IO", |
|---|
| 1311 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1312 | Â Â Â Â Â Â Â Â devid =>Â 0x6d, |
|---|
| 1313 |     }, { |
|---|
| 1314 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47B37x Super IO Fan Sensors", |
|---|
| 1315 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1316 | Â Â Â Â Â Â Â Â devid =>Â 0x52, |
|---|
| 1317 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1318 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1319 |     }, { |
|---|
| 1320 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47B397-NC Super IO", |
|---|
| 1321 | Â Â Â Â Â Â Â Â driver =>Â "smsc47b397", |
|---|
| 1322 | Â Â Â Â Â Â Â Â devid =>Â 0x6f, |
|---|
| 1323 | Â Â Â Â Â Â Â Â logdev =>Â 0x08, |
|---|
| 1324 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1325 |     }, { |
|---|
| 1326 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47M10x/112/13x Super IO Fan Sensors", |
|---|
| 1327 | Â Â Â Â Â Â Â Â driver =>Â "smsc47m1", |
|---|
| 1328 | Â Â Â Â Â Â Â Â devid =>Â 0x59, |
|---|
| 1329 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1330 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1331 |     }, { |
|---|
| 1332 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47M14x Super IO Fan Sensors", |
|---|
| 1333 | Â Â Â Â Â Â Â Â driver =>Â "smsc47m1", |
|---|
| 1334 | Â Â Â Â Â Â Â Â devid =>Â 0x5f, |
|---|
| 1335 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1336 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1337 |     }, { |
|---|
| 1338 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47M15x/192/997 Super IO Fan Sensors", |
|---|
| 1339 | Â Â Â Â Â Â Â Â driver =>Â "smsc47m1", |
|---|
| 1340 | Â Â Â Â Â Â Â Â devid =>Â 0x60, |
|---|
| 1341 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1342 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1343 |     }, { |
|---|
| 1344 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47M172 Super IO Fan Sensors", |
|---|
| 1345 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1346 | Â Â Â Â Â Â Â Â devid =>Â 0x14, |
|---|
| 1347 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1348 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1349 |     }, { |
|---|
| 1350 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47M182 Super IO Fan Sensors", |
|---|
| 1351 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1352 | Â Â Â Â Â Â Â Â devid =>Â 0x74, |
|---|
| 1353 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1354 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1355 |     }, { |
|---|
| 1356 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47M233 Super IO Sensors", |
|---|
| 1357 | Â Â Â Â Â Â Â Â driver =>Â "smsc47m1", |
|---|
| 1358 | Â Â Â Â Â Â Â Â devid =>Â 0x6b80, |
|---|
| 1359 | Â Â Â Â Â Â Â Â devid_mask =>Â 0xff80, |
|---|
| 1360 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1361 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1362 |     }, { |
|---|
| 1363 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47M292 Super IO Fan Sensors", |
|---|
| 1364 | Â Â Â Â Â Â Â Â driver =>Â "smsc47m1", |
|---|
| 1365 | Â Â Â Â Â Â Â Â devid =>Â 0x6b00, |
|---|
| 1366 | Â Â Â Â Â Â Â Â devid_mask =>Â 0xff80, |
|---|
| 1367 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1368 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1369 |     }, { |
|---|
| 1370 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47M584-NC Super IO", |
|---|
| 1371 | Â Â Â Â Â Â Â Â # No datasheet |
|---|
| 1372 | Â Â Â Â Â Â Â Â devid =>Â 0x76, |
|---|
| 1373 |     }, { |
|---|
| 1374 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47N252 Super IO Fan Sensors", |
|---|
| 1375 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1376 | Â Â Â Â Â Â Â Â devid =>Â 0x0e, |
|---|
| 1377 | Â Â Â Â Â Â Â Â logdev =>Â 0x09, |
|---|
| 1378 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1379 |     }, { |
|---|
| 1380 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47S42x Super IO Fan Sensors", |
|---|
| 1381 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1382 | Â Â Â Â Â Â Â Â devid =>Â 0x57, |
|---|
| 1383 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1384 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1385 |     }, { |
|---|
| 1386 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47S45x Super IO Fan Sensors", |
|---|
| 1387 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1388 | Â Â Â Â Â Â Â Â devid =>Â 0x62, |
|---|
| 1389 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1390 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1391 |     }, { |
|---|
| 1392 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47U33x Super IO Fan Sensors", |
|---|
| 1393 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1394 | Â Â Â Â Â Â Â Â devid =>Â 0x54, |
|---|
| 1395 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1396 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1397 |     }, { |
|---|
| 1398 | Â Â Â Â Â Â Â Â name =>Â "SMSC SCH3112 Super IO", |
|---|
| 1399 | Â Â Â Â Â Â Â Â driver =>Â "dme1737", |
|---|
| 1400 | Â Â Â Â Â Â Â Â devid =>Â 0x7c, |
|---|
| 1401 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1402 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1403 |     }, { |
|---|
| 1404 | Â Â Â Â Â Â Â Â name =>Â "SMSC SCH3114 Super IO", |
|---|
| 1405 | Â Â Â Â Â Â Â Â driver =>Â "dme1737", |
|---|
| 1406 | Â Â Â Â Â Â Â Â devid =>Â 0x7d, |
|---|
| 1407 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1408 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1409 |     }, { |
|---|
| 1410 | Â Â Â Â Â Â Â Â name =>Â "SMSC SCH3116 Super IO", |
|---|
| 1411 | Â Â Â Â Â Â Â Â driver =>Â "dme1737", |
|---|
| 1412 | Â Â Â Â Â Â Â Â devid =>Â 0x7f, |
|---|
| 1413 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1414 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1415 |     }, { |
|---|
| 1416 | Â Â Â Â Â Â Â Â name =>Â "SMSC SCH4307 Super IO Fan Sensors", |
|---|
| 1417 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1418 | Â Â Â Â Â Â Â Â devid =>Â 0x90, |
|---|
| 1419 | Â Â Â Â Â Â Â Â logdev =>Â 0x08, |
|---|
| 1420 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1421 |     }, { |
|---|
| 1422 | Â Â Â Â Â Â Â Â name =>Â "SMSC SCH5027D-NW Super IO", |
|---|
| 1423 | Â Â Â Â Â Â Â Â # Hardware monitoring features are accessed on the SMBus |
|---|
| 1424 | Â Â Â Â Â Â Â Â driver =>Â "via-smbus-only", |
|---|
| 1425 | Â Â Â Â Â Â Â Â devid =>Â 0x89, |
|---|
| 1426 |     }, { |
|---|
| 1427 | Â Â Â Â Â Â Â Â name =>Â "SMSC SCH5127 Super IO", |
|---|
| 1428 | Â Â Â Â Â Â Â Â driver =>Â "dme1737", |
|---|
| 1429 | Â Â Â Â Â Â Â Â devid =>Â 0x86, |
|---|
| 1430 | Â Â Â Â Â Â Â Â logdev =>Â 0x0a, |
|---|
| 1431 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1432 |     }, { |
|---|
| 1433 | Â Â Â Â Â Â Â Â name =>Â "SMSC SCH5307-NS Super IO", |
|---|
| 1434 | Â Â Â Â Â Â Â Â driver =>Â "smsc47b397", |
|---|
| 1435 | Â Â Â Â Â Â Â Â devid =>Â 0x81, |
|---|
| 1436 | Â Â Â Â Â Â Â Â logdev =>Â 0x08, |
|---|
| 1437 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1438 |     }, { |
|---|
| 1439 | Â Â Â Â Â Â Â Â name =>Â "SMSC SCH5317 Super IO", |
|---|
| 1440 | Â Â Â Â Â Â Â Â driver =>Â "smsc47b397", |
|---|
| 1441 | Â Â Â Â Â Â Â Â devid =>Â 0x85, |
|---|
| 1442 | Â Â Â Â Â Â Â Â logdev =>Â 0x08, |
|---|
| 1443 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1444 |     }, { |
|---|
| 1445 | Â Â Â Â Â Â Â Â name =>Â "SMSC SCH5317 Super IO", |
|---|
| 1446 | Â Â Â Â Â Â Â Â # The SCH5317 shows up twice in this list because it can return either |
|---|
| 1447 | Â Â Â Â Â Â Â Â # 0x85 or 0x8c as its device ID. |
|---|
| 1448 | Â Â Â Â Â Â Â Â driver =>Â "smsc47b397", |
|---|
| 1449 | Â Â Â Â Â Â Â Â devid =>Â 0x8c, |
|---|
| 1450 | Â Â Â Â Â Â Â Â logdev =>Â 0x08, |
|---|
| 1451 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1452 |     }, { |
|---|
| 1453 | Â Â Â Â Â Â Â Â name =>Â "SMSC SCH5504-NS Super IO", |
|---|
| 1454 | Â Â Â Â Â Â Â Â # No datasheet |
|---|
| 1455 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1456 | Â Â Â Â Â Â Â Â devid =>Â 0x79, |
|---|
| 1457 |     }, { |
|---|
| 1458 | Â Â Â Â Â Â Â Â name =>Â "SMSC SCH5514D-NS Super IO", |
|---|
| 1459 | Â Â Â Â Â Â Â Â # No datasheet |
|---|
| 1460 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1461 | Â Â Â Â Â Â Â Â devid =>Â 0x83, |
|---|
| 1462 | Â Â Â Â } |
|---|
| 1463 | ); |
|---|
| 1464 | |
|---|
| 1465 | # Non-standard SMSC chip list. These chips differ from the standard ones |
|---|
| 1466 | # listed above in that the device ID register address is 0x0d instead of |
|---|
| 1467 | # 0x20 (as specified by the ISA PNP spec). |
|---|
| 1468 | @superio_ids_smsc_ns = ( |
|---|
| 1469 | Â Â Â Â { |
|---|
| 1470 | Â Â Â Â Â Â Â Â name =>Â "SMSC FDC37C665 Super IO", |
|---|
| 1471 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1472 | Â Â Â Â Â Â Â Â devid =>Â 0x65, |
|---|
| 1473 |     }, { |
|---|
| 1474 | Â Â Â Â Â Â Â Â name =>Â "SMSC FDC37C666 Super IO", |
|---|
| 1475 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1476 | Â Â Â Â Â Â Â Â devid =>Â 0x66, |
|---|
| 1477 |     }, { |
|---|
| 1478 | Â Â Â Â Â Â Â Â name =>Â "SMSC FDC37C669 Super IO", |
|---|
| 1479 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1480 | Â Â Â Â Â Â Â Â devid =>Â 0x03, |
|---|
| 1481 |     }, { |
|---|
| 1482 | Â Â Â Â Â Â Â Â name =>Â "SMSC FDC37N769 Super IO", |
|---|
| 1483 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1484 | Â Â Â Â Â Â Â Â devid =>Â 0x28, |
|---|
| 1485 |     }, { |
|---|
| 1486 | Â Â Â Â Â Â Â Â name =>Â "SMSC LPC47N227 Super IO", |
|---|
| 1487 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1488 | Â Â Â Â Â Â Â Â devid =>Â 0x5a, |
|---|
| 1489 | Â Â Â Â } |
|---|
| 1490 | ); |
|---|
| 1491 | |
|---|
| 1492 | @superio_ids_winbond = ( |
|---|
| 1493 | Â Â Â Â { |
|---|
| 1494 | Â Â Â Â Â Â Â Â name =>Â "VIA VT1211 Super IO Sensors", |
|---|
| 1495 | Â Â Â Â Â Â Â Â driver =>Â "vt1211", |
|---|
| 1496 | Â Â Â Â Â Â Â Â devid =>Â 0x3c, |
|---|
| 1497 | Â Â Â Â Â Â Â Â logdev =>Â 0x0b, |
|---|
| 1498 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1499 |     }, { |
|---|
| 1500 |         name => "VIA VT1212 Super IO Lite",   # in 100 pin TQFP package |
|---|
| 1501 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1502 | Â Â Â Â Â Â Â Â devid =>Â 0x3e, |
|---|
| 1503 |     }, { |
|---|
| 1504 |         name => "VIA VT1212 Super IO Lite",   # in 48 pin LQFP package |
|---|
| 1505 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1506 | Â Â Â Â Â Â Â Â devid =>Â 0x3f, |
|---|
| 1507 |     }, { |
|---|
| 1508 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83627HF/F/HG/G Super IO Sensors", |
|---|
| 1509 | Â Â Â Â Â Â Â Â driver =>Â "w83627hf", |
|---|
| 1510 | Â Â Â Â Â Â Â Â devid =>Â 0x52, |
|---|
| 1511 | Â Â Â Â Â Â Â Â logdev =>Â 0x0b, |
|---|
| 1512 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1513 |     }, { |
|---|
| 1514 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83627THF/THG Super IO Sensors", |
|---|
| 1515 | Â Â Â Â Â Â Â Â driver =>Â "w83627hf", |
|---|
| 1516 | Â Â Â Â Â Â Â Â devid =>Â 0x82, |
|---|
| 1517 | Â Â Â Â Â Â Â Â logdev =>Â 0x0b, |
|---|
| 1518 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1519 |     }, { |
|---|
| 1520 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83637HF/HG Super IO Sensors", |
|---|
| 1521 | Â Â Â Â Â Â Â Â driver =>Â "w83627hf", |
|---|
| 1522 | Â Â Â Â Â Â Â Â devid =>Â 0x70, |
|---|
| 1523 | Â Â Â Â Â Â Â Â logdev =>Â 0x0b, |
|---|
| 1524 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1525 |     }, { |
|---|
| 1526 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83687THF Super IO Sensors", |
|---|
| 1527 | Â Â Â Â Â Â Â Â driver =>Â "w83627hf", |
|---|
| 1528 | Â Â Â Â Â Â Â Â devid =>Â 0x85, |
|---|
| 1529 | Â Â Â Â Â Â Â Â logdev =>Â 0x0b, |
|---|
| 1530 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1531 |     }, { |
|---|
| 1532 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83697HF/F/HG Super IO Sensors", |
|---|
| 1533 | Â Â Â Â Â Â Â Â driver =>Â "w83627hf", |
|---|
| 1534 | Â Â Â Â Â Â Â Â devid =>Â 0x60, |
|---|
| 1535 | Â Â Â Â Â Â Â Â logdev =>Â 0x0b, |
|---|
| 1536 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1537 |     }, { |
|---|
| 1538 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83697SF/UF/UG Super IO PWM", |
|---|
| 1539 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1540 | Â Â Â Â Â Â Â Â devid =>Â 0x68, |
|---|
| 1541 | Â Â Â Â Â Â Â Â logdev =>Â 0x0b, |
|---|
| 1542 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1543 |     }, { |
|---|
| 1544 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83627EHF/EF/EHG/EG Super IO Sensors", |
|---|
| 1545 | Â Â Â Â Â Â Â Â driver =>Â "w83627ehf", |
|---|
| 1546 | Â Â Â Â Â Â Â Â # W83627EHF datasheet says 0x886x but 0x8853 was seen, thus the |
|---|
| 1547 | Â Â Â Â Â Â Â Â # broader mask. W83627EHG was seen with ID 0x8863. |
|---|
| 1548 | Â Â Â Â Â Â Â Â devid =>Â 0x8840, |
|---|
| 1549 | Â Â Â Â Â Â Â Â devid_mask =>Â 0xFFC0, |
|---|
| 1550 | Â Â Â Â Â Â Â Â logdev =>Â 0x0b, |
|---|
| 1551 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1552 |     }, { |
|---|
| 1553 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83627DHG Super IO Sensors", |
|---|
| 1554 | Â Â Â Â Â Â Â Â driver =>Â "w83627ehf", |
|---|
| 1555 | Â Â Â Â Â Â Â Â devid =>Â 0xA020, |
|---|
| 1556 | Â Â Â Â Â Â Â Â devid_mask =>Â 0xFFF0, |
|---|
| 1557 | Â Â Â Â Â Â Â Â logdev =>Â 0x0b, |
|---|
| 1558 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1559 |     }, { |
|---|
| 1560 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83667HG Super IO Sensors", |
|---|
| 1561 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1562 | Â Â Â Â Â Â Â Â devid =>Â 0xA510, |
|---|
| 1563 | Â Â Â Â Â Â Â Â devid_mask =>Â 0xFFF0, |
|---|
| 1564 | Â Â Â Â Â Â Â Â logdev =>Â 0x0b, |
|---|
| 1565 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1566 |     }, { |
|---|
| 1567 | Â Â Â Â Â Â Â Â name =>Â "Winbond W83L517D Super IO", |
|---|
| 1568 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1569 | Â Â Â Â Â Â Â Â devid =>Â 0x61, |
|---|
| 1570 |     }, { |
|---|
| 1571 | Â Â Â Â Â Â Â Â name =>Â "Fintek F71805F/FG Super IO Sensors", |
|---|
| 1572 | Â Â Â Â Â Â Â Â driver =>Â "f71805f", |
|---|
| 1573 | Â Â Â Â Â Â Â Â devid =>Â 0x0406, |
|---|
| 1574 | Â Â Â Â Â Â Â Â logdev =>Â 0x04, |
|---|
| 1575 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1576 |     }, { |
|---|
| 1577 | Â Â Â Â Â Â Â Â name =>Â "Fintek F71862FG Super IO Sensors", |
|---|
| 1578 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1579 | Â Â Â Â Â Â Â Â devid =>Â 0x0601, |
|---|
| 1580 | Â Â Â Â Â Â Â Â logdev =>Â 0x04, |
|---|
| 1581 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1582 |     }, { |
|---|
| 1583 | Â Â Â Â Â Â Â Â name =>Â "Fintek F71806FG/F71872FG Super IO Sensors", |
|---|
| 1584 | Â Â Â Â Â Â Â Â driver =>Â "f71805f", |
|---|
| 1585 | Â Â Â Â Â Â Â Â devid =>Â 0x0341, |
|---|
| 1586 | Â Â Â Â Â Â Â Â logdev =>Â 0x04, |
|---|
| 1587 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1588 |     }, { |
|---|
| 1589 | Â Â Â Â Â Â Â Â name =>Â "Fintek F71858DG Super IO Sensors", |
|---|
| 1590 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1591 | Â Â Â Â Â Â Â Â devid =>Â 0x0507, |
|---|
| 1592 | Â Â Â Â Â Â Â Â logdev =>Â 0x02, |
|---|
| 1593 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1594 |     }, { |
|---|
| 1595 | Â Â Â Â Â Â Â Â name =>Â "Fintek F71882FG/F71883FG Super IO Sensors", |
|---|
| 1596 | Â Â Â Â Â Â Â Â driver =>Â "f71882fg", |
|---|
| 1597 | Â Â Â Â Â Â Â Â devid =>Â 0x0541, |
|---|
| 1598 | Â Â Â Â Â Â Â Â logdev =>Â 0x04, |
|---|
| 1599 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1600 |     }, { |
|---|
| 1601 | Â Â Â Â Â Â Â Â name =>Â "Fintek F81216D Super IO", |
|---|
| 1602 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1603 | Â Â Â Â Â Â Â Â devid =>Â 0x0208, |
|---|
| 1604 |     }, { |
|---|
| 1605 | Â Â Â Â Â Â Â Â name =>Â "Fintek F81218D Super IO", |
|---|
| 1606 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1607 | Â Â Â Â Â Â Â Â devid =>Â 0x0206, |
|---|
| 1608 |     }, { |
|---|
| 1609 | Â Â Â Â Â Â Â Â name =>Â "Asus F8000 Super IO", |
|---|
| 1610 | Â Â Â Â Â Â Â Â driver =>Â "f71882fg", |
|---|
| 1611 | Â Â Â Â Â Â Â Â devid =>Â 0x0581, |
|---|
| 1612 | Â Â Â Â Â Â Â Â logdev =>Â 0x04, |
|---|
| 1613 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1614 |     }, { |
|---|
| 1615 | Â Â Â Â Â Â Â Â # Shouldn't be in this family, but seems to be still. |
|---|
| 1616 | Â Â Â Â Â Â Â Â name =>Â "ITE IT8708F Super IO", |
|---|
| 1617 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1618 | Â Â Â Â Â Â Â Â devid =>Â 0x8708, |
|---|
| 1619 |     }, { |
|---|
| 1620 | Â Â Â Â Â Â Â Â # Shouldn't be in this family, but seems to be still. |
|---|
| 1621 | Â Â Â Â Â Â Â Â name =>Â "ITE IT8710F Super IO", |
|---|
| 1622 | Â Â Â Â Â Â Â Â driver =>Â "not-a-sensor", |
|---|
| 1623 | Â Â Â Â Â Â Â Â devid =>Â 0x8710, |
|---|
| 1624 | Â Â Â Â } |
|---|
| 1625 | ); |
|---|
| 1626 | |
|---|
| 1627 | @superio_ids_ite = ( |
|---|
| 1628 | Â Â Â Â { |
|---|
| 1629 | Â Â Â Â Â Â Â Â name =>Â "ITE IT8702F Super IO Fan Sensors", |
|---|
| 1630 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1631 | Â Â Â Â Â Â Â Â devid =>Â 0x8702, |
|---|
| 1632 | Â Â Â Â Â Â Â Â logdev =>Â 0x04, |
|---|
| 1633 | Â Â Â Â Â Â Â Â features =>Â FEAT_FAN, |
|---|
| 1634 |     }, { |
|---|
| 1635 | Â Â Â Â Â Â Â Â name =>Â "ITE IT8705F Super IO Sensors", |
|---|
| 1636 | Â Â Â Â Â Â Â Â driver =>Â "it87", |
|---|
| 1637 | Â Â Â Â Â Â Â Â devid =>Â 0x8705, |
|---|
| 1638 | Â Â Â Â Â Â Â Â logdev =>Â 0x04, |
|---|
| 1639 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1640 |     }, { |
|---|
| 1641 | Â Â Â Â Â Â Â Â name =>Â "ITE IT8712F Super IO Sensors", |
|---|
| 1642 | Â Â Â Â Â Â Â Â driver =>Â "it87", |
|---|
| 1643 | Â Â Â Â Â Â Â Â devid =>Â 0x8712, |
|---|
| 1644 | Â Â Â Â Â Â Â Â logdev =>Â 0x04, |
|---|
| 1645 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1646 |     }, { |
|---|
| 1647 | Â Â Â Â Â Â Â Â name =>Â "ITE IT8716F Super IO Sensors", |
|---|
| 1648 | Â Â Â Â Â Â Â Â driver =>Â "it87", |
|---|
| 1649 | Â Â Â Â Â Â Â Â devid =>Â 0x8716, |
|---|
| 1650 | Â Â Â Â Â Â Â Â logdev =>Â 0x04, |
|---|
| 1651 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1652 |     }, { |
|---|
| 1653 | Â Â Â Â Â Â Â Â name =>Â "ITE IT8718F Super IO Sensors", |
|---|
| 1654 | Â Â Â Â Â Â Â Â driver =>Â "it87", |
|---|
| 1655 | Â Â Â Â Â Â Â Â devid =>Â 0x8718, |
|---|
| 1656 | Â Â Â Â Â Â Â Â logdev =>Â 0x04, |
|---|
| 1657 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1658 |     }, { |
|---|
| 1659 | Â Â Â Â Â Â Â Â name =>Â "ITE IT8720F Super IO Sensors", |
|---|
| 1660 | Â Â Â Â Â Â Â Â driver =>Â "it87", |
|---|
| 1661 | Â Â Â Â Â Â Â Â devid =>Â 0x8720, |
|---|
| 1662 | Â Â Â Â Â Â Â Â logdev =>Â 0x04, |
|---|
| 1663 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1664 |     }, { |
|---|
| 1665 | Â Â Â Â Â Â Â Â name =>Â "ITE IT8726F Super IO Sensors", |
|---|
| 1666 | Â Â Â Â Â Â Â Â driver =>Â "it87", |
|---|
| 1667 | Â Â Â Â Â Â Â Â devid =>Â 0x8726, |
|---|
| 1668 | Â Â Â Â Â Â Â Â logdev =>Â 0x04, |
|---|
| 1669 | Â Â Â Â Â Â Â Â features =>Â FEAT_IN |Â FEAT_FAN |Â FEAT_TEMP, |
|---|
| 1670 | Â Â Â Â } |
|---|
| 1671 | ); |
|---|
| 1672 | |
|---|
| 1673 | # Entries are grouped by family. Each family entry has the following fields: |
|---|
| 1674 | #Â family: The family name |
|---|
| 1675 | #Â guess (optional): Typical logical device address. This lets us do |
|---|
| 1676 | #Â Â Â Â generic probing if we fail to recognize the chip. |
|---|
| 1677 | #Â enter: The password sequence to write to the address register |
|---|
| 1678 | #Â chips: Array of chips |
|---|
| 1679 | # The order of families matters, because we stop as soon as one family |
|---|
| 1680 | # succeeds. So we have to list families with shorter password sequences |
|---|
| 1681 | # first. |
|---|
| 1682 | @superio_ids = ( |
|---|
| 1683 | Â Â Â Â { |
|---|
| 1684 | Â Â Â Â Â Â Â Â family =>Â "National Semiconductor", |
|---|
| 1685 | Â Â Â Â Â Â Â Â enter => |
|---|
| 1686 | Â Â Â Â Â Â Â Â { |
|---|
| 1687 |             0x2e => [], |
|---|
| 1688 |             0x4e => [], |
|---|
| 1689 | Â Â Â Â Â Â Â Â }, |
|---|
| 1690 | Â Â Â Â Â Â Â Â chips =>Â \@superio_ids_natsemi, |
|---|
| 1691 |     }, { |
|---|
| 1692 | Â Â Â Â Â Â Â Â family =>Â "SMSC", |
|---|
| 1693 | Â Â Â Â Â Â Â Â enter => |
|---|
| 1694 | Â Â Â Â Â Â Â Â { |
|---|
| 1695 |             0x2e => [0x55], |
|---|
| 1696 |             0x4e => [0x55], |
|---|
| 1697 | Â Â Â Â Â Â Â Â }, |
|---|
| 1698 | Â Â Â Â Â Â Â Â chips =>Â \@superio_ids_smsc, |
|---|
| 1699 | Â Â Â Â Â Â Â Â ns_detect =>Â \&smsc_ns_detect_superio, |
|---|
| 1700 | Â Â Â Â Â Â Â Â ns_chips =>Â \@superio_ids_smsc_ns, |
|---|
| 1701 |     }, { |
|---|
| 1702 | Â Â Â Â Â Â Â Â family =>Â "VIA/Winbond/Fintek", |
|---|
| 1703 | Â Â Â Â Â Â Â Â guess =>Â 0x290, |
|---|
| 1704 | Â Â Â Â Â Â Â Â enter => |
|---|
| 1705 | Â Â Â Â Â Â Â Â { |
|---|
| 1706 |             0x2e => [0x87, 0x87], |
|---|
| 1707 |             0x4e => [0x87, 0x87], |
|---|
| 1708 | Â Â Â Â Â Â Â Â }, |
|---|
| 1709 | Â Â Â Â Â Â Â Â chips =>Â \@superio_ids_winbond, |
|---|
| 1710 |     }, { |
|---|
| 1711 | Â Â Â Â Â Â Â Â family =>Â "ITE", |
|---|
| 1712 | Â Â Â Â Â Â Â Â guess =>Â 0x290, |
|---|
| 1713 | Â Â Â Â Â Â Â Â enter => |
|---|
| 1714 | Â Â Â Â Â Â Â Â { |
|---|
| 1715 |             0x2e => [0x87, 0x01, 0x55, 0x55], |
|---|
| 1716 |             0x4e => [0x87, 0x01, 0x55, 0xaa], |
|---|
| 1717 | Â Â Â Â Â Â Â Â }, |
|---|
| 1718 | Â Â Â Â Â Â Â Â chips =>Â \@superio_ids_ite, |
|---|
| 1719 | Â Â Â Â } |
|---|
| 1720 | ); |
|---|
| 1721 | |
|---|
| 1722 | # Drivers for bridge, CPU and memory embedded sensors |
|---|
| 1723 | # Each entry must have the following fields: |
|---|
| 1724 | #Â name: The device name |
|---|
| 1725 | #Â driver: The driver name. Put "to-be-written" if no driver is available. |
|---|
| 1726 | #Â detect: Detection callback function. No parameter will be passed to |
|---|
| 1727 | #Â Â Â Â this function, it must use global lists of PCI devices, CPU, |
|---|
| 1728 | #Â Â Â Â etc. It must return a confidence value, undef if no supported |
|---|
| 1729 | #Â Â Â Â CPU is found. |
|---|
| 1730 | use vars qw(@cpu_ids); |
|---|
| 1731 | |
|---|
| 1732 | @cpu_ids = ( |
|---|
| 1733 | Â Â Â Â { |
|---|
| 1734 | Â Â Â Â Â Â Â Â name =>Â "Silicon Integrated Systems SIS5595", |
|---|
| 1735 | Â Â Â Â Â Â Â Â driver =>Â "sis5595", |
|---|
| 1736 | Â Â Â Â Â Â Â Â detect =>Â \&sis5595_pci_detect, |
|---|
| 1737 |     }, { |
|---|
| 1738 | Â Â Â Â Â Â Â Â name =>Â "VIA VT82C686 Integrated Sensors", |
|---|
| 1739 | Â Â Â Â Â Â Â Â driver =>Â "via686a", |
|---|
| 1740 | Â Â Â Â Â Â Â Â detect =>Â \&via686a_pci_detect, |
|---|
| 1741 |     }, { |
|---|
| 1742 | Â Â Â Â Â Â Â Â name =>Â "VIA VT8231 Integrated Sensors", |
|---|
| 1743 | Â Â Â Â Â Â Â Â driver =>Â "vt8231", |
|---|
| 1744 | Â Â Â Â Â Â Â Â detect =>Â \&via8231_pci_detect, |
|---|
| 1745 |     }, { |
|---|
| 1746 | Â Â Â Â Â Â Â Â name =>Â "AMD K8 thermal sensors", |
|---|
| 1747 | Â Â Â Â Â Â Â Â driver =>Â "k8temp", |
|---|
| 1748 | Â Â Â Â Â Â Â Â detect =>Â \&k8temp_pci_detect, |
|---|
| 1749 |     }, { |
|---|
| 1750 | Â Â Â Â Â Â Â Â name =>Â "AMD K10 thermal sensors", |
|---|
| 1751 | Â Â Â Â Â Â Â Â driver =>Â "to-be-written", |
|---|
| 1752 | Â Â Â Â Â Â Â Â detect =>Â \&k10temp_pci_detect, |
|---|
| 1753 |     }, { |
|---|
| 1754 | Â Â Â Â Â Â Â Â name =>Â "Intel Core family thermal sensor", |
|---|
| 1755 | Â Â Â Â Â Â Â Â driver =>Â "coretemp", |
|---|
| 1756 | Â Â Â Â Â Â Â Â detect =>Â \&coretemp_detect, |
|---|
| 1757 |     }, { |
|---|
| 1758 | Â Â Â Â Â Â Â Â name =>Â "Intel AMB FB-DIMM thermal sensor", |
|---|
| 1759 | Â Â Â Â Â Â Â Â driver =>Â "i5k_amb", |
|---|
| 1760 | Â Â Â Â Â Â Â Â detect =>Â \&intel_amb_detect, |
|---|
| 1761 |     }, { |
|---|
| 1762 | Â Â Â Â Â Â Â Â name =>Â "VIA C7 thermal and voltage sensors", |
|---|
| 1763 | Â Â Â Â Â Â Â Â driver =>Â "c7temp", |
|---|
| 1764 | Â Â Â Â Â Â Â Â detect =>Â \&c7temp_detect, |
|---|
| 1765 | Â Â Â Â } |
|---|
| 1766 | ); |
|---|
| 1767 | |
|---|
| 1768 | ####################### |
|---|
| 1769 | # AUXILIARY FUNCTIONS # |
|---|
| 1770 | ####################### |
|---|
| 1771 | |
|---|
| 1772 | # $_[0] is the sought value |
|---|
| 1773 | # $_[1..] is the list to seek in |
|---|
| 1774 | # Returns: 1 if found, 0 if not. |
|---|
| 1775 | sub contains |
|---|
| 1776 | { |
|---|
| 1777 |     my $sought = shift; |
|---|
| 1778 |     local $_; |
|---|
| 1779 | |
|---|
| 1780 |     foreach (@_) { |
|---|
| 1781 |         return 1 if $sought eq $_; |
|---|
| 1782 | Â Â Â Â } |
|---|
| 1783 |     return 0; |
|---|
| 1784 | } |
|---|
| 1785 | |
|---|
| 1786 | # Address can be decimal or hexadecimal |
|---|
| 1787 | sub valid_address |
|---|
| 1788 | { |
|---|
| 1789 |     my $value = shift; |
|---|
| 1790 | |
|---|
| 1791 |     if ($value !~ m/^(0x[0-9a-f]+|[0-9]+)$/i) { |
|---|
| 1792 |         print "$value is not a valid address, sorry.\n"; |
|---|
| 1793 |         exit -1; |
|---|
| 1794 | Â Â Â Â } |
|---|
| 1795 |     $value = oct($value) if $value =~ m/^0x/i; |
|---|
| 1796 | |
|---|
| 1797 |     return $value; |
|---|
| 1798 | } |
|---|
| 1799 | |
|---|
| 1800 | sub parse_not_to_scan |
|---|
| 1801 | { |
|---|
| 1802 |     my ($min, $max, $to_parse) = @_; |
|---|
| 1803 |     my @ranges = split /\s*, \s*/, $to_parse; |
|---|
| 1804 |     my @res; |
|---|
| 1805 |     my $range; |
|---|
| 1806 | |
|---|
| 1807 |     foreach $range (@ranges) { |
|---|
| 1808 |         my ($start, $end) = split /\s*-\s*/, $range; |
|---|
| 1809 |         $start = valid_address($start); |
|---|
| 1810 |         if (defined $end) { |
|---|
| 1811 |             $end = valid_address($end); |
|---|
| 1812 |             if ($end <= $start) { |
|---|
| 1813 |                 print "$start-$end is not a valid range, sorry.\n"; |
|---|
| 1814 |                 exit -1; |
|---|
| 1815 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 1816 |             $start = $min if $start < $min; |
|---|
| 1817 |             $end = $max if $end > $max; |
|---|
| 1818 |             push @res, ($start..$end); |
|---|
| 1819 |         } else { |
|---|
| 1820 |             push @res, $start if $start >= $min and $start <= $max; |
|---|
| 1821 | Â Â Â Â Â Â Â Â } |
|---|
| 1822 | Â Â Â Â } |
|---|
| 1823 | |
|---|
| 1824 |     return sort { $a <=> $b } @res; |
|---|
| 1825 | } |
|---|
| 1826 | |
|---|
| 1827 | # $_[0]: Reference to list 1 |
|---|
| 1828 | # $_[1]: Reference to list 2 |
|---|
| 1829 | # Result: 0 if they have no elements in common, 1 if they have |
|---|
| 1830 | # Elements must be numeric. |
|---|
| 1831 | sub any_list_match |
|---|
| 1832 | { |
|---|
| 1833 |     my ($list1, $list2) = @_; |
|---|
| 1834 |     my ($el1, $el2); |
|---|
| 1835 | |
|---|
| 1836 |     foreach $el1 (@$list1) { |
|---|
| 1837 |         foreach $el2 (@$list2) { |
|---|
| 1838 |             return 1 if $el1 == $el2; |
|---|
| 1839 | Â Â Â Â Â Â Â Â } |
|---|
| 1840 | Â Â Â Â } |
|---|
| 1841 |     return 0; |
|---|
| 1842 | } |
|---|
| 1843 | |
|---|
| 1844 | ################### |
|---|
| 1845 | # I/O PORT ACCESS # |
|---|
| 1846 | ################### |
|---|
| 1847 | |
|---|
| 1848 | sub initialize_ioports |
|---|
| 1849 | { |
|---|
| 1850 |     sysopen(IOPORTS, "/dev/port", O_RDWR) |
|---|
| 1851 |         or die "/dev/port: $!\n"; |
|---|
| 1852 | Â Â Â Â binmode(IOPORTS); |
|---|
| 1853 | } |
|---|
| 1854 | |
|---|
| 1855 | sub close_ioports |
|---|
| 1856 | { |
|---|
| 1857 | Â Â Â Â close(IOPORTS); |
|---|
| 1858 | } |
|---|
| 1859 | |
|---|
| 1860 | # $_[0]: port to read |
|---|
| 1861 | # Returns: -1 on failure, read value on success. |
|---|
| 1862 | sub inb |
|---|
| 1863 | { |
|---|
| 1864 |     my ($res, $nrchars); |
|---|
| 1865 |     sysseek(IOPORTS, $_[0], 0) or return -1; |
|---|
| 1866 |     $nrchars = sysread(IOPORTS, $res, 1); |
|---|
| 1867 |     return -1 if not defined $nrchars or $nrchars != 1; |
|---|
| 1868 |     $res = unpack("C", $res); |
|---|
| 1869 |     return $res; |
|---|
| 1870 | } |
|---|
| 1871 | |
|---|
| 1872 | # $_[0]: port to write |
|---|
| 1873 | # $_[1]: value to write |
|---|
| 1874 | # We assume this can't fail. |
|---|
| 1875 | sub outb |
|---|
| 1876 | { |
|---|
| 1877 |     sysseek(IOPORTS, $_[0], 0); |
|---|
| 1878 |     syswrite(IOPORTS, pack("C", $_[1]), 1); |
|---|
| 1879 | } |
|---|
| 1880 | |
|---|
| 1881 | # $_[0]: Address register |
|---|
| 1882 | # $_[1]: Data register |
|---|
| 1883 | # $_[2]: Register to read |
|---|
| 1884 | # Returns: read value |
|---|
| 1885 | sub isa_read_byte |
|---|
| 1886 | { |
|---|
| 1887 |     outb($_[0], $_[2]); |
|---|
| 1888 |     return inb($_[1]); |
|---|
| 1889 | } |
|---|
| 1890 | |
|---|
| 1891 | # $_[0]: Base address |
|---|
| 1892 | # $_[1]: Register to read |
|---|
| 1893 | # Returns: read value |
|---|
| 1894 | # This one can be used for any ISA chip with index register at |
|---|
| 1895 | # offset 5 and data register at offset 6. |
|---|
| 1896 | sub isa_read_i5d6 |
|---|
| 1897 | { |
|---|
| 1898 |     my ($addr, $reg) = @_; |
|---|
| 1899 |     return isa_read_byte($addr + 5, $addr + 6, $reg); |
|---|
| 1900 | } |
|---|
| 1901 | |
|---|
| 1902 | ################# |
|---|
| 1903 | # AUTODETECTION # |
|---|
| 1904 | ################# |
|---|
| 1905 | |
|---|
| 1906 | use vars qw($dev_i2c $sysfs_root); |
|---|
| 1907 | |
|---|
| 1908 | sub initialize_conf |
|---|
| 1909 | { |
|---|
| 1910 |     my $use_devfs = 0; |
|---|
| 1911 |     open(local *INPUTFILE, "/proc/mounts") or die "Can't access /proc/mounts!"; |
|---|
| 1912 |     local $_; |
|---|
| 1913 |     while (<INPUTFILE>) { |
|---|
| 1914 |         if (m@^\w+ /dev devfs @) { |
|---|
| 1915 |             $use_devfs = 1; |
|---|
| 1916 |             $dev_i2c = '/dev/i2c/'; |
|---|
| 1917 | Â Â Â Â Â Â Â Â } |
|---|
| 1918 |         if (m@^\S+ (/\w+) sysfs @) { |
|---|
| 1919 |             $sysfs_root = $1; |
|---|
| 1920 | Â Â Â Â Â Â Â Â } |
|---|
| 1921 | Â Â Â Â } |
|---|
| 1922 | Â Â Â Â close(INPUTFILE); |
|---|
| 1923 | |
|---|
| 1924 | Â Â Â Â # We need sysfs for many things |
|---|
| 1925 |     if (!defined $sysfs_root) { |
|---|
| 1926 |         print "Sysfs not mounted?\n"; |
|---|
| 1927 |         exit -1; |
|---|
| 1928 | Â Â Â Â } |
|---|
| 1929 | |
|---|
| 1930 |     my $use_udev = 0; |
|---|
| 1931 |     if (open(*INPUTFILE, '/etc/udev/udev.conf')) { |
|---|
| 1932 |         while (<INPUTFILE>) { |
|---|
| 1933 |             next unless m/^\s*udev_db\s*=\s*\"([^"]*)\"/ |
|---|
| 1934 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ||Â m/^\s*udev_db\s*=\s*(\S+)/; |
|---|
| 1935 |             if (-e $1) { |
|---|
| 1936 |                 $use_udev = 1; |
|---|
| 1937 |                 $dev_i2c = '/dev/i2c-'; |
|---|
| 1938 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 1939 | Â Â Â Â Â Â Â Â Â Â Â Â last; |
|---|
| 1940 | Â Â Â Â Â Â Â Â } |
|---|
| 1941 | Â Â Â Â Â Â Â Â close(INPUTFILE); |
|---|
| 1942 | Â Â Â Â Â } |
|---|
| 1943 | |
|---|
| 1944 |     if (!$use_udev) { |
|---|
| 1945 | Â Â Â Â Â Â Â Â # Try some known default udev db locations, just in case |
|---|
| 1946 |         if (-e '/dev/.udev.tdb' || -e '/dev/.udev' |
|---|
| 1947 | Â Â Â Â Â Â Â Â Â ||Â -e '/dev/.udevdb')Â { |
|---|
| 1948 |             $use_udev = 1; |
|---|
| 1949 |             $dev_i2c = '/dev/i2c-'; |
|---|
| 1950 | Â Â Â Â Â Â Â Â } |
|---|
| 1951 | Â Â Â Â } |
|---|
| 1952 | |
|---|
| 1953 |     if (!($use_devfs || $use_udev)) { |
|---|
| 1954 |         if (! -c '/dev/i2c-0' && -x '/sbin/MAKEDEV') { |
|---|
| 1955 | Â Â Â Â Â Â Â Â Â Â Â Â system("/sbin/MAKEDEV i2c"); |
|---|
| 1956 | Â Â Â Â Â Â Â Â } |
|---|
| 1957 |         if (! -c '/dev/i2c-0' && -x '/dev/MAKEDEV') { |
|---|
| 1958 | Â Â Â Â Â Â Â Â Â Â Â Â system("/dev/MAKEDEV i2c"); |
|---|
| 1959 | Â Â Â Â Â Â Â Â } |
|---|
| 1960 |         if (-c '/dev/i2c-0') { |
|---|
| 1961 |             $dev_i2c = '/dev/i2c-'; |
|---|
| 1962 |         } else { # default |
|---|
| 1963 |             print "No i2c device files found.\n"; |
|---|
| 1964 |             exit -1; |
|---|
| 1965 | Â Â Â Â Â Â Â Â } |
|---|
| 1966 | Â Â Â Â } |
|---|
| 1967 | } |
|---|
| 1968 | |
|---|
| 1969 | # [0] -> VERSION |
|---|
| 1970 | # [1] -> PATCHLEVEL |
|---|
| 1971 | # [2] -> SUBLEVEL |
|---|
| 1972 | # [3] -> EXTRAVERSION |
|---|
| 1973 | # |
|---|
| 1974 | use vars qw(@kernel_version $kernel_arch); |
|---|
| 1975 | |
|---|
| 1976 | sub initialize_kernel_version |
|---|
| 1977 | { |
|---|
| 1978 | Â Â Â Â `uname -r`Â =~Â /(\d+)\.(\d+)\.(\d+)(.*)/; |
|---|
| 1979 |     @kernel_version = ($1, $2, $3, $4); |
|---|
| 1980 |     chomp($kernel_arch = `uname -m`); |
|---|
| 1981 | |
|---|
| 1982 | Â Â Â Â # We only support kernels >= 2.6.5 |
|---|
| 1983 |     if (!kernel_version_at_least(2, 6, 5)) { |
|---|
| 1984 |         print "Kernel version is unsupported (too old, >= 2.6.5 needed)\n"; |
|---|
| 1985 |         exit -1; |
|---|
| 1986 | Â Â Â Â } |
|---|
| 1987 | } |
|---|
| 1988 | |
|---|
| 1989 | sub kernel_version_at_least |
|---|
| 1990 | { |
|---|
| 1991 |     my ($vers, $plvl, $slvl) = @_; |
|---|
| 1992 |     return 1 if ($kernel_version[0] > $vers || |
|---|
| 1993 |            ($kernel_version[0] == $vers && |
|---|
| 1994 |            ($kernel_version[1] > $plvl || |
|---|
| 1995 |             ($kernel_version[1] == $plvl && |
|---|
| 1996 | Â Â Â Â Â Â Â Â Â Â Â Â ($kernel_version[2]Â >=Â $slvl))))); |
|---|
| 1997 |     return 0; |
|---|
| 1998 | } |
|---|
| 1999 | |
|---|
| 2000 | # @cpu is a list of reference to hashes, one hash per CPU. |
|---|
| 2001 | # Each entry has the following keys: vendor_id, cpu family, model, |
|---|
| 2002 | # model name and stepping, directly taken from /proc/cpuinfo. |
|---|
| 2003 | use vars qw(@cpu); |
|---|
| 2004 | |
|---|
| 2005 | sub initialize_cpu_list |
|---|
| 2006 | { |
|---|
| 2007 |     local $_; |
|---|
| 2008 |     my $entry; |
|---|
| 2009 | |
|---|
| 2010 |     open(local *INPUTFILE, "/proc/cpuinfo") or die "Can't access /proc/cpuinfo!"; |
|---|
| 2011 |     while (<INPUTFILE>) { |
|---|
| 2012 |         if (m/^processor\s*:\s*(\d+)/) { |
|---|
| 2013 |             push @cpu, $entry if scalar keys(%{$entry}); # Previous entry |
|---|
| 2014 |             $entry = {}; # New entry |
|---|
| 2015 | Â Â Â Â Â Â Â Â Â Â Â Â next; |
|---|
| 2016 | Â Â Â Â Â Â Â Â } |
|---|
| 2017 |         if (m/^(vendor_id|cpu family|model|model name|stepping)\s*:\s*(.+)$/) { |
|---|
| 2018 |             my $k = $1; |
|---|
| 2019 |             my $v = $2; |
|---|
| 2020 |             $v =~ s/\s+/ /g;    # Merge multiple spaces |
|---|
| 2021 |             $v =~ s/ $//;      # Trim trailing space |
|---|
| 2022 | Â Â Â Â Â Â Â Â Â Â Â Â $entry->{$k}Â =Â $v; |
|---|
| 2023 | Â Â Â Â Â Â Â Â Â Â Â Â next; |
|---|
| 2024 | Â Â Â Â Â Â Â Â } |
|---|
| 2025 | Â Â Â Â } |
|---|
| 2026 | Â Â Â Â close(INPUTFILE); |
|---|
| 2027 |     push @cpu, $entry if scalar keys(%{$entry}); # Last entry |
|---|
| 2028 | } |
|---|
| 2029 | |
|---|
| 2030 | # @i2c_adapters is a list of references to hashes, one hash per I2C/SMBus |
|---|
| 2031 | # adapter present on the system. Each entry has the following keys: name |
|---|
| 2032 | # (directly taken from /sys/class/i2c-adapter) and driver. |
|---|
| 2033 | use vars qw(@i2c_adapters); |
|---|
| 2034 | |
|---|
| 2035 | sub initialize_i2c_adapters_list |
|---|
| 2036 | { |
|---|
| 2037 |     my $entry; |
|---|
| 2038 |     local $_; |
|---|
| 2039 | |
|---|
| 2040 |     my $class_dir = "${sysfs_root}/class/i2c-adapter"; |
|---|
| 2041 |     opendir(local *ADAPTERS, $class_dir) or return; |
|---|
| 2042 | |
|---|
| 2043 |     while (defined($_ = readdir(ADAPTERS))) { |
|---|
| 2044 |         next unless m/^i2c-(\d+)$/; |
|---|
| 2045 |         $entry = {}; # New entry |
|---|
| 2046 | Â Â Â Â Â Â Â Â $entry->{name}Â =Â sysfs_device_attribute("${class_dir}/i2c-$1", |
|---|
| 2047 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "name") |
|---|
| 2048 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ||Â sysfs_device_attribute("${class_dir}/i2c-$1/device", |
|---|
| 2049 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "name"); |
|---|
| 2050 |         next if $entry->{name} eq "ISA main adapter"; |
|---|
| 2051 | |
|---|
| 2052 | Â Â Â Â Â Â Â Â # First try to get the I2C adapter driver name from sysfs, |
|---|
| 2053 | Â Â Â Â Â Â Â Â # and if it fails, fall back to searching our list of known |
|---|
| 2054 | Â Â Â Â Â Â Â Â # I2C adapters. |
|---|
| 2055 | Â Â Â Â Â Â Â Â $entry->{driver}Â =Â sysfs_device_driver("${class_dir}/i2c-$1/device") |
|---|
| 2056 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ||Â find_i2c_adapter_driver($entry->{name}) |
|---|
| 2057 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ||Â 'UNKNOWN'; |
|---|
| 2058 | Â Â Â Â Â Â Â Â $i2c_adapters[$1]Â =Â $entry; |
|---|
| 2059 | Â Â Â Â } |
|---|
| 2060 | Â Â Â Â closedir(ADAPTERS); |
|---|
| 2061 | } |
|---|
| 2062 | |
|---|
| 2063 | ########### |
|---|
| 2064 | # MODULES # |
|---|
| 2065 | ########### |
|---|
| 2066 | |
|---|
| 2067 | use vars qw(%modules_list %modules_supported @modules_we_loaded); |
|---|
| 2068 | |
|---|
| 2069 | sub initialize_modules_list |
|---|
| 2070 | { |
|---|
| 2071 |     local $_; |
|---|
| 2072 | |
|---|
| 2073 |     open(local *INPUTFILE, "/proc/modules") or return; |
|---|
| 2074 |     while (<INPUTFILE>) { |
|---|
| 2075 | Â Â Â Â Â Â Â Â tr/-/_/;Â # Probably not needed |
|---|
| 2076 |         $modules_list{$1} = 1 if m/^(\S*)/; |
|---|
| 2077 | Â Â Â Â } |
|---|
| 2078 | } |
|---|
| 2079 | |
|---|
| 2080 | sub is_module_loaded |
|---|
| 2081 | { |
|---|
| 2082 |     my $module = shift; |
|---|
| 2083 |     $module =~ tr/-/_/; |
|---|
| 2084 |     return exists $modules_list{$module} |
|---|
| 2085 | } |
|---|
| 2086 | |
|---|
| 2087 | sub load_module |
|---|
| 2088 | { |
|---|
| 2089 |     my $module = shift; |
|---|
| 2090 | |
|---|
| 2091 |     return if is_module_loaded($module); |
|---|
| 2092 | |
|---|
| 2093 |     system("modprobe", $module); |
|---|
| 2094 |     if (($? >> 8) != 0) { |
|---|
| 2095 |         print "Failed to load module $module.\n"; |
|---|
| 2096 |         return -1; |
|---|
| 2097 | Â Â Â Â } |
|---|
| 2098 | |
|---|
| 2099 |     print "Module $module loaded successfully.\n"; |
|---|
| 2100 |     push @modules_we_loaded, $module; |
|---|
| 2101 | |
|---|
| 2102 | Â Â Â Â # Update the list of loaded modules |
|---|
| 2103 |     my $normalized = $module; |
|---|
| 2104 |     $normalized =~ tr/-/_/; |
|---|
| 2105 | Â Â Â Â $modules_list{$normalized}Â =Â 1; |
|---|
| 2106 | } |
|---|
| 2107 | |
|---|
| 2108 | sub loaded_by_us |
|---|
| 2109 | { |
|---|
| 2110 |     my $sought = shift; |
|---|
| 2111 |     local $_; |
|---|
| 2112 | |
|---|
| 2113 |     $sought =~ tr/-/_/; |
|---|
| 2114 |     foreach (@modules_we_loaded) { |
|---|
| 2115 |         my $module = $_; |
|---|
| 2116 |         $module =~ tr/-/_/; |
|---|
| 2117 |         return 1 if $module eq $sought; |
|---|
| 2118 | Â Â Â Â } |
|---|
| 2119 |     return 0; |
|---|
| 2120 | } |
|---|
| 2121 | |
|---|
| 2122 | sub initialize_modules_supported |
|---|
| 2123 | { |
|---|
| 2124 |     foreach my $chip (@chip_ids) { |
|---|
| 2125 |         next if $chip->{driver} eq "to-be-written"; |
|---|
| 2126 |         next if $chip->{driver} eq "use-isa-instead"; |
|---|
| 2127 | |
|---|
| 2128 |         my $normalized = $chip->{driver}; |
|---|
| 2129 |         $normalized =~ tr/-/_/; |
|---|
| 2130 | Â Â Â Â Â Â Â Â $modules_supported{$normalized}++; |
|---|
| 2131 | Â Â Â Â } |
|---|
| 2132 | } |
|---|
| 2133 | |
|---|
| 2134 | sub unload_modules |
|---|
| 2135 | { |
|---|
| 2136 |     return unless @modules_we_loaded; |
|---|
| 2137 | |
|---|
| 2138 | Â Â Â Â # Attempt to unload all kernel drivers we loaded ourselves |
|---|
| 2139 |     while (my $module = pop @modules_we_loaded) { |
|---|
| 2140 |         print "Unloading $module... "; |
|---|
| 2141 | Â Â Â Â Â Â Â Â system("modprobe -r $module 2> /dev/null"); |
|---|
| 2142 |         if (($? >> 8) == 0) { |
|---|
| 2143 |             print "OK\n"; |
|---|
| 2144 |         } else { |
|---|
| 2145 |             print "failed\n"; |
|---|
| 2146 | Â Â Â Â Â Â Â Â } |
|---|
| 2147 | Â Â Â Â } |
|---|
| 2148 |     print "\n"; |
|---|
| 2149 | } |
|---|
| 2150 | |
|---|
| 2151 | ############ |
|---|
| 2152 | # DMI DATA # |
|---|
| 2153 | ############ |
|---|
| 2154 | |
|---|
| 2155 | use vars qw(%dmi); |
|---|
| 2156 | |
|---|
| 2157 | sub initialize_dmi_data |
|---|
| 2158 | { |
|---|
| 2159 |     my %items = ( |
|---|
| 2160 | Â Â Â Â Â Â Â Â # sysfs file name => dmidecode string name |
|---|
| 2161 | Â Â Â Â Â Â Â Â sys_vendor =>Â 'system-manufacturer', |
|---|
| 2162 | Â Â Â Â Â Â Â Â product_name =>Â 'system-product-name', |
|---|
| 2163 | Â Â Â Â Â Â Â Â product_version =>Â 'system-version', |
|---|
| 2164 | Â Â Â Â Â Â Â Â board_vendor =>Â 'baseboard-manufacturer', |
|---|
| 2165 | Â Â Â Â Â Â Â Â board_name =>Â 'baseboard-product-name', |
|---|
| 2166 | Â Â Â Â Â Â Â Â board_version =>Â 'baseboard-product-name', |
|---|
| 2167 | Â Â Â Â Â Â Â Â chassis_type =>Â 'chassis-type', |
|---|
| 2168 | Â Â Â Â ); |
|---|
| 2169 | Â Â Â Â # Many BIOS have broken DMI data, filter it out |
|---|
| 2170 |     my %fake = ( |
|---|
| 2171 | Â Â Â Â Â Â Â Â 'System Manufacturer'Â =>Â 1, |
|---|
| 2172 | Â Â Â Â Â Â Â Â 'System Name'Â =>Â 1, |
|---|
| 2173 | Â Â Â Â ); |
|---|
| 2174 |     my $dmi_id_dir; |
|---|
| 2175 | |
|---|
| 2176 | Â Â Â Â # First try reading the strings from sysfs if available |
|---|
| 2177 |     if (-d ($dmi_id_dir = "$sysfs_root/devices/virtual/dmi/id")   # kernel >= 2.6.28 |
|---|
| 2178 |      || -d ($dmi_id_dir = "$sysfs_root/class/dmi/id")) { |
|---|
| 2179 |         foreach my $k (keys %items) { |
|---|
| 2180 |             $dmi{$k} = sysfs_device_attribute($dmi_id_dir, $k); |
|---|
| 2181 | Â Â Â Â Â Â Â Â } |
|---|
| 2182 |     } else { |
|---|
| 2183 | Â Â Â Â Â Â Â Â # Else fallback on calling dmidecode |
|---|
| 2184 |         my $version; |
|---|
| 2185 |         if (open(local *DMIDECODE, "dmidecode --version 2>/dev/null |")) { |
|---|
| 2186 |             $version = <DMIDECODE>; |
|---|
| 2187 | Â Â Â Â Â Â Â Â Â Â Â Â close(DMIDECODE); |
|---|
| 2188 |             chomp $version if defined $version; |
|---|
| 2189 | Â Â Â Â Â Â Â Â } |
|---|
| 2190 | |
|---|
| 2191 |         if (!defined $version |
|---|
| 2192 |          || !($version =~ m/^(\d+).(\d+)$/) |
|---|
| 2193 | Â Â Â Â Â Â Â Â Â ||Â !(($1Â ==Â 2Â &&Â $2Â >=Â 7)Â ||Â $1Â >Â 2))Â { |
|---|
| 2194 |             print "# DMI data unavailable, please consider installing dmidecode 2.7\n". |
|---|
| 2195 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "# or later for better results.\n"; |
|---|
| 2196 | Â Â Â Â Â Â Â Â Â Â Â Â return; |
|---|
| 2197 | Â Â Â Â Â Â Â Â } |
|---|
| 2198 | |
|---|
| 2199 |         foreach my $k (keys %items) { |
|---|
| 2200 |             next unless open(local *DMIDECODE, |
|---|
| 2201 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "dmidecode -s $items{$k} 2>/dev/null |"); |
|---|
| 2202 | Â Â Â Â Â Â Â Â Â Â Â Â $dmi{$k}Â =Â <DMIDECODE>; |
|---|
| 2203 | Â Â Â Â Â Â Â Â Â Â Â Â close(DMIDECODE); |
|---|
| 2204 | Â Â Â Â Â Â Â Â } |
|---|
| 2205 | Â Â Â Â } |
|---|
| 2206 | |
|---|
| 2207 | Â Â Â Â # Strip trailing white-space, discard empty field |
|---|
| 2208 |     foreach my $k (keys %dmi) { |
|---|
| 2209 |         if (!defined $dmi{$k}) { |
|---|
| 2210 |             delete $dmi{$k}; |
|---|
| 2211 | Â Â Â Â Â Â Â Â Â Â Â Â next; |
|---|
| 2212 | Â Â Â Â Â Â Â Â } |
|---|
| 2213 | Â Â Â Â Â Â Â Â $dmi{$k}Â =~Â s/\s*$//; |
|---|
| 2214 |         delete $dmi{$k} if $dmi{$k} eq '' || exists $fake{$dmi{$k}}; |
|---|
| 2215 | Â Â Â Â } |
|---|
| 2216 | } |
|---|
| 2217 | |
|---|
| 2218 | sub print_dmi_summary |
|---|
| 2219 | { |
|---|
| 2220 |     my ($system, $board); |
|---|
| 2221 |     if (defined $dmi{sys_vendor} && defined $dmi{product_name}) { |
|---|
| 2222 |         $system = "$dmi{sys_vendor} $dmi{product_name}"; |
|---|
| 2223 | Â Â Â Â } |
|---|
| 2224 |     if (defined $dmi{board_vendor} && defined $dmi{board_name}) { |
|---|
| 2225 |         $board = "$dmi{board_vendor} $dmi{board_name}"; |
|---|
| 2226 | Â Â Â Â } |
|---|
| 2227 | Â Â Â Â |
|---|
| 2228 |     if (defined $system) { |
|---|
| 2229 |         print "# System: $system"; |
|---|
| 2230 |         print " (laptop)" if (is_laptop()); |
|---|
| 2231 |         print "\n"; |
|---|
| 2232 | Â Â Â Â } |
|---|
| 2233 |     print "# Board: $board\n" if defined $board |
|---|
| 2234 |                  && (!defined $system || $system ne $board); |
|---|
| 2235 | } |
|---|
| 2236 | |
|---|
| 2237 | sub dmi_match |
|---|
| 2238 | { |
|---|
| 2239 |     my $key = shift; |
|---|
| 2240 |     my $value; |
|---|
| 2241 | |
|---|
| 2242 |     return unless defined $dmi{$key}; |
|---|
| 2243 |     while (defined ($value = shift)) { |
|---|
| 2244 |         return 1 if $dmi{$key} =~ m/\b$value\b/i; |
|---|
| 2245 | Â Â Â Â } |
|---|
| 2246 |     return 0; |
|---|
| 2247 | } |
|---|
| 2248 | |
|---|
| 2249 | sub is_laptop |
|---|
| 2250 | { |
|---|
| 2251 |     return 0 unless $dmi{chassis_type}; |
|---|
| 2252 |     return 1 if $dmi{chassis_type} =~ m/(Laptop|Notebook|Hand Held)/i; |
|---|
| 2253 |     return 1 if $dmi{chassis_type} =~ m/^(9|10|11|14)$/; |
|---|
| 2254 |     return 0; |
|---|
| 2255 | } |
|---|
| 2256 | |
|---|
| 2257 | ################# |
|---|
| 2258 | # SYSFS HELPERS # |
|---|
| 2259 | ################# |
|---|
| 2260 | |
|---|
| 2261 | # From a sysfs device path, return the driver (module) name, or undef |
|---|
| 2262 | sub sysfs_device_driver |
|---|
| 2263 | { |
|---|
| 2264 |     my $device = shift; |
|---|
| 2265 | |
|---|
| 2266 |     my $link = readlink("$device/driver/module"); |
|---|
| 2267 |     return unless defined $link; |
|---|
| 2268 |     return basename($link); |
|---|
| 2269 | } |
|---|
| 2270 | |
|---|
| 2271 | # From a sysfs device path, return the subsystem name, or undef |
|---|
| 2272 | sub sysfs_device_subsystem |
|---|
| 2273 | { |
|---|
| 2274 |     my $device = shift; |
|---|
| 2275 | |
|---|
| 2276 |     my $link = readlink("$device/subsystem"); |
|---|
| 2277 |     return unless defined $link; |
|---|
| 2278 |     return basename($link); |
|---|
| 2279 | } |
|---|
| 2280 | |
|---|
| 2281 | # From a sysfs device path and an attribute name, return the attribute |
|---|
| 2282 | # value, or undef |
|---|
| 2283 | sub sysfs_device_attribute |
|---|
| 2284 | { |
|---|
| 2285 |     my ($device, $attr) = @_; |
|---|
| 2286 |     my $value; |
|---|
| 2287 | |
|---|
| 2288 |     open(local *FILE, "$device/$attr") or return; |
|---|
| 2289 |     $value = <FILE>; |
|---|
| 2290 | Â Â Â Â close(FILE); |
|---|
| 2291 |     return unless defined $value; |
|---|
| 2292 | |
|---|
| 2293 | Â Â Â Â chomp($value); |
|---|
| 2294 |     return $value; |
|---|
| 2295 | } |
|---|
| 2296 | |
|---|
| 2297 | ############## |
|---|
| 2298 | # PCI ACCESS # |
|---|
| 2299 | ############## |
|---|
| 2300 | |
|---|
| 2301 | use vars qw(%pci_list); |
|---|
| 2302 | |
|---|
| 2303 | # This function returns a list of hashes. Each hash has some PCI information: |
|---|
| 2304 | # 'domain', 'bus', 'slot' and 'func' uniquely identify a PCI device in a |
|---|
| 2305 | # computer; 'vendid' and 'devid' uniquely identify a type of device. |
|---|
| 2306 | # 'class' lets us spot unknown SMBus adapters. |
|---|
| 2307 | sub read_sys_dev_pci |
|---|
| 2308 | { |
|---|
| 2309 |     my $devices = shift; |
|---|
| 2310 |     my ($dev, @pci_list); |
|---|
| 2311 | |
|---|
| 2312 |     opendir(local *DEVICES, "$devices") |
|---|
| 2313 |         or die "$devices: $!"; |
|---|
| 2314 | |
|---|
| 2315 |     while (defined($dev = readdir(DEVICES))) { |
|---|
| 2316 |         my %record; |
|---|
| 2317 |         next unless $dev =~ |
|---|
| 2318 | Â Â Â Â Â Â Â Â Â Â Â Â m/^(?:([\da-f]+):)?([\da-f]+):([\da-f]+)\.([\da-f]+)$/; |
|---|
| 2319 | |
|---|
| 2320 |         $record{domain} = hex $1; |
|---|
| 2321 |         $record{bus} = hex $2; |
|---|
| 2322 |         $record{slot} = hex $3; |
|---|
| 2323 |         $record{func} = hex $4; |
|---|
| 2324 | |
|---|
| 2325 |         $record{vendid} = oct sysfs_device_attribute("$devices/$dev", |
|---|
| 2326 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "vendor"); |
|---|
| 2327 |         $record{devid} = oct sysfs_device_attribute("$devices/$dev", |
|---|
| 2328 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "device"); |
|---|
| 2329 |         $record{class} = (oct sysfs_device_attribute("$devices/$dev", |
|---|
| 2330 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "class"))Â >>Â 8; |
|---|
| 2331 | |
|---|
| 2332 |         push @pci_list, \%record; |
|---|
| 2333 | Â Â Â Â } |
|---|
| 2334 | |
|---|
| 2335 |     return \@pci_list; |
|---|
| 2336 | } |
|---|
| 2337 | |
|---|
| 2338 | sub initialize_pci |
|---|
| 2339 | { |
|---|
| 2340 |     my $pci_list; |
|---|
| 2341 |     local $_; |
|---|
| 2342 | |
|---|
| 2343 |     $pci_list = read_sys_dev_pci("$sysfs_root/bus/pci/devices"); |
|---|
| 2344 | |
|---|
| 2345 | Â Â Â Â # Note that we lose duplicate devices at this point, but we don't |
|---|
| 2346 | Â Â Â Â # really care. What matters to us is which unique devices are present, |
|---|
| 2347 | Â Â Â Â # not how many of each. |
|---|
| 2348 |     %pci_list = map { |
|---|
| 2349 |         sprintf("%04x:%04x", $_->{vendid}, $_->{devid}) => $_ |
|---|
| 2350 | Â Â Â Â }Â @{$pci_list}; |
|---|
| 2351 | } |
|---|
| 2352 | |
|---|
| 2353 | ##################### |
|---|
| 2354 | # ADAPTER DETECTION # |
|---|
| 2355 | ##################### |
|---|
| 2356 | |
|---|
| 2357 | # Build and return a PCI device's bus ID |
|---|
| 2358 | sub pci_busid |
|---|
| 2359 | { |
|---|
| 2360 |     my $device = shift; |
|---|
| 2361 |     my $busid; |
|---|
| 2362 | |
|---|
| 2363 |     $busid = sprintf("\%02x:\%02x.\%x", |
|---|
| 2364 |              $device->{bus}, $device->{slot}, $device->{func}); |
|---|
| 2365 |     $busid = sprintf("\%04x:", $device->{domain}) . $busid |
|---|
| 2366 |         if defined $device->{domain}; |
|---|
| 2367 | |
|---|
| 2368 |     return $busid; |
|---|
| 2369 | } |
|---|
| 2370 | |
|---|
| 2371 | sub adapter_pci_detection |
|---|
| 2372 | { |
|---|
| 2373 |     my ($key, $device, $try, %smbus, $count); |
|---|
| 2374 | |
|---|
| 2375 | Â Â Â Â # Build a list of detected SMBus devices |
|---|
| 2376 |     foreach $key (keys %pci_list) { |
|---|
| 2377 |         $device = $pci_list{$key}; |
|---|
| 2378 | Â Â Â Â Â Â Â Â $smbus{$key}++ |
|---|
| 2379 |             if exists $device->{class} && |
|---|
| 2380 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â $device->{class}Â ==Â 0x0c05;Â # SMBus |
|---|
| 2381 | Â Â Â Â } |
|---|
| 2382 | |
|---|
| 2383 | Â Â Â Â # Loop over the known I2C/SMBus adapters |
|---|
| 2384 |     foreach $try (@pci_adapters) { |
|---|
| 2385 |         $key = sprintf("%04x:%04x", $try->{vendid}, $try->{devid}); |
|---|
| 2386 |         next unless exists $pci_list{$key}; |
|---|
| 2387 | |
|---|
| 2388 |         $device = $pci_list{$key}; |
|---|
| 2389 |         if ($try->{driver} eq "to-be-tested") { |
|---|
| 2390 |             print "\nWe are currently looking for testers for this adapter!\n". |
|---|
| 2391 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Please check http://www.lm-sensors.org/wiki/Devices\n". |
|---|
| 2392 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "and/or contact us if you want to help.\n\n". |
|---|
| 2393 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Continue... "; |
|---|
| 2394 | Â Â Â Â Â Â Â Â Â Â Â Â <STDIN>; |
|---|
| 2395 |             print "\n"; |
|---|
| 2396 | Â Â Â Â Â Â Â Â } |
|---|
| 2397 | |
|---|
| 2398 |         if ($try->{driver} =~ m/^to-be-/) { |
|---|
| 2399 |             printf "No known driver for device \%s: \%s\n", |
|---|
| 2400 |                 pci_busid($device), $try->{procid}; |
|---|
| 2401 |         } else { |
|---|
| 2402 |             printf "Using driver `\%s' for device \%s: \%s\n", |
|---|
| 2403 |                 $try->{driver}, pci_busid($device), |
|---|
| 2404 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $try->{procid}; |
|---|
| 2405 | Â Â Â Â Â Â Â Â Â Â Â Â $count++; |
|---|
| 2406 | Â Â Â Â Â Â Â Â Â Â Â Â load_module($try->{driver}); |
|---|
| 2407 | Â Â Â Â Â Â Â Â } |
|---|
| 2408 | |
|---|
| 2409 | Â Â Â Â Â Â Â Â # Delete from detected SMBus device list |
|---|
| 2410 |         delete $smbus{$key}; |
|---|
| 2411 | Â Â Â Â } |
|---|
| 2412 | |
|---|
| 2413 | Â Â Â Â # Now see if there are unknown SMBus devices left |
|---|
| 2414 |     foreach $key (keys %smbus) { |
|---|
| 2415 |         $device = $pci_list{$key}; |
|---|
| 2416 |         printf "Found unknown SMBus adapter \%04x:\%04x at \%s.\n", |
|---|
| 2417 |             $device->{vendid}, $device->{devid}, pci_busid($device); |
|---|
| 2418 | Â Â Â Â } |
|---|
| 2419 | |
|---|
| 2420 |     print "Sorry, no supported PCI bus adapters found.\n" |
|---|
| 2421 |         unless $count; |
|---|
| 2422 | } |
|---|
| 2423 | |
|---|
| 2424 | # $_[0]: Adapter description as found in /sys/class/i2c-adapter |
|---|
| 2425 | sub find_i2c_adapter_driver |
|---|
| 2426 | { |
|---|
| 2427 |     my $name = shift; |
|---|
| 2428 |     my $entry; |
|---|
| 2429 | |
|---|
| 2430 |     foreach $entry (@i2c_adapter_names) { |
|---|
| 2431 |         return $entry->{driver} |
|---|
| 2432 |             if $name =~ $entry->{match}; |
|---|
| 2433 | Â Â Â Â } |
|---|
| 2434 | } |
|---|
| 2435 | |
|---|
| 2436 | ############################# |
|---|
| 2437 | # I2C AND SMBUS /DEV ACCESS # |
|---|
| 2438 | ############################# |
|---|
| 2439 | |
|---|
| 2440 | # This should really go into a separate module/package. |
|---|
| 2441 | |
|---|
| 2442 | # These are copied from <linux/i2c-dev.h> |
|---|
| 2443 | |
|---|
| 2444 | use constant IOCTL_I2C_SLAVE  => 0x0703; |
|---|
| 2445 | use constant IOCTL_I2C_FUNCS  => 0x0705; |
|---|
| 2446 | use constant IOCTL_I2C_SMBUS  => 0x0720; |
|---|
| 2447 | |
|---|
| 2448 | use constant SMBUS_READ     => 1; |
|---|
| 2449 | use constant SMBUS_WRITE    => 0; |
|---|
| 2450 | |
|---|
| 2451 | use constant SMBUS_QUICK    => 0; |
|---|
| 2452 | use constant SMBUS_BYTE     => 1; |
|---|
| 2453 | use constant SMBUS_BYTE_DATA  => 2; |
|---|
| 2454 | use constant SMBUS_WORD_DATA  => 3; |
|---|
| 2455 | |
|---|
| 2456 | use constant I2C_FUNC_SMBUS_QUICK    => 0x00010000; |
|---|
| 2457 | use constant I2C_FUNC_SMBUS_READ_BYTE  => 0x00020000; |
|---|
| 2458 | |
|---|
| 2459 | # Get the i2c adapter's functionalities |
|---|
| 2460 | # $_[0]: Reference to an opened filehandle |
|---|
| 2461 | # Returns: -1 on failure, functionality bitfield on success. |
|---|
| 2462 | sub i2c_get_funcs |
|---|
| 2463 | { |
|---|
| 2464 |     my $file = shift; |
|---|
| 2465 |     my $funcs = pack("L", 0); # Allocate space |
|---|
| 2466 | |
|---|
| 2467 |     ioctl($file, IOCTL_I2C_FUNCS, $funcs) or return -1; |
|---|
| 2468 |     $funcs = unpack("L", $funcs); |
|---|
| 2469 | |
|---|
| 2470 |     return $funcs; |
|---|
| 2471 | } |
|---|
| 2472 | |
|---|
| 2473 | # Select the device to communicate with through its address. |
|---|
| 2474 | # $_[0]: Reference to an opened filehandle |
|---|
| 2475 | # $_[1]: Address to select |
|---|
| 2476 | # Returns: 0 on failure, 1 on success. |
|---|
| 2477 | sub i2c_set_slave_addr |
|---|
| 2478 | { |
|---|
| 2479 |     my ($file, $addr) = @_; |
|---|
| 2480 | |
|---|
| 2481 | Â Â Â Â # Reset register data cache |
|---|
| 2482 |     @i2c_byte_cache = (); |
|---|
| 2483 | |
|---|
| 2484 |     $addr += 0; # Make sure it's a number not a string |
|---|
| 2485 |     ioctl($file, IOCTL_I2C_SLAVE, $addr) or return 0; |
|---|
| 2486 |     return 1; |
|---|
| 2487 | } |
|---|
| 2488 | |
|---|
| 2489 | # i2c_smbus_access is based upon the corresponding C function (see |
|---|
| 2490 | # <linux/i2c-dev.h>). You should not need to call this directly. |
|---|
| 2491 | # $_[0]: Reference to an opened filehandle |
|---|
| 2492 | # $_[1]: SMBUS_READ for reading, SMBUS_WRITE for writing |
|---|
| 2493 | # $_[2]: Command (usually register number) |
|---|
| 2494 | # $_[3]: Transaction kind (SMBUS_BYTE, SMBUS_BYTE_DATA, etc.) |
|---|
| 2495 | # $_[4]: Reference to an array used for input/output of data |
|---|
| 2496 | # Returns: 0 on failure, 1 on success. |
|---|
| 2497 | # Note that we need to get back to Integer boundaries through the 'x2' |
|---|
| 2498 | # in the pack. This is very compiler-dependent; I wish there was some other |
|---|
| 2499 | # way to do this. |
|---|
| 2500 | sub i2c_smbus_access |
|---|
| 2501 | { |
|---|
| 2502 |     my ($file, $read_write, $command, $size, $data) = @_; |
|---|
| 2503 |     my $data_array = pack("C32", @$data); |
|---|
| 2504 |     my $ioctl_data = pack("C2x2Ip", $read_write, $command, $size, |
|---|
| 2505 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $data_array); |
|---|
| 2506 | |
|---|
| 2507 |     ioctl($file, IOCTL_I2C_SMBUS, $ioctl_data) or return 0; |
|---|
| 2508 |     @{$_[4]} = unpack("C32", $data_array); |
|---|
| 2509 |     return 1; |
|---|
| 2510 | } |
|---|
| 2511 | |
|---|
| 2512 | # $_[0]: Reference to an opened filehandle |
|---|
| 2513 | # Returns: -1 on failure, the read byte on success. |
|---|
| 2514 | sub i2c_smbus_read_byte |
|---|
| 2515 | { |
|---|
| 2516 |     my ($file) = @_; |
|---|
| 2517 |     my @data; |
|---|
| 2518 | |
|---|
| 2519 |     i2c_smbus_access($file, SMBUS_READ, 0, SMBUS_BYTE, \@data) |
|---|
| 2520 |         or return -1; |
|---|
| 2521 |     return $data[0]; |
|---|
| 2522 | } |
|---|
| 2523 | |
|---|
| 2524 | # $_[0]: Reference to an opened filehandle |
|---|
| 2525 | # $_[1]: Command byte (usually register number) |
|---|
| 2526 | # Returns: -1 on failure, the read byte on success. |
|---|
| 2527 | # Read byte data values are cached by default. As we keep reading the |
|---|
| 2528 | # same registers over and over again in the detection functions, and |
|---|
| 2529 | # SMBus can be slow, caching results in a big performance boost. |
|---|
| 2530 | sub i2c_smbus_read_byte_data |
|---|
| 2531 | { |
|---|
| 2532 |     my ($file, $command, $nocache) = @_; |
|---|
| 2533 |     my @data; |
|---|
| 2534 | |
|---|
| 2535 |     return $i2c_byte_cache[$command] |
|---|
| 2536 |         if !$nocache && exists $i2c_byte_cache[$command]; |
|---|
| 2537 | |
|---|
| 2538 |     i2c_smbus_access($file, SMBUS_READ, $command, SMBUS_BYTE_DATA, \@data) |
|---|
| 2539 |         or return -1; |
|---|
| 2540 |     return ($i2c_byte_cache[$command] = $data[0]); |
|---|
| 2541 | } |
|---|
| 2542 | |
|---|
| 2543 | # $_[0]: Reference to an opened filehandle |
|---|
| 2544 | # $_[1]: Command byte (usually register number) |
|---|
| 2545 | # Returns: -1 on failure, the read word on success. |
|---|
| 2546 | # Use this function with care, some devices don't like word reads, |
|---|
| 2547 | # so you should do as much of the detection as possible using byte reads, |
|---|
| 2548 | # and only start using word reads when there is a good chance that |
|---|
| 2549 | # the detection will succeed. |
|---|
| 2550 | # Note: some devices use the wrong endianness. |
|---|
| 2551 | sub i2c_smbus_read_word_data |
|---|
| 2552 | { |
|---|
| 2553 |     my ($file, $command) = @_; |
|---|
| 2554 |     my @data; |
|---|
| 2555 |     i2c_smbus_access($file, SMBUS_READ, $command, SMBUS_WORD_DATA, \@data) |
|---|
| 2556 |         or return -1; |
|---|
| 2557 |     return $data[0] + 256 * $data[1]; |
|---|
| 2558 | } |
|---|
| 2559 | |
|---|
| 2560 | # $_[0]: Reference to an opened filehandle |
|---|
| 2561 | # $_[1]: Address |
|---|
| 2562 | # $_[2]: Functionalities of this i2c adapter |
|---|
| 2563 | # Returns: 1 on successful probing, 0 else. |
|---|
| 2564 | # This function is meant to prevent AT24RF08 corruption and write-only |
|---|
| 2565 | # chips locks. This is done by choosing the best probing method depending |
|---|
| 2566 | # on the address range. |
|---|
| 2567 | sub i2c_probe |
|---|
| 2568 | { |
|---|
| 2569 |     my ($file, $addr, $funcs) = @_; |
|---|
| 2570 | |
|---|
| 2571 |     if (($addr >= 0x50 && $addr <= 0x5F) |
|---|
| 2572 |      || ($addr >= 0x30 && $addr <= 0x37)) { |
|---|
| 2573 | Â Â Â Â Â Â Â Â # This covers all EEPROMs we know of, including page protection |
|---|
| 2574 | Â Â Â Â Â Â Â Â # addresses. Note that some page protection addresses will not |
|---|
| 2575 | Â Â Â Â Â Â Â Â # reveal themselves with this, because they ack on write only, |
|---|
| 2576 | Â Â Â Â Â Â Â Â # but this is probably better since some EEPROMs write-protect |
|---|
| 2577 | Â Â Â Â Â Â Â Â # themselves permanently on almost any write to their page |
|---|
| 2578 | Â Â Â Â Â Â Â Â # protection address. |
|---|
| 2579 |         return 0 unless ($funcs & I2C_FUNC_SMBUS_READ_BYTE); |
|---|
| 2580 |         return i2c_smbus_access($file, SMBUS_READ, 0, SMBUS_BYTE, []); |
|---|
| 2581 |     } else { |
|---|
| 2582 |         return 0 unless ($funcs & I2C_FUNC_SMBUS_QUICK); |
|---|
| 2583 |         return i2c_smbus_access($file, SMBUS_WRITE, 0, SMBUS_QUICK, []); |
|---|
| 2584 | Â Â Â Â } |
|---|
| 2585 | } |
|---|
| 2586 | |
|---|
| 2587 | # $_[0]: Reference to an opened file handle |
|---|
| 2588 | # Returns: 1 if the device is safe to access, 0 else. |
|---|
| 2589 | # This function is meant to prevent access to 1-register-only devices, |
|---|
| 2590 | # which are designed to be accessed with SMBus receive byte and SMBus send |
|---|
| 2591 | # byte transactions (i.e. short reads and short writes) and treat SMBus |
|---|
| 2592 | # read byte as a real write followed by a read. The device detection |
|---|
| 2593 | # routines would write random values to the chip with possibly very nasty |
|---|
| 2594 | # results for the hardware. Note that this function won't catch all such |
|---|
| 2595 | # chips, as it assumes that reads and writes relate to the same register, |
|---|
| 2596 | # but that's the best we can do. |
|---|
| 2597 | sub i2c_safety_check |
|---|
| 2598 | { |
|---|
| 2599 |     my ($file) = @_; |
|---|
| 2600 |     my $data; |
|---|
| 2601 | |
|---|
| 2602 | Â Â Â Â # First we receive a byte from the chip, and remember it. |
|---|
| 2603 |     $data = i2c_smbus_read_byte($file); |
|---|
| 2604 |     return 1 if ($data < 0); |
|---|
| 2605 | |
|---|
| 2606 | Â Â Â Â # We receive a byte again; very likely to be the same for |
|---|
| 2607 | Â Â Â Â # 1-register-only devices. |
|---|
| 2608 |     return 1 if (i2c_smbus_read_byte($file) != $data); |
|---|
| 2609 | |
|---|
| 2610 | Â Â Â Â # Then we try a standard byte read, with a register offset equal to |
|---|
| 2611 | Â Â Â Â # the byte we received; we should receive the same byte value in return. |
|---|
| 2612 |     return 1 if (i2c_smbus_read_byte_data($file, $data) != $data); |
|---|
| 2613 | |
|---|
| 2614 | Â Â Â Â # Then we try a standard byte read, with a slightly different register |
|---|
| 2615 | Â Â Â Â # offset; we should again receive the same byte value in return. |
|---|
| 2616 |     return 1 if (i2c_smbus_read_byte_data($file, $data ^ 1) != ($data ^ 1)); |
|---|
| 2617 | |
|---|
| 2618 | Â Â Â Â # Apprently this is a 1-register-only device, restore the original |
|---|
| 2619 | Â Â Â Â # register value and leave it alone. |
|---|
| 2620 |     i2c_smbus_read_byte_data($file, $data); |
|---|
| 2621 |     return 0; |
|---|
| 2622 | } |
|---|
| 2623 | |
|---|
| 2624 | #################### |
|---|
| 2625 | # ADAPTER SCANNING # |
|---|
| 2626 | #################### |
|---|
| 2627 | |
|---|
| 2628 | use vars qw(%chips_detected); |
|---|
| 2629 | |
|---|
| 2630 | # We will build a complicated structure %chips_detected here, being a hash |
|---|
| 2631 | # where keys are driver names and values are detected chip information in |
|---|
| 2632 | # the form of a list of hashes of type 'detect_data'. |
|---|
| 2633 | |
|---|
| 2634 | # Type detect_data: |
|---|
| 2635 | # A hash |
|---|
| 2636 | #Â with field 'i2c_devnr', contianing the /dev/i2c-* number of this |
|---|
| 2637 | #Â Â Â Â adapter (if this is an I2C detection) |
|---|
| 2638 | #Â with field 'i2c_addr', containing the I2C address of the detection; |
|---|
| 2639 | #Â Â Â Â (if this is an I2C detection) |
|---|
| 2640 | #Â with field 'i2c_sub_addrs', containing a reference to a list of |
|---|
| 2641 | #Â Â Â Â other I2C addresses (if this is an I2C detection) |
|---|
| 2642 | #Â with field 'isa_addr' containing the ISA address this chip is on |
|---|
| 2643 | #Â Â Â Â (if this is an ISA detection) |
|---|
| 2644 | #Â with field 'conf', containing the confidence level of this detection |
|---|
| 2645 | #Â with field 'chipname', containing the chip name |
|---|
| 2646 | #Â with optional field 'alias_detect', containing a reference to an alias |
|---|
| 2647 | #Â Â Â Â detection function for this chip |
|---|
| 2648 | |
|---|
| 2649 | # This adds a detection to the above structure. |
|---|
| 2650 | # Not all possibilities of i2c_addr and i2c_sub_addrs are exhausted. |
|---|
| 2651 | # In all normal cases, it should be all right. |
|---|
| 2652 | # $_[0]: chip driver |
|---|
| 2653 | # $_[1]: reference to data hash |
|---|
| 2654 | # Returns: Nothing |
|---|
| 2655 | sub add_i2c_to_chips_detected |
|---|
| 2656 | { |
|---|
| 2657 |     my ($chipdriver, $datahash) = @_; |
|---|
| 2658 |     my ($i, $new_detected_ref, $detected_ref, $detected_entry, |
|---|
| 2659 |       $put_in_detected, @hash_addrs, @entry_addrs); |
|---|
| 2660 | |
|---|
| 2661 | Â Â Â Â # First determine where the hash has to be added. |
|---|
| 2662 | Â Â Â Â $chips_detected{$chipdriver}Â =Â [] |
|---|
| 2663 |         unless exists $chips_detected{$chipdriver}; |
|---|
| 2664 |     $new_detected_ref = $chips_detected{$chipdriver}; |
|---|
| 2665 | |
|---|
| 2666 | Â Â Â Â # Find out whether our new entry should go into the detected list |
|---|
| 2667 | Â Â Â Â # or not. We compare all i2c addresses; if at least one matches, |
|---|
| 2668 | Â Â Â Â # but our confidence value is lower, we assume this is a misdetection, |
|---|
| 2669 | Â Â Â Â # in which case we simply discard our new entry. |
|---|
| 2670 |     @hash_addrs = ($datahash->{i2c_addr}); |
|---|
| 2671 |     push @hash_addrs, @{$datahash->{i2c_sub_addrs}} |
|---|
| 2672 |         if exists $datahash->{i2c_sub_addrs}; |
|---|
| 2673 |     $put_in_detected = 1; |
|---|
| 2674 | Â FIND_LOOP: |
|---|
| 2675 |     foreach $detected_ref (values %chips_detected) { |
|---|
| 2676 |         foreach $detected_entry (@{$detected_ref}) { |
|---|
| 2677 |             next unless defined $detected_entry->{i2c_addr}; |
|---|
| 2678 |             @entry_addrs = ($detected_entry->{i2c_addr}); |
|---|
| 2679 |             push @entry_addrs, @{$detected_entry->{i2c_sub_addrs}} |
|---|
| 2680 |                 if exists $detected_entry->{i2c_sub_addrs}; |
|---|
| 2681 |             if ($detected_entry->{i2c_devnr} == $datahash->{i2c_devnr} && |
|---|
| 2682 |               any_list_match(\@entry_addrs, \@hash_addrs)) { |
|---|
| 2683 |                 if ($detected_entry->{conf} >= $datahash->{conf}) { |
|---|
| 2684 |                     $put_in_detected = 0; |
|---|
| 2685 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 2686 |                 last FIND_LOOP; |
|---|
| 2687 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 2688 | Â Â Â Â Â Â Â Â } |
|---|
| 2689 | Â Â Â Â } |
|---|
| 2690 | |
|---|
| 2691 |     return unless $put_in_detected; |
|---|
| 2692 | |
|---|
| 2693 | Â Â Â Â # Here, we discard all entries which match at least in one main or |
|---|
| 2694 | Â Â Â Â # sub address. This may not be the best idea to do, as it may remove |
|---|
| 2695 | Â Â Â Â # detections without replacing them with second-best ones. Too bad. |
|---|
| 2696 |     foreach $detected_ref (values %chips_detected) { |
|---|
| 2697 |         for ($i = @$detected_ref-1; $i >=0; $i--) { |
|---|
| 2698 |             next unless defined $detected_ref->[$i]->{i2c_addr}; |
|---|
| 2699 |             @entry_addrs = ($detected_ref->[$i]->{i2c_addr}); |
|---|
| 2700 |             push @entry_addrs, @{$detected_ref->[$i]->{i2c_sub_addrs}} |
|---|
| 2701 |                 if exists $detected_ref->[$i]->{i2c_sub_addrs}; |
|---|
| 2702 |             if ($detected_ref->[$i]->{i2c_devnr} == $datahash->{i2c_devnr} && |
|---|
| 2703 |               any_list_match(\@entry_addrs, \@hash_addrs)) { |
|---|
| 2704 |                 splice @$detected_ref, $i, 1; |
|---|
| 2705 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 2706 | Â Â Â Â Â Â Â Â } |
|---|
| 2707 | Â Â Â Â } |
|---|
| 2708 | |
|---|
| 2709 | Â Â Â Â # Now add the new entry to detected |
|---|
| 2710 |     push @$new_detected_ref, $datahash; |
|---|
| 2711 | } |
|---|
| 2712 | |
|---|
| 2713 | # This adds a detection to the above structure. |
|---|
| 2714 | # $_[0]: chip driver |
|---|
| 2715 | # $_[1]: reference to data hash |
|---|
| 2716 | sub add_isa_to_chips_detected |
|---|
| 2717 | { |
|---|
| 2718 |     my ($chipdriver, $datahash) = @_; |
|---|
| 2719 |     my ($i, $new_detected_ref, $detected_ref); |
|---|
| 2720 | |
|---|
| 2721 | Â Â Â Â # First determine where the hash has to be added. |
|---|
| 2722 | Â Â Â Â $chips_detected{$chipdriver}Â =Â [] |
|---|
| 2723 |         unless exists $chips_detected{$chipdriver}; |
|---|
| 2724 |     $new_detected_ref = $chips_detected{$chipdriver}; |
|---|
| 2725 | |
|---|
| 2726 | Â Â Â Â # Find out whether our new entry should go into the detected list |
|---|
| 2727 | Â Â Â Â # or not. We only compare main isa_addr here, of course. |
|---|
| 2728 |     foreach $detected_ref (values %chips_detected) { |
|---|
| 2729 |         for ($i = 0; $i < @{$detected_ref}; $i++) { |
|---|
| 2730 |             if (exists $detected_ref->[$i]->{isa_addr} and |
|---|
| 2731 |               exists $datahash->{isa_addr} and |
|---|
| 2732 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â $detected_ref->[$i]->{isa_addr}Â ==Â $datahash->{isa_addr})Â { |
|---|
| 2733 |                 if ($detected_ref->[$i]->{conf} < $datahash->{conf}) { |
|---|
| 2734 |                     splice @$detected_ref, $i, 1; |
|---|
| 2735 |                     push @$new_detected_ref, $datahash; |
|---|
| 2736 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 2737 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â return; |
|---|
| 2738 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 2739 | Â Â Â Â Â Â Â Â } |
|---|
| 2740 | Â Â Â Â } |
|---|
| 2741 | |
|---|
| 2742 | Â Â Â Â # Not found? OK, put it in the detected list |
|---|
| 2743 |     push @$new_detected_ref, $datahash; |
|---|
| 2744 | } |
|---|
| 2745 | |
|---|
| 2746 | # $_[0]: reference to an array of chips which may be aliases of each other |
|---|
| 2747 | sub find_aliases |
|---|
| 2748 | { |
|---|
| 2749 |     my $detected = shift; |
|---|
| 2750 |     my ($isa, $i2c, $dev, $alias_detect, $is_alias); |
|---|
| 2751 | |
|---|
| 2752 |     for ($isa = 0; $isa < @{$detected}; $isa++) { |
|---|
| 2753 | Â Â Â Â Â Â Â Â # Look for chips with an ISA address but no I2C address |
|---|
| 2754 |         next unless defined $detected->[$isa]; |
|---|
| 2755 |         next unless $detected->[$isa]->{isa_addr}; |
|---|
| 2756 |         next if defined $detected->[$isa]->{i2c_addr}; |
|---|
| 2757 | Â Â Â Â Â Â Â Â # Additionally, the chip must possibly have I2C aliases |
|---|
| 2758 |         next unless defined $detected->[$isa]->{alias_detect}; |
|---|
| 2759 | |
|---|
| 2760 |         for ($i2c = 0; $i2c < @{$detected}; $i2c++) { |
|---|
| 2761 | Â Â Â Â Â Â Â Â Â Â Â Â # Look for chips with an I2C address but no ISA address |
|---|
| 2762 |             next unless defined $detected->[$i2c]; |
|---|
| 2763 |             next unless defined $detected->[$i2c]->{i2c_addr}; |
|---|
| 2764 |             next if $detected->[$i2c]->{isa_addr}; |
|---|
| 2765 | Â Â Â Â Â Â Â Â Â Â Â Â # Additionally, it must have the same chip name |
|---|
| 2766 |             next unless $detected->[$i2c]->{chipname} eq |
|---|
| 2767 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $detected->[$isa]->{chipname}; |
|---|
| 2768 | |
|---|
| 2769 | Â Â Â Â Â Â Â Â Â Â Â Â # We have potential aliases, check if they actually are |
|---|
| 2770 |             $dev = $dev_i2c.$detected->[$i2c]->{i2c_devnr}; |
|---|
| 2771 |             open(local *FILE, $dev) or |
|---|
| 2772 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â print("Can't open $dev\n"), |
|---|
| 2773 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â next; |
|---|
| 2774 | Â Â Â Â Â Â Â Â Â Â Â Â binmode(FILE); |
|---|
| 2775 |             i2c_set_slave_addr(\*FILE, $detected->[$i2c]->{i2c_addr}) or |
|---|
| 2776 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â print("Can't set I2C address for $dev\n"), |
|---|
| 2777 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â next; |
|---|
| 2778 | |
|---|
| 2779 | Â Â Â Â Â Â Â Â Â Â Â Â initialize_ioports(); |
|---|
| 2780 |             $alias_detect = $detected->[$isa]->{alias_detect}; |
|---|
| 2781 |             $is_alias = &$alias_detect($detected->[$isa]->{isa_addr}, |
|---|
| 2782 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \*FILE, |
|---|
| 2783 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $detected->[$i2c]->{i2c_addr}); |
|---|
| 2784 | Â Â Â Â Â Â Â Â Â Â Â Â close(FILE); |
|---|
| 2785 | Â Â Â Â Â Â Â Â Â Â Â Â close_ioports(); |
|---|
| 2786 | |
|---|
| 2787 |             next unless $is_alias; |
|---|
| 2788 | Â Â Â Â Â Â Â Â Â Â Â Â # This is an alias: copy the I2C data into the ISA |
|---|
| 2789 | Â Â Â Â Â Â Â Â Â Â Â Â # entry, then discard the I2C entry |
|---|
| 2790 | Â Â Â Â Â Â Â Â Â Â Â Â $detected->[$isa]->{i2c_devnr}Â =Â $detected->[$i2c]->{i2c_devnr}; |
|---|
| 2791 | Â Â Â Â Â Â Â Â Â Â Â Â $detected->[$isa]->{i2c_addr}Â =Â $detected->[$i2c]->{i2c_addr}; |
|---|
| 2792 | Â Â Â Â Â Â Â Â Â Â Â Â $detected->[$isa]->{i2c_sub_addr}Â =Â $detected->[$i2c]->{i2c_sub_addr}; |
|---|
| 2793 |             undef $detected->[$i2c]; |
|---|
| 2794 | Â Â Â Â Â Â Â Â Â Â Â Â last; |
|---|
| 2795 | Â Â Â Â Â Â Â Â } |
|---|
| 2796 | Â Â Â Â } |
|---|
| 2797 | |
|---|
| 2798 | Â Â Â Â # The loops above may have made the chip list sparse, make it |
|---|
| 2799 | Â Â Â Â # compact again |
|---|
| 2800 |     for ($isa = 0; $isa < @{$detected}; ) { |
|---|
| 2801 |         if (defined($detected->[$isa])) { |
|---|
| 2802 | Â Â Â Â Â Â Â Â Â Â Â Â $isa++; |
|---|
| 2803 |         } else { |
|---|
| 2804 |             splice @{$detected}, $isa, 1; |
|---|
| 2805 | Â Â Â Â Â Â Â Â } |
|---|
| 2806 | Â Â Â Â } |
|---|
| 2807 | } |
|---|
| 2808 | |
|---|
| 2809 | # From the list of known I2C/SMBus devices, build a list of I2C addresses |
|---|
| 2810 | # which are worth probing. There's no point in probing an address for which |
|---|
| 2811 | # we don't know a single device, and probing some addresses has caused |
|---|
| 2812 | # random trouble in the past. |
|---|
| 2813 | sub i2c_addresses_to_scan |
|---|
| 2814 | { |
|---|
| 2815 |     my @used; |
|---|
| 2816 |     my @addresses; |
|---|
| 2817 |     my $addr; |
|---|
| 2818 | |
|---|
| 2819 |     foreach my $chip (@chip_ids) { |
|---|
| 2820 |         next unless defined $chip->{i2c_addrs}; |
|---|
| 2821 |         foreach $addr (@{$chip->{i2c_addrs}}) { |
|---|
| 2822 | Â Â Â Â Â Â Â Â Â Â Â Â $used[$addr]++; |
|---|
| 2823 | Â Â Â Â Â Â Â Â } |
|---|
| 2824 | Â Â Â Â } |
|---|
| 2825 | |
|---|
| 2826 |     for ($addr = 0x03; $addr <= 0x77; $addr++) { |
|---|
| 2827 |         push @addresses, $addr if $used[$addr]; |
|---|
| 2828 | Â Â Â Â } |
|---|
| 2829 |     return \@addresses; |
|---|
| 2830 | } |
|---|
| 2831 | |
|---|
| 2832 | # $_[0]: The number of the adapter to scan |
|---|
| 2833 | # $_[1]: Address |
|---|
| 2834 | sub add_busy_i2c_address |
|---|
| 2835 | { |
|---|
| 2836 |     my ($adapter_nr, $addr) = @_; |
|---|
| 2837 | Â Â Â Â # If the address is busy, we can normally find out which driver |
|---|
| 2838 | Â Â Â Â # requested it (if the kernel is recent enough, at least 2.6.16 and |
|---|
| 2839 | Â Â Â Â # later are known to work), and we assume it is the right one. |
|---|
| 2840 |     my ($device, $driver, $new_hash); |
|---|
| 2841 | |
|---|
| 2842 |     $device = sprintf("$sysfs_root/bus/i2c/devices/\%d-\%04x", |
|---|
| 2843 |              $adapter_nr, $addr); |
|---|
| 2844 |     $driver = sysfs_device_driver($device); |
|---|
| 2845 | |
|---|
| 2846 |     if (!defined($driver)) { |
|---|
| 2847 | Â Â Â Â Â Â Â Â printf("Client at address 0x%02x can not be probed - ". |
|---|
| 2848 |             "unload all client drivers first!\n", $addr); |
|---|
| 2849 | Â Â Â Â Â Â Â Â return; |
|---|
| 2850 | Â Â Â Â } |
|---|
| 2851 | |
|---|
| 2852 |     $new_hash = { |
|---|
| 2853 |         conf => 6, # Arbitrary confidence |
|---|
| 2854 | Â Â Â Â Â Â Â Â i2c_addr =>Â $addr, |
|---|
| 2855 |         chipname => sysfs_device_attribute($device, "name") |
|---|
| 2856 | Â Â Â Â Â Â Â Â Â Â Â Â Â ||Â "unknown", |
|---|
| 2857 | Â Â Â Â Â Â Â Â i2c_devnr =>Â $adapter_nr, |
|---|
| 2858 | Â Â Â Â }; |
|---|
| 2859 | |
|---|
| 2860 |     printf "Client found at address 0x\%02x\n", $addr; |
|---|
| 2861 |     printf "Handled by driver `\%s' (already loaded), chip type `\%s'\n", |
|---|
| 2862 |         $driver, $new_hash->{chipname}; |
|---|
| 2863 | |
|---|
| 2864 | Â Â Â Â # Only add it to the list if this is something we would have detected, |
|---|
| 2865 | Â Â Â Â # else we end up with random i2c chip drivers listed (for example |
|---|
| 2866 | Â Â Â Â # media/video drivers.) |
|---|
| 2867 |     if (exists $modules_supported{$driver}) { |
|---|
| 2868 |         add_i2c_to_chips_detected($driver, $new_hash); |
|---|
| 2869 |     } else { |
|---|
| 2870 |         print "  (note: this is probably NOT a sensor chip!)\n"; |
|---|
| 2871 | Â Â Â Â } |
|---|
| 2872 | } |
|---|
| 2873 | |
|---|
| 2874 | # $_[0]: The number of the adapter to scan |
|---|
| 2875 | # $_[1]: Address |
|---|
| 2876 | # $_[2]: Chip being probed |
|---|
| 2877 | sub probe_free_i2c_address |
|---|
| 2878 | { |
|---|
| 2879 |     my ($adapter_nr, $addr, $chip) = @_; |
|---|
| 2880 |     my ($conf, @other_addr, $new_hash); |
|---|
| 2881 | |
|---|
| 2882 |     printf("\%-60s", sprintf("Probing for `\%s'... ", $chip->{name})); |
|---|
| 2883 |     if (($conf, @other_addr) = &{$chip->{i2c_detect}} (\*FILE, $addr)) { |
|---|
| 2884 |         if ($chip->{driver} eq "not-a-sensor") { |
|---|
| 2885 |             print "Yes\n", |
|---|
| 2886 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Â Â (confidence $conf, not a hardware monitoring chip"; |
|---|
| 2887 |         } else { |
|---|
| 2888 |             print "Success!\n", |
|---|
| 2889 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Â Â (confidence $conf, driver `$chip->{driver}'"; |
|---|
| 2890 | Â Â Â Â Â Â Â Â } |
|---|
| 2891 |         if (@other_addr) { |
|---|
| 2892 |             print ", other addresses:"; |
|---|
| 2893 |             @other_addr = sort @other_addr; |
|---|
| 2894 |             foreach my $other_addr (@other_addr) { |
|---|
| 2895 |                 printf(" 0x%02x", $other_addr); |
|---|
| 2896 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 2897 | Â Â Â Â Â Â Â Â } |
|---|
| 2898 |         print ")\n"; |
|---|
| 2899 | |
|---|
| 2900 |         return if ($chip->{driver} eq "not-a-sensor" |
|---|
| 2901 |             || $chip->{driver} eq "use-isa-instead"); |
|---|
| 2902 | |
|---|
| 2903 |         $new_hash = { |
|---|
| 2904 | Â Â Â Â Â Â Â Â Â Â Â Â conf =>Â $conf, |
|---|
| 2905 | Â Â Â Â Â Â Â Â Â Â Â Â i2c_addr =>Â $addr, |
|---|
| 2906 | Â Â Â Â Â Â Â Â Â Â Â Â chipname =>Â $chip->{name}, |
|---|
| 2907 | Â Â Â Â Â Â Â Â Â Â Â Â i2c_devnr =>Â $adapter_nr, |
|---|
| 2908 | Â Â Â Â Â Â Â Â }; |
|---|
| 2909 |         if (@other_addr) { |
|---|
| 2910 |             my @other_addr_copy = @other_addr; |
|---|
| 2911 | Â Â Â Â Â Â Â Â Â Â Â Â $new_hash->{i2c_sub_addrs}Â =Â \@other_addr_copy; |
|---|
| 2912 | Â Â Â Â Â Â Â Â } |
|---|
| 2913 |         add_i2c_to_chips_detected($chip->{driver}, $new_hash); |
|---|
| 2914 |     } else { |
|---|
| 2915 |         print "No\n"; |
|---|
| 2916 | Â Â Â Â } |
|---|
| 2917 | } |
|---|
| 2918 | |
|---|
| 2919 | # $_[0]: The number of the adapter to check |
|---|
| 2920 | # Returns: PCI class of the adapter if available, 0 if not |
|---|
| 2921 | sub get_i2c_adapter_class |
|---|
| 2922 | { |
|---|
| 2923 |     my ($adapter_nr) = @_; |
|---|
| 2924 |     my ($adapter, $subsystem, $class); |
|---|
| 2925 | |
|---|
| 2926 |     $adapter = "$sysfs_root/class/i2c-adapter/i2c-$adapter_nr"; |
|---|
| 2927 |     $subsystem = sysfs_device_subsystem("$adapter/device"); |
|---|
| 2928 |     return 0 unless defined $subsystem && $subsystem eq "pci"; |
|---|
| 2929 | |
|---|
| 2930 |     $class = sysfs_device_attribute("$adapter/device", "class"); |
|---|
| 2931 |     return 0 unless defined $class; |
|---|
| 2932 |     $class = oct($class) if $class =~ /^0/; |
|---|
| 2933 |     return $class >> 8; |
|---|
| 2934 | } |
|---|
| 2935 | |
|---|
| 2936 | # $_[0]: The number of the adapter to scan |
|---|
| 2937 | sub scan_i2c_adapter |
|---|
| 2938 | { |
|---|
| 2939 |     my ($adapter_nr, $smbus_default) = @_; |
|---|
| 2940 |     my ($funcs, $chip, $addr, $class, $default, $input, @not_to_scan); |
|---|
| 2941 | |
|---|
| 2942 |     $class = get_i2c_adapter_class($adapter_nr); |
|---|
| 2943 |     if (($class & 0xff00) == 0x0400) { |
|---|
| 2944 | Â Â Â Â Â Â Â Â # Do not probe adapters on PCI multimedia cards by default |
|---|
| 2945 |         $default = 0; |
|---|
| 2946 |     } elsif ($class == 0x0c01 || $class == 0x0c05 |
|---|
| 2947 | Â Â Â Â Â Â Â ||Â find_i2c_adapter_driver($i2c_adapters[$adapter_nr]->{name}))Â { |
|---|
| 2948 |         $default = $smbus_default; |
|---|
| 2949 |     } else { |
|---|
| 2950 |         $default = 1; |
|---|
| 2951 | Â Â Â Â } |
|---|
| 2952 | |
|---|
| 2953 |     printf "Next adapter: $i2c_adapters[$adapter_nr]->{name} (i2c-$adapter_nr)\n". |
|---|
| 2954 | Â Â Â Â Â Â Â Â "Do you want to scan it? (\%s/selectively): ", |
|---|
| 2955 |         $default ? "YES/no" : "yes/NO"; |
|---|
| 2956 | |
|---|
| 2957 |     $input = <STDIN>; |
|---|
| 2958 |     if ($input =~ /^\s*n/i |
|---|
| 2959 |      || (!$default && $input !~ /^\s*[ys]/i)) { |
|---|
| 2960 |         print "\n"; |
|---|
| 2961 | Â Â Â Â Â Â Â Â return; |
|---|
| 2962 | Â Â Â Â } |
|---|
| 2963 | |
|---|
| 2964 |     if ($input =~ /^\s*s/i) { |
|---|
| 2965 |         print "Please enter one or more addresses not to scan. Separate them with commas.\n", |
|---|
| 2966 | Â Â Â Â Â Â Â Â Â Â Â "You can specify a range by using dashes. Example: 0x58-0x5f,0x69.\n", |
|---|
| 2967 | Â Â Â Â Â Â Â Â Â Â Â "Addresses: "; |
|---|
| 2968 |         $input = <STDIN>; |
|---|
| 2969 | Â Â Â Â Â Â Â Â chomp($input); |
|---|
| 2970 |         @not_to_scan = parse_not_to_scan(0x03, 0x77, $input); |
|---|
| 2971 | Â Â Â Â } |
|---|
| 2972 | |
|---|
| 2973 |     open(local *FILE, "$dev_i2c$adapter_nr") or |
|---|
| 2974 |         (print "Can't open $dev_i2c$adapter_nr\n"), return; |
|---|
| 2975 | Â Â Â Â binmode(FILE); |
|---|
| 2976 | |
|---|
| 2977 | Â Â Â Â # Can we probe this adapter? |
|---|
| 2978 |     $funcs = i2c_get_funcs(\*FILE); |
|---|
| 2979 |     if ($funcs < 0) { |
|---|
| 2980 |         print "Adapter failed to provide its functionalities, skipping.\n"; |
|---|
| 2981 | Â Â Â Â Â Â Â Â return; |
|---|
| 2982 | Â Â Â Â } |
|---|
| 2983 |     if (!($funcs & (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_READ_BYTE))) { |
|---|
| 2984 |         print "Adapter cannot be probed, skipping.\n"; |
|---|
| 2985 | Â Â Â Â Â Â Â Â return; |
|---|
| 2986 | Â Â Â Â } |
|---|
| 2987 |     if (~$funcs & (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_READ_BYTE)) { |
|---|
| 2988 |         print "Adapter doesn't support all probing functions.\n", |
|---|
| 2989 | Â Â Â Â Â Â Â Â Â Â Â "Some addresses won't be probed.\n"; |
|---|
| 2990 | Â Â Â Â } |
|---|
| 2991 | |
|---|
| 2992 | Â Â Â Â # Now scan each address in turn |
|---|
| 2993 |     foreach $addr (@{$i2c_addresses_to_scan}) { |
|---|
| 2994 | Â Â Â Â Â Â Â Â # As the not_to_scan list is sorted, we can check it fast |
|---|
| 2995 |         shift @not_to_scan # User skipped an address which we didn't intend to probe anyway |
|---|
| 2996 |             while (@not_to_scan and $not_to_scan[0] < $addr); |
|---|
| 2997 |         if (@not_to_scan and $not_to_scan[0] == $addr) { |
|---|
| 2998 |             shift @not_to_scan; |
|---|
| 2999 | Â Â Â Â Â Â Â Â Â Â Â Â next; |
|---|
| 3000 | Â Â Â Â Â Â Â Â } |
|---|
| 3001 | |
|---|
| 3002 |         if (!i2c_set_slave_addr(\*FILE, $addr)) { |
|---|
| 3003 |             add_busy_i2c_address($adapter_nr, $addr); |
|---|
| 3004 | Â Â Â Â Â Â Â Â Â Â Â Â next; |
|---|
| 3005 | Â Â Â Â Â Â Â Â } |
|---|
| 3006 | |
|---|
| 3007 |         next unless i2c_probe(\*FILE, $addr, $funcs); |
|---|
| 3008 |         printf "Client found at address 0x%02x\n", $addr; |
|---|
| 3009 |         if (!i2c_safety_check(\*FILE)) { |
|---|
| 3010 |             print "Seems to be a 1-register-only device, skipping.\n"; |
|---|
| 3011 | Â Â Â Â Â Â Â Â Â Â Â Â next; |
|---|
| 3012 | Â Â Â Â Â Â Â Â } |
|---|
| 3013 | |
|---|
| 3014 | Â Â Â Â Â Â Â Â $|Â =Â 1; |
|---|
| 3015 |         foreach $chip (@chip_ids, @non_hwmon_chip_ids) { |
|---|
| 3016 |             next unless exists $chip->{i2c_addrs} |
|---|
| 3017 |                  && contains($addr, @{$chip->{i2c_addrs}}); |
|---|
| 3018 |             probe_free_i2c_address($adapter_nr, $addr, $chip); |
|---|
| 3019 | Â Â Â Â Â Â Â Â } |
|---|
| 3020 | Â Â Â Â Â Â Â Â $|Â =Â 0; |
|---|
| 3021 | Â Â Â Â } |
|---|
| 3022 |     print "\n"; |
|---|
| 3023 | } |
|---|
| 3024 | |
|---|
| 3025 | sub scan_isa_bus |
|---|
| 3026 | { |
|---|
| 3027 |     my $chip_list_ref = shift; |
|---|
| 3028 |     my ($chip, $addr, $conf); |
|---|
| 3029 | |
|---|
| 3030 | Â Â Â Â $|Â =Â 1; |
|---|
| 3031 |     foreach $chip (@{$chip_list_ref}) { |
|---|
| 3032 |         next if not exists $chip->{isa_addrs} or not exists $chip->{isa_detect}; |
|---|
| 3033 |         foreach $addr (@{$chip->{isa_addrs}}) { |
|---|
| 3034 |             printf("\%-60s", sprintf("Probing for `\%s'\ at 0x\%x... ", |
|---|
| 3035 |                          $chip->{name}, $addr)); |
|---|
| 3036 |             $conf = &{$chip->{isa_detect}} ($addr); |
|---|
| 3037 |             print("No\n"), next if not defined $conf; |
|---|
| 3038 |             print "Success!\n"; |
|---|
| 3039 |             printf "  (confidence %d, driver `%s')\n", $conf, $chip->{driver}; |
|---|
| 3040 |             my $new_hash = { |
|---|
| 3041 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â conf =>Â $conf, |
|---|
| 3042 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â isa_addr =>Â $addr, |
|---|
| 3043 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â chipname =>Â $chip->{name}, |
|---|
| 3044 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â alias_detect =>Â $chip->{alias_detect}, |
|---|
| 3045 | Â Â Â Â Â Â Â Â Â Â Â Â }; |
|---|
| 3046 |             add_isa_to_chips_detected($chip->{driver}, $new_hash); |
|---|
| 3047 | Â Â Â Â Â Â Â Â } |
|---|
| 3048 | Â Â Â Â } |
|---|
| 3049 | Â Â Â Â $|Â =Â 0; |
|---|
| 3050 | } |
|---|
| 3051 | |
|---|
| 3052 | use vars qw(%superio); |
|---|
| 3053 | |
|---|
| 3054 | # The following are taken from the PNP ISA spec (so it's supposed |
|---|
| 3055 | # to be common to all Super I/O chips): |
|---|
| 3056 | #Â devidreg: The device ID register(s) |
|---|
| 3057 | #Â logdevreg: The logical device register |
|---|
| 3058 | #Â actreg: The activation register within the logical device |
|---|
| 3059 | #Â actmask: The activation bit in the activation register |
|---|
| 3060 | #Â basereg: The I/O base register within the logical device |
|---|
| 3061 | %superio = ( |
|---|
| 3062 | Â Â Â Â devidreg =>Â 0x20, |
|---|
| 3063 | Â Â Â Â logdevreg =>Â 0x07, |
|---|
| 3064 | Â Â Â Â actreg =>Â 0x30, |
|---|
| 3065 | Â Â Â Â actmask =>Â 0x01, |
|---|
| 3066 | Â Â Â Â basereg =>Â 0x60, |
|---|
| 3067 | ); |
|---|
| 3068 | |
|---|
| 3069 | sub exit_superio |
|---|
| 3070 | { |
|---|
| 3071 |     my ($addrreg, $datareg) = @_; |
|---|
| 3072 | |
|---|
| 3073 | Â Â Â Â # Some chips (SMSC, Winbond) want this |
|---|
| 3074 |     outb($addrreg, 0xaa); |
|---|
| 3075 | |
|---|
| 3076 | Â Â Â Â # Return to "Wait For Key" state (PNP-ISA spec) |
|---|
| 3077 |     outb($addrreg, 0x02); |
|---|
| 3078 |     outb($datareg, 0x02); |
|---|
| 3079 | } |
|---|
| 3080 | |
|---|
| 3081 | # Guess if an unknown Super-I/O chip has sensors |
|---|
| 3082 | sub guess_superio_ld |
|---|
| 3083 | { |
|---|
| 3084 |     my ($addrreg, $datareg, $typical_addr) = @_; |
|---|
| 3085 |     my ($oldldn, $ldn, $addr); |
|---|
| 3086 | |
|---|
| 3087 | Â Â Â Â # Save logical device number |
|---|
| 3088 |     outb($addrreg, $superio{logdevreg}); |
|---|
| 3089 |     $oldldn = inb($datareg); |
|---|
| 3090 | |
|---|
| 3091 |     for ($ldn = 0; $ldn < 16; $ldn++) { |
|---|
| 3092 | Â Â Â Â Â Â Â Â # Select logical device |
|---|
| 3093 |         outb($addrreg, $superio{logdevreg}); |
|---|
| 3094 |         outb($datareg, $ldn); |
|---|
| 3095 | |
|---|
| 3096 | Â Â Â Â Â Â Â Â # Read base I/O address |
|---|
| 3097 |         outb($addrreg, $superio{basereg}); |
|---|
| 3098 |         $addr = inb($datareg) << 8; |
|---|
| 3099 |         outb($addrreg, $superio{basereg} + 1); |
|---|
| 3100 |         $addr |= inb($datareg); |
|---|
| 3101 |         next unless ($addr & 0xfff8) == $typical_addr; |
|---|
| 3102 | |
|---|
| 3103 |         printf "  (logical device \%X has address 0x\%x, could be sensors)\n", |
|---|
| 3104 |             $ldn, $addr; |
|---|
| 3105 | Â Â Â Â Â Â Â Â last; |
|---|
| 3106 | Â Â Â Â } |
|---|
| 3107 | |
|---|
| 3108 | Â Â Â Â # Be nice, restore original logical device |
|---|
| 3109 |     outb($addrreg, $superio{logdevreg}); |
|---|
| 3110 |     outb($datareg, $oldldn); |
|---|
| 3111 | } |
|---|
| 3112 | |
|---|
| 3113 | # Returns: features bitmask if device added to chips_detected, 0 if not |
|---|
| 3114 | sub probe_superio |
|---|
| 3115 | { |
|---|
| 3116 |     my ($addrreg, $datareg, $chip) = @_; |
|---|
| 3117 |     my ($val, $addr); |
|---|
| 3118 | |
|---|
| 3119 |     printf "\%-60s", "Found `$chip->{name}'"; |
|---|
| 3120 | |
|---|
| 3121 | Â Â Â Â # Does it have hardware monitoring capabilities? |
|---|
| 3122 |     if (!exists $chip->{driver}) { |
|---|
| 3123 |         print "\n  (no information available)\n"; |
|---|
| 3124 |         return 0; |
|---|
| 3125 | Â Â Â Â } |
|---|
| 3126 |     if ($chip->{driver} eq "not-a-sensor") { |
|---|
| 3127 |         print "\n  (no hardware monitoring capabilities)\n"; |
|---|
| 3128 |         return 0; |
|---|
| 3129 | Â Â Â Â } |
|---|
| 3130 |     if ($chip->{driver} eq "via-smbus-only") { |
|---|
| 3131 |         print "\n  (hardware monitoring capabilities accessible via SMBus only)\n"; |
|---|
| 3132 |         return FEAT_SMBUS; |
|---|
| 3133 | Â Â Â Â } |
|---|
| 3134 | |
|---|
| 3135 | Â Â Â Â # Switch to the sensor logical device |
|---|
| 3136 |     outb($addrreg, $superio{logdevreg}); |
|---|
| 3137 |     outb($datareg, $chip->{logdev}); |
|---|
| 3138 | |
|---|
| 3139 | Â Â Â Â # Check the activation register |
|---|
| 3140 |     outb($addrreg, $superio{actreg}); |
|---|
| 3141 |     $val = inb($datareg); |
|---|
| 3142 |     if (!($val & $superio{actmask})) { |
|---|
| 3143 |         print "\n  (but not activated)\n"; |
|---|
| 3144 |         return 0; |
|---|
| 3145 | Â Â Â Â } |
|---|
| 3146 | |
|---|
| 3147 | Â Â Â Â # Get the IO base register |
|---|
| 3148 |     outb($addrreg, $superio{basereg}); |
|---|
| 3149 |     $addr = inb($datareg); |
|---|
| 3150 |     outb($addrreg, $superio{basereg} + 1); |
|---|
| 3151 |     $addr = ($addr << 8) | inb($datareg); |
|---|
| 3152 |     if ($addr == 0) { |
|---|
| 3153 |         print "\n  (but no address specified)\n"; |
|---|
| 3154 |         return 0; |
|---|
| 3155 | Â Â Â Â } |
|---|
| 3156 |     print "Success!\n"; |
|---|
| 3157 |     printf "  (address 0x\%x, driver `%s')\n", $addr, $chip->{driver}; |
|---|
| 3158 |     my $new_hash = { |
|---|
| 3159 | Â Â Â Â Â Â Â Â conf =>Â 9, |
|---|
| 3160 | Â Â Â Â Â Â Â Â isa_addr =>Â $addr, |
|---|
| 3161 | Â Â Â Â Â Â Â Â chipname =>Â $chip->{name} |
|---|
| 3162 | Â Â Â Â }; |
|---|
| 3163 |     add_isa_to_chips_detected($chip->{driver}, $new_hash); |
|---|
| 3164 |     return $chip->{features}; |
|---|
| 3165 | } |
|---|
| 3166 | |
|---|
| 3167 | # Detection routine for non-standard SMSC Super I/O chips |
|---|
| 3168 | # $_[0]: Super I/O LPC config/index port |
|---|
| 3169 | # $_[1]: Super I/O LPC data port |
|---|
| 3170 | # $_[2]: Reference to array of non-standard chips |
|---|
| 3171 | # Return values: 1 if non-standard chip found, 0 otherwise |
|---|
| 3172 | sub smsc_ns_detect_superio |
|---|
| 3173 | { |
|---|
| 3174 |     my ($addrreg, $datareg, $ns_chips) = @_; |
|---|
| 3175 |     my ($val, $chip); |
|---|
| 3176 | |
|---|
| 3177 | Â Â Â Â # read alternate device ID register |
|---|
| 3178 |     outb($addrreg, 0x0d); |
|---|
| 3179 |     $val = inb($datareg); |
|---|
| 3180 |     return 0 if $val == 0x00 || $val == 0xff; |
|---|
| 3181 | |
|---|
| 3182 |     print "Yes\n"; |
|---|
| 3183 | |
|---|
| 3184 |     foreach $chip (@{$ns_chips}) { |
|---|
| 3185 |         if ($chip->{devid} == $val) { |
|---|
| 3186 |             probe_superio($addrreg, $datareg, $chip); |
|---|
| 3187 |             return 1; |
|---|
| 3188 | Â Â Â Â Â Â Â Â } |
|---|
| 3189 | Â Â Â Â } |
|---|
| 3190 | |
|---|
| 3191 |     printf("Found unknown non-standard chip with ID 0x%02x\n", $val); |
|---|
| 3192 |     return 1; |
|---|
| 3193 | } |
|---|
| 3194 | |
|---|
| 3195 | # Returns: features supported by the device added, if any |
|---|
| 3196 | sub scan_superio |
|---|
| 3197 | { |
|---|
| 3198 |     my ($addrreg, $datareg) = @_; |
|---|
| 3199 |     my ($val, $found); |
|---|
| 3200 |     my $features = 0; |
|---|
| 3201 | |
|---|
| 3202 |     printf("Probing for Super-I/O at 0x\%x/0x\%x\n", $addrreg, $datareg); |
|---|
| 3203 | |
|---|
| 3204 | Â Â Â Â $|Â =Â 1; |
|---|
| 3205 | Â Â Â Â # reset state to avoid false positives |
|---|
| 3206 |     exit_superio($addrreg, $datareg); |
|---|
| 3207 |     foreach my $family (@superio_ids) { |
|---|
| 3208 |         printf("\%-60s", "Trying family `$family->{family}'... "); |
|---|
| 3209 | Â Â Â Â Â Â Â Â # write the password |
|---|
| 3210 |         foreach $val (@{$family->{enter}->{$addrreg}}) { |
|---|
| 3211 |             outb($addrreg, $val); |
|---|
| 3212 | Â Â Â Â Â Â Â Â } |
|---|
| 3213 | Â Â Â Â Â Â Â Â # call the non-standard detection routine first if it exists |
|---|
| 3214 |         if (defined($family->{ns_detect}) && |
|---|
| 3215 |           &{$family->{ns_detect}}($addrreg, $datareg, $family->{ns_chips})) { |
|---|
| 3216 | Â Â Â Â Â Â Â Â Â Â Â Â last; |
|---|
| 3217 | Â Â Â Â Â Â Â Â } |
|---|
| 3218 | |
|---|
| 3219 | Â Â Â Â Â Â Â Â # did it work? |
|---|
| 3220 |         outb($addrreg, $superio{devidreg}); |
|---|
| 3221 |         $val = inb($datareg); |
|---|
| 3222 |         outb($addrreg, $superio{devidreg} + 1); |
|---|
| 3223 |         $val = ($val << 8) | inb($datareg); |
|---|
| 3224 |         if ($val == 0x0000 || $val == 0xffff) { |
|---|
| 3225 |             print "No\n"; |
|---|
| 3226 | Â Â Â Â Â Â Â Â Â Â Â Â next; |
|---|
| 3227 | Â Â Â Â Â Â Â Â } |
|---|
| 3228 |         print "Yes\n"; |
|---|
| 3229 | |
|---|
| 3230 |         $found = 0; |
|---|
| 3231 |         foreach my $chip (@{$family->{chips}}) { |
|---|
| 3232 |             if (($chip->{devid} > 0xff && |
|---|
| 3233 |                ($val & ($chip->{devid_mask} || 0xffff)) == $chip->{devid}) |
|---|
| 3234 |              || ($chip->{devid} <= 0xff && |
|---|
| 3235 |                ($val >> 8) == $chip->{devid})) { |
|---|
| 3236 |                 $features |= probe_superio($addrreg, $datareg, $chip); |
|---|
| 3237 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $found++; |
|---|
| 3238 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 3239 | Â Â Â Â Â Â Â Â } |
|---|
| 3240 | |
|---|
| 3241 |         if (!$found) { |
|---|
| 3242 |             printf("Found unknown chip with ID 0x%04x\n", $val); |
|---|
| 3243 | Â Â Â Â Â Â Â Â Â Â Â Â # Guess if a logical device could correspond to sensors |
|---|
| 3244 |             guess_superio_ld($addrreg, $datareg, $family->{guess}) |
|---|
| 3245 |                 if defined $family->{guess}; |
|---|
| 3246 | Â Â Â Â Â Â Â Â } |
|---|
| 3247 | Â Â Â Â Â Â Â Â last; |
|---|
| 3248 | Â Â Â Â } |
|---|
| 3249 |     exit_superio($addrreg, $datareg); |
|---|
| 3250 | Â Â Â Â $|Â =Â 0; |
|---|
| 3251 |     return $features; |
|---|
| 3252 | } |
|---|
| 3253 | |
|---|
| 3254 | sub scan_cpu |
|---|
| 3255 | { |
|---|
| 3256 |     my $entry = shift; |
|---|
| 3257 |     my $confidence; |
|---|
| 3258 | |
|---|
| 3259 |     printf("\%-60s", "$entry->{name}... "); |
|---|
| 3260 |     if (defined ($confidence = $entry->{detect}())) { |
|---|
| 3261 |         print "Success!\n"; |
|---|
| 3262 |         printf "  (driver `%s')\n", $entry->{driver}; |
|---|
| 3263 |         my $new_hash = { |
|---|
| 3264 | Â Â Â Â Â Â Â Â Â Â Â Â conf =>Â $confidence, |
|---|
| 3265 | Â Â Â Â Â Â Â Â Â Â Â Â chipname =>Â $entry->{name}, |
|---|
| 3266 | Â Â Â Â Â Â Â Â }; |
|---|
| 3267 |         add_isa_to_chips_detected($entry->{driver}, $new_hash); |
|---|
| 3268 |     } else { |
|---|
| 3269 |         print "No\n"; |
|---|
| 3270 | Â Â Â Â } |
|---|
| 3271 | } |
|---|
| 3272 | |
|---|
| 3273 | ################## |
|---|
| 3274 | # CHIP DETECTION # |
|---|
| 3275 | ################## |
|---|
| 3276 | |
|---|
| 3277 | # This routine allows you to dynamically update the chip detection list. |
|---|
| 3278 | # The most common use is to allow for different chip to driver mappings |
|---|
| 3279 | # based on different linux kernels |
|---|
| 3280 | sub chip_special_cases |
|---|
| 3281 | { |
|---|
| 3282 | Â Â Â Â # Some chip to driver mappings depend on the environment |
|---|
| 3283 |     foreach my $chip (@chip_ids) { |
|---|
| 3284 |         if (ref($chip->{driver}) eq 'CODE') { |
|---|
| 3285 | Â Â Â Â Â Â Â Â Â Â Â Â $chip->{driver}Â =Â $chip->{driver}->(); |
|---|
| 3286 | Â Â Â Â Â Â Â Â } |
|---|
| 3287 | Â Â Â Â } |
|---|
| 3288 | |
|---|
| 3289 | Â Â Â Â # Also fill the fake driver name of non-hwmon chips |
|---|
| 3290 |     foreach my $chip (@non_hwmon_chip_ids) { |
|---|
| 3291 | Â Â Â Â Â Â Â Â $chip->{driver}Â =Â "not-a-sensor"; |
|---|
| 3292 | Â Â Â Â } |
|---|
| 3293 | } |
|---|
| 3294 | |
|---|
| 3295 | # Each function returns a confidence value. The higher this value, the more |
|---|
| 3296 | # sure we are about this chip. This may help overrule false positives, |
|---|
| 3297 | # although we also attempt to prevent false positives in the first place. |
|---|
| 3298 | |
|---|
| 3299 | # Each function returns a list. The first element is the confidence value; |
|---|
| 3300 | # Each element after it is an SMBus address. In this way, we can detect |
|---|
| 3301 | # chips with several SMBus addresses. The SMBus address for which the |
|---|
| 3302 | # function was called is never returned. |
|---|
| 3303 | |
|---|
| 3304 | # All I2C detection functions below take at least 2 parameters: |
|---|
| 3305 | # $_[0]: Reference to the file descriptor to access the chip |
|---|
| 3306 | # $_[1]: Address |
|---|
| 3307 | # Some of these functions which can detect more than one type of device, |
|---|
| 3308 | # take a third parameter: |
|---|
| 3309 | # $_[2]: Chip to detect |
|---|
| 3310 | |
|---|
| 3311 | # Registers used: 0x58 |
|---|
| 3312 | sub mtp008_detect |
|---|
| 3313 | { |
|---|
| 3314 |     my ($file, $addr) = @_; |
|---|
| 3315 |     return if i2c_smbus_read_byte_data($file, 0x58) != 0xac; |
|---|
| 3316 |     return 3; |
|---|
| 3317 | } |
|---|
| 3318 | |
|---|
| 3319 | # Chip to detect: 0 = LM78, 2 = LM79 |
|---|
| 3320 | # Registers used: |
|---|
| 3321 | #Â Â 0x40: Configuration |
|---|
| 3322 | #Â Â 0x48: Full I2C Address |
|---|
| 3323 | #Â Â 0x49: Device ID |
|---|
| 3324 | sub lm78_detect |
|---|
| 3325 | { |
|---|
| 3326 |     my ($file, $addr, $chip) = @_; |
|---|
| 3327 |     my $reg; |
|---|
| 3328 | |
|---|
| 3329 |     return unless i2c_smbus_read_byte_data($file, 0x48) == $addr; |
|---|
| 3330 |     return unless (i2c_smbus_read_byte_data($file, 0x40) & 0x80) == 0x00; |
|---|
| 3331 | |
|---|
| 3332 |     $reg = i2c_smbus_read_byte_data($file, 0x49); |
|---|
| 3333 |     return if $chip == 0 && ($reg != 0x00 && $reg != 0x20 && $reg != 0x40); |
|---|
| 3334 |     return if $chip == 2 && ($reg & 0xfe) != 0xc0; |
|---|
| 3335 | |
|---|
| 3336 | Â Â Â Â # Explicitly prevent misdetection of Winbond chips |
|---|
| 3337 |     $reg = i2c_smbus_read_byte_data($file, 0x4f); |
|---|
| 3338 |     return if $reg == 0xa3 || $reg == 0x5c; |
|---|
| 3339 | |
|---|
| 3340 |     return 6; |
|---|
| 3341 | } |
|---|
| 3342 | |
|---|
| 3343 | # Chip to detect: 0 = LM75, 1 = DS75 |
|---|
| 3344 | # Registers used: |
|---|
| 3345 | #Â Â 0x00: Temperature |
|---|
| 3346 | #Â Â 0x01: Configuration |
|---|
| 3347 | #Â Â 0x02: Hysteresis |
|---|
| 3348 | #Â Â 0x03: Overtemperature Shutdown |
|---|
| 3349 | #Â Â 0x04-0x07: No registers |
|---|
| 3350 | # The first detection step is based on the fact that the LM75 has only |
|---|
| 3351 | # four registers, and cycles addresses over 8-byte boundaries. We use the |
|---|
| 3352 | # 0x04-0x07 addresses (unused) to improve the reliability. These are not |
|---|
| 3353 | # real registers and will always return the last returned value. This isn't |
|---|
| 3354 | # documented. |
|---|
| 3355 | # Note that register 0x00 may change, so we can't use the modulo trick on it. |
|---|
| 3356 | # The DS75 is a bit different, it doesn't cycle over 8-byte boundaries, and |
|---|
| 3357 | # all register addresses from 0x04 to 0x0f behave like 0x04-0x07 do for |
|---|
| 3358 | # the LM75. |
|---|
| 3359 | # Not all devices enjoy SMBus read word transactions, so we use read byte |
|---|
| 3360 | # transactions even for the 16-bit registers. The low bits aren't very |
|---|
| 3361 | # useful for detection anyway. |
|---|
| 3362 | sub lm75_detect |
|---|
| 3363 | { |
|---|
| 3364 |     my ($file, $addr, $chip) = @_; |
|---|
| 3365 |     my $i; |
|---|
| 3366 |     my $cur = i2c_smbus_read_byte_data($file, 0x00); |
|---|
| 3367 |     my $conf = i2c_smbus_read_byte_data($file, 0x01); |
|---|
| 3368 | |
|---|
| 3369 |     my $hyst = i2c_smbus_read_byte_data($file, 0x02, NO_CACHE); |
|---|
| 3370 |     my $maxreg = $chip == 1 ? 0x0f : 0x07; |
|---|
| 3371 |     for $i (0x04 .. $maxreg) { |
|---|
| 3372 |         return if i2c_smbus_read_byte_data($file, $i, NO_CACHE) != $hyst; |
|---|
| 3373 | Â Â Â Â } |
|---|
| 3374 | |
|---|
| 3375 |     my $os = i2c_smbus_read_byte_data($file, 0x03, NO_CACHE); |
|---|
| 3376 |     for $i (0x04 .. $maxreg) { |
|---|
| 3377 |         return if i2c_smbus_read_byte_data($file, $i, NO_CACHE) != $os; |
|---|
| 3378 | Â Â Â Â } |
|---|
| 3379 | |
|---|
| 3380 |     if ($chip == 0) { |
|---|
| 3381 |         for ($i = 8; $i <= 248; $i += 40) { |
|---|
| 3382 |             return if i2c_smbus_read_byte_data($file, $i + 0x01) != $conf |
|---|
| 3383 |                 or i2c_smbus_read_byte_data($file, $i + 0x02) != $hyst |
|---|
| 3384 |                 or i2c_smbus_read_byte_data($file, $i + 0x03) != $os; |
|---|
| 3385 | Â Â Â Â Â Â Â Â } |
|---|
| 3386 | Â Â Â Â } |
|---|
| 3387 | |
|---|
| 3388 | Â Â Â Â # All registers hold the same value, obviously a misdetection |
|---|
| 3389 |     return if $conf == $cur and $cur == $hyst and $cur == $os; |
|---|
| 3390 | |
|---|
| 3391 | Â Â Â Â # Unused bits |
|---|
| 3392 |     return if $chip == 0 and ($conf & 0xe0); |
|---|
| 3393 |     return if $chip == 1 and ($conf & 0x80); |
|---|
| 3394 | |
|---|
| 3395 | Â Â Â Â # Most probable value ranges |
|---|
| 3396 |     return 6 if $cur <= 100 and ($hyst >= 10 && $hyst <= 125) |
|---|
| 3397 |         and ($os >= 20 && $os <= 127) and $hyst < $os; |
|---|
| 3398 |     return 3; |
|---|
| 3399 | } |
|---|
| 3400 | |
|---|
| 3401 | # Registers used: |
|---|
| 3402 | #Â Â 0x00: Temperature |
|---|
| 3403 | #Â Â 0x01: Configuration |
|---|
| 3404 | #Â Â 0x02: Hysteresis |
|---|
| 3405 | #Â Â 0x03: Overtemperature Shutdown |
|---|
| 3406 | #Â Â 0x04: Low limit |
|---|
| 3407 | #Â Â 0x05: High limit |
|---|
| 3408 | #Â Â 0x06-0x07: No registers |
|---|
| 3409 | # The first detection step is based on the fact that the LM77 has only |
|---|
| 3410 | # six registers, and cycles addresses over 8-byte boundaries. We use the |
|---|
| 3411 | # 0x06-0x07 addresses (unused) to improve the reliability. These are not |
|---|
| 3412 | # real registers and will always return the last returned value. This isn't |
|---|
| 3413 | # documented. |
|---|
| 3414 | # Note that register 0x00 may change, so we can't use the modulo trick on it. |
|---|
| 3415 | # Not all devices enjoy SMBus read word transactions, so we use read byte |
|---|
| 3416 | # transactions even for the 16-bit registers at first. We only use read word |
|---|
| 3417 | # transactions in the end when we are already almost certain that we have an |
|---|
| 3418 | # LM77 chip. |
|---|
| 3419 | sub lm77_detect |
|---|
| 3420 | { |
|---|
| 3421 |     my ($file, $addr) = @_; |
|---|
| 3422 |     my $i; |
|---|
| 3423 |     my $cur = i2c_smbus_read_byte_data($file, 0x00); |
|---|
| 3424 |     my $conf = i2c_smbus_read_byte_data($file, 0x01); |
|---|
| 3425 |     my $hyst = i2c_smbus_read_byte_data($file, 0x02); |
|---|
| 3426 |     my $os = i2c_smbus_read_byte_data($file, 0x03); |
|---|
| 3427 | |
|---|
| 3428 |     my $low = i2c_smbus_read_byte_data($file, 0x04, NO_CACHE); |
|---|
| 3429 |     return if i2c_smbus_read_byte_data($file, 0x06, NO_CACHE) != $low; |
|---|
| 3430 |     return if i2c_smbus_read_byte_data($file, 0x07, NO_CACHE) != $low; |
|---|
| 3431 | |
|---|
| 3432 |     my $high = i2c_smbus_read_byte_data($file, 0x05, NO_CACHE); |
|---|
| 3433 |     return if i2c_smbus_read_byte_data($file, 0x06, NO_CACHE) != $high; |
|---|
| 3434 |     return if i2c_smbus_read_byte_data($file, 0x07, NO_CACHE) != $high; |
|---|
| 3435 | |
|---|
| 3436 |     for ($i = 8; $i <= 248; $i += 40) { |
|---|
| 3437 |         return if i2c_smbus_read_byte_data($file, $i + 0x01) != $conf; |
|---|
| 3438 |         return if i2c_smbus_read_byte_data($file, $i + 0x02) != $hyst; |
|---|
| 3439 |         return if i2c_smbus_read_byte_data($file, $i + 0x03) != $os; |
|---|
| 3440 |         return if i2c_smbus_read_byte_data($file, $i + 0x04) != $low; |
|---|
| 3441 |         return if i2c_smbus_read_byte_data($file, $i + 0x05) != $high; |
|---|
| 3442 | Â Â Â Â } |
|---|
| 3443 | |
|---|
| 3444 | Â Â Â Â # All registers hold the same value, obviously a misdetection |
|---|
| 3445 |     return if $conf == $cur and $cur == $hyst |
|---|
| 3446 |        and $cur == $os and $cur == $low and $cur == $high; |
|---|
| 3447 | |
|---|
| 3448 | Â Â Â Â # Unused bits |
|---|
| 3449 |     return if ($conf & 0xe0) |
|---|
| 3450 |         or (($cur >> 4) != 0 && ($cur >> 4) != 0xf) |
|---|
| 3451 |         or (($hyst >> 4) != 0 && ($hyst >> 4) != 0xf) |
|---|
| 3452 |         or (($os >> 4) != 0 && ($os >> 4) != 0xf) |
|---|
| 3453 |         or (($low >> 4) != 0 && ($low >> 4) != 0xf) |
|---|
| 3454 |         or (($high >> 4) != 0 && ($high >> 4) != 0xf); |
|---|
| 3455 | |
|---|
| 3456 | Â Â Â Â # Make sure the chip supports SMBus read word transactions |
|---|
| 3457 |     foreach $i (0x00, 0x02, 0x03, 0x04, 0x05) { |
|---|
| 3458 |         return if i2c_smbus_read_word_data($file, $i) < 0; |
|---|
| 3459 | Â Â Â Â } |
|---|
| 3460 | |
|---|
| 3461 |     return 3; |
|---|
| 3462 | } |
|---|
| 3463 | |
|---|
| 3464 | # Chip to detect: 0 = LM92, 1 = LM76, 2 = MAX6633/MAX6634/MAX6635 |
|---|
| 3465 | # Registers used: |
|---|
| 3466 | #Â Â 0x01: Configuration (National Semiconductor only) |
|---|
| 3467 | #Â Â 0x02: Hysteresis |
|---|
| 3468 | #Â Â 0x03: Critical Temp |
|---|
| 3469 | #Â Â 0x04: Low Limit |
|---|
| 3470 | #Â Â 0x05: High Limit |
|---|
| 3471 | #Â Â 0x07: Manufacturer ID (LM92 only) |
|---|
| 3472 | # One detection step is based on the fact that the LM92 and clones have a |
|---|
| 3473 | # limited number of registers, which cycle modulo 16 address values. |
|---|
| 3474 | # Note that register 0x00 may change, so we can't use the modulo trick on it. |
|---|
| 3475 | # Not all devices enjoy SMBus read word transactions, so we use read byte |
|---|
| 3476 | # transactions even for the 16-bit registers at first. We only use read |
|---|
| 3477 | # word transactions in the end when we are already almost certain that we |
|---|
| 3478 | # have an LM92 chip or compatible. |
|---|
| 3479 | sub lm92_detect |
|---|
| 3480 | { |
|---|
| 3481 |     my ($file, $addr, $chip) = @_; |
|---|
| 3482 | |
|---|
| 3483 |     my $conf = i2c_smbus_read_byte_data($file, 0x01); |
|---|
| 3484 |     my $hyst = i2c_smbus_read_byte_data($file, 0x02); |
|---|
| 3485 |     my $crit = i2c_smbus_read_byte_data($file, 0x03); |
|---|
| 3486 |     my $low = i2c_smbus_read_byte_data($file, 0x04); |
|---|
| 3487 |     my $high = i2c_smbus_read_byte_data($file, 0x05); |
|---|
| 3488 | |
|---|
| 3489 |     return if $conf == 0 and $hyst == 0 and $crit == 0 |
|---|
| 3490 |         and $low == 0 and $high == 0; |
|---|
| 3491 | |
|---|
| 3492 | Â Â Â Â # Unused bits |
|---|
| 3493 |     return if ($chip == 0 || $chip == 1) |
|---|
| 3494 |        and ($conf & 0xE0); |
|---|
| 3495 | |
|---|
| 3496 |     for (my $i = 0; $i <= 240; $i += 16) { |
|---|
| 3497 |         return if i2c_smbus_read_byte_data($file, $i + 0x01) != $conf; |
|---|
| 3498 |         return if i2c_smbus_read_byte_data($file, $i + 0x02) != $hyst; |
|---|
| 3499 |         return if i2c_smbus_read_byte_data($file, $i + 0x03) != $crit; |
|---|
| 3500 |         return if i2c_smbus_read_byte_data($file, $i + 0x04) != $low; |
|---|
| 3501 |         return if i2c_smbus_read_byte_data($file, $i + 0x05) != $high; |
|---|
| 3502 | Â Â Â Â } |
|---|
| 3503 | |
|---|
| 3504 |     return if $chip == 0 |
|---|
| 3505 |        and i2c_smbus_read_word_data($file, 0x07) != 0x0180; |
|---|
| 3506 | |
|---|
| 3507 | Â Â Â Â # Make sure the chip supports SMBus read word transactions |
|---|
| 3508 |     $hyst = i2c_smbus_read_word_data($file, 0x02); |
|---|
| 3509 |     return if $hyst < 0; |
|---|
| 3510 |     $crit = i2c_smbus_read_word_data($file, 0x03); |
|---|
| 3511 |     return if $crit < 0; |
|---|
| 3512 |     $low = i2c_smbus_read_word_data($file, 0x04); |
|---|
| 3513 |     return if $low < 0; |
|---|
| 3514 |     $high = i2c_smbus_read_word_data($file, 0x05); |
|---|
| 3515 |     return if $high < 0; |
|---|
| 3516 | |
|---|
| 3517 |     foreach my $temp ($hyst, $crit, $low, $high) { |
|---|
| 3518 |         return if $chip == 2 and ($temp & 0x7F00); |
|---|
| 3519 |         return if $chip != 2 and ($temp & 0x0700); |
|---|
| 3520 | Â Â Â Â } |
|---|
| 3521 | |
|---|
| 3522 |     return ($chip == 0) ? 4 : 2; |
|---|
| 3523 | } |
|---|
| 3524 | |
|---|
| 3525 | # Registers used: |
|---|
| 3526 | #Â Â 0xAA: Temperature |
|---|
| 3527 | #Â Â 0xA1: High limit |
|---|
| 3528 | #Â Â 0xA2: Low limit |
|---|
| 3529 | #Â Â 0xA8: Counter |
|---|
| 3530 | #Â Â 0xA9: Slope |
|---|
| 3531 | #Â Â 0xAC: Configuration |
|---|
| 3532 | # Detection is weak. We check if bit 4 (NVB) is clear, because it is |
|---|
| 3533 | # unlikely to be set (would mean that EEPROM is currently being accessed). |
|---|
| 3534 | # We also check the value of the counter and slope registers, the datasheet |
|---|
| 3535 | # doesn't mention the possible values but the conversion formula together |
|---|
| 3536 | # with experimental evidence suggest possible sanity checks. |
|---|
| 3537 | # Not all devices enjoy SMBus read word transactions, so we do as much as |
|---|
| 3538 | # possible with read byte transactions first, and only use read word |
|---|
| 3539 | # transactions second. |
|---|
| 3540 | sub ds1621_detect |
|---|
| 3541 | { |
|---|
| 3542 |     my ($file, $addr) = @_; |
|---|
| 3543 | |
|---|
| 3544 |     my $conf = i2c_smbus_read_byte_data($file, 0xAC); |
|---|
| 3545 |     return if ($conf & 0x10); |
|---|
| 3546 | |
|---|
| 3547 |     my $counter = i2c_smbus_read_byte_data($file, 0xA8); |
|---|
| 3548 |     my $slope = i2c_smbus_read_byte_data($file, 0xA9); |
|---|
| 3549 |     return if ($slope != 0x10 || $counter > $slope); |
|---|
| 3550 | |
|---|
| 3551 |     my $temp = i2c_smbus_read_word_data($file, 0xAA); |
|---|
| 3552 |     return if $temp < 0 || ($temp & 0x0f00); |
|---|
| 3553 | Â Â Â Â # On the DS1631, the following two checks are too strict in theory, |
|---|
| 3554 | Â Â Â Â # but in practice I very much doubt that anyone will set temperature |
|---|
| 3555 | Â Â Â Â # limits not a multiple of 0.5 degrees C. |
|---|
| 3556 |     my $high = i2c_smbus_read_word_data($file, 0xA1); |
|---|
| 3557 |     return if $high < 0 || ($high & 0x7f00); |
|---|
| 3558 |     my $low = i2c_smbus_read_word_data($file, 0xA2); |
|---|
| 3559 |     return if $low < 0 || ($low & 0x7f00); |
|---|
| 3560 | |
|---|
| 3561 |     return if ($temp == 0 && $high == 0 && $low == 0 && $conf == 0); |
|---|
| 3562 | |
|---|
| 3563 |     return 3; |
|---|
| 3564 | } |
|---|
| 3565 | |
|---|
| 3566 | # Registers used: |
|---|
| 3567 | #Â Â 0x00: Configuration register |
|---|
| 3568 | #Â Â 0x02: Interrupt state register |
|---|
| 3569 | #Â Â 0x2a-0x3d: Limits registers |
|---|
| 3570 | # This one is easily misdetected since it doesn't provide identification |
|---|
| 3571 | # registers. So we have to use some tricks: |
|---|
| 3572 | #Â Â - 6-bit addressing, so limits readings modulo 0x40 should be unchanged |
|---|
| 3573 | #Â Â - positive temperature limits |
|---|
| 3574 | #Â Â - limits order correctness |
|---|
| 3575 | # Hopefully this should limit the rate of false positives, without increasing |
|---|
| 3576 | # the rate of false negatives. |
|---|
| 3577 | # Thanks to Lennard Klein for testing on a non-LM80 chip, which was |
|---|
| 3578 | # previously misdetected, and isn't anymore. For reference, it scored |
|---|
| 3579 | # a final confidence of 0, and changing from strict limit comparisons |
|---|
| 3580 | # to loose comparisons did not change the score. |
|---|
| 3581 | sub lm80_detect |
|---|
| 3582 | { |
|---|
| 3583 |     my ($file, $addr) = @_; |
|---|
| 3584 |     my ($i, $reg); |
|---|
| 3585 | |
|---|
| 3586 |     return if (i2c_smbus_read_byte_data($file, 0x00) & 0x80) != 0; |
|---|
| 3587 |     return if (i2c_smbus_read_byte_data($file, 0x02) & 0xc0) != 0; |
|---|
| 3588 | |
|---|
| 3589 |     for ($i = 0x2a; $i <= 0x3d; $i++) { |
|---|
| 3590 |         $reg = i2c_smbus_read_byte_data($file, $i); |
|---|
| 3591 |         return if i2c_smbus_read_byte_data($file, $i+0x40) != $reg; |
|---|
| 3592 |         return if i2c_smbus_read_byte_data($file, $i+0x80) != $reg; |
|---|
| 3593 |         return if i2c_smbus_read_byte_data($file, $i+0xc0) != $reg; |
|---|
| 3594 | Â Â Â Â } |
|---|
| 3595 | |
|---|
| 3596 | Â Â Â Â # Refine a bit by checking whether limits are in the correct order |
|---|
| 3597 | Â Â Â Â # (min<max for voltages, hyst<max for temperature). Since it is still |
|---|
| 3598 | Â Â Â Â # possible that the chip is an LM80 with limits not properly set, |
|---|
| 3599 | Â Â Â Â # a few "errors" are tolerated. |
|---|
| 3600 |     my $confidence = 0; |
|---|
| 3601 |     for ($i = 0x2a; $i <= 0x3a; $i++) { |
|---|
| 3602 | Â Â Â Â Â Â Â Â $confidence++ |
|---|
| 3603 |             if i2c_smbus_read_byte_data($file, $i) < i2c_smbus_read_byte_data($file, $i+1); |
|---|
| 3604 | Â Â Â Â } |
|---|
| 3605 | Â Â Â Â # hot temp<OS temp |
|---|
| 3606 | Â Â Â Â $confidence++ |
|---|
| 3607 |         if i2c_smbus_read_byte_data($file, 0x38) < i2c_smbus_read_byte_data($file, 0x3a); |
|---|
| 3608 | |
|---|
| 3609 | Â Â Â Â # Negative temperature limits are unlikely. |
|---|
| 3610 |     for ($i = 0x3a; $i <= 0x3d; $i++) { |
|---|
| 3611 |         $confidence++ if (i2c_smbus_read_byte_data($file, $i) & 0x80) == 0; |
|---|
| 3612 | Â Â Â Â } |
|---|
| 3613 | |
|---|
| 3614 | Â Â Â Â # $confidence is between 0 and 14 |
|---|
| 3615 |     $confidence = ($confidence >> 1) - 4; |
|---|
| 3616 | Â Â Â Â # $confidence is now between -4 and 3 |
|---|
| 3617 | |
|---|
| 3618 |     return unless $confidence > 0; |
|---|
| 3619 | |
|---|
| 3620 |     return $confidence; |
|---|
| 3621 | } |
|---|
| 3622 | |
|---|
| 3623 | # Registers used: |
|---|
| 3624 | #Â Â 0x02: Status 1 |
|---|
| 3625 | #Â Â 0x03: Configuration |
|---|
| 3626 | #Â Â 0x04: Company ID of LM84 |
|---|
| 3627 | #Â Â 0x35: Status 2 |
|---|
| 3628 | #Â Â 0xfe: Manufacturer ID |
|---|
| 3629 | #Â Â 0xff: Chip ID / die revision |
|---|
| 3630 | # We can use the LM84 Company ID register because the LM83 and the LM82 are |
|---|
| 3631 | # compatible with the LM84. |
|---|
| 3632 | # The LM83 chip ID is missing from the datasheet and was contributed by |
|---|
| 3633 | # Magnus Forsstrom: 0x03. |
|---|
| 3634 | # At least some revisions of the LM82 seem to be repackaged LM83, so they |
|---|
| 3635 | # have the same chip ID, and temp2/temp4 will be stuck in "OPEN" state. |
|---|
| 3636 | # For this reason, we don't even try to distinguish between both chips. |
|---|
| 3637 | # Thanks to Ben Gardner for reporting. |
|---|
| 3638 | sub lm83_detect |
|---|
| 3639 | { |
|---|
| 3640 |     my ($file, $addr) = @_; |
|---|
| 3641 |     return if i2c_smbus_read_byte_data($file, 0xfe) != 0x01; |
|---|
| 3642 |     my $chipid = i2c_smbus_read_byte_data($file, 0xff); |
|---|
| 3643 |     return if $chipid != 0x01 && $chipid != 0x03; |
|---|
| 3644 | |
|---|
| 3645 |     my $confidence = 4; |
|---|
| 3646 | Â Â Â Â $confidence++ |
|---|
| 3647 |         if (i2c_smbus_read_byte_data($file, 0x02) & 0xa8) == 0x00; |
|---|
| 3648 | Â Â Â Â $confidence++ |
|---|
| 3649 |         if (i2c_smbus_read_byte_data($file, 0x03) & 0x41) == 0x00; |
|---|
| 3650 | Â Â Â Â $confidence++ |
|---|
| 3651 |         if i2c_smbus_read_byte_data($file, 0x04) == 0x00; |
|---|
| 3652 | Â Â Â Â $confidence++ |
|---|
| 3653 |         if (i2c_smbus_read_byte_data($file, 0x35) & 0x48) == 0x00; |
|---|
| 3654 | |
|---|
| 3655 |     return $confidence; |
|---|
| 3656 | } |
|---|
| 3657 | |
|---|
| 3658 | # Chip to detect: 0 = LM90, 1 = LM89/LM99, 2 = LM86, 3 = ADM1032, |
|---|
| 3659 | #Â Â Â Â Â Â Â Â Â 4 = MAX6654/MAX6690, 5 = ADT7461, |
|---|
| 3660 | #Â Â Â Â Â Â Â Â Â 6 = MAX6646/MAX6647/MAX6648/MAX6649/MAX6692, |
|---|
| 3661 | #Â Â Â Â Â Â Â Â Â 7 = MAX6680/MAX6681, 8 = W83L771W/G, 9 = TMP401, 10 = TMP411 |
|---|
| 3662 | # Registers used: |
|---|
| 3663 | #Â Â 0x03: Configuration |
|---|
| 3664 | #Â Â 0x04: Conversion rate |
|---|
| 3665 | #Â Â 0xfe: Manufacturer ID |
|---|
| 3666 | #Â Â 0xff: Chip ID / die revision |
|---|
| 3667 | sub lm90_detect |
|---|
| 3668 | { |
|---|
| 3669 |     my ($file, $addr, $chip) = @_; |
|---|
| 3670 |     my $mid = i2c_smbus_read_byte_data($file, 0xfe); |
|---|
| 3671 |     my $cid = i2c_smbus_read_byte_data($file, 0xff); |
|---|
| 3672 |     my $conf = i2c_smbus_read_byte_data($file, 0x03); |
|---|
| 3673 |     my $rate = i2c_smbus_read_byte_data($file, 0x04); |
|---|
| 3674 | |
|---|
| 3675 |     if ($chip == 0) { |
|---|
| 3676 |         return if ($conf & 0x2a) != 0; |
|---|
| 3677 |         return if $rate > 0x09; |
|---|
| 3678 |         return if $mid != 0x01;     # National Semiconductor |
|---|
| 3679 |         return 8 if $cid == 0x21;    # LM90 |
|---|
| 3680 |         return 6 if ($cid & 0x0f) == 0x20; |
|---|
| 3681 | Â Â Â Â } |
|---|
| 3682 |     if ($chip == 1) { |
|---|
| 3683 |         return if ($conf & 0x2a) != 0; |
|---|
| 3684 |         return if $rate > 0x09; |
|---|
| 3685 |         return if $mid != 0x01;     # National Semiconductor |
|---|
| 3686 |         return 8 if $addr == 0x4c and $cid == 0x31; # LM89/LM99 |
|---|
| 3687 |         return 8 if $addr == 0x4d and $cid == 0x34; # LM89-1/LM99-1 |
|---|
| 3688 |         return 6 if ($cid & 0x0f) == 0x30; |
|---|
| 3689 | Â Â Â Â } |
|---|
| 3690 |     if ($chip == 2) { |
|---|
| 3691 |         return if ($conf & 0x2a) != 0; |
|---|
| 3692 |         return if $rate > 0x09; |
|---|
| 3693 |         return if $mid != 0x01;     # National Semiconductor |
|---|
| 3694 |         return 8 if $cid == 0x11;    # LM86 |
|---|
| 3695 |         return 6 if ($cid & 0xf0) == 0x10; |
|---|
| 3696 | Â Â Â Â } |
|---|
| 3697 |     if ($chip == 3) { |
|---|
| 3698 |         return if ($conf & 0x3f) != 0; |
|---|
| 3699 |         return if $rate > 0x0a; |
|---|
| 3700 |         return if $mid != 0x41;     # Analog Devices |
|---|
| 3701 |         return 6 if ($cid & 0xf0) == 0x40; # ADM1032 |
|---|
| 3702 | Â Â Â Â } |
|---|
| 3703 |     if ($chip == 4) { |
|---|
| 3704 |         return if ($conf & 0x07) != 0; |
|---|
| 3705 |         return if $rate > 0x07; |
|---|
| 3706 |         return if $mid != 0x4d;     # Maxim |
|---|
| 3707 |         return 8 if $cid == 0x08;    # MAX6654/MAX6690 |
|---|
| 3708 | Â Â Â Â } |
|---|
| 3709 |     if ($chip == 5) { |
|---|
| 3710 |         return if ($conf & 0x1b) != 0; |
|---|
| 3711 |         return if $rate > 0x0a; |
|---|
| 3712 |         return if $mid != 0x41;     # Analog Devices |
|---|
| 3713 |         return 8 if $cid == 0x51;    # ADT7461 |
|---|
| 3714 | Â Â Â Â } |
|---|
| 3715 |     if ($chip == 6) { |
|---|
| 3716 |         return if ($conf & 0x3f) != 0; |
|---|
| 3717 |         return if $rate > 0x07; |
|---|
| 3718 |         return if $mid != 0x4d;     # Maxim |
|---|
| 3719 |         return 8 if $cid == 0x59;    # MAX6648/MAX6692 |
|---|
| 3720 | Â Â Â Â } |
|---|
| 3721 |     if ($chip == 7) { |
|---|
| 3722 |         return if ($conf & 0x03) != 0; |
|---|
| 3723 |         return if $rate > 0x07; |
|---|
| 3724 |         return if $mid != 0x4d;     # Maxim |
|---|
| 3725 |         return 8 if $cid == 0x01;    # MAX6680/MAX6681 |
|---|
| 3726 | Â Â Â Â } |
|---|
| 3727 |     if ($chip == 8) { |
|---|
| 3728 |         return if ($conf & 0x2a) != 0; |
|---|
| 3729 |         return if $rate > 0x09; |
|---|
| 3730 |         return if $mid != 0x5c;     # Winbond |
|---|
| 3731 |         return 6 if $cid == 0x00;    # W83L771W/G |
|---|
| 3732 | Â Â Â Â } |
|---|
| 3733 |     if ($chip == 9) { |
|---|
| 3734 |         return if ($conf & 0x1B) != 0; |
|---|
| 3735 |         return if $rate > 0x0F; |
|---|
| 3736 |         return if $mid != 0x55;     # Texas Instruments |
|---|
| 3737 |         return 8 if $cid == 0x11;    # TMP401 |
|---|
| 3738 | Â Â Â Â } |
|---|
| 3739 |     if ($chip == 10) { |
|---|
| 3740 |         return if ($conf & 0x1B) != 0; |
|---|
| 3741 |         return if $rate > 0x0F; |
|---|
| 3742 |         return if $mid != 0x55;     # Texas Instruments |
|---|
| 3743 |         return 6 if ($addr == 0x4c && $cid == 0x12); # TMP411A |
|---|
| 3744 |         return 6 if ($addr == 0x4d && $cid == 0x13); # TMP411B |
|---|
| 3745 |         return 6 if ($addr == 0x4e && $cid == 0x10); # TMP411C |
|---|
| 3746 | Â Â Â Â } |
|---|
| 3747 | Â Â Â Â return; |
|---|
| 3748 | } |
|---|
| 3749 | |
|---|
| 3750 | # Registers used: |
|---|
| 3751 | #Â Â 0x03: Configuration (no low nibble, returns the previous low nibble) |
|---|
| 3752 | #Â Â 0x04: Conversion rate |
|---|
| 3753 | #Â Â 0xfe: Manufacturer ID |
|---|
| 3754 | #Â Â 0xff: no register |
|---|
| 3755 | sub max6657_detect |
|---|
| 3756 | { |
|---|
| 3757 |     my ($file, $addr) = @_; |
|---|
| 3758 |     my $mid = i2c_smbus_read_byte_data($file, 0xfe, NO_CACHE); |
|---|
| 3759 |     my $cid = i2c_smbus_read_byte_data($file, 0xff, NO_CACHE); |
|---|
| 3760 |     my $conf = i2c_smbus_read_byte_data($file, 0x03, NO_CACHE); |
|---|
| 3761 | |
|---|
| 3762 |     return if $mid != 0x4d;     # Maxim |
|---|
| 3763 |     return if ($conf & 0x1f) != 0x0d; |
|---|
| 3764 |     return if $cid != 0x4d;     # No register, returns previous value |
|---|
| 3765 | |
|---|
| 3766 |     my $rate = i2c_smbus_read_byte_data($file, 0x04, NO_CACHE); |
|---|
| 3767 |     return if $rate > 0x09; |
|---|
| 3768 | |
|---|
| 3769 |     $cid = i2c_smbus_read_byte_data($file, 0xff, NO_CACHE); |
|---|
| 3770 |     $conf = i2c_smbus_read_byte_data($file, 0x03, NO_CACHE); |
|---|
| 3771 |     return if ($conf & 0x0f) != $rate; |
|---|
| 3772 |     return if $cid != $rate;    # No register, returns previous value |
|---|
| 3773 | |
|---|
| 3774 |     return 5; |
|---|
| 3775 | } |
|---|
| 3776 | |
|---|
| 3777 | # Registers used: |
|---|
| 3778 | #Â Â 0x03: Configuration |
|---|
| 3779 | #Â Â 0xfe: Manufacturer ID |
|---|
| 3780 | #Â Â 0xff: Revision ID |
|---|
| 3781 | sub lm95231_detect |
|---|
| 3782 | { |
|---|
| 3783 |     my ($file, $addr) = @_; |
|---|
| 3784 |     my $mid = i2c_smbus_read_byte_data($file, 0xfe); |
|---|
| 3785 |     my $cid = i2c_smbus_read_byte_data($file, 0xff); |
|---|
| 3786 |     my $conf = i2c_smbus_read_byte_data($file, 0x03); |
|---|
| 3787 | |
|---|
| 3788 |     return if ($conf & 0x89) != 0; |
|---|
| 3789 |     return if $mid != 0x01;     # National Semiconductor |
|---|
| 3790 |     return if $cid != 0xa1;     # LM95231 |
|---|
| 3791 | |
|---|
| 3792 |     return 6; |
|---|
| 3793 | } |
|---|
| 3794 | |
|---|
| 3795 | # Registers used: |
|---|
| 3796 | #Â Â 0x03: Configuration 1 |
|---|
| 3797 | #Â Â 0x24: Configuration 2 |
|---|
| 3798 | #Â Â 0x3d: Manufacturer ID |
|---|
| 3799 | #Â Â 0x3e: Device ID |
|---|
| 3800 | sub adt7481_detect |
|---|
| 3801 | { |
|---|
| 3802 |     my ($file, $addr) = @_; |
|---|
| 3803 |     my $mid = i2c_smbus_read_byte_data($file, 0x3d); |
|---|
| 3804 |     my $cid = i2c_smbus_read_byte_data($file, 0x3e); |
|---|
| 3805 |     my $conf1 = i2c_smbus_read_byte_data($file, 0x03); |
|---|
| 3806 |     my $conf2 = i2c_smbus_read_byte_data($file, 0x24); |
|---|
| 3807 | |
|---|
| 3808 |     return if ($conf1 & 0x10) != 0; |
|---|
| 3809 |     return if ($conf2 & 0x7f) != 0; |
|---|
| 3810 |     return if $mid != 0x41;     # Analog Devices |
|---|
| 3811 |     return if $cid != 0x81;     # ADT7481 |
|---|
| 3812 | |
|---|
| 3813 |     return 6; |
|---|
| 3814 | } |
|---|
| 3815 | |
|---|
| 3816 | # Chip to detect: 1 = LM63, 2 = F75363SG, 3 = LM64 |
|---|
| 3817 | # Registers used: |
|---|
| 3818 | #Â Â 0xfe: Manufacturer ID |
|---|
| 3819 | #Â Â 0xff: Chip ID / die revision |
|---|
| 3820 | #Â Â 0x03: Configuration (two or three unused bits) |
|---|
| 3821 | #Â Â 0x16: Alert mask (two or three unused bits) |
|---|
| 3822 | sub lm63_detect |
|---|
| 3823 | { |
|---|
| 3824 |     my ($file, $addr, $chip) = @_; |
|---|
| 3825 | |
|---|
| 3826 |     my $mid = i2c_smbus_read_byte_data($file, 0xfe); |
|---|
| 3827 |     my $cid = i2c_smbus_read_byte_data($file, 0xff); |
|---|
| 3828 |     my $conf = i2c_smbus_read_byte_data($file, 0x03); |
|---|
| 3829 |     my $mask = i2c_smbus_read_byte_data($file, 0x16); |
|---|
| 3830 | |
|---|
| 3831 |     if ($chip == 1) { |
|---|
| 3832 |         return if $mid != 0x01     # National Semiconductor |
|---|
| 3833 |             || $cid != 0x41;     # LM63 |
|---|
| 3834 |         return if ($conf & 0x18) != 0x00 |
|---|
| 3835 |             || ($mask & 0xa4) != 0xa4; |
|---|
| 3836 |     } elsif ($chip == 2) { |
|---|
| 3837 |         return if $mid != 0x23     # Fintek |
|---|
| 3838 |             || $cid != 0x20;     # F75363SG |
|---|
| 3839 |         return if ($conf & 0x1a) != 0x00 |
|---|
| 3840 |             || ($mask & 0x84) != 0x00; |
|---|
| 3841 |     } elsif ($chip == 3) { |
|---|
| 3842 |         return if $mid != 0x01     # National Semiconductor |
|---|
| 3843 |             || $cid != 0x51;     # LM64 |
|---|
| 3844 |         return if ($conf & 0x18) != 0x00 |
|---|
| 3845 |             || ($mask & 0xa4) != 0xa4; |
|---|
| 3846 | Â Â Â Â } |
|---|
| 3847 | |
|---|
| 3848 |     return 6; |
|---|
| 3849 | } |
|---|
| 3850 | |
|---|
| 3851 | # Registers used: |
|---|
| 3852 | #Â Â 0x02, 0x03: Fan support |
|---|
| 3853 | #Â Â 0x06: Temperature support |
|---|
| 3854 | #Â Â 0x07, 0x08, 0x09: Fan config |
|---|
| 3855 | #Â Â 0x0d: Manufacturer ID |
|---|
| 3856 | #Â Â 0x0e: Chip ID / die revision |
|---|
| 3857 | sub adm1029_detect |
|---|
| 3858 | { |
|---|
| 3859 |     my ($file, $addr) = @_; |
|---|
| 3860 |     my $mid = i2c_smbus_read_byte_data($file, 0x0d); |
|---|
| 3861 |     my $cid = i2c_smbus_read_byte_data($file, 0x0e); |
|---|
| 3862 |     my $cfg; |
|---|
| 3863 | |
|---|
| 3864 |     return unless $mid == 0x41;       # Analog Devices |
|---|
| 3865 |     return unless ($cid & 0xF0) == 0x00;  # ADM1029 |
|---|
| 3866 | |
|---|
| 3867 | Â Â Â Â # Extra check on unused bits |
|---|
| 3868 |     $cfg = i2c_smbus_read_byte_data($file, 0x02); |
|---|
| 3869 |     return unless $cfg == 0x03; |
|---|
| 3870 |     $cfg = i2c_smbus_read_byte_data($file, 0x06); |
|---|
| 3871 |     return unless ($cfg & 0xF9) == 0x01; |
|---|
| 3872 |     foreach my $reg (0x03, 0x07, 0x08, 0x09) { |
|---|
| 3873 |         $cfg = i2c_smbus_read_byte_data($file, $reg); |
|---|
| 3874 |         return unless ($cfg & 0xFC) == 0x00; |
|---|
| 3875 | Â Â Â Â } |
|---|
| 3876 | |
|---|
| 3877 |     return 7; |
|---|
| 3878 | } |
|---|
| 3879 | |
|---|
| 3880 | # Chip to detect: 0 = ADM1030, 1 = ADM1031 |
|---|
| 3881 | # Registers used: |
|---|
| 3882 | #Â Â 0x01: Config 2 |
|---|
| 3883 | #Â Â 0x03: Status 2 |
|---|
| 3884 | #Â Â 0x0d, 0x0e, 0x0f: Temperature offsets |
|---|
| 3885 | #Â Â 0x22: Fan speed config |
|---|
| 3886 | #Â Â 0x3d: Chip ID |
|---|
| 3887 | #Â Â 0x3e: Manufacturer ID |
|---|
| 3888 | #Â Â 0x3f: Die revision |
|---|
| 3889 | sub adm1031_detect |
|---|
| 3890 | { |
|---|
| 3891 |     my ($file, $addr, $chip) = @_; |
|---|
| 3892 |     my $mid = i2c_smbus_read_byte_data($file, 0x3e); |
|---|
| 3893 |     my $cid = i2c_smbus_read_byte_data($file, 0x3d); |
|---|
| 3894 |     my $drev = i2c_smbus_read_byte_data($file, 0x3f); |
|---|
| 3895 |     my $conf2 = i2c_smbus_read_byte_data($file, 0x01); |
|---|
| 3896 |     my $stat2 = i2c_smbus_read_byte_data($file, 0x03); |
|---|
| 3897 |     my $fsc = i2c_smbus_read_byte_data($file, 0x22); |
|---|
| 3898 |     my $lto = i2c_smbus_read_byte_data($file, 0x0d); |
|---|
| 3899 |     my $r1to = i2c_smbus_read_byte_data($file, 0x0e); |
|---|
| 3900 |     my $r2to = i2c_smbus_read_byte_data($file, 0x0f); |
|---|
| 3901 |     my $confidence = 3; |
|---|
| 3902 | |
|---|
| 3903 |     if ($chip == 0) { |
|---|
| 3904 |         return if $mid != 0x41;     # Analog Devices |
|---|
| 3905 |         return if $cid != 0x30;     # ADM1030 |
|---|
| 3906 |         $confidence++ if ($drev & 0x70) == 0x00; |
|---|
| 3907 |         $confidence++ if ($conf2 & 0x4A) == 0x00; |
|---|
| 3908 |         $confidence++ if ($stat2 & 0x3F) == 0x00; |
|---|
| 3909 |         $confidence++ if ($fsc & 0xF0) == 0x00; |
|---|
| 3910 |         $confidence++ if ($lto & 0x70) == 0x00; |
|---|
| 3911 |         $confidence++ if ($r1to & 0x70) == 0x00; |
|---|
| 3912 |         return $confidence; |
|---|
| 3913 | Â Â Â Â } |
|---|
| 3914 |     if ($chip == 1) { |
|---|
| 3915 |         return if $mid != 0x41;     # Analog Devices |
|---|
| 3916 |         return if $cid != 0x31;     # ADM1031 |
|---|
| 3917 |         $confidence++ if ($drev & 0x70) == 0x00; |
|---|
| 3918 |         $confidence++ if ($lto & 0x70) == 0x00; |
|---|
| 3919 |         $confidence++ if ($r1to & 0x70) == 0x00; |
|---|
| 3920 |         $confidence++ if ($r2to & 0x70) == 0x00; |
|---|
| 3921 |         return $confidence; |
|---|
| 3922 | Â Â Â Â } |
|---|
| 3923 | } |
|---|
| 3924 | |
|---|
| 3925 | # Chip to detect: 0 = ADM1033, 1 = ADM1034 |
|---|
| 3926 | # Registers used: |
|---|
| 3927 | #Â Â 0x3d: Chip ID |
|---|
| 3928 | #Â Â 0x3e: Manufacturer ID |
|---|
| 3929 | #Â Â 0x3f: Die revision |
|---|
| 3930 | sub adm1034_detect |
|---|
| 3931 | { |
|---|
| 3932 |     my ($file, $addr, $chip) = @_; |
|---|
| 3933 |     my $mid = i2c_smbus_read_byte_data($file, 0x3e); |
|---|
| 3934 |     my $cid = i2c_smbus_read_byte_data($file, 0x3d); |
|---|
| 3935 |     my $drev = i2c_smbus_read_byte_data($file, 0x3f); |
|---|
| 3936 | |
|---|
| 3937 |     if ($chip == 0) { |
|---|
| 3938 |         return if $mid != 0x41;     # Analog Devices |
|---|
| 3939 |         return if $cid != 0x33;     # ADM1033 |
|---|
| 3940 |         return if ($drev & 0xf8) != 0x00; |
|---|
| 3941 |         return 6 if $drev == 0x02; |
|---|
| 3942 |         return 4; |
|---|
| 3943 | Â Â Â Â } |
|---|
| 3944 |     if ($chip == 1) { |
|---|
| 3945 |         return if $mid != 0x41;     # Analog Devices |
|---|
| 3946 |         return if $cid != 0x34;     # ADM1034 |
|---|
| 3947 |         return if ($drev & 0xf8) != 0x00; |
|---|
| 3948 |         return 6 if $drev == 0x02; |
|---|
| 3949 |         return 4; |
|---|
| 3950 | Â Â Â Â } |
|---|
| 3951 | } |
|---|
| 3952 | |
|---|
| 3953 | # Chip to detect: 0 = ADT7467/ADT7468, 1 = ADT7476, 2 = ADT7462, 3 = ADT7466, |
|---|
| 3954 | #Â Â Â Â Â Â Â Â Â 4 = ADT7470 |
|---|
| 3955 | # Registers used: |
|---|
| 3956 | #Â Â 0x3d: Chip ID |
|---|
| 3957 | #Â Â 0x3e: Manufacturer ID |
|---|
| 3958 | #Â Â 0x3f: Die revision |
|---|
| 3959 | sub adt7467_detect |
|---|
| 3960 | { |
|---|
| 3961 |     my ($file, $addr, $chip) = @_; |
|---|
| 3962 |     my $mid = i2c_smbus_read_byte_data($file, 0x3e); |
|---|
| 3963 |     my $cid = i2c_smbus_read_byte_data($file, 0x3d); |
|---|
| 3964 |     my $drev = i2c_smbus_read_byte_data($file, 0x3f); |
|---|
| 3965 | |
|---|
| 3966 |     return if $mid != 0x41;         # Analog Devices |
|---|
| 3967 | |
|---|
| 3968 |     if ($chip == 0) { |
|---|
| 3969 |         return if $cid != 0x68;     # ADT7467 |
|---|
| 3970 |         return if ($drev & 0xf0) != 0x70; |
|---|
| 3971 |         return 7 if $drev == 0x71 || $drev == 0x72; |
|---|
| 3972 |         return 5; |
|---|
| 3973 | Â Â Â Â } |
|---|
| 3974 |     if ($chip == 1) { |
|---|
| 3975 |         return if $cid != 0x76;     # ADT7476 |
|---|
| 3976 |         return if ($drev & 0xf0) != 0x60; |
|---|
| 3977 |         return 7 if $drev == 0x69; |
|---|
| 3978 |         return 5; |
|---|
| 3979 | Â Â Â Â } |
|---|
| 3980 |     if ($chip == 2) { |
|---|
| 3981 |         return if $cid != 0x62;     # ADT7462 |
|---|
| 3982 |         return if ($drev & 0xf0) != 0x00; |
|---|
| 3983 |         return 7 if $drev == 0x04; |
|---|
| 3984 |         return 5; |
|---|
| 3985 | Â Â Â Â } |
|---|
| 3986 |     if ($chip == 3) { |
|---|
| 3987 |         return if $cid != 0x66;     # ADT7466 |
|---|
| 3988 |         return if ($drev & 0xf0) != 0x00; |
|---|
| 3989 |         return 7 if $drev == 0x02; |
|---|
| 3990 |         return 5; |
|---|
| 3991 | Â Â Â Â } |
|---|
| 3992 |     if ($chip == 4) { |
|---|
| 3993 |         return if $cid != 0x70;     # ADT7470 |
|---|
| 3994 |         return if ($drev & 0xf0) != 0x00; |
|---|
| 3995 |         return 7 if $drev == 0x00; |
|---|
| 3996 |         return 5; |
|---|
| 3997 | Â Â Â Â } |
|---|
| 3998 | } |
|---|
| 3999 | |
|---|
| 4000 | # Chip to detect: 0 = ADT7473, 1 = ADT7475 |
|---|
| 4001 | # Registers used: |
|---|
| 4002 | #Â Â 0x3d: Chip ID |
|---|
| 4003 | #Â Â 0x3e: Manufacturer ID |
|---|
| 4004 | sub adt7473_detect |
|---|
| 4005 | { |
|---|
| 4006 |     my ($file, $addr, $chip) = @_; |
|---|
| 4007 |     my $mid = i2c_smbus_read_byte_data($file, 0x3e); |
|---|
| 4008 |     my $cid = i2c_smbus_read_byte_data($file, 0x3d); |
|---|
| 4009 | |
|---|
| 4010 |     return if $mid != 0x41;         # Analog Devices |
|---|
| 4011 | |
|---|
| 4012 |     return if $chip == 0 && $cid != 0x73;  # ADT7473 |
|---|
| 4013 |     return if $chip == 1 && $cid != 0x75;  # ADT7475 |
|---|
| 4014 |     return 5; |
|---|
| 4015 | } |
|---|
| 4016 | |
|---|
| 4017 | # Chip to detect: 0 = aSC7512, 1 = aSC7611, 2 = aSC7621 |
|---|
| 4018 | # Registers used: |
|---|
| 4019 | #Â Â 0x3e: Manufacturer ID |
|---|
| 4020 | #Â Â 0x3f: Version |
|---|
| 4021 | sub andigilog_detect |
|---|
| 4022 | { |
|---|
| 4023 |     my ($file, $addr, $chip) = @_; |
|---|
| 4024 |     my $mid = i2c_smbus_read_byte_data($file, 0x3e); |
|---|
| 4025 |     my $cid = i2c_smbus_read_byte_data($file, 0x3f); |
|---|
| 4026 | |
|---|
| 4027 |     return if $mid != 0x61;     # Andigilog |
|---|
| 4028 | |
|---|
| 4029 |     return if $chip == 0 && $cid != 0x62; |
|---|
| 4030 |     return if $chip == 1 && $cid != 0x69; |
|---|
| 4031 |     return if $chip == 2 && ($cid != 0x6C && $cid != 0x6D); |
|---|
| 4032 |     return 5; |
|---|
| 4033 | } |
|---|
| 4034 | |
|---|
| 4035 | # Registers used: |
|---|
| 4036 | #Â Â 0xfe: Manufacturer ID |
|---|
| 4037 | #Â Â 0xff: Die Code |
|---|
| 4038 | sub andigilog_aSC7511_detect |
|---|
| 4039 | { |
|---|
| 4040 |     my ($file, $addr) = @_; |
|---|
| 4041 |     my $mid = i2c_smbus_read_byte_data($file, 0xfe); |
|---|
| 4042 |     my $die = i2c_smbus_read_byte_data($file, 0xff); |
|---|
| 4043 | |
|---|
| 4044 |     return if $mid != 0x61;     # Andigilog |
|---|
| 4045 |     return if $die != 0x00; |
|---|
| 4046 |     return 3; |
|---|
| 4047 | } |
|---|
| 4048 | |
|---|
| 4049 | # Chip to detect: 0 = LM85, 1 = LM96000, 2 = ADM1027, 3 = ADT7463, |
|---|
| 4050 | #Â Â Â Â Â Â Â Â Â 4 = EMC6D100/101, 5 = EMC6D102, 6 = EMC6D103 |
|---|
| 4051 | # Registers used: |
|---|
| 4052 | #Â Â 0x3e: Vendor register |
|---|
| 4053 | #Â Â 0x3d: Device ID register (Analog Devices only) |
|---|
| 4054 | #Â Â 0x3f: Version/Stepping register |
|---|
| 4055 | sub lm85_detect |
|---|
| 4056 | { |
|---|
| 4057 |     my ($file, $addr, $chip) = @_; |
|---|
| 4058 |     my $vendor = i2c_smbus_read_byte_data($file, 0x3e); |
|---|
| 4059 |     my $verstep = i2c_smbus_read_byte_data($file, 0x3f); |
|---|
| 4060 | |
|---|
| 4061 |     if ($chip == 0) { |
|---|
| 4062 |         return if $vendor != 0x01;   # National Semiconductor |
|---|
| 4063 |         return if $verstep != 0x60   # LM85 C |
|---|
| 4064 |             && $verstep != 0x62;   # LM85 B |
|---|
| 4065 |     } elsif ($chip == 1) { |
|---|
| 4066 |         return if $vendor != 0x01;   # National Semiconductor |
|---|
| 4067 |         return if $verstep != 0x68   # LM96000 |
|---|
| 4068 |             && $verstep != 0x69;   # LM96000 |
|---|
| 4069 |     } elsif ($chip == 2) { |
|---|
| 4070 |         return if $vendor != 0x41;   # Analog Devices |
|---|
| 4071 |         return if $verstep != 0x60;   # ADM1027 |
|---|
| 4072 |     } elsif ($chip == 3) { |
|---|
| 4073 |         return if $vendor != 0x41;   # Analog Devices |
|---|
| 4074 |         return if $verstep != 0x62   # ADT7463 |
|---|
| 4075 |             && $verstep != 0x6a;   # ADT7463 C |
|---|
| 4076 |     } elsif ($chip == 4) { |
|---|
| 4077 |         return if $vendor != 0x5c;   # SMSC |
|---|
| 4078 |         return if $verstep != 0x60   # EMC6D100/101 A0 |
|---|
| 4079 |             && $verstep != 0x61;   # EMC6D100/101 A1 |
|---|
| 4080 |     } elsif ($chip == 5) { |
|---|
| 4081 |         return if $vendor != 0x5c;   # SMSC |
|---|
| 4082 |         return if $verstep != 0x65;   # EMC6D102 |
|---|
| 4083 |     } elsif ($chip == 6) { |
|---|
| 4084 |         return if $vendor != 0x5c;   # SMSC |
|---|
| 4085 |         return if $verstep != 0x68;   # EMC6D103 |
|---|
| 4086 | Â Â Â Â } |
|---|
| 4087 | |
|---|
| 4088 |     if ($vendor == 0x41) {         # Analog Devices |
|---|
| 4089 |         return if i2c_smbus_read_byte_data($file, 0x3d) != 0x27; |
|---|
| 4090 |         return 8; |
|---|
| 4091 | Â Â Â Â } |
|---|
| 4092 |     return 7; |
|---|
| 4093 | } |
|---|
| 4094 | |
|---|
| 4095 | # Chip to detect: 0 = LM87, 1 = ADM1024 |
|---|
| 4096 | # Registers used: |
|---|
| 4097 | #Â Â 0x3e: Company ID |
|---|
| 4098 | #Â Â 0x3f: Revision |
|---|
| 4099 | #Â Â 0x40: Configuration |
|---|
| 4100 | sub lm87_detect |
|---|
| 4101 | { |
|---|
| 4102 |     my ($file, $addr, $chip) = @_; |
|---|
| 4103 |     my $cid = i2c_smbus_read_byte_data($file, 0x3e); |
|---|
| 4104 |     my $rev = i2c_smbus_read_byte_data($file, 0x3f); |
|---|
| 4105 | |
|---|
| 4106 |     if ($chip == 0) { |
|---|
| 4107 |         return if $cid != 0x02;     # National Semiconductor |
|---|
| 4108 |         return if ($rev & 0xfc) != 0x04; # LM87 |
|---|
| 4109 | Â Â Â Â } |
|---|
| 4110 |     if ($chip == 1) { |
|---|
| 4111 |         return if $cid != 0x41;     # Analog Devices |
|---|
| 4112 |         return if ($rev & 0xf0) != 0x10; # ADM1024 |
|---|
| 4113 | Â Â Â Â } |
|---|
| 4114 | |
|---|
| 4115 |     my $cfg = i2c_smbus_read_byte_data($file, 0x40); |
|---|
| 4116 |     return if ($cfg & 0x80) != 0x00; |
|---|
| 4117 | |
|---|
| 4118 |     return 7; |
|---|
| 4119 | } |
|---|
| 4120 | |
|---|
| 4121 | # Chip to detect: 0 = W83781D, 1 = W83782D, 2 = W83783S, 3 = W83627HF, |
|---|
| 4122 | #Â Â Â Â Â Â Â Â Â 4 = AS99127F (rev.1), 5 = AS99127F (rev.2), 6 = ASB100, |
|---|
| 4123 | #Â Â Â Â Â Â Â Â Â 7 = W83791D, 8 = W83792D, 9 = W83627EHF, 10 = W83627DHG |
|---|
| 4124 | # Registers used: |
|---|
| 4125 | #Â Â 0x48: Full I2C Address |
|---|
| 4126 | #Â Â 0x4a: I2C addresses of emulated LM75 chips |
|---|
| 4127 | #Â Â 0x4e: Vendor ID byte selection, and bank selection |
|---|
| 4128 | #Â Â 0x4f: Vendor ID |
|---|
| 4129 | #Â Â 0x58: Device ID (only when in bank 0) |
|---|
| 4130 | # Note: Fails if the W8378xD is not in bank 0! |
|---|
| 4131 | # Note: Asus chips do not have their I2C address at register 0x48? |
|---|
| 4132 | #Â Â Â Â AS99127F rev.1 and ASB100 have 0x00, confirmation wanted for |
|---|
| 4133 | #Â Â Â Â AS99127F rev.2. |
|---|
| 4134 | sub w83781d_detect |
|---|
| 4135 | { |
|---|
| 4136 |     my ($file, $addr, $chip) = @_; |
|---|
| 4137 |     my ($reg1, $reg2, @res); |
|---|
| 4138 | |
|---|
| 4139 |     return unless (i2c_smbus_read_byte_data($file, 0x48) == $addr) |
|---|
| 4140 |           or ($chip >= 4 && $chip <= 6); |
|---|
| 4141 | |
|---|
| 4142 |     $reg1 = i2c_smbus_read_byte_data($file, 0x4e); |
|---|
| 4143 |     $reg2 = i2c_smbus_read_byte_data($file, 0x4f); |
|---|
| 4144 |     if ($chip == 4) {        # Asus AS99127F (rev.1) |
|---|
| 4145 |         return unless (($reg1 & 0x80) == 0x00 and $reg2 == 0xc3) or |
|---|
| 4146 |                (($reg1 & 0x80) == 0x80 and $reg2 == 0x12); |
|---|
| 4147 |     } elsif ($chip == 6) {     # Asus ASB100 |
|---|
| 4148 |         return unless (($reg1 & 0x80) == 0x00 and $reg2 == 0x94) or |
|---|
| 4149 |                (($reg1 & 0x80) == 0x80 and $reg2 == 0x06); |
|---|
| 4150 |     } else {            # Winbond and Asus AS99127F (rev.2) |
|---|
| 4151 |         return unless (($reg1 & 0x80) == 0x00 and $reg2 == 0xa3) or |
|---|
| 4152 |                (($reg1 & 0x80) == 0x80 and $reg2 == 0x5c); |
|---|
| 4153 | Â Â Â Â } |
|---|
| 4154 | |
|---|
| 4155 |     return unless ($reg1 & 0x07) == 0x00; |
|---|
| 4156 | |
|---|
| 4157 |     $reg1 = i2c_smbus_read_byte_data($file, 0x58); |
|---|
| 4158 |     return if $chip == 0 and ($reg1 != 0x10 && $reg1 != 0x11); |
|---|
| 4159 |     return if $chip == 1 and $reg1 != 0x30; |
|---|
| 4160 |     return if $chip == 2 and $reg1 != 0x40; |
|---|
| 4161 |     return if $chip == 3 and $reg1 != 0x21; |
|---|
| 4162 |     return if $chip == 4 and $reg1 != 0x31; |
|---|
| 4163 |     return if $chip == 5 and $reg1 != 0x31; |
|---|
| 4164 |     return if $chip == 6 and $reg1 != 0x31; |
|---|
| 4165 |     return if $chip == 7 and $reg1 != 0x71; |
|---|
| 4166 |     return if $chip == 8 and $reg1 != 0x7a; |
|---|
| 4167 |     return if $chip == 9 and ($reg1 != 0x88 && $reg1 != 0xa1); |
|---|
| 4168 |     return if $chip == 10 and $reg1 != 0xc1; |
|---|
| 4169 | Â Â Â Â # Default address is 0x2d |
|---|
| 4170 |     @res = ($addr != 0x2d) ? (7) : (8); |
|---|
| 4171 |     return @res if $chip >= 9; # No subclients |
|---|
| 4172 | |
|---|
| 4173 |     $reg1 = i2c_smbus_read_byte_data($file, 0x4a); |
|---|
| 4174 |     push @res, ($reg1 & 0x07) + 0x48 unless $reg1 & 0x08; |
|---|
| 4175 |     push @res, (($reg1 & 0x70) >> 4) + 0x48 |
|---|
| 4176 |         unless ($reg1 & 0x80 or $chip == 2); |
|---|
| 4177 |     return @res; |
|---|
| 4178 | } |
|---|
| 4179 | |
|---|
| 4180 | # Registers used: |
|---|
| 4181 | #Â Â 0x0b: Full I2C Address |
|---|
| 4182 | #Â Â 0x0c: I2C addresses of emulated LM75 chips |
|---|
| 4183 | #Â Â 0x00: Vendor ID byte selection, and bank selection(Bank 0, 1, 2) |
|---|
| 4184 | #Â Â 0x0d: Vendor ID(Bank 0, 1, 2) |
|---|
| 4185 | #Â Â 0x0e: Device ID(Bank 0, 1, 2) |
|---|
| 4186 | sub w83793_detect |
|---|
| 4187 | { |
|---|
| 4188 |     my ($file, $addr) = @_; |
|---|
| 4189 |     my ($bank, $reg, @res); |
|---|
| 4190 | |
|---|
| 4191 |     $bank = i2c_smbus_read_byte_data($file, 0x00); |
|---|
| 4192 |     $reg = i2c_smbus_read_byte_data($file, 0x0d); |
|---|
| 4193 | |
|---|
| 4194 |     return unless (($bank & 0x80) == 0x00 and $reg == 0xa3) or |
|---|
| 4195 |            (($bank & 0x80) == 0x80 and $reg == 0x5c); |
|---|
| 4196 | |
|---|
| 4197 |     $reg = i2c_smbus_read_byte_data($file, 0x0e); |
|---|
| 4198 |     return if $reg != 0x7b; |
|---|
| 4199 | |
|---|
| 4200 | Â Â Â Â # If bank 0 is selected, we can do more checks |
|---|
| 4201 |     return 6 unless ($bank & 0x07) == 0; |
|---|
| 4202 |     $reg = i2c_smbus_read_byte_data($file, 0x0b); |
|---|
| 4203 |     return unless ($reg == ($addr << 1)); |
|---|
| 4204 | |
|---|
| 4205 |     $reg = i2c_smbus_read_byte_data($file, 0x0c); |
|---|
| 4206 |     @res = (8); |
|---|
| 4207 |     push @res, ($reg & 0x07) + 0x48 unless $reg & 0x08; |
|---|
| 4208 |     push @res, (($reg & 0x70) >> 4) + 0x48 unless $reg & 0x80; |
|---|
| 4209 |     return @res; |
|---|
| 4210 | } |
|---|
| 4211 | |
|---|
| 4212 | # Registers used: |
|---|
| 4213 | #Â Â 0x48: Full I2C Address |
|---|
| 4214 | #Â Â 0x4e: Vendor ID byte selection |
|---|
| 4215 | #Â Â 0x4f: Vendor ID |
|---|
| 4216 | #Â Â 0x58: Device ID |
|---|
| 4217 | # Note that the datasheet was useless and this detection routine |
|---|
| 4218 | # is based on dumps we received from users. Also, the W83781SD is *NOT* |
|---|
| 4219 | # a hardware monitoring chip as far as we know, but we still want to |
|---|
| 4220 | # detect it so that people won't keep reporting it as an unknown chip |
|---|
| 4221 | # we should investigate about. |
|---|
| 4222 | sub w83791sd_detect |
|---|
| 4223 | { |
|---|
| 4224 |     my ($file, $addr) = @_; |
|---|
| 4225 |     my ($reg1, $reg2); |
|---|
| 4226 | |
|---|
| 4227 |     return unless (i2c_smbus_read_byte_data($file, 0x48) == $addr); |
|---|
| 4228 | |
|---|
| 4229 |     $reg1 = i2c_smbus_read_byte_data($file, 0x4e); |
|---|
| 4230 |     $reg2 = i2c_smbus_read_byte_data($file, 0x4f); |
|---|
| 4231 |     return unless (!($reg1 & 0x80) && $reg2 == 0xa3) |
|---|
| 4232 | Â Â Â Â Â Â Â Â Â Â ||Â (($reg1Â &Â 0x80)Â &&Â $reg2Â ==Â 0x5c); |
|---|
| 4233 | |
|---|
| 4234 |     $reg1 = i2c_smbus_read_byte_data($file, 0x58); |
|---|
| 4235 |     return unless $reg1 == 0x72; |
|---|
| 4236 | |
|---|
| 4237 |     return 3; |
|---|
| 4238 | } |
|---|
| 4239 | |
|---|
| 4240 | # Registers used: |
|---|
| 4241 | #Â Â 0x4e: Vendor ID high byte |
|---|
| 4242 | #Â Â 0x4f: Vendor ID low byte |
|---|
| 4243 | #Â Â 0x58: Device ID |
|---|
| 4244 | # Note: The values were given by Alex van Kaam, we don't have datasheets |
|---|
| 4245 | #Â Â Â Â to confirm. |
|---|
| 4246 | sub mozart_detect |
|---|
| 4247 | { |
|---|
| 4248 |     my ($file, $addr) = @_; |
|---|
| 4249 |     my ($vid, $dev); |
|---|
| 4250 | |
|---|
| 4251 |     $vid = (i2c_smbus_read_byte_data($file, 0x4e) << 8) |
|---|
| 4252 |        + i2c_smbus_read_byte_data($file, 0x4f); |
|---|
| 4253 |     $dev = i2c_smbus_read_byte_data($file, 0x58); |
|---|
| 4254 | |
|---|
| 4255 |     return unless ($dev == 0x56 && $vid == 0x9436) # ASM58 |
|---|
| 4256 |           || ($dev == 0x56 && $vid == 0x9406) # AS2K129R |
|---|
| 4257 |           || ($dev == 0x10 && $vid == 0x5ca3); |
|---|
| 4258 | |
|---|
| 4259 |     return 5; |
|---|
| 4260 | } |
|---|
| 4261 | |
|---|
| 4262 | # Chip to detect: 0 = GL518SM, 1 = GL520SM |
|---|
| 4263 | # Registers used: |
|---|
| 4264 | #Â Â 0x00: Device ID |
|---|
| 4265 | #Â Â 0x01: Revision ID |
|---|
| 4266 | #Â Â 0x03: Configuration |
|---|
| 4267 | sub gl518sm_detect |
|---|
| 4268 | { |
|---|
| 4269 |     my ($file, $addr, $chip) = @_; |
|---|
| 4270 |     my $reg; |
|---|
| 4271 | |
|---|
| 4272 |     $reg = i2c_smbus_read_byte_data($file, 0x00); |
|---|
| 4273 |     return if $chip == 0 && $reg != 0x80; |
|---|
| 4274 |     return if $chip == 1 && $reg != 0x20; |
|---|
| 4275 | |
|---|
| 4276 |     return unless (i2c_smbus_read_byte_data($file, 0x03) & 0x80) == 0x00; |
|---|
| 4277 |     $reg = i2c_smbus_read_byte_data($file, 0x01); |
|---|
| 4278 |     return unless $reg == 0x00 or $reg == 0x80; |
|---|
| 4279 |     return 6; |
|---|
| 4280 | } |
|---|
| 4281 | |
|---|
| 4282 | # Registers used: |
|---|
| 4283 | #Â Â 0x00: Device ID |
|---|
| 4284 | #Â Â 0x03: Configuration |
|---|
| 4285 | # Mediocre detection |
|---|
| 4286 | sub gl525sm_detect |
|---|
| 4287 | { |
|---|
| 4288 |     my ($file, $addr) = @_; |
|---|
| 4289 |     return unless i2c_smbus_read_byte_data($file, 0x00) == 0x25; |
|---|
| 4290 |     return unless (i2c_smbus_read_byte_data($file, 0x03) & 0x80) == 0x00; |
|---|
| 4291 |     return 5; |
|---|
| 4292 | } |
|---|
| 4293 | |
|---|
| 4294 | # Chip to detect: 0 = ADM9240, 1 = DS1780, 2 = LM81 |
|---|
| 4295 | # Registers used: |
|---|
| 4296 | #Â Â 0x3e: Company ID |
|---|
| 4297 | #Â Â 0x40: Configuration |
|---|
| 4298 | #Â Â 0x48: Full I2C Address |
|---|
| 4299 | sub adm9240_detect |
|---|
| 4300 | { |
|---|
| 4301 |     my ($file, $addr, $chip) = @_; |
|---|
| 4302 |     my $reg; |
|---|
| 4303 |     $reg = i2c_smbus_read_byte_data($file, 0x3e); |
|---|
| 4304 |     return unless ($chip == 0 and $reg == 0x23) or |
|---|
| 4305 |            ($chip == 1 and $reg == 0xda) or |
|---|
| 4306 |            ($chip == 2 and $reg == 0x01); |
|---|
| 4307 |     return unless (i2c_smbus_read_byte_data($file, 0x40) & 0x80) == 0x00; |
|---|
| 4308 |     return unless i2c_smbus_read_byte_data($file, 0x48) == $addr; |
|---|
| 4309 | |
|---|
| 4310 |     return 7; |
|---|
| 4311 | } |
|---|
| 4312 | |
|---|
| 4313 | # Chip to detect: 0 = ADM1022, 1 = THMC50, 2 = ADM1028, 3 = THMC51 |
|---|
| 4314 | # Registers used: |
|---|
| 4315 | #Â Â 0x3e: Company ID |
|---|
| 4316 | #Â Â 0x3f: Revision |
|---|
| 4317 | #Â Â 0x40: Configuration |
|---|
| 4318 | sub adm1022_detect |
|---|
| 4319 | { |
|---|
| 4320 |     my ($file, $addr, $chip) = @_; |
|---|
| 4321 |     my $reg; |
|---|
| 4322 |     $reg = i2c_smbus_read_byte_data($file, 0x3e); |
|---|
| 4323 |     return unless ($chip == 0 and $reg == 0x41) or |
|---|
| 4324 |            ($chip == 1 and $reg == 0x49) or |
|---|
| 4325 |            ($chip == 2 and $reg == 0x41) or |
|---|
| 4326 |            ($chip == 3 and $reg == 0x49); |
|---|
| 4327 |     $reg = i2c_smbus_read_byte_data($file, 0x40); |
|---|
| 4328 |     return if ($reg & 0x10);            # Soft Reset always reads 0 |
|---|
| 4329 |     return if ($chip != 0 and ($reg & 0x80));    # Reserved on THMC50 and ADM1028 |
|---|
| 4330 |     $reg = i2c_smbus_read_byte_data($file, 0x3f) & 0xf0; |
|---|
| 4331 |     return unless ($chip == 0 and $reg == 0xc0) or |
|---|
| 4332 |            ($chip == 1 and $reg == 0xc0) or |
|---|
| 4333 |            ($chip == 2 and $reg == 0xd0) or |
|---|
| 4334 |            ($chip == 3 and $reg == 0xd0); |
|---|
| 4335 |     return 8; |
|---|
| 4336 | } |
|---|
| 4337 | |
|---|
| 4338 | # Chip to detect: 0 = ADM1025, 1 = NE1619 |
|---|
| 4339 | # Registers used: |
|---|
| 4340 | #Â Â 0x3e: Company ID |
|---|
| 4341 | #Â Â 0x3f: Revision |
|---|
| 4342 | #Â Â 0x40: Configuration |
|---|
| 4343 | #Â Â 0x41: Status 1 |
|---|
| 4344 | #Â Â 0x42: Status 2 |
|---|
| 4345 | sub adm1025_detect |
|---|
| 4346 | { |
|---|
| 4347 |     my ($file, $addr, $chip) = @_; |
|---|
| 4348 |     my $reg; |
|---|
| 4349 | |
|---|
| 4350 |     $reg = i2c_smbus_read_byte_data($file, 0x3e); |
|---|
| 4351 |     return if ($chip == 0) and ($reg != 0x41); |
|---|
| 4352 |     return if ($chip == 1) and ($reg != 0xA1); |
|---|
| 4353 | |
|---|
| 4354 |     return unless (i2c_smbus_read_byte_data($file, 0x40) & 0x80) == 0x00; |
|---|
| 4355 |     return unless (i2c_smbus_read_byte_data($file, 0x41) & 0xC0) == 0x00; |
|---|
| 4356 |     return unless (i2c_smbus_read_byte_data($file, 0x42) & 0xBC) == 0x00; |
|---|
| 4357 |     return unless (i2c_smbus_read_byte_data($file, 0x3f) & 0xf0) == 0x20; |
|---|
| 4358 | |
|---|
| 4359 |     return 8; |
|---|
| 4360 | } |
|---|
| 4361 | |
|---|
| 4362 | # Registers used: |
|---|
| 4363 | #Â Â 0x16: Company ID |
|---|
| 4364 | #Â Â 0x17: Revision |
|---|
| 4365 | sub adm1026_detect |
|---|
| 4366 | { |
|---|
| 4367 |     my ($file, $addr) = @_; |
|---|
| 4368 |     my $reg; |
|---|
| 4369 |     $reg = i2c_smbus_read_byte_data($file, 0x16); |
|---|
| 4370 |     return unless ($reg == 0x41); |
|---|
| 4371 |     return unless (i2c_smbus_read_byte_data($file, 0x17) & 0xf0) == 0x40; |
|---|
| 4372 |     return 8; |
|---|
| 4373 | } |
|---|
| 4374 | |
|---|
| 4375 | # Chip to detect: 0 = ADM1021, 1 = ADM1021A/ADM1023, 2 = MAX1617, 3 = MAX1617A, |
|---|
| 4376 | #Â Â Â Â Â Â Â Â Â 4 = THMC10, 5 = LM84, 6 = GL523, 7 = MC1066 |
|---|
| 4377 | # Registers used: |
|---|
| 4378 | #Â Â 0x04: Company ID (LM84 only) |
|---|
| 4379 | #Â Â 0xfe: Company ID (all but LM84 and MAX1617) |
|---|
| 4380 | #Â Â 0xff: Revision (ADM1021, ADM1021A/ADM1023 and MAX1617A) |
|---|
| 4381 | #Â Â 0x02: Status |
|---|
| 4382 | #Â Â 0x03: Configuration |
|---|
| 4383 | #Â Â 0x04: Conversion rate |
|---|
| 4384 | #Â Â 0x00-0x01, 0x05-0x08: Temperatures (MAX1617 and LM84) |
|---|
| 4385 | # Note: Especially the MAX1617 has very bad detection; we give it a low |
|---|
| 4386 | # confidence value. |
|---|
| 4387 | sub adm1021_detect |
|---|
| 4388 | { |
|---|
| 4389 |     my ($file, $addr, $chip) = @_; |
|---|
| 4390 |     my $man_id = i2c_smbus_read_byte_data($file, 0xfe); |
|---|
| 4391 |     my $rev = i2c_smbus_read_byte_data($file, 0xff); |
|---|
| 4392 |     my $conf = i2c_smbus_read_byte_data($file, 0x03); |
|---|
| 4393 |     my $status = i2c_smbus_read_byte_data($file, 0x02); |
|---|
| 4394 |     my $convrate = i2c_smbus_read_byte_data($file, 0x04); |
|---|
| 4395 | |
|---|
| 4396 | Â Â Â Â # Check manufacturer IDs and product revisions when available |
|---|
| 4397 |     return if $chip == 0 and $man_id != 0x41 || ($rev & 0xf0) != 0x00; |
|---|
| 4398 |     return if $chip == 1 and $man_id != 0x41 || ($rev & 0xf0) != 0x30; |
|---|
| 4399 |     return if $chip == 3 and $man_id != 0x4d || $rev != 0x01; |
|---|
| 4400 |     return if $chip == 4 and $man_id != 0x49; |
|---|
| 4401 |     return if $chip == 5 and $convrate != 0x00; |
|---|
| 4402 |     return if $chip == 6 and $man_id != 0x23; |
|---|
| 4403 |     return if $chip == 7 and $man_id != 0x54; |
|---|
| 4404 | |
|---|
| 4405 | Â Â Â Â # Check unused bits |
|---|
| 4406 |     if ($chip == 5) {    # LM84 |
|---|
| 4407 |         return if ($status & 0xab) != 0; |
|---|
| 4408 |         return if ($conf & 0x7f) != 0; |
|---|
| 4409 |     } else { |
|---|
| 4410 |         return if ($status & 0x03) != 0; |
|---|
| 4411 |         return if ($conf & 0x3f) != 0; |
|---|
| 4412 |         return if ($convrate & 0xf8) != 0; |
|---|
| 4413 | Â Â Â Â } |
|---|
| 4414 | |
|---|
| 4415 | Â Â Â Â # Extra checks for MAX1617 and LM84, since those are often misdetected. |
|---|
| 4416 | Â Â Â Â # We verify several assertions (6 for the MAX1617, 4 for the LM84) and |
|---|
| 4417 | Â Â Â Â # discard the chip if any fail. Note that these checks are not done |
|---|
| 4418 | Â Â Â Â # by the adm1021 driver. |
|---|
| 4419 |     if ($chip == 2 || $chip == 5) { |
|---|
| 4420 |         my $lte = i2c_smbus_read_byte_data($file, 0x00); |
|---|
| 4421 |         my $rte = i2c_smbus_read_byte_data($file, 0x01); |
|---|
| 4422 |         my $lhi = i2c_smbus_read_byte_data($file, 0x05); |
|---|
| 4423 |         my $rhi = i2c_smbus_read_byte_data($file, 0x07); |
|---|
| 4424 |         my $llo = i2c_smbus_read_byte_data($file, 0x06); |
|---|
| 4425 |         my $rlo = i2c_smbus_read_byte_data($file, 0x08); |
|---|
| 4426 | |
|---|
| 4427 | Â Â Â Â Â Â Â Â # If all registers hold the same value, it has to be a misdetection |
|---|
| 4428 |         return if $lte == $rte and $lte == $lhi and $lte == $rhi |
|---|
| 4429 |            and $lte == $llo and $lte == $rlo; |
|---|
| 4430 | |
|---|
| 4431 | Â Â Â Â Â Â Â Â # Negative temperatures |
|---|
| 4432 |         return if ($lte & 0x80) or ($rte & 0x80); |
|---|
| 4433 | Â Â Â Â Â Â Â Â # Negative high limits |
|---|
| 4434 |         return if ($lhi & 0x80) or ($rhi & 0x80); |
|---|
| 4435 | Â Â Â Â Â Â Â Â # Low limits over high limits |
|---|
| 4436 |         if ($chip == 2) { |
|---|
| 4437 |             $llo -= 256 if ($llo & 0x80); |
|---|
| 4438 |             $rlo -= 256 if ($rlo & 0x80); |
|---|
| 4439 |             return if ($llo > $lhi) or ($rlo > $rhi); |
|---|
| 4440 | Â Â Â Â Â Â Â Â } |
|---|
| 4441 |         return 3; |
|---|
| 4442 | Â Â Â Â } |
|---|
| 4443 | |
|---|
| 4444 |     return ($chip <= 3) ? 7 : 5; |
|---|
| 4445 | } |
|---|
| 4446 | |
|---|
| 4447 | # Chip to detect: 0 = MAX1668, 1 = MAX1805, 2 = MAX1989 |
|---|
| 4448 | # Registers used: |
|---|
| 4449 | #Â Â 0xfe: Company ID |
|---|
| 4450 | #Â Â 0xff: Device ID |
|---|
| 4451 | sub max1668_detect |
|---|
| 4452 | { |
|---|
| 4453 |     my ($file, $addr, $chip) = @_; |
|---|
| 4454 |     my $man_id = i2c_smbus_read_byte_data($file, 0xfe); |
|---|
| 4455 |     my $dev_id = i2c_smbus_read_byte_data($file, 0xff); |
|---|
| 4456 | |
|---|
| 4457 |     return if $man_id != 0x4d; |
|---|
| 4458 |     return if $chip == 0 and $dev_id != 0x03; |
|---|
| 4459 |     return if $chip == 1 and $dev_id != 0x05; |
|---|
| 4460 |     return if $chip == 2 and $dev_id != 0x0b; |
|---|
| 4461 | |
|---|
| 4462 |     return 7; |
|---|
| 4463 | } |
|---|
| 4464 | |
|---|
| 4465 | # Chip to detect: 0 = MAX1619, 1 = MAX1618 |
|---|
| 4466 | # Registers used: |
|---|
| 4467 | #Â Â 0xfe: Company ID |
|---|
| 4468 | #Â Â 0xff: Device ID |
|---|
| 4469 | #Â Â 0x02: Status |
|---|
| 4470 | #Â Â 0x03: Configuration |
|---|
| 4471 | #Â Â 0x04: Conversion rate |
|---|
| 4472 | sub max1619_detect |
|---|
| 4473 | { |
|---|
| 4474 |     my ($file, $addr, $chip) = @_; |
|---|
| 4475 |     my $man_id = i2c_smbus_read_byte_data($file, 0xfe); |
|---|
| 4476 |     my $dev_id = i2c_smbus_read_byte_data($file, 0xff); |
|---|
| 4477 |     my $conf = i2c_smbus_read_byte_data($file, 0x03); |
|---|
| 4478 |     my $status = i2c_smbus_read_byte_data($file, 0x02); |
|---|
| 4479 |     my $convrate = i2c_smbus_read_byte_data($file, 0x04); |
|---|
| 4480 | |
|---|
| 4481 |     return if $man_id != 0x4D;   # Maxim |
|---|
| 4482 | |
|---|
| 4483 |     if ($chip == 0) {        # MAX1619 |
|---|
| 4484 |         return if $dev_id != 0x04 |
|---|
| 4485 |             or ($conf & 0x03) |
|---|
| 4486 |             or ($status & 0x61) |
|---|
| 4487 |             or $convrate >= 8; |
|---|
| 4488 | Â Â Â Â } |
|---|
| 4489 |     if ($chip == 1) {        # MAX1618 |
|---|
| 4490 |         return if $dev_id != 0x02 |
|---|
| 4491 |             or ($conf & 0x07) |
|---|
| 4492 |             or ($status & 0x63); |
|---|
| 4493 | Â Â Â Â } |
|---|
| 4494 | |
|---|
| 4495 |     return 7; |
|---|
| 4496 | } |
|---|
| 4497 | |
|---|
| 4498 | # Registers used: |
|---|
| 4499 | #Â Â 0x28: User ID |
|---|
| 4500 | #Â Â 0x29: User ID2 |
|---|
| 4501 | sub ite_overclock_detect |
|---|
| 4502 | { |
|---|
| 4503 |     my ($file, $addr) = @_; |
|---|
| 4504 | |
|---|
| 4505 |     my $uid1 = i2c_smbus_read_byte_data($file, 0x28); |
|---|
| 4506 |     my $uid2 = i2c_smbus_read_byte_data($file, 0x29); |
|---|
| 4507 |     return if $uid1 != 0x83 || $uid2 != 0x12; |
|---|
| 4508 | |
|---|
| 4509 |     return 6; |
|---|
| 4510 | } |
|---|
| 4511 | |
|---|
| 4512 | # Registers used: |
|---|
| 4513 | #Â Â 0x00: Configuration |
|---|
| 4514 | #Â Â 0x48: Full I2C Address |
|---|
| 4515 | #Â Â 0x58: Mfr ID |
|---|
| 4516 | #Â Â 0x5b: Device ID |
|---|
| 4517 | sub it8712_i2c_detect |
|---|
| 4518 | { |
|---|
| 4519 |     my ($file, $addr) = @_; |
|---|
| 4520 |     my $reg; |
|---|
| 4521 |     return unless i2c_smbus_read_byte_data($file, 0x48) == $addr; |
|---|
| 4522 |     return unless (i2c_smbus_read_byte_data($file, 0x00) & 0x90) == 0x10; |
|---|
| 4523 |     return unless i2c_smbus_read_byte_data($file, 0x58) == 0x90; |
|---|
| 4524 |     return if i2c_smbus_read_byte_data($file, 0x5b) != 0x12; |
|---|
| 4525 |     return 7 + ($addr == 0x2d); |
|---|
| 4526 | } |
|---|
| 4527 | |
|---|
| 4528 | # Registers used: |
|---|
| 4529 | #Â Â 0-63: SPD Data and Checksum |
|---|
| 4530 | sub eeprom_detect |
|---|
| 4531 | { |
|---|
| 4532 |     my ($file, $addr) = @_; |
|---|
| 4533 |     my $checksum = 0; |
|---|
| 4534 | |
|---|
| 4535 | Â Â Â Â # Check the checksum for validity (works for most DIMMs and RIMMs) |
|---|
| 4536 |     for (my $i = 0; $i <= 62; $i++) { |
|---|
| 4537 |         $checksum += i2c_smbus_read_byte_data($file, $i); |
|---|
| 4538 | Â Â Â Â } |
|---|
| 4539 |     $checksum &= 255; |
|---|
| 4540 | |
|---|
| 4541 |     return 8 if $checksum == i2c_smbus_read_byte_data($file, 63); |
|---|
| 4542 | Â Â Â Â return; |
|---|
| 4543 | } |
|---|
| 4544 | |
|---|
| 4545 | # Registers used: |
|---|
| 4546 | #Â Â 0x00..0x07: DDC signature |
|---|
| 4547 | sub ddcmonitor_detect |
|---|
| 4548 | { |
|---|
| 4549 |     my ($file, $addr) = @_; |
|---|
| 4550 | |
|---|
| 4551 |     return unless |
|---|
| 4552 |         i2c_smbus_read_byte_data($file, 0x00) == 0x00 and |
|---|
| 4553 |         i2c_smbus_read_byte_data($file, 0x01) == 0xFF and |
|---|
| 4554 |         i2c_smbus_read_byte_data($file, 0x02) == 0xFF and |
|---|
| 4555 |         i2c_smbus_read_byte_data($file, 0x03) == 0xFF and |
|---|
| 4556 |         i2c_smbus_read_byte_data($file, 0x04) == 0xFF and |
|---|
| 4557 |         i2c_smbus_read_byte_data($file, 0x05) == 0xFF and |
|---|
| 4558 |         i2c_smbus_read_byte_data($file, 0x06) == 0xFF and |
|---|
| 4559 |         i2c_smbus_read_byte_data($file, 0x07) == 0x00; |
|---|
| 4560 | |
|---|
| 4561 |     return 8; |
|---|
| 4562 | } |
|---|
| 4563 | |
|---|
| 4564 | # Chip to detect: 0 = Poseidon I, 1 = Poseidon II, 2 = Scylla, |
|---|
| 4565 | #Â Â Â Â Â Â Â Â Â 3 = Hermes, 4 = Heimdal, 5 = Heracles |
|---|
| 4566 | # Registers used: |
|---|
| 4567 | #Â Â 0x00-0x02: Identification (3 capital ASCII letters) |
|---|
| 4568 | sub fsc_detect |
|---|
| 4569 | { |
|---|
| 4570 |     my ($file, $addr, $chip) = @_; |
|---|
| 4571 |     my $id; |
|---|
| 4572 | |
|---|
| 4573 |     $id = chr(i2c_smbus_read_byte_data($file, 0x00)) |
|---|
| 4574 |       . chr(i2c_smbus_read_byte_data($file, 0x01)) |
|---|
| 4575 |       . chr(i2c_smbus_read_byte_data($file, 0x02)); |
|---|
| 4576 | |
|---|
| 4577 |     return if $chip == 0 and $id ne 'PEG'; # Pegasus? aka Poseidon I |
|---|
| 4578 |     return if $chip == 1 and $id ne 'POS'; # Poseidon II |
|---|
| 4579 |     return if $chip == 2 and $id ne 'SCY'; # Scylla |
|---|
| 4580 |     return if $chip == 3 and $id ne 'HER'; # Hermes |
|---|
| 4581 |     return if $chip == 4 and $id ne 'HMD'; # Heimdal |
|---|
| 4582 |     return if $chip == 5 and $id ne 'HRC'; # Heracles |
|---|
| 4583 | |
|---|
| 4584 |     return 8; |
|---|
| 4585 | } |
|---|
| 4586 | |
|---|
| 4587 | # Registers used: |
|---|
| 4588 | #Â Â 0x3E: Manufacturer ID |
|---|
| 4589 | #Â Â 0x3F: Version/Stepping |
|---|
| 4590 | sub lm93_detect |
|---|
| 4591 | { |
|---|
| 4592 |     my ($file, $addr) = @_; |
|---|
| 4593 |     return unless i2c_smbus_read_byte_data($file, 0x3E) == 0x01 |
|---|
| 4594 |          and i2c_smbus_read_byte_data($file, 0x3F) == 0x73; |
|---|
| 4595 |     return 5; |
|---|
| 4596 | } |
|---|
| 4597 | |
|---|
| 4598 | # Registers used: |
|---|
| 4599 | #Â Â 0x3F: Revision ID |
|---|
| 4600 | #Â Â 0x48: Address |
|---|
| 4601 | #Â Â 0x4A, 0x4B, 0x4F, 0x57, 0x58: Reserved bits. |
|---|
| 4602 | # We do not use 0x49's reserved bits on purpose. The register is named |
|---|
| 4603 | # "VID4/Device ID" so it is doubtful bits 7-1 are really unused. |
|---|
| 4604 | sub m5879_detect |
|---|
| 4605 | { |
|---|
| 4606 |     my ($file, $addr) = @_; |
|---|
| 4607 | |
|---|
| 4608 |     return unless i2c_smbus_read_byte_data($file, 0x3F) == 0x01; |
|---|
| 4609 |     return unless i2c_smbus_read_byte_data($file, 0x48) == $addr; |
|---|
| 4610 | |
|---|
| 4611 |     return unless (i2c_smbus_read_byte_data($file, 0x4A) & 0x06) == 0 |
|---|
| 4612 |          and (i2c_smbus_read_byte_data($file, 0x4B) & 0xFC) == 0 |
|---|
| 4613 |          and (i2c_smbus_read_byte_data($file, 0x4F) & 0xFC) == 0 |
|---|
| 4614 |          and (i2c_smbus_read_byte_data($file, 0x57) & 0xFE) == 0 |
|---|
| 4615 |          and (i2c_smbus_read_byte_data($file, 0x58) & 0xEF) == 0; |
|---|
| 4616 | |
|---|
| 4617 |     return 7; |
|---|
| 4618 | } |
|---|
| 4619 | |
|---|
| 4620 | # Registers used: |
|---|
| 4621 | #Â Â 0x3E: Manufacturer ID |
|---|
| 4622 | #Â Â 0x3F: Version/Stepping |
|---|
| 4623 | #Â Â 0x47: VID (3 reserved bits) |
|---|
| 4624 | #Â Â 0x49: VID4 (7 reserved bits) |
|---|
| 4625 | sub smsc47m192_detect |
|---|
| 4626 | { |
|---|
| 4627 |     my ($file, $addr) = @_; |
|---|
| 4628 |     return unless i2c_smbus_read_byte_data($file, 0x3E) == 0x55 |
|---|
| 4629 |          and (i2c_smbus_read_byte_data($file, 0x3F) & 0xF0) == 0x20 |
|---|
| 4630 |          and (i2c_smbus_read_byte_data($file, 0x47) & 0x70) == 0x00 |
|---|
| 4631 |          and (i2c_smbus_read_byte_data($file, 0x49) & 0xFE) == 0x80; |
|---|
| 4632 |     return ($addr == 0x2d ? 6 : 5); |
|---|
| 4633 | } |
|---|
| 4634 | |
|---|
| 4635 | # Chip to detect: 1 = DME1737, 2 = SCH5027 |
|---|
| 4636 | # Registers used: |
|---|
| 4637 | #Â Â 0x3E: Manufacturer ID |
|---|
| 4638 | #Â Â 0x3F: Version/Stepping |
|---|
| 4639 | #Â Â 0x73: Read-only test register (4 test bits) |
|---|
| 4640 | #Â Â 0x8A: Read-only test register (7 test bits) |
|---|
| 4641 | #Â Â 0xBA: Read-only test register (8 test bits) |
|---|
| 4642 | sub dme1737_detect |
|---|
| 4643 | { |
|---|
| 4644 |     my ($file, $addr, $chip) = @_; |
|---|
| 4645 |     my $vendor = i2c_smbus_read_byte_data($file, 0x3E); |
|---|
| 4646 |     my $verstep = i2c_smbus_read_byte_data($file, 0x3F); |
|---|
| 4647 | |
|---|
| 4648 |     return unless $vendor == 0x5C; # SMSC |
|---|
| 4649 | |
|---|
| 4650 |     if ($chip == 1) { # DME1737 |
|---|
| 4651 |         return unless ($verstep & 0xF8) == 0x88 and |
|---|
| 4652 |                (i2c_smbus_read_byte_data($file, 0x73) & 0x0F) == 0x09 and |
|---|
| 4653 |                (i2c_smbus_read_byte_data($file, 0x8A) & 0x7F) == 0x4D; |
|---|
| 4654 |     } elsif ($chip == 2) { # SCH5027 |
|---|
| 4655 |         return unless $verstep >= 0x69 and $verstep <= 0x6F and |
|---|
| 4656 |                i2c_smbus_read_byte_data($file, 0xBA) == 0x0F; |
|---|
| 4657 | Â Â Â Â } |
|---|
| 4658 | |
|---|
| 4659 |     return ($addr == 0x2e ? 6 : 5); |
|---|
| 4660 | } |
|---|
| 4661 | |
|---|
| 4662 | # Chip to detect: 1 = F75111R/RG/N, 2 = F75121R/F75122R/RG, 3 = F75373S/SG, |
|---|
| 4663 | #Â Â Â Â Â Â Â Â Â 4 = F75375S/SP, 5 = F75387SG/RG, 6 = F75383M/S/F75384M/S, |
|---|
| 4664 | #Â Â Â Â Â Â Â Â Â 7 = custom power control IC |
|---|
| 4665 | # Registers used: |
|---|
| 4666 | #Â Â 0x5A-0x5B: Chip ID |
|---|
| 4667 | #Â Â 0x5D-0x5E: Vendor ID |
|---|
| 4668 | sub fintek_detect |
|---|
| 4669 | { |
|---|
| 4670 |     my ($file, $addr, $chip) = @_; |
|---|
| 4671 |     my $chipid = (i2c_smbus_read_byte_data($file, 0x5A) << 8) |
|---|
| 4672 |           | i2c_smbus_read_byte_data($file, 0x5B); |
|---|
| 4673 |     my $vendid = (i2c_smbus_read_byte_data($file, 0x5D) << 8) |
|---|
| 4674 |           | i2c_smbus_read_byte_data($file, 0x5E); |
|---|
| 4675 | |
|---|
| 4676 |     return unless $vendid == 0x1934; # Fintek ID |
|---|
| 4677 | |
|---|
| 4678 |     if ($chip == 1) { # F75111R/RG/N |
|---|
| 4679 |         return unless $chipid == 0x0300; |
|---|
| 4680 |     } elsif ($chip == 2) { # F75121R/F75122R/RG |
|---|
| 4681 |         return unless $chipid == 0x0301; |
|---|
| 4682 |     } elsif ($chip == 3) { # F75373S/SG |
|---|
| 4683 |         return unless $chipid == 0x0204; |
|---|
| 4684 |     } elsif ($chip == 4) { # F75375S/SP |
|---|
| 4685 |         return unless $chipid == 0x0306; |
|---|
| 4686 |     } elsif ($chip == 5) { # F75387SG/RG |
|---|
| 4687 |         return unless $chipid == 0x0410; |
|---|
| 4688 |     } elsif ($chip == 6) { # F75383M/S/F75384M/S |
|---|
| 4689 | Â Â Â Â Â Â Â Â # The datasheet has 0x0303, but Fintek say 0x0413 is also |
|---|
| 4690 | Â Â Â Â Â Â Â Â # possible |
|---|
| 4691 |         return unless $chipid == 0x0303 || $chipid == 0x0413; |
|---|
| 4692 |     } elsif ($chip == 7) { # custom power control IC |
|---|
| 4693 |         return unless $chipid == 0x0302; |
|---|
| 4694 | Â Â Â Â } |
|---|
| 4695 | |
|---|
| 4696 |     return 7; |
|---|
| 4697 | } |
|---|
| 4698 | |
|---|
| 4699 | # This checks for non-FFFF values for temperature, voltage, and current. |
|---|
| 4700 | # The address (0x0b) is specified by the SMBus standard so it's likely |
|---|
| 4701 | # that this really is a smart battery. |
|---|
| 4702 | sub smartbatt_detect |
|---|
| 4703 | { |
|---|
| 4704 |     my ($file, $addr) = @_; |
|---|
| 4705 | |
|---|
| 4706 |     return if i2c_smbus_read_word_data($file, 0x08) == 0xffff |
|---|
| 4707 |         || i2c_smbus_read_word_data($file, 0x09) == 0xffff |
|---|
| 4708 |         || i2c_smbus_read_word_data($file, 0x0a) == 0xffff; |
|---|
| 4709 |     return 5; |
|---|
| 4710 | } |
|---|
| 4711 | |
|---|
| 4712 | # Chip to detect: 0 = W83L784R/AR/G, 1 = W83L785R/G, 2 = W83L786NR/NG/R/G, |
|---|
| 4713 | #Â Â Â Â Â Â Â Â Â 3 = W83L785TS-S |
|---|
| 4714 | # Registers used: |
|---|
| 4715 | #Â Â 0x40: Configuration |
|---|
| 4716 | #Â Â 0x4a: Full I2C Address (W83L784R only) |
|---|
| 4717 | #Â Â 0x4b: I2C addresses of emulated LM75 chips (W83L784R only) |
|---|
| 4718 | #Â Â 0x4c: Winbond Vendor ID (Low Byte) |
|---|
| 4719 | #Â Â 0x4d: Winbond Vendor ID (High Byte) |
|---|
| 4720 | #Â Â 0x4e: Chip ID |
|---|
| 4721 | sub w83l784r_detect |
|---|
| 4722 | { |
|---|
| 4723 |     my ($file, $addr, $chip) = @_; |
|---|
| 4724 |     my ($reg, @res); |
|---|
| 4725 | |
|---|
| 4726 |     return unless (i2c_smbus_read_byte_data($file, 0x40) & 0x80) == 0x00; |
|---|
| 4727 |     return if $chip == 0 |
|---|
| 4728 |        and i2c_smbus_read_byte_data($file, 0x4a) != $addr; |
|---|
| 4729 |     return unless i2c_smbus_read_byte_data($file, 0x4c) == 0xa3; |
|---|
| 4730 |     return unless i2c_smbus_read_byte_data($file, 0x4d) == 0x5c; |
|---|
| 4731 | |
|---|
| 4732 |     $reg = i2c_smbus_read_byte_data($file, 0x4e); |
|---|
| 4733 |     return if $chip == 0 and $reg != 0x50; |
|---|
| 4734 |     return if $chip == 1 and $reg != 0x60; |
|---|
| 4735 |     return if $chip == 2 and $reg != 0x80; |
|---|
| 4736 |     return if $chip == 3 and $reg != 0x70; |
|---|
| 4737 | |
|---|
| 4738 |     return 8 if $chip != 0; # No subclients |
|---|
| 4739 | |
|---|
| 4740 |     @res = (8); |
|---|
| 4741 |     $reg = i2c_smbus_read_byte_data($file, 0x4b); |
|---|
| 4742 |     push @res, ($reg & 0x07) + 0x48 unless $reg & 0x08; |
|---|
| 4743 |     push @res, (($reg & 0x70) >> 4) + 0x48 unless $reg & 0x80; |
|---|
| 4744 |     return @res; |
|---|
| 4745 | } |
|---|
| 4746 | |
|---|
| 4747 | # The max6650 has no device ID register. However, a few registers have |
|---|
| 4748 | # spare bits, which are documented as being always zero on read. We read |
|---|
| 4749 | # all of these registers check the spare bits. Any non-zero means this |
|---|
| 4750 | # is not a max6650/1. |
|---|
| 4751 | # |
|---|
| 4752 | # The always zero bits are: |
|---|
| 4753 | #Â Â configuration byte register (0x02) - top 2 bits |
|---|
| 4754 | #Â Â gpio status register (0x14) - top 3 bits |
|---|
| 4755 | #Â Â alarm enable register (0x08) - top 3 bits |
|---|
| 4756 | #Â Â alarm status register (0x0A) - top 3 bits |
|---|
| 4757 | #Â Â tachometer count time register (0x16) - top 6 bits |
|---|
| 4758 | # Additionally, not all values are possible for lower 3 bits of |
|---|
| 4759 | # the configuration register. |
|---|
| 4760 | sub max6650_detect |
|---|
| 4761 | { |
|---|
| 4762 |     my ($file, $addr) = @_; |
|---|
| 4763 | |
|---|
| 4764 |     my $conf = i2c_smbus_read_byte_data($file, 0x02); |
|---|
| 4765 | |
|---|
| 4766 |     return if i2c_smbus_read_byte_data($file, 0x16) & 0xFC; |
|---|
| 4767 |     return if i2c_smbus_read_byte_data($file, 0x0A) & 0xE0; |
|---|
| 4768 |     return if i2c_smbus_read_byte_data($file, 0x08) & 0xE0; |
|---|
| 4769 |     return if i2c_smbus_read_byte_data($file, 0x14) & 0xE0; |
|---|
| 4770 |     return if ($conf & 0xC0) or ($conf & 0x07) > 4; |
|---|
| 4771 | |
|---|
| 4772 |     return 3; |
|---|
| 4773 | } |
|---|
| 4774 | |
|---|
| 4775 | sub max6655_detect |
|---|
| 4776 | { |
|---|
| 4777 |     my ($file, $addr) = @_; |
|---|
| 4778 | |
|---|
| 4779 | Â Â Â Â # checking RDID (Device ID) |
|---|
| 4780 |     return unless i2c_smbus_read_byte_data($file, 0xfe) == 0x0a; |
|---|
| 4781 | Â Â Â Â # checking RDRV (Manufacturer ID) |
|---|
| 4782 |     return unless i2c_smbus_read_byte_data($file, 0xff) == 0x4d; |
|---|
| 4783 | Â Â Â Â # checking unused bits (conversion rate, extended temperature) |
|---|
| 4784 |     return unless i2c_smbus_read_byte_data($file, 0x04) & 0xf8; |
|---|
| 4785 |     return unless i2c_smbus_read_byte_data($file, 0x10) & 0x1f; |
|---|
| 4786 |     return unless i2c_smbus_read_byte_data($file, 0x11) & 0x1f; |
|---|
| 4787 |     return unless i2c_smbus_read_byte_data($file, 0x12) & 0x1f; |
|---|
| 4788 | |
|---|
| 4789 |     return 6; |
|---|
| 4790 | } |
|---|
| 4791 | |
|---|
| 4792 | # This isn't very good detection. |
|---|
| 4793 | # Verify the i2c address, and the stepping ID (which is 0xb0 on |
|---|
| 4794 | # my chip but could be different for others... |
|---|
| 4795 | sub vt1211_i2c_detect |
|---|
| 4796 | { |
|---|
| 4797 |     my ($file, $addr) = @_; |
|---|
| 4798 |     return unless (i2c_smbus_read_byte_data($file, 0x48) & 0x7f) == $addr; |
|---|
| 4799 |     return unless i2c_smbus_read_byte_data($file, 0x3f) == 0xb0; |
|---|
| 4800 |     return 2; |
|---|
| 4801 | } |
|---|
| 4802 | |
|---|
| 4803 | # All ISA detection functions below take at least 1 parameter: |
|---|
| 4804 | # $_[0]: Address |
|---|
| 4805 | # Some of these functions which can detect more than one type of device, |
|---|
| 4806 | # take a second parameter: |
|---|
| 4807 | # $_[1]: Chip to detect |
|---|
| 4808 | |
|---|
| 4809 | # Chip to detect: 0 = LM78, 2 = LM79 |
|---|
| 4810 | sub lm78_isa_detect |
|---|
| 4811 | { |
|---|
| 4812 |     my ($addr, $chip) = @_; |
|---|
| 4813 |     my $val = inb($addr + 1); |
|---|
| 4814 |     return if inb($addr + 2) != $val or inb($addr + 3) != $val or |
|---|
| 4815 |          inb($addr + 7) != $val; |
|---|
| 4816 | |
|---|
| 4817 |     $val = inb($addr + 5); |
|---|
| 4818 |     outb($addr + 5, ~$val & 0x7f); |
|---|
| 4819 |     if ((inb($addr+5) & 0x7f) != (~ $val & 0x7f)) { |
|---|
| 4820 |         outb($addr+5, $val); |
|---|
| 4821 | Â Â Â Â Â Â Â Â return; |
|---|
| 4822 | Â Â Â Â } |
|---|
| 4823 | |
|---|
| 4824 |     return unless (isa_read_i5d6($addr, 0x40) & 0x80) == 0x00; |
|---|
| 4825 |     my $reg = isa_read_i5d6($addr, 0x49); |
|---|
| 4826 |     return if $chip == 0 && ($reg != 0x00 && $reg != 0x20 && $reg != 0x40); |
|---|
| 4827 |     return if $chip == 2 && ($reg & 0xfe) != 0xc0; |
|---|
| 4828 | |
|---|
| 4829 | Â Â Â Â # Explicitly prevent misdetection of Winbond chips |
|---|
| 4830 |     $reg = isa_read_i5d6($addr, 0x4f); |
|---|
| 4831 |     return if $reg == 0xa3 || $reg == 0x5c; |
|---|
| 4832 | |
|---|
| 4833 | Â Â Â Â # Explicitly prevent misdetection of ITE chips |
|---|
| 4834 |     $reg = isa_read_i5d6($addr, 0x58); |
|---|
| 4835 |     return if $reg == 0x90; |
|---|
| 4836 | |
|---|
| 4837 |     return 6; |
|---|
| 4838 | } |
|---|
| 4839 | |
|---|
| 4840 | # Chip to detect: 0 = W83781D, 1 = W83782D |
|---|
| 4841 | sub w83781d_isa_detect |
|---|
| 4842 | { |
|---|
| 4843 |     my ($addr, $chip) = @_; |
|---|
| 4844 |     my ($reg1, $reg2); |
|---|
| 4845 |     my $val = inb($addr + 1); |
|---|
| 4846 |     return if inb($addr + 2) != $val or inb($addr + 3) != $val or |
|---|
| 4847 |          inb($addr + 7) != $val; |
|---|
| 4848 | |
|---|
| 4849 |     $val = inb($addr + 5); |
|---|
| 4850 |     outb($addr+5, ~$val & 0x7f); |
|---|
| 4851 |     if ((inb($addr+5) & 0x7f) != (~ $val & 0x7f)) { |
|---|
| 4852 |         outb($addr+5, $val); |
|---|
| 4853 | Â Â Â Â Â Â Â Â return; |
|---|
| 4854 | Â Â Â Â } |
|---|
| 4855 | |
|---|
| 4856 |     $reg1 = isa_read_i5d6($addr, 0x4e); |
|---|
| 4857 |     $reg2 = isa_read_i5d6($addr, 0x4f); |
|---|
| 4858 |     return unless (($reg1 & 0x80) == 0x00 and $reg2 == 0xa3) or |
|---|
| 4859 |            (($reg1 & 0x80) == 0x80 and $reg2 == 0x5c); |
|---|
| 4860 |     return unless ($reg1 & 0x07) == 0x00; |
|---|
| 4861 |     $reg1 = isa_read_i5d6($addr, 0x58); |
|---|
| 4862 |     return if $chip == 0 && ($reg1 & 0xfe) != 0x10; |
|---|
| 4863 |     return if $chip == 1 && ($reg1 & 0xfe) != 0x30; |
|---|
| 4864 | |
|---|
| 4865 |     return 8; |
|---|
| 4866 | } |
|---|
| 4867 | |
|---|
| 4868 | # We simply look for a register at standard locations. |
|---|
| 4869 | # For KCS, use the STATUS register. For SMIC, use the FLAGS register. |
|---|
| 4870 | # Incidentally they live at the same offset. |
|---|
| 4871 | sub ipmi_detect |
|---|
| 4872 | { |
|---|
| 4873 |     my ($addr) = @_; |
|---|
| 4874 |     return if inb($addr + 3) == 0xff; |
|---|
| 4875 |     return 4; |
|---|
| 4876 | } |
|---|
| 4877 | |
|---|
| 4878 | ################### |
|---|
| 4879 | # ALIAS DETECTION # |
|---|
| 4880 | ################### |
|---|
| 4881 | |
|---|
| 4882 | # These functions take at least 3 parameters: |
|---|
| 4883 | # $_[0]: ISA/LPC address |
|---|
| 4884 | # $_[1]: I2C file handle |
|---|
| 4885 | # $_[2]: I2C address |
|---|
| 4886 | # Some of these functions may take extra parameters. |
|---|
| 4887 | # They return 1 if both devices are the same, 0 if not. |
|---|
| 4888 | |
|---|
| 4889 | # Extra parameters: |
|---|
| 4890 | # $_[3]: First limit register to compare |
|---|
| 4891 | # $_[4]: Last limit register to compare |
|---|
| 4892 | sub winbond_alias_detect |
|---|
| 4893 | { |
|---|
| 4894 |     my ($isa_addr, $file, $i2c_addr, $first, $last) = @_; |
|---|
| 4895 |     my $i; |
|---|
| 4896 | |
|---|
| 4897 |     return 0 unless isa_read_i5d6($isa_addr, 0x48) == $i2c_addr; |
|---|
| 4898 |     for ($i = $first; $i <= $last; $i++) { |
|---|
| 4899 |         return 0 unless isa_read_i5d6($isa_addr, $i) == |
|---|
| 4900 |                 i2c_smbus_read_byte_data($file, $i); |
|---|
| 4901 | Â Â Â Â } |
|---|
| 4902 |     return 1; |
|---|
| 4903 | } |
|---|
| 4904 | |
|---|
| 4905 | ############################ |
|---|
| 4906 | # PCI CHIP / CPU DETECTION # |
|---|
| 4907 | ############################ |
|---|
| 4908 | |
|---|
| 4909 | sub sis5595_pci_detect |
|---|
| 4910 | { |
|---|
| 4911 |     return unless exists $pci_list{'1039:0008'}; |
|---|
| 4912 |     return 9; |
|---|
| 4913 | } |
|---|
| 4914 | |
|---|
| 4915 | sub via686a_pci_detect |
|---|
| 4916 | { |
|---|
| 4917 |     return unless exists $pci_list{'1106:3057'}; |
|---|
| 4918 |     return 9; |
|---|
| 4919 | } |
|---|
| 4920 | |
|---|
| 4921 | sub via8231_pci_detect |
|---|
| 4922 | { |
|---|
| 4923 |     return unless exists $pci_list{'1106:8235'}; |
|---|
| 4924 |     return 9; |
|---|
| 4925 | } |
|---|
| 4926 | |
|---|
| 4927 | sub k8temp_pci_detect |
|---|
| 4928 | { |
|---|
| 4929 |     return unless exists $pci_list{'1022:1103'}; |
|---|
| 4930 |     return 9; |
|---|
| 4931 | } |
|---|
| 4932 | |
|---|
| 4933 | sub k10temp_pci_detect |
|---|
| 4934 | { |
|---|
| 4935 |     return unless exists $pci_list{'1022:1203'}; |
|---|
| 4936 |     return 9; |
|---|
| 4937 | } |
|---|
| 4938 | |
|---|
| 4939 | sub intel_amb_detect |
|---|
| 4940 | { |
|---|
| 4941 |     if ((exists $pci_list{'8086:25f0'}) || # Intel 5000 |
|---|
| 4942 |       (exists $pci_list{'8086:4030'})) { # Intel 5400 |
|---|
| 4943 |         return 9; |
|---|
| 4944 | Â Â Â Â } |
|---|
| 4945 | Â Â Â Â return; |
|---|
| 4946 | } |
|---|
| 4947 | |
|---|
| 4948 | sub coretemp_detect |
|---|
| 4949 | { |
|---|
| 4950 |     my $probecpu; |
|---|
| 4951 |     foreach $probecpu (@cpu) { |
|---|
| 4952 |         if ($probecpu->{vendor_id} eq 'GenuineIntel' && |
|---|
| 4953 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $probecpu->{'cpu family'}Â ==Â 6Â && |
|---|
| 4954 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ($probecpu->{model}Â ==Â 14Â || |
|---|
| 4955 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $probecpu->{model}Â ==Â 15Â || |
|---|
| 4956 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $probecpu->{model}Â ==Â 0x16Â || |
|---|
| 4957 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $probecpu->{model}Â ==Â 0x17Â || |
|---|
| 4958 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $probecpu->{model}Â ==Â 0x1a))Â { |
|---|
| 4959 |             return 9; |
|---|
| 4960 | Â Â Â Â Â Â Â Â } |
|---|
| 4961 | Â Â Â Â } |
|---|
| 4962 | Â Â Â Â return; |
|---|
| 4963 | } |
|---|
| 4964 | |
|---|
| 4965 | sub c7temp_detect |
|---|
| 4966 | { |
|---|
| 4967 |     my $probecpu; |
|---|
| 4968 |     foreach $probecpu (@cpu) { |
|---|
| 4969 |         if ($probecpu->{vendor_id} eq 'CentaurHauls' && |
|---|
| 4970 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $probecpu->{'cpu family'}Â ==Â 6Â && |
|---|
| 4971 |                 ($probecpu->{model} == 0xa || |
|---|
| 4972 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $probecpu->{model}Â ==Â 0xd))Â { |
|---|
| 4973 |             return 9; |
|---|
| 4974 | Â Â Â Â Â Â Â Â } |
|---|
| 4975 | Â Â Â Â } |
|---|
| 4976 | Â Â Â Â return; |
|---|
| 4977 | } |
|---|
| 4978 | |
|---|
| 4979 | ################# |
|---|
| 4980 | # SPECIAL MODES # |
|---|
| 4981 | ################# |
|---|
| 4982 | |
|---|
| 4983 | sub show_i2c_stats |
|---|
| 4984 | { |
|---|
| 4985 |     my ($chip, $addr, %histo, $chips); |
|---|
| 4986 | |
|---|
| 4987 | Â Â Â Â # Gather the data |
|---|
| 4988 |     foreach $chip (@chip_ids) { |
|---|
| 4989 |         next unless defined $chip->{i2c_addrs}; |
|---|
| 4990 | Â Â Â Â Â Â Â Â $chips++; |
|---|
| 4991 |         foreach my $addr (@{$chip->{i2c_addrs}}) { |
|---|
| 4992 | Â Â Â Â Â Â Â Â Â Â Â Â $histo{$addr}++; |
|---|
| 4993 | Â Â Â Â Â Â Â Â } |
|---|
| 4994 | Â Â Â Â } |
|---|
| 4995 | |
|---|
| 4996 | Â Â Â Â # Display the data |
|---|
| 4997 |     printf "\%d I2C chips known, \%d I2C addresses probed\n\n", |
|---|
| 4998 |         $chips, scalar keys %histo; |
|---|
| 4999 |     print "   0 1 2 3 4 5 6 7 8 9 a b c d e f\n". |
|---|
| 5000 | Â Â Â Â Â Â Â "00:Â Â Â Â Â "; |
|---|
| 5001 |     for (my $addr = 0x03; $addr <= 0x77; $addr++) { |
|---|
| 5002 |         printf("\n\%02x:", $addr) if ($addr % 16) == 0; |
|---|
| 5003 |         if (defined $histo{$addr}) { |
|---|
| 5004 |             printf ' %02d', $histo{$addr}; |
|---|
| 5005 |         } else { |
|---|
| 5006 |             print ' --'; |
|---|
| 5007 | Â Â Â Â Â Â Â Â } |
|---|
| 5008 | Â Â Â Â } |
|---|
| 5009 |     print "\n"; |
|---|
| 5010 | } |
|---|
| 5011 | |
|---|
| 5012 | ################ |
|---|
| 5013 | # MAIN PROGRAM # |
|---|
| 5014 | ################ |
|---|
| 5015 | |
|---|
| 5016 | # $_[0]: reference to a list of chip hashes |
|---|
| 5017 | sub print_chips_report |
|---|
| 5018 | { |
|---|
| 5019 |     my ($listref) = @_; |
|---|
| 5020 |     my $data; |
|---|
| 5021 | |
|---|
| 5022 |     foreach $data (@$listref) { |
|---|
| 5023 |         my $is_i2c = exists $data->{i2c_addr}; |
|---|
| 5024 |         my $is_isa = exists $data->{isa_addr}; |
|---|
| 5025 |         print " * "; |
|---|
| 5026 |         if ($is_i2c) { |
|---|
| 5027 |             printf "Bus `%s'\n", $i2c_adapters[$data->{i2c_devnr}]->{name}; |
|---|
| 5028 |             printf "  Busdriver `%s', I2C address 0x%02x", |
|---|
| 5029 |                 $i2c_adapters[$data->{i2c_devnr}]->{driver}, $data->{i2c_addr}; |
|---|
| 5030 |             if (exists $data->{i2c_sub_addrs}) { |
|---|
| 5031 |                 print " (and"; |
|---|
| 5032 |                 my $sub_addr; |
|---|
| 5033 |                 foreach $sub_addr (@{$data->{i2c_sub_addrs}}) { |
|---|
| 5034 |                     printf " 0x%02x", $sub_addr; |
|---|
| 5035 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 5036 |                 print ")" |
|---|
| 5037 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 5038 |             print "\n  "; |
|---|
| 5039 | Â Â Â Â Â Â Â Â } |
|---|
| 5040 |         if ($is_isa) { |
|---|
| 5041 |             print "ISA bus"; |
|---|
| 5042 |             if ($data->{isa_addr}) { |
|---|
| 5043 |                 printf ", address 0x%x", $data->{isa_addr}; |
|---|
| 5044 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 5045 |             print " (Busdriver `i2c-isa')" |
|---|
| 5046 |                 unless kernel_version_at_least(2, 6, 18); |
|---|
| 5047 |             print "\n  "; |
|---|
| 5048 | Â Â Â Â Â Â Â Â } |
|---|
| 5049 |         printf "Chip `%s' (confidence: %d)\n", |
|---|
| 5050 |             $data->{chipname}, $data->{conf}; |
|---|
| 5051 | Â Â Â Â } |
|---|
| 5052 | } |
|---|
| 5053 | |
|---|
| 5054 | sub generate_modprobes |
|---|
| 5055 | { |
|---|
| 5056 |     my ($driver, $detection, $adap); |
|---|
| 5057 |     my ($isa, $ipmi); |
|---|
| 5058 |     my ($modprobes, $configfile, %bus_modules, %hwmon_modules); |
|---|
| 5059 | |
|---|
| 5060 |     foreach $driver (keys %chips_detected) { |
|---|
| 5061 |         foreach $detection (@{$chips_detected{$driver}}) { |
|---|
| 5062 | Â Â Â Â Â Â Â Â Â Â Â Â # Tag adapters which host hardware monitoring chips we want to access |
|---|
| 5063 |             if (exists $detection->{i2c_devnr} |
|---|
| 5064 |              && !exists $detection->{isa_addr}) { |
|---|
| 5065 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $i2c_adapters[$detection->{i2c_devnr}]->{used}++; |
|---|
| 5066 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 5067 | |
|---|
| 5068 |             if (exists $detection->{isa_addr}) { |
|---|
| 5069 |                 $isa = 1; |
|---|
| 5070 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 5071 | Â Â Â Â Â Â Â Â } |
|---|
| 5072 |         if ($driver eq "ipmisensors") { |
|---|
| 5073 |             $ipmi = 1; |
|---|
| 5074 | Â Â Â Â Â Â Â Â } |
|---|
| 5075 | Â Â Â Â } |
|---|
| 5076 | |
|---|
| 5077 | Â Â Â Â # Handle aliases |
|---|
| 5078 | Â Â Â Â # As of kernel 2.6.28, alias detection is handled by kernel drivers |
|---|
| 5079 | Â Â Â Â # directly, so module options are no longer needed. |
|---|
| 5080 |     unless (kernel_version_at_least(2, 6, 28)) { |
|---|
| 5081 |         foreach $driver (keys %chips_detected) { |
|---|
| 5082 |             my @optionlist = (); |
|---|
| 5083 |             foreach $detection (@{$chips_detected{$driver}}) { |
|---|
| 5084 |                 next unless exists $detection->{i2c_addr} |
|---|
| 5085 |                      && exists $detection->{isa_addr} |
|---|
| 5086 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &&Â $i2c_adapters[$detection->{i2c_devnr}]->{used}; |
|---|
| 5087 | |
|---|
| 5088 |                 push @optionlist, sprintf("%d,0x%02x", |
|---|
| 5089 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $detection->{i2c_devnr}, |
|---|
| 5090 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $detection->{i2c_addr}); |
|---|
| 5091 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 5092 | |
|---|
| 5093 |             next if not @optionlist; |
|---|
| 5094 |             $configfile = "# hwmon module options\n" |
|---|
| 5095 |                 unless defined $configfile; |
|---|
| 5096 |             $configfile .= "options $driver ignore=". |
|---|
| 5097 |                     (join ",", @optionlist)."\n"; |
|---|
| 5098 | Â Â Â Â Â Â Â Â } |
|---|
| 5099 | Â Â Â Â } |
|---|
| 5100 | |
|---|
| 5101 | Â Â Â Â # If we added any module option to handle aliases, we need to load all |
|---|
| 5102 | Â Â Â Â # the adapter drivers so that the numbers will be the same. If not, then |
|---|
| 5103 | Â Â Â Â # we only load the adapter drivers which are useful. |
|---|
| 5104 |     foreach $adap (@i2c_adapters) { |
|---|
| 5105 |         next unless loaded_by_us($adap->{driver}); |
|---|
| 5106 |         next if not defined $configfile and not $adap->{used}; |
|---|
| 5107 |         $modprobes .= "# I2C adapter drivers\n" unless defined $modprobes; |
|---|
| 5108 |         $modprobes .= "modprobe $adap->{driver}\n" |
|---|
| 5109 |             unless exists $bus_modules{$adap->{driver}}; |
|---|
| 5110 | Â Â Â Â Â Â Â Â $bus_modules{$adap->{driver}}++; |
|---|
| 5111 | Â Â Â Â } |
|---|
| 5112 | |
|---|
| 5113 | Â Â Â Â # i2c-isa is loaded automatically (as a dependency) since 2.6.14, |
|---|
| 5114 | Â Â Â Â # and will soon be gone. |
|---|
| 5115 |     if ($isa && !kernel_version_at_least(2, 6, 18)) { |
|---|
| 5116 |         $modprobes .= "modprobe i2c-isa\n"; |
|---|
| 5117 | Â Â Â Â Â Â Â Â $bus_modules{"i2c-isa"}++; |
|---|
| 5118 | Â Â Â Â } |
|---|
| 5119 |     if ($ipmi) { |
|---|
| 5120 |         $modprobes .= "# You must also install and load the IPMI modules\n"; |
|---|
| 5121 |         $modprobes .= "modprobe ipmi-si\n"; |
|---|
| 5122 | Â Â Â Â Â Â Â Â $bus_modules{"ipmi-si"}++; |
|---|
| 5123 | Â Â Â Â } |
|---|
| 5124 | |
|---|
| 5125 | Â Â Â Â # Now determine the chip probe lines |
|---|
| 5126 |     $modprobes .= "# Chip drivers\n"; |
|---|
| 5127 |     foreach $driver (keys %chips_detected) { |
|---|
| 5128 |         next if not @{$chips_detected{$driver}}; |
|---|
| 5129 |         if ($driver eq "to-be-written") { |
|---|
| 5130 |             $modprobes .= "# no driver for ${$chips_detected{$driver}}[0]{chipname} yet\n"; |
|---|
| 5131 |         } else { |
|---|
| 5132 |             open(local *INPUTFILE, "modprobe -l $driver 2>/dev/null |"); |
|---|
| 5133 |             local $_; |
|---|
| 5134 |             my $modulefound = 0; |
|---|
| 5135 |             while (<INPUTFILE>) { |
|---|
| 5136 |                 if (m@/@) { |
|---|
| 5137 |                     $modulefound = 1; |
|---|
| 5138 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â last; |
|---|
| 5139 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 5140 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 5141 | Â Â Â Â Â Â Â Â Â Â Â Â close(INPUTFILE); |
|---|
| 5142 | Â Â Â Â Â Â Â Â Â Â Â Â # Check return value from modprobe in case modprobe -l |
|---|
| 5143 | Â Â Â Â Â Â Â Â Â Â Â Â # isn't supported |
|---|
| 5144 |             if ((($? >> 8) == 0) && ! $modulefound) { |
|---|
| 5145 |                 $modprobes .= "# Warning: the required module $driver is not currently installed\n". |
|---|
| 5146 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "# on your system. For status of 2.6 kernel ports check\n". |
|---|
| 5147 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "# http://www.lm-sensors.org/wiki/Devices. If driver is built\n". |
|---|
| 5148 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "# into the kernel, or unavailable, comment out the following line.\n"; |
|---|
| 5149 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 5150 |             $modprobes .= "modprobe $driver\n"; |
|---|
| 5151 | Â Â Â Â Â Â Â Â Â Â Â Â $hwmon_modules{$driver}++; |
|---|
| 5152 | Â Â Â Â Â Â Â Â } |
|---|
| 5153 | Â Â Â Â } |
|---|
| 5154 | |
|---|
| 5155 |     my @bus_modules = sort keys %bus_modules; |
|---|
| 5156 |     my @hwmon_modules = sort keys %hwmon_modules; |
|---|
| 5157 |     return ($modprobes, $configfile, \@bus_modules, \@hwmon_modules); |
|---|
| 5158 | } |
|---|
| 5159 | |
|---|
| 5160 | sub main |
|---|
| 5161 | { |
|---|
| 5162 |     my ($input, $superio_features); |
|---|
| 5163 | |
|---|
| 5164 | Â Â Â Â # Handle special command line cases first |
|---|
| 5165 |     if (defined $ARGV[0] && $ARGV[0] eq "--stat") { |
|---|
| 5166 | Â Â Â Â Â Â Â Â show_i2c_stats(); |
|---|
| 5167 |         exit 0; |
|---|
| 5168 | Â Â Â Â } |
|---|
| 5169 | |
|---|
| 5170 | Â Â Â Â # We won't go very far if not root |
|---|
| 5171 |     unless ($> == 0) { |
|---|
| 5172 |         print "You need to be root to run this script.\n"; |
|---|
| 5173 |         exit -1; |
|---|
| 5174 | Â Â Â Â } |
|---|
| 5175 | |
|---|
| 5176 |     if (-x "/sbin/service" && -f "/etc/init.d/lm_sensors" && |
|---|
| 5177 | Â Â Â Â Â Â -f "/var/lock/subsys/lm_sensors")Â { |
|---|
| 5178 |         system("/sbin/service", "lm_sensors", "stop"); |
|---|
| 5179 | Â Â Â Â } |
|---|
| 5180 | |
|---|
| 5181 | Â Â Â Â initialize_kernel_version(); |
|---|
| 5182 | Â Â Â Â initialize_conf(); |
|---|
| 5183 | Â Â Â Â initialize_pci(); |
|---|
| 5184 | Â Â Â Â initialize_modules_list(); |
|---|
| 5185 | Â Â Â Â # Make sure any special case chips are added to the chip_ids list |
|---|
| 5186 | Â Â Â Â # before making the support modules list |
|---|
| 5187 | Â Â Â Â chip_special_cases(); |
|---|
| 5188 | Â Â Â Â initialize_modules_supported(); |
|---|
| 5189 | Â Â Â Â initialize_cpu_list(); |
|---|
| 5190 | |
|---|
| 5191 |     print "# sensors-detect revision $revision\n"; |
|---|
| 5192 | Â Â Â Â initialize_dmi_data(); |
|---|
| 5193 | Â Â Â Â print_dmi_summary(); |
|---|
| 5194 |     print "\n"; |
|---|
| 5195 |     print "This program will help you determine which kernel modules you need\n", |
|---|
| 5196 | Â Â Â Â Â Â Â "to load to use lm_sensors most effectively. It is generally safe\n", |
|---|
| 5197 | Â Â Â Â Â Â Â "and recommended to accept the default answers to all questions,\n", |
|---|
| 5198 | Â Â Â Â Â Â Â "unless you know what you're doing.\n\n"; |
|---|
| 5199 | |
|---|
| 5200 |     print "Some south bridges, CPUs or memory controllers contain embedded sensors.\n". |
|---|
| 5201 | Â Â Â Â Â Â Â "Do you want to scan for them? This is totally safe. (YES/no): "; |
|---|
| 5202 |     unless (<STDIN> =~ /^\s*n/i) { |
|---|
| 5203 | Â Â Â Â Â Â Â Â $|Â =Â 1; |
|---|
| 5204 |         foreach my $entry (@cpu_ids) { |
|---|
| 5205 | Â Â Â Â Â Â Â Â Â Â Â Â scan_cpu($entry); |
|---|
| 5206 | Â Â Â Â Â Â Â Â } |
|---|
| 5207 | Â Â Â Â Â Â Â Â $|Â =Â 0; |
|---|
| 5208 | Â Â Â Â } |
|---|
| 5209 |     print "\n"; |
|---|
| 5210 | |
|---|
| 5211 |     $superio_features = 0; |
|---|
| 5212 | Â Â Â Â # Skip "random" I/O port probing on PPC |
|---|
| 5213 |     if ($kernel_arch ne 'ppc' |
|---|
| 5214 |      && $kernel_arch ne 'ppc64') { |
|---|
| 5215 |         print "Some Super I/O chips contain embedded sensors. We have to write to\n". |
|---|
| 5216 | Â Â Â Â Â Â Â Â Â Â Â "standard I/O ports to probe them. This is usually safe.\n"; |
|---|
| 5217 |         print "Do you want to scan for Super I/O sensors? (YES/no): "; |
|---|
| 5218 |         unless (<STDIN> =~ /^\s*n/i) { |
|---|
| 5219 | Â Â Â Â Â Â Â Â Â Â Â Â initialize_ioports(); |
|---|
| 5220 |             $superio_features |= scan_superio(0x2e, 0x2f); |
|---|
| 5221 |             $superio_features |= scan_superio(0x4e, 0x4f); |
|---|
| 5222 | Â Â Â Â Â Â Â Â Â Â Â Â close_ioports(); |
|---|
| 5223 | Â Â Â Â Â Â Â Â } |
|---|
| 5224 |         print "\n"; |
|---|
| 5225 | |
|---|
| 5226 |         unless (is_laptop()) { |
|---|
| 5227 |             print "Some systems (mainly servers) implement IPMI, a set of common interfaces\n". |
|---|
| 5228 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "through which system health data may be retrieved, amongst other things.\n". |
|---|
| 5229 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "We have to read from arbitrary I/O ports to probe for such interfaces.\n". |
|---|
| 5230 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "This is normally safe. Do you want to scan for IPMI interfaces?\n". |
|---|
| 5231 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "(YES/no): "; |
|---|
| 5232 |             unless (<STDIN> =~ /^\s*n/i) { |
|---|
| 5233 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â initialize_ioports(); |
|---|
| 5234 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â scan_isa_bus(\@ipmi_ifs); |
|---|
| 5235 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â close_ioports(); |
|---|
| 5236 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 5237 |             print "\n"; |
|---|
| 5238 | Â Â Â Â Â Â Â Â } |
|---|
| 5239 | |
|---|
| 5240 |         printf "Some hardware monitoring chips are accessible through the ISA I/O ports.\n". |
|---|
| 5241 | Â Â Â Â Â Â Â Â Â Â Â Â "We have to write to arbitrary I/O ports to probe them. This is usually\n". |
|---|
| 5242 | Â Â Â Â Â Â Â Â Â Â Â Â "safe though. Yes, you do have ISA I/O ports even if you do not have any\n". |
|---|
| 5243 | Â Â Â Â Â Â Â Â Â Â Â Â "ISA slots! Do you want to scan the ISA I/O ports? (\%s): ", |
|---|
| 5244 |             $superio_features ? "yes/NO" : "YES/no"; |
|---|
| 5245 |         $input = <STDIN>; |
|---|
| 5246 |         unless ($input =~ /^\s*n/i |
|---|
| 5247 |            || ($superio_features && $input !~ /^\s*y/i)) { |
|---|
| 5248 | Â Â Â Â Â Â Â Â Â Â Â Â initialize_ioports(); |
|---|
| 5249 | Â Â Â Â Â Â Â Â Â Â Â Â scan_isa_bus(\@chip_ids); |
|---|
| 5250 | Â Â Â Â Â Â Â Â Â Â Â Â close_ioports(); |
|---|
| 5251 | Â Â Â Â Â Â Â Â } |
|---|
| 5252 |         print "\n"; |
|---|
| 5253 | Â Â Â Â } |
|---|
| 5254 | |
|---|
| 5255 |     print "Lastly, we can probe the I2C/SMBus adapters for connected hardware\n". |
|---|
| 5256 | Â Â Â Â Â Â Â "monitoring devices. This is the most risky part, and while it works\n". |
|---|
| 5257 | Â Â Â Â Â Â Â "reasonably well on most systems, it has been reported to cause trouble\n". |
|---|
| 5258 | Â Â Â Â Â Â Â "on some systems.\n". |
|---|
| 5259 | Â Â Â Â Â Â Â "Do you want to probe the I2C/SMBus adapters now? (YES/no): "; |
|---|
| 5260 | |
|---|
| 5261 |     unless (<STDIN> =~ /^\s*n/i) { |
|---|
| 5262 | Â Â Â Â Â Â Â Â adapter_pci_detection(); |
|---|
| 5263 |         load_module("i2c-dev") unless -e "$sysfs_root/class/i2c-dev"; |
|---|
| 5264 | Â Â Â Â Â Â Â Â initialize_i2c_adapters_list(); |
|---|
| 5265 |         $i2c_addresses_to_scan = i2c_addresses_to_scan(); |
|---|
| 5266 |         print "\n"; |
|---|
| 5267 | |
|---|
| 5268 | Â Â Â Â Â Â Â Â # Skip SMBus probing by default if Super-I/O has all the features |
|---|
| 5269 |         my $by_default = ~$superio_features & (FEAT_IN | FEAT_FAN | FEAT_TEMP); |
|---|
| 5270 | Â Â Â Â Â Â Â Â # Except on Asus and Tyan boards which often have more than |
|---|
| 5271 | Â Â Â Â Â Â Â Â # one hardware monitoring chip |
|---|
| 5272 |         $by_default = 1 if dmi_match('board_vendor', 'asustek', 'tyan', |
|---|
| 5273 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 'supermicro'); |
|---|
| 5274 | |
|---|
| 5275 |         for (my $dev_nr = 0; $dev_nr < @i2c_adapters; $dev_nr++) { |
|---|
| 5276 |             next unless exists $i2c_adapters[$dev_nr]; |
|---|
| 5277 |             scan_i2c_adapter($dev_nr, $by_default); |
|---|
| 5278 | Â Â Â Â Â Â Â Â } |
|---|
| 5279 | Â Â Â Â } |
|---|
| 5280 | |
|---|
| 5281 |     if (!keys %chips_detected) { |
|---|
| 5282 |         print "Sorry, no sensors were detected.\n"; |
|---|
| 5283 |         if (is_laptop() && -d "$sysfs_root/firmware/acpi") { |
|---|
| 5284 |             print "This is relatively common on laptops, where thermal management is\n". |
|---|
| 5285 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "handled by ACPI rather than the OS.\n"; |
|---|
| 5286 |         } else { |
|---|
| 5287 |             print "Either your system has no sensors, or they are not supported, or\n". |
|---|
| 5288 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "they are connected to an I2C or SMBus adapter that is not\n". |
|---|
| 5289 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "supported. If you find out what chips are on your board, check\n". |
|---|
| 5290 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "http://www.lm-sensors.org/wiki/Devices for driver status.\n"; |
|---|
| 5291 | Â Â Â Â Â Â Â Â } |
|---|
| 5292 | Â Â Â Â Â Â Â Â exit; |
|---|
| 5293 | Â Â Â Â } |
|---|
| 5294 | |
|---|
| 5295 |     print "Now follows a summary of the probes I have just done.\n". |
|---|
| 5296 | Â Â Â Â Â Â Â "Just press ENTER to continue: "; |
|---|
| 5297 | Â Â Â Â <STDIN>; |
|---|
| 5298 | |
|---|
| 5299 |     foreach my $driver (keys %chips_detected) { |
|---|
| 5300 |         next unless @{$chips_detected{$driver}}; |
|---|
| 5301 | Â Â Â Â Â Â Â Â find_aliases($chips_detected{$driver}); |
|---|
| 5302 |         print "\nDriver `$driver':\n"; |
|---|
| 5303 | Â Â Â Â Â Â Â Â print_chips_report($chips_detected{$driver}); |
|---|
| 5304 | Â Â Â Â } |
|---|
| 5305 |     print "\n"; |
|---|
| 5306 | |
|---|
| 5307 |     my ($modprobes, $configfile, $bus_modules, $hwmon_modules) = generate_modprobes(); |
|---|
| 5308 | |
|---|
| 5309 |     if (defined $configfile) { |
|---|
| 5310 |         my $have_modprobe_d = -d '/etc/modprobe.d'; |
|---|
| 5311 |         printf "Do you want to \%s /etc/modprobe.d/lm_sensors? (\%s): ", |
|---|
| 5312 |             (-e '/etc/modprobe.d/lm_sensors' ? 'overwrite' : 'generate'), |
|---|
| 5313 |             ($have_modprobe_d ? 'YES/no' : 'yes/NO'); |
|---|
| 5314 | Â Â Â Â Â Â Â Â $_Â =Â <STDIN>; |
|---|
| 5315 |         if (($have_modprobe_d and not m/^\s*n/i) or m/^\s*y/i) { |
|---|
| 5316 |             unless ($have_modprobe_d) { |
|---|
| 5317 |                 mkdir('/etc/modprobe.d', 0777) |
|---|
| 5318 |                     or die "Sorry, can't create /etc/modprobe.d ($!)"; |
|---|
| 5319 | Â Â Â Â Â Â Â Â Â Â Â Â } |
|---|
| 5320 |             open(local *MODPROBE_D, ">/etc/modprobe.d/lm_sensors") |
|---|
| 5321 |                 or die "Sorry, can't create /etc/modprobe.d/lm_sensors ($!)"; |
|---|
| 5322 |             print MODPROBE_D "# Generated by sensors-detect on " . scalar localtime() . "\n"; |
|---|
| 5323 |             print MODPROBE_D $configfile; |
|---|
| 5324 | Â Â Â Â Â Â Â Â Â Â Â Â close(MODPROBE_D); |
|---|
| 5325 |         } else { |
|---|
| 5326 |             print "To make the sensors modules behave correctly, add these lines to\n". |
|---|
| 5327 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "/etc/modprobe.conf:\n\n"; |
|---|
| 5328 |             print "#----cut here----\n". |
|---|
| 5329 | Â Â Â Â Â Â Â Â Â Â Â |
|---|