Skip to content

Commit 730c9df

Browse files
krzkgregkh
authored andcommitted
power: supply: bq27xxx: report "not charging" on all types
[ Upstream commit 7bf738b ] 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 <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 77dbbcd commit 730c9df

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
@@ -1772,8 +1772,6 @@ static int bq27xxx_battery_status(struct bq27xxx_device_info *di,
17721772
status = POWER_SUPPLY_STATUS_FULL;
17731773
else if (di->cache.flags & BQ27000_FLAG_CHGS)
17741774
status = POWER_SUPPLY_STATUS_CHARGING;
1775-
else if (power_supply_am_i_supplied(di->bat) > 0)
1776-
status = POWER_SUPPLY_STATUS_NOT_CHARGING;
17771775
else
17781776
status = POWER_SUPPLY_STATUS_DISCHARGING;
17791777
} else if (di->opts & BQ27Z561_O_BITS) {
@@ -1792,6 +1790,10 @@ static int bq27xxx_battery_status(struct bq27xxx_device_info *di,
17921790
status = POWER_SUPPLY_STATUS_CHARGING;
17931791
}
17941792

1793+
if ((status == POWER_SUPPLY_STATUS_DISCHARGING) &&
1794+
(power_supply_am_i_supplied(di->bat) > 0))
1795+
status = POWER_SUPPLY_STATUS_NOT_CHARGING;
1796+
17951797
val->intval = status;
17961798

17971799
return 0;

0 commit comments

Comments
 (0)