Message ID | 20180215204153.ztdal3qhtmgi7sjo@earth.universe (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Hi Sebastian, On 15/02/18 21:41, Sebastian Reichel wrote: > > "Not charging" is reported, when the battery is neither charged, nor > dis-charged. It's supposed to be used when a charger is connected > without charging the battery. Makes sense. > Basically the bq27xxx driver assumes, that charger is connected. > I guess the problem is, that the N900 devicetree does not specify, > that the bq27xxx is supplied by the charger, so > power_supply_am_i_supplied returns -ENODEV. > > This can be fixed by adding the following to the N900 DT: > > &bq27200 { > power-supplies = <&bq24150a>; > }; > > But there is also a bug in the bq27xxx driver, that should cope > with no charger being specified. The following patch should fix > the issue. I currently don't have my N900 with me. Could you > give it a try? I added the dts change and bq27xxx change on top of my kernel, but now the bq27xxx-battery does not want to probe: [ 34.947082] power_supply bq27200-0: Not all required supplies found, defer probe [ 34.958953] bq27xxx-battery 2-0055: failed to register battery Full boot log here: https://ptpb.pw/UeEV Thanks, Cheers, Merlijn
diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index d99981542a46..7ce60519b1bc 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -1670,7 +1670,7 @@ static int bq27xxx_battery_status(struct bq27xxx_device_info *di, status = POWER_SUPPLY_STATUS_FULL; else if (di->cache.flags & BQ27000_FLAG_CHGS) status = POWER_SUPPLY_STATUS_CHARGING; - else if (power_supply_am_i_supplied(di->bat)) + else if (power_supply_am_i_supplied(di->bat) > 0) status = POWER_SUPPLY_STATUS_NOT_CHARGING; else status = POWER_SUPPLY_STATUS_DISCHARGING;