| 1490 | | isa_addrs => [0x290], |
| 1491 | | isa_detect => sub { ite_isa_detect 0, @_ }, |
| 1492 | | alias_detect => sub { ite_alias_detect 0, @_ }, |
| 1493 | | }, |
| 1494 | | { |
| 1495 | | name => "ITE IT8716F", |
| 1496 | | driver => "it87", |
| 1497 | | isa_addrs => [0x290], |
| 1498 | | isa_detect => sub { ite_isa_detect 2, @_ }, |
| 1499 | | }, |
| 1500 | | { |
| 1501 | | name => "ITE IT8705F / SiS 950", |
| 1502 | | driver => "it87", |
| 1503 | | isa_addrs => [0x290], |
| 1504 | | isa_detect => sub { ite_isa_detect 1, @_ }, |
| 1505 | | } , |
| | 1490 | }, |
| 4421 | | # $_[0]: Chip to detect (0 = IT8712F, 1 = IT8705F/SiS950, 2 = IT8716F) |
| 4422 | | # $_[1]: Address |
| 4423 | | # Returns: undef if not detected, 7 or 8 if detected (tops LM78). |
| 4424 | | # Registers used: |
| 4425 | | # 0x00: Configuration |
| 4426 | | # 0x48: Full I2C Address (IT8712F only) |
| 4427 | | # 0x58: Mfr ID |
| 4428 | | # 0x5b: Device ID (not IT8705F) |
| 4429 | | # Note: Only address 0x290 is scanned at this moment. |
| 4430 | | sub ite_isa_detect |
| 4431 | | { |
| 4432 | | my ($chip,$addr) = @_ ; |
| 4433 | | my $val; |
| 4434 | | |
| 4435 | | if ($chip == 2) { |
| 4436 | | $val = inb ($addr + 6); |
| 4437 | | return if inb ($addr + 4) != $val or inb ($addr + 6) != $val or |
| 4438 | | inb ($addr + 7) != $val; |
| 4439 | | } else { |
| 4440 | | $val = inb ($addr + 1); |
| 4441 | | return if inb ($addr + 2) != $val or inb ($addr + 3) != $val or |
| 4442 | | inb ($addr + 7) != $val; |
| 4443 | | $val = inb($addr + 5) & 0x7f; |
| 4444 | | outb($addr+5, ~$val & 0xff); |
| 4445 | | if ((inb ($addr+5) & 0x7f) != (~ $val & 0x7f)) { |
| 4446 | | outb($addr+5,$val); |
| 4447 | | return; |
| 4448 | | } |
| 4449 | | } |
| 4450 | | |
| 4451 | | my $readproc = sub { isa_read_byte $addr + 5, $addr + 6, @_ }; |
| 4452 | | return unless (&$readproc(0x00) & 0x90) == 0x10; |
| 4453 | | return unless &$readproc(0x58) == 0x90; |
| 4454 | | return if $chip == 0 and &$readproc(0x5b) != 0x12; |
| 4455 | | return if $chip == 2 and &$readproc(0x5b) != 0x12; |
| 4456 | | return if $chip == 1 and &$readproc(0x5b) == 0x12; |
| 4457 | | |
| 4458 | | # Explcitely prevents misdetection of W83627THF |
| 4459 | | if ($chip == 1) { |
| 4460 | | my $val2 = &$readproc(0x4e); |
| 4461 | | $val = &$readproc(0x4f); |
| 4462 | | return if (($val2 & 0x80) && $val == 0x5c) |
| 4463 | | or (!($val2 & 0x80) && $val == 0xa3); |
| 4464 | | } |
| 4465 | | |
| 4466 | | # I2C address must be possible |
| 4467 | | if ($chip == 0) { |
| 4468 | | my $i2caddr = &$readproc(0x48); |
| 4469 | | return if ($i2caddr < 0x03 || $i2caddr > 0x77); |
| 4470 | | return (7 + ($i2caddr == 0x2d)); |
| 4471 | | } |
| 4472 | | |
| 4473 | | return (7); |
| 4474 | | } |
| 4475 | | |