[Letux-kernel] [PATCH 0/6] bq2429x: Clean up driver for future fixes

H. Nikolaus Schaller hns at goldelico.com
Sat Aug 29 11:37:08 CEST 2020


Hi Nick,
I am currently testing the (new driver) with 5.9-rc2. The spurious problems have disappeared, maybe some -rc1 issues.

I already have some smaller fixes, e.g. for polled mode (which stops if there is no state change, i.e. almost immediately).
There are also small bugs in usb detection and setting the input current limit.

What I am currently hunting for is that vbus becoming available now properly sets the registers to charging,
but charging does not start before I read back the status. Strange. Looks like the chip needs
some additional trigger.

And OTG is being programmed, the registers look fine but does not start according to REG08 vbus_stat. Even if there is no HOT report.
So I have to look into the old driver what it is doing differently.

Regarding "HOT" I indeed sometimes see the hot indication. The bq27421 reports ca. 38°C which is the chip temperature (not the battery).

Therefore the battery may be hotter. And I found a notice in the data sheet that our choice of R709/R710 will reach the HOT point at 45°C.

In addition we have R2001 and R2002 as a voltage divider so that the GPADC can also read the temperature.
What came to my mind is that we have an additional resistor in parallel to the NTC and R710 which likely reduces the HOT point
further. A 10k NTC and the 133k Voltage divider makes ca. 7% deviation. So to optimize that for a 45°C point we should modify R709/710.

It is quite likely that the charger stops charging (and OTG) at >40°C. Which is good for battery life and safety but not so good for
charging the Pyra while it is running... Especially in hot environment (outdoor, car, bike) or while using WWAN in weak radio situation
(where RF power and heat dissipation of the module goes up). I think there is a new "energy management" framework coming to Linux which
should make it easier to manage heat sources (processor OPPs etc.) depending on temperature.

So far another intermediate result. Let's continue testing...

BR,
Nikolaus

> Am 24.08.2020 um 18:18 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> Hi Nick,
> 
>> Am 22.08.2020 um 00:55 schrieb Nick Elsmore <nicholaselsmore at gmail.com>:
>> 
>>> I also saw the high temperature issue on 5.6 when charging sometimes - I guess
>>> you know already from your previous bq work but "60°" just means too hot to
>>> charge as there is no exact readout. This also resulted in a "HOT" print from
>>> the driver.
>> 
>> Yes, there are only three levels: too cold, of, too hot. And these are mapped
>> to -10°C, 22.5°C and 60°C.
>> 
>> But the battery wasn't charging (battery is full) and after a reboot it did read
>> out correctly. So it was a driver glitch. And I never had that with the old driver.
>> 
>> I remember that these bits reporting NTC temperature are not easy to be handled
>> correctly by the driver so the rework may have changed something subtle.
>> 
>> 
>> I have seen this on the old driver on 5.6.y.  I will see if I can reproduce again on the old driver and get a register dump and some other information.  Re-examining the logic in the restructure patches, the reporting in the NTC fields looks ok.  So there may be something in the configuration of the chip causing these NTC bits to be set.  Have you dumped the registers when you reproduce this issue to see if the actual values are as expected?
> 
> No. It was just a very quick (ca. 5 minutes) look at it: apply patches, compile, compile fix, boot and look what happens...
> 
>> 
>>>> I have started a little to test your patches on top of v5.8-rc7 (including
>>>> also David's patches so that the Panel is working again).
>>>> There was a missing comma - easy to fix for compilation.
>> 
>> Yes I noticed that, sorry.  Something broke in my submission.
> 
> No problem. Such things happen...
> 
>> 
>>>> Basically the driver seems to work, but OTG doesn't. It does not even try to
>>>> switch power on, although DWC3 detects it.
>>>> 
>>>> Unplugging the OTG cable once did lead to:
>>>> 
>>>> root at letux:~# [  397.149733] ------------[ cut here ]------------
>>>> [  397.154707] WARNING: CPU: 0 PID: 37 at drivers/regulator/core.c:2603
>>>> _regulator_disable+0x3c/0x168
>>>> [  397.170413] unbalanced disables for otg_path
>> 
>> This is interesting.  I don't have a device handy to test OTG, so this is probably why I didn't catch this.  I'll try and get a device to test OTG mode with.
>> 
>>>> And once the temperature report was 60°C.
>>>> 
>>>> So I think there is something wrong with interrupts / status change detection.
>>>> Just a note: I have tested on an older Pyra prototype with tca6424 and there,
>>>> IRQs are definitively broken. So we must poll the status bits.
>> 
>> Also interesting, I'll need to investigate what broke with the interrupts.  My original driver rewrite behaved quite well on 4.19. 
> 
> I just did two initial tests. Maybe I find more time after rebasing everything to v5.9-rc2 this week. And add some printk to understand what is happening around OTG...
> 
> BR and thanks,
> Nikolaus
> 



More information about the Letux-kernel mailing list