]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ds2760_battery: Fix indexing of the 4 active full EEPROM registers
authorPaul Parsons <lost.distance@yahoo.com>
Mon, 25 Apr 2011 14:43:30 +0000 (14:43 +0000)
committerAnton Vorontsov <cbouatmailru@gmail.com>
Fri, 20 May 2011 15:25:09 +0000 (19:25 +0400)
Fix indexing of the 4 active full EEPROM registers. The indexing was out by 1, accessing the EEPROM registers at 0x23 to 0x26 instead of 0x22 to 0x25.

Signed-off-by: Paul Parsons <lost.distance@yahoo.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
drivers/power/ds2760_battery.c

index e534290f32561d6d8322375f6baccf086f0c6de1..aa60e3791754d3c4c0d122500ac82dbc865d9530 100644 (file)
@@ -186,7 +186,7 @@ static int ds2760_battery_read_status(struct ds2760_device_info *di)
 
        scale[0] = di->full_active_uAh;
        for (i = 1; i < 5; i++)
-               scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 2 + i];
+               scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 1 + i];
 
        di->full_active_uAh = battery_interpolate(scale, di->temp_C / 10);
        di->full_active_uAh *= 1000; /* convert to µAh */