| | 1143 | }, |
| | 1144 | { |
| | 1145 | name => "Maxim MAX1668", |
| | 1146 | driver => "max1668", |
| | 1147 | i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], |
| | 1148 | i2c_detect => sub { max1668_detect(0, @_); }, |
| | 1149 | }, |
| | 1150 | { |
| | 1151 | name => "Maxim MAX1805", |
| | 1152 | driver => "max1668", |
| | 1153 | i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], |
| | 1154 | i2c_detect => sub { max1668_detect(1, @_); }, |
| | 1155 | }, |
| | 1156 | { |
| | 1157 | name => "Maxim MAX1989", |
| | 1158 | driver => "max1668", |
| | 1159 | i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], |
| | 1160 | i2c_detect => sub { max1668_detect(2, @_); }, |
| | 4495 | # (0 = MAX1668, 1 = MAX1805, 2 = MAX1989) |
| | 4496 | # $_[1]: A reference to the file descriptor to access this chip. |
| | 4497 | # We may assume an i2c_set_slave_addr was already done. |
| | 4498 | # $_[2]: Address |
| | 4499 | # Returns: undef if not detected, 7 if detected |
| | 4500 | # Registers used: |
| | 4501 | # 0xfe: Company ID |
| | 4502 | # 0xff: Device ID |
| | 4503 | sub max1668_detect |
| | 4504 | { |
| | 4505 | my ($chip, $file, $addr) = @_; |
| | 4506 | my $man_id = i2c_smbus_read_byte_data($file, 0xfe); |
| | 4507 | my $dev_id = i2c_smbus_read_byte_data($file, 0xff); |
| | 4508 | |
| | 4509 | return if $man_id != 0x4d; |
| | 4510 | return if $chip == 0 and $dev_id != 0x03; |
| | 4511 | return if $chip == 1 and $dev_id != 0x05; |
| | 4512 | return if $chip == 2 and $dev_id != 0x0b; |
| | 4513 | |
| | 4514 | return 7; |
| | 4515 | } |
| | 4516 | |
| | 4517 | # $_[0]: Chip to detect |