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

Liam Breck
2017-04-14T22:43:40Z

Hi Sebastian,

Re surfacing the batfet state as a regulator...

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.

Note we cannot get the batfet voltage level from a register, just
batfet_disable == {0,1}. Should we alternatively consider doing this?
/sys/class...bq24190-charger/online = vbus_up && !batfet_disable

Otherwise, what are your thoughts on values for these attributes?
from https://kernel.org/doc/Documentation/ABI/testing/sysfs-class-regulator

/sys/class/regulator/.../state
/sys/class/regulator/.../status
/sys/class/regulator/.../type
/sys/class/regulator/.../name
/sys/class/regulator/.../num_users
/sys/class/regulator/.../parent

I assume the volts, amps, and suspend attributes aren't relevant.

I don't think we can broadcast batfet_disable changes via
regulator_notifier_call_chain(), since we don't see an interrupt on
batfet changes. From
https://kernel.org/doc/Documentation/power/regulator/regulator.txt

Any pointers to example code appreciated...

> 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.
>
> -- Sebastian