Re: [PATCH v1 7/7] power: bq24190_charger: Set bq24190-battery device .type=unknown

Liam Breck
2017-03-23T11:31:52Z

On Thu, Mar 23, 2017 at 3:52 AM, Sebastian Reichel <sre@kernel.org> wrote:
> Hi,
>
> On Tue, Mar 21, 2017 at 03:09:21PM -0700, Liam Breck wrote:
>> From: Liam Breck <kernel@networkimprov.net>
>>
>> Not for upstream.
>
> Obviously.
>
>> Temporary workaround to prevent bq24190-battery device
>> from interfering with a fuel gauge that has .type=power_supply_type_battery
>>
>> I'll move properties from -battery device to -charger in a subsequent version.
>
> I thought about the transistor, which can take the battery
> offline and IMHO it should be exposed as regulator.

OK

> That still leaves the health status reading, though. From
> userspace's point-of-view this should be merged into the
> battery device, if fuel-gauge can't provide that information.

I think the bigger issue is that multiple sysfs devices for what is
conceptually one power supply is awkward. With the addition of static
battery object, we have yet another set of properties which belong to
that supply.

A solution to this would be a core registry which allows various
drivers to submit properties to a named supply. Properties with the
same id (e.g. health) are OK given a tag (input-V, NTC-1, battery-V)
to differentiate them. Duplicates would be dropped (e.g. both drivers
submit monitored-battery stats). The result would be represented in
sysfs as a single device, where each property would appear as a file
or directory as necessary. And perhaps also as a file "health_summary"
which indicates whether there's trouble below decks.