power: ds2781: Use correct value for Rsnsp
authorGreg Meiste <w30289@motorola.com>
Fri, 30 Jul 2010 14:28:56 +0000 (09:28 -0500)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:33:27 +0000 (16:33 -0700)
The current being reported by the DS2781 battery driver was off
due to the incorrect value being used for Rsnsp. The DS2781 has
a register with the correct value, so use it instead of a hard
coded value.

Change-Id: I6fbd32a2a890232a805a2d4f1e595b0b3daf30e8
Signed-off-by: Greg Meiste <w30289@motorola.com>
drivers/power/ds2781_battery.c

index 848bfc88b3ca4dc3c3308cb64f6b1a4bc49e2d7e..6b9641f7271134ebac5d88328c4bc82ce34ed18e 100644 (file)
@@ -171,14 +171,14 @@ static void ds2781_parse_data(u8 *raw, struct battery_status *s)
 
        s->voltage_uV = n * 9760;
 
-       /* Get Current: Unit= 1.5625uV x Rsnsp(67)=104.68 */
+       /* Get Current: Unit= 1.5625uV x Rsnsp */
        n = ((raw[DS2781_REG_CURR_MSB]) << 8) |
                raw[DS2781_REG_CURR_LSB];
-       s->current_uA = ((n * 15625) / 10000) * 67;
+       s->current_uA = ((n * 15625) / 10000) * raw[DS2781_REG_RSNSP];
 
        n = ((raw[DS2781_REG_AVG_CURR_MSB]) << 8) |
                raw[DS2781_REG_AVG_CURR_LSB];
-       s->current_avg_uA = ((n * 15625) / 10000) * 67;
+       s->current_avg_uA = ((n * 15625) / 10000) * raw[DS2781_REG_RSNSP];
 
        /* Get Temperature:
         * Unit=0.125 degree C,therefore, give up LSB ,