[pkg-fso-commits] [SCM] linux-2.6-openmoko, the Linux 2.6 kernel tree from Openmoko branch, andy-tracking, updated. upstream/20090303.gitb9de904e-140-g23b564c

Nelson Castillo arhuaco at freaks-unidos.net
Mon Jun 8 17:30:13 UTC 2009


The following commit has been merged in the andy-tracking branch:
commit dc91099c0ef18660bc2d9e3bd75fc1ad811e1116
Author: Paul Fertser <fercerpav at gmail.com>
Date:   Thu Jun 4 23:40:52 2009 +0400

    GTA02: bq27000 report current charge
    
    Using HAL for E's battery gadget highlighted an oddity: the kernel exposed
    last full charge property but didn't expose current charge property. This
    resulted in the wrong computation of current battery capacity by E's gadget
    (and probably other programs as well).
    
    This patch exposes a corresponding bq27000 register to make E battery
    gadget happy (it is still not showing correct values because of bugs in HAL
    resulting in 3 batteries (apm emulation and usb supply being bogus here)
    instead of one).
    
    Signed-off-by: Paul Fertser <fercerpav at gmail.com>

diff --git a/drivers/power/bq27000_battery.c b/drivers/power/bq27000_battery.c
index 7e8b3f8..593cbe6 100644
--- a/drivers/power/bq27000_battery.c
+++ b/drivers/power/bq27000_battery.c
@@ -115,6 +115,7 @@ struct bq27000_bat_regs {
 	int		ai;
 	int		flags;
 	int		lmd;
+	int		nac;
 	int		rsoc;
 	int		temp;
 	int		tte;
@@ -271,6 +272,11 @@ use_bat:
 			return di->regs.lmd;
 		val->intval = (di->regs.lmd * 3570) / di->pdata->rsense_mohms;
 		break;
+	case POWER_SUPPLY_PROP_CHARGE_NOW:
+		if (di->regs.nac < 0)
+			return di->regs.nac;
+		val->intval = (di->regs.nac * 3570) / di->pdata->rsense_mohms;
+		break;
 	case POWER_SUPPLY_PROP_TEMP:
 		if (di->regs.temp < 0)
 			return di->regs.temp;
@@ -323,6 +329,7 @@ static void bq27000_battery_work(struct work_struct *work)
 		regs.ai    = hdq_read16(di, BQ27000_AI_L);
 		regs.flags = (di->pdata->hdq_read)(BQ27000_FLAGS);
 		regs.lmd   = hdq_read16(di, BQ27000_LMD_L);
+		regs.nac   = hdq_read16(di, BQ27000_NAC_L);
 		regs.rsoc  = (di->pdata->hdq_read)(BQ27000_RSOC);
 		regs.temp  = hdq_read16(di, BQ27000_TEMP_L);
 		regs.tte   = hdq_read16(di, BQ27000_TTE_L);
@@ -345,6 +352,7 @@ static enum power_supply_property bq27000_battery_props[] = {
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
 	POWER_SUPPLY_PROP_CURRENT_NOW,
 	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
 	POWER_SUPPLY_PROP_TEMP,
 	POWER_SUPPLY_PROP_TECHNOLOGY,
 	POWER_SUPPLY_PROP_PRESENT,

-- 
linux-2.6-openmoko, the Linux 2.6 kernel tree from Openmoko



More information about the pkg-fso-commits mailing list