From 0f9f0c7dcefa2ca8c151c34c9e430a0a511afd10 Mon Sep 17 00:00:00 2001 From: Jon Benson Date: Mon, 18 Oct 2010 16:30:00 +1100 Subject: [PATCH] Modified the battery driver to switch to SLOW charge at 99% instead of switching OFF. Now only switches off at 100% charge. Other minor cleanup of my tweaks. --- arch/arm/mach-msm/board-htcleo-battery.c | 26 ++++++++++++++---------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-msm/board-htcleo-battery.c b/arch/arm/mach-msm/board-htcleo-battery.c index b3110087..3cead6f2 100644 --- a/arch/arm/mach-msm/board-htcleo-battery.c +++ b/arch/arm/mach-msm/board-htcleo-battery.c @@ -326,7 +326,7 @@ static int htcleo_charge(int on, int fast) static void htcleo_parse_data(uint32_t raw_status, u8 *raw, struct battery_status *s) { - short n; + short n, tRaw; uint32_t n32; uint32_t FL, ACR, ACR_EMPTY, PC; @@ -373,7 +373,7 @@ static void htcleo_parse_data(uint32_t raw_status, u8 *raw, struct battery_statu /* Get Temperature */ n = ((raw[0] << 8) | (raw[1])); - short tRaw = n; + tRaw = n; // TODO: This isn't ideal but gives ROUGHLY (within about 3C) the correct values and is better than what I had previously if ( PC == LEO_EXTENDED_BATTERY_CAPACITY ) n *= 7; n /= 16; @@ -552,15 +552,19 @@ static int battery_adjust_charge_state(struct htcleo_device_info *di) { di->status.battery_full = 0; }*/ - if(di->status.percentage >= 99) - { - di->status.battery_full = 1; - charge_mode = CHARGE_BATT_DISABLE; - } - else - { - di->status.battery_full = 0; - } + if(di->status.percentage >= 100) + { + di->status.battery_full = 1; + charge_mode = CHARGE_BATT_DISABLE; + } + else + { + di->status.battery_full = 0; + } + if((di->status.percentage > 98) && (charge_mode == CHARGE_FAST)) + { + charge_mode = CHARGE_SLOW; + } #else // CotullaTODO: add DS274X check code here di->status.battery_full = 0;