aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/bq27x00_battery.c
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2011-10-31 20:43:08 -0400
committerAnton Vorontsov <cbouatmailru@gmail.com>2011-11-25 14:59:49 -0500
commit270968c0984aeed096da3cfffb0e131f4c416166 (patch)
tree1cb5467e11f956509ba3da4833ae41f3cec59fbe /drivers/power/bq27x00_battery.c
parentd149e98e02c84fe1e81aa7f6b91a667d796b2c6e (diff)
bq27x00_battery: Fix reporting status value for bq27500 battery
Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power/bq27x00_battery.c')
-rw-r--r--drivers/power/bq27x00_battery.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index a22124ab1e3b..c4c403e5542c 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -62,10 +62,11 @@
62 62
63#define BQ27500_REG_SOC 0x2C 63#define BQ27500_REG_SOC 0x2C
64#define BQ27500_REG_DCAP 0x3C /* Design capacity */ 64#define BQ27500_REG_DCAP 0x3C /* Design capacity */
65#define BQ27500_FLAG_DSC BIT(0) 65#define BQ27500_FLAG_DSG BIT(0) /* Discharging */
66#define BQ27500_FLAG_SOCF BIT(1) /* State-of-Charge threshold final */ 66#define BQ27500_FLAG_SOCF BIT(1) /* State-of-Charge threshold final */
67#define BQ27500_FLAG_SOC1 BIT(2) /* State-of-Charge threshold 1 */ 67#define BQ27500_FLAG_SOC1 BIT(2) /* State-of-Charge threshold 1 */
68#define BQ27500_FLAG_FC BIT(9) 68#define BQ27500_FLAG_CHG BIT(8) /* Charging */
69#define BQ27500_FLAG_FC BIT(9) /* Fully charged */
69 70
70#define BQ27000_RS 20 /* Resistor sense */ 71#define BQ27000_RS 20 /* Resistor sense */
71 72
@@ -395,10 +396,14 @@ static int bq27x00_battery_status(struct bq27x00_device_info *di,
395 if (di->chip == BQ27500) { 396 if (di->chip == BQ27500) {
396 if (di->cache.flags & BQ27500_FLAG_FC) 397 if (di->cache.flags & BQ27500_FLAG_FC)
397 status = POWER_SUPPLY_STATUS_FULL; 398 status = POWER_SUPPLY_STATUS_FULL;
398 else if (di->cache.flags & BQ27500_FLAG_DSC) 399 else if (di->cache.flags & BQ27500_FLAG_DSG)
399 status = POWER_SUPPLY_STATUS_DISCHARGING; 400 status = POWER_SUPPLY_STATUS_DISCHARGING;
400 else 401 else if (di->cache.flags & BQ27500_FLAG_CHG)
401 status = POWER_SUPPLY_STATUS_CHARGING; 402 status = POWER_SUPPLY_STATUS_CHARGING;
403 else if (power_supply_am_i_supplied(&di->bat))
404 status = POWER_SUPPLY_STATUS_NOT_CHARGING;
405 else
406 status = POWER_SUPPLY_STATUS_UNKNOWN;
402 } else { 407 } else {
403 if (di->cache.flags & BQ27000_FLAG_FC) 408 if (di->cache.flags & BQ27000_FLAG_FC)
404 status = POWER_SUPPLY_STATUS_FULL; 409 status = POWER_SUPPLY_STATUS_FULL;