aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorAnton Vorontsov <cbouatmailru@gmail.com>2012-02-01 12:20:15 -0500
committerAnton Vorontsov <cbouatmailru@gmail.com>2012-02-01 12:21:29 -0500
commitb7aaacf56ac9e0cdb58c3d087fea7084d897c307 (patch)
tree13f7a896054839a1e2e3fa773e428205e475ec52 /drivers/power
parent62aa2b537c6f5957afd98e29f96897419ed5ebab (diff)
Revert "bq27x00_battery: Fix reporting status value for bq27500 battery"
This reverts commit 270968c0984aeed096da3cfffb0e131f4c416166. Grazvydas Ignotas wrote: After 270968c0984ae "bq27x00_battery: Fix reporting status value for bq27500 battery" status doesn't seem to be reported correctly when the battery is close to fully charged state. It reports "Not charging" while in fact there is >130mA current flowing to the battery according to current_now. This status report seems to be based on CHG bit in status register, but looking at the datasheet the description says "(Fast) charging allowed", which I guess means that the chip recommends charging and not that charging is actually going on? If you check the bit while battery is discharging and it's not full, the bit is also set. Suggested-by: Grazvydas Ignotas <notasas@gmail.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/bq27x00_battery.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index 98bf5676318d..d4b5281dea15 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -62,11 +62,10 @@
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_DSG BIT(0) /* Discharging */ 65#define BQ27500_FLAG_DSC BIT(0)
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_CHG BIT(8) /* Charging */ 68#define BQ27500_FLAG_FC BIT(9)
69#define BQ27500_FLAG_FC BIT(9) /* Fully charged */
70 69
71#define BQ27000_RS 20 /* Resistor sense */ 70#define BQ27000_RS 20 /* Resistor sense */
72 71
@@ -401,14 +400,10 @@ static int bq27x00_battery_status(struct bq27x00_device_info *di,
401 if (di->chip == BQ27500) { 400 if (di->chip == BQ27500) {
402 if (di->cache.flags & BQ27500_FLAG_FC) 401 if (di->cache.flags & BQ27500_FLAG_FC)
403 status = POWER_SUPPLY_STATUS_FULL; 402 status = POWER_SUPPLY_STATUS_FULL;
404 else if (di->cache.flags & BQ27500_FLAG_DSG) 403 else if (di->cache.flags & BQ27500_FLAG_DSC)
405 status = POWER_SUPPLY_STATUS_DISCHARGING; 404 status = POWER_SUPPLY_STATUS_DISCHARGING;
406 else if (di->cache.flags & BQ27500_FLAG_CHG)
407 status = POWER_SUPPLY_STATUS_CHARGING;
408 else if (power_supply_am_i_supplied(&di->bat))
409 status = POWER_SUPPLY_STATUS_NOT_CHARGING;
410 else 405 else
411 status = POWER_SUPPLY_STATUS_UNKNOWN; 406 status = POWER_SUPPLY_STATUS_CHARGING;
412 } else { 407 } else {
413 if (di->cache.flags & BQ27000_FLAG_FC) 408 if (di->cache.flags & BQ27000_FLAG_FC)
414 status = POWER_SUPPLY_STATUS_FULL; 409 status = POWER_SUPPLY_STATUS_FULL;