| | 1283 | }, |
| | 1284 | { |
| | 1285 | name => "Smart Battery Charger", |
| | 1286 | driver => "to-be-written", |
| | 1287 | i2c_addrs => [0x09], |
| | 1288 | i2c_detect => sub { smartbatt_chgr_detect @_}, |
| | 1289 | }, |
| | 1290 | { |
| | 1291 | name => "Smart Battery Manager/Selector", |
| | 1292 | driver => "to-be-written", |
| | 1293 | i2c_addrs => [0x0a], |
| | 1294 | i2c_detect => sub { smartbatt_mgr_detect @_}, |
| | 3922 | } |
| | 3923 | |
| | 3924 | # This checks for non-FFFF values for SpecInfo and Status. |
| | 3925 | # The address (0x09) is specified by the SMBus standard so it's likely |
| | 3926 | # that this really is a smart battery charger. |
| | 3927 | # $_[0]: A reference to the file descriptor to access this chip. |
| | 3928 | # We may assume an i2c_set_slave_addr was already done. |
| | 3929 | # $_[1]: Address |
| | 3930 | # Returns: 5 |
| | 3931 | sub smartbatt_chgr_detect |
| | 3932 | { |
| | 3933 | my ($file,$addr) = @_; |
| | 3934 | # check some registers |
| | 3935 | if (i2c_smbus_read_word_data($file,0x11) == 0xffff) { |
| | 3936 | return; |
| | 3937 | } |
| | 3938 | if (i2c_smbus_read_word_data($file,0x13) == 0xffff) { |
| | 3939 | return; |
| | 3940 | } |
| | 3941 | return (5); |
| | 3942 | } |
| | 3943 | |
| | 3944 | # This checks for non-FFFF values for State and Info. |
| | 3945 | # The address (0x0a) is specified by the SMBus standard so it's likely |
| | 3946 | # that this really is a smart battery manager/selector. |
| | 3947 | # $_[0]: A reference to the file descriptor to access this chip. |
| | 3948 | # We may assume an i2c_set_slave_addr was already done. |
| | 3949 | # $_[1]: Address |
| | 3950 | # Returns: 5 |
| | 3951 | sub smartbatt_mgr_detect |
| | 3952 | { |
| | 3953 | my ($file,$addr) = @_; |
| | 3954 | # check some registers |
| | 3955 | if (i2c_smbus_read_word_data($file,0x01) == 0xffff) { |
| | 3956 | return; |
| | 3957 | } |
| | 3958 | if (i2c_smbus_read_word_data($file,0x04) == 0xffff) { |
| | 3959 | return; |
| | 3960 | } |
| | 3961 | return (5); |