power: supply: Classify Battery Monitor Systems as batteries

CAF's new fuel gauge drivers report POWER_SUPPLY_TYPE_BMS (Battery
Monitor System) instead of POWER_SUPPLY_TYPE_BATTERY (battery), and
rightfully so because it describes their purpose more accurately.

Update the power_supply_is_system_supplied function to recognize BMS
power supplies as batteries to prevent it from attempting to query the
POWER_SUPPLY_PROP_ONLINE property on our fuel gauge drivers.

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
Signed-off-by: dreamisbaka <jolinux.g@gmail.com>
This commit is contained in:
Danny Lin 2019-08-15 05:55:55 +00:00 committed by Gagan Malvi
parent d25a021cea
commit 8098862fa4
No known key found for this signature in database
GPG key ID: B932A7CE71E9198F

View file

@ -355,7 +355,8 @@ static int __power_supply_is_system_supplied(struct device *dev, void *data)
unsigned int *count = data;
(*count)++;
if (psy->desc->type != POWER_SUPPLY_TYPE_BATTERY)
if (psy->desc->type != POWER_SUPPLY_TYPE_BATTERY &&
psy->desc->type != POWER_SUPPLY_TYPE_BMS)
if (!psy->desc->get_property(psy, POWER_SUPPLY_PROP_ONLINE,
&ret))
return ret.intval;