Skip to content

Commit 7bf738b

Browse files
krzksre
authored andcommitted
power: supply: bq27xxx: report "not charging" on all types
Commit 6f24ff9 ("power: supply: bq27xxx_battery: Add the BQ27Z561 Battery monitor") and commit d74534c ("power: bq27xxx_battery: Add support for additional bq27xxx family devices") added support for new device types by copying most of the code and adding necessary quirks. However they did not copy the code in bq27xxx_battery_status() responsible for returning POWER_SUPPLY_STATUS_NOT_CHARGING. Unify the bq27xxx_battery_status() so for all types when charger is supplied, it will return "not charging" status. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 3e8282a commit 7bf738b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/power/supply/bq27xxx_battery.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,8 +1765,6 @@ static int bq27xxx_battery_status(struct bq27xxx_device_info *di,
17651765
status = POWER_SUPPLY_STATUS_FULL;
17661766
else if (di->cache.flags & BQ27000_FLAG_CHGS)
17671767
status = POWER_SUPPLY_STATUS_CHARGING;
1768-
else if (power_supply_am_i_supplied(di->bat) > 0)
1769-
status = POWER_SUPPLY_STATUS_NOT_CHARGING;
17701768
else
17711769
status = POWER_SUPPLY_STATUS_DISCHARGING;
17721770
} else if (di->opts & BQ27Z561_O_BITS) {
@@ -1785,6 +1783,10 @@ static int bq27xxx_battery_status(struct bq27xxx_device_info *di,
17851783
status = POWER_SUPPLY_STATUS_CHARGING;
17861784
}
17871785

1786+
if ((status == POWER_SUPPLY_STATUS_DISCHARGING) &&
1787+
(power_supply_am_i_supplied(di->bat) > 0))
1788+
status = POWER_SUPPLY_STATUS_NOT_CHARGING;
1789+
17881790
val->intval = status;
17891791

17901792
return 0;

0 commit comments

Comments
 (0)