Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283448
b: refs/heads/master
c: 270968c
h: refs/heads/master
v: v3
  • Loading branch information
Pali Rohár authored and Anton Vorontsov committed Nov 25, 2011
1 parent a63202c commit 2b96be3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d149e98e02c84fe1e81aa7f6b91a667d796b2c6e
refs/heads/master: 270968c0984aeed096da3cfffb0e131f4c416166
13 changes: 9 additions & 4 deletions trunk/drivers/power/bq27x00_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@

#define BQ27500_REG_SOC 0x2C
#define BQ27500_REG_DCAP 0x3C /* Design capacity */
#define BQ27500_FLAG_DSC BIT(0)
#define BQ27500_FLAG_DSG BIT(0) /* Discharging */
#define BQ27500_FLAG_SOCF BIT(1) /* State-of-Charge threshold final */
#define BQ27500_FLAG_SOC1 BIT(2) /* State-of-Charge threshold 1 */
#define BQ27500_FLAG_FC BIT(9)
#define BQ27500_FLAG_CHG BIT(8) /* Charging */
#define BQ27500_FLAG_FC BIT(9) /* Fully charged */

#define BQ27000_RS 20 /* Resistor sense */

Expand Down Expand Up @@ -395,10 +396,14 @@ static int bq27x00_battery_status(struct bq27x00_device_info *di,
if (di->chip == BQ27500) {
if (di->cache.flags & BQ27500_FLAG_FC)
status = POWER_SUPPLY_STATUS_FULL;
else if (di->cache.flags & BQ27500_FLAG_DSC)
else if (di->cache.flags & BQ27500_FLAG_DSG)
status = POWER_SUPPLY_STATUS_DISCHARGING;
else
else if (di->cache.flags & BQ27500_FLAG_CHG)
status = POWER_SUPPLY_STATUS_CHARGING;
else if (power_supply_am_i_supplied(&di->bat))
status = POWER_SUPPLY_STATUS_NOT_CHARGING;
else
status = POWER_SUPPLY_STATUS_UNKNOWN;
} else {
if (di->cache.flags & BQ27000_FLAG_FC)
status = POWER_SUPPLY_STATUS_FULL;
Expand Down

0 comments on commit 2b96be3

Please sign in to comment.