Skip to content
Browse files

charge_now in sysfs for bq27000 batteries

  • Loading branch information...
1 parent 2804cec commit dcb4208235dd2f1cb9807cd4e8d939fdc2c5927e @mev mev committed with
Showing with 8 additions and 0 deletions.
  1. +8 −0 drivers/power/bq27000_battery.c
View
8 drivers/power/bq27000_battery.c
@@ -116,6 +116,7 @@ struct bq27000_bat_regs {
int ai;
int flags;
int lmd;
+ int nac;
int rsoc;
int temp;
int tte;
@@ -273,6 +274,11 @@ static int bq27000_battery_get_property(struct power_supply *psy,
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;
@@ -325,6 +331,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);
@@ -347,6 +354,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,

0 comments on commit dcb4208

Please sign in to comment.
Something went wrong with that request. Please try again.