@@ -1547,12 +1547,14 @@ static int bq256xx_power_supply_init(struct bq256xx_device *bq,
return PTR_ERR(bq->charger);
}
- bq->battery = devm_power_supply_register(bq->dev,
- &bq256xx_battery_desc,
- psy_cfg);
- if (IS_ERR(bq->battery)) {
- dev_err(dev, "power supply register battery failed\n");
- return PTR_ERR(bq->battery);
+ if (!device_property_read_bool(dev, "omit-battery-class")) {
+ bq->battery = devm_power_supply_register(bq->dev,
+ &bq256xx_battery_desc,
+ psy_cfg);
+ if (IS_ERR(bq->battery)) {
+ dev_err(dev, "power supply register battery failed\n");
+ return PTR_ERR(bq->battery);
+ }
}
return 0;
}
Add omit-battery-class property to avoid make a battery device for charger when fg makes one. Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org> --- drivers/power/supply/bq256xx_charger.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)