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

Liam Breck
2017-03-23T19:05:39Z

On Thu, Mar 23, 2017 at 6:37 AM, Sebastian Reichel <sre@kernel.org> wrote:
> Hi,
>
> On Thu, Mar 23, 2017 at 04:31:50AM -0700, Liam Breck wrote:
>>> 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.
>
> The simple-battery is consumed by the fuel-gauge, so not a problem.
>
>> 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.
>
> Yes, that would be the proper solution. Might become important, if
> more platforms with multiple chips providing battery information
> appear. Since I don't think you want to implement your suggestion,

If you're genuinely interested, I could probably ask Matt to work on this...

> I suggest sticking to the custom "bat_fault" sysfs property. That
> should already be exposed for the charger device as far as I can
> see.