aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2009-06-04 23:40:52 +0400
committerNelson Castillo <arhuaco@freaks-unidos.net>2009-06-04 21:59:39 -0300
commitdc91099c0ef18660bc2d9e3bd75fc1ad811e1116 (patch)
tree93b8be558c3c0b8a891ee81478c358bed2cb4422 /drivers
parent5b8138ba5c1dbc86dce264a0d4c078737aa2007a (diff)
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@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/power/bq27000_battery.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/power/bq27000_battery.c b/drivers/power/bq27000_battery.c
index 7e8b3f8ad96..593cbe6f752 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,