Re: [PATCH 2/2] extcon intel-cht-wc: Enable external charger

From: Hans de Goede
Date: Thu Feb 21 2019 - 04:33:47 EST


Hi,

On 20-02-19 21:28, Yauhen Kharuzhy wrote:
On Wed, Feb 20, 2019 at 05:42:28PM +0100, Hans de Goede wrote:
The input-current-limit only specifies how much current the charger may
draw from the micro-usb for both supplying the laptop as well as for
charging the battery combined. You can safely set this as high as
the charger can handle (2A for a dedicated charger).

The BQ25892 should have a *separate* setting for the max current to
use while charging the battery (assuming that the input current allows
drawing enough current in the first place). I would hope that those bits
have some sane value set from the firmware...

Yes, the charger has separate battery current limit but firmware doesn't
change its default value (2048 mA) while Lenovo's software driver does.
It set battery charging limit to 4 A and input limit to 2 A (it makes
sense because Lenovo adapter and BQ25892 both support voltage increasing
upto 12V).

Hmm, I guess your device uses a separate power-barrel charging conector
then? 12v over micro-usb requires special negotiation which the Whiskey Cove
PMIC does not support AFAIK.

The Yoga Book supports kind of quick charging by negotiate voltage with
'current pulse protocol' supported by BQ25892 and Lenovo's wall cube.
I think that PMIC is not connected to VBUS directly. After charging
started, BQ25892 driver can ask power adapter to increase voltage
number of times upto 12V. See
https://github.com/jekhor/yogabook-linux-kernel/blob/master/drivers/power/supply/bq25890_charger.c#L918
for example.


In either case if you want to increase the max battery current to 4A
in the kernel, then this will have to be guarded by a DMI check.

Yes.


I beieve the way to do this wuld be throuh a device-property on the
charger which gets set from drivers/i2c/busses/i2c-cht-wc.c, but as
said this needs to be behind a DMI check, e cannot just g and boost
the max charge current to 4A everywhere.

Yes, I use such method already in the my kernel:
https://github.com/jekhor/yogabook-linux-kernel/blob/master/drivers/i2c/busses/i2c-cht-wc.c#L247

Anyway, charger tweaking will be next iteration, now I want to complete
current extcon stuff/

Ok, sounds good.

Regards,

Hans