[Letux-kernel] letux-4.7-rc7: charging & ethernet gadget

H. Nikolaus Schaller hns at goldelico.com
Wed Jul 20 10:59:55 CEST 2016


> Am 19.07.2016 um 23:37 schrieb Andreas Kemnade <andreas at kemnade.info>:
> On Tue, 19 Jul 2016 22:50:44 +0200
> "H. Nikolaus Schaller" <hns at goldelico.com> wrote:
>>> I think I have to study the twl4030 data sheet if there is a common
>>> factor.
>> First interesting finding:
>> Nobody does and can call twl4030_madc_set_current_generator() for
>> channel=1, i.e. the BATTEMP channel / ADCIN1.
>> Therefore, ITHEN is not touched by the kernel and either U-Boot must
>> take care of. Or (I hope) automatic charging enabled by hardware does
>> set this bit. Anyways this means ITHEN is off if we boot w/o external
>> power.
>> The same is true for the current source strength (ITHSENS). So we are
>> lucky that 10kOhm at 10µA translates into 100mV. Unless our U-Boot
>> modifies these values.
>> I remember that I stumbled over a similar thing when developing the
>> gpadc driver for the Palmas (twl6037). There we have made it a config
>> through DT:
>> http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/iio/adc/palmas-gpadc.txt#L26
>> This could explain why we sometimes read 56°C. I think this always
>> happens if the ITHEN bit becomes reset (why?) and therefore the
>> current source is off. Pretending a missing battery. This of course
>> will disable automatic charging.
>> But it does not explain why we sometimes get more or less random
>> values.
>> Hm. Wait. Who is powering the current source for ITHEN? What if that
>> LDO is broken? Something to keep in mind for another test. Although I
>> could not find any reference where the current source is powered from.
> Well, ITHEN is normally enabled during automatic charge.
> If I enable it manually
> i2cset -f 0 0x4a 0x97 0x1f 
> Temperature shows sane values, so no additional regulator needed for
> that. But there are regulators needed for automatic charging...

I have booted with USB cable connected. Which means automatic charging
should have been enabled by hardware and U-Boot...

But when reading the adcin1 value through madc sysfs I get (with some printk

> [   60.034973] twl4030 REG_BCICTL1 = 12
> [   60.046569] twl4030 REG_BCICTL2 = 00
> [   60.061920] twl4030 current = 10 uA
> [   60.074676] twl4030 res = 0 Ohm
> [   60.089141] twl4030 temp = 59 C
> temp: 56°C

This means ITHEN is disabled after boot! For whatever reasons. Or did we introduce
an unnoticed bug in U-Boot some time ago? Unlikely since switching the SD card
to a 4.3 kernel works fine for exactly the same U-Boot.

At least we have a first more specific hint that something is going wrong. Let's
reveal the next onion shell :)

The next observation is that the low level madc command for measuring VBUS

> [   60.278411] twl4030_madc_conversion ret=1
> [   60.282623] twl4030_madc_read chan=8 val=13
> VBUS: 13mV

indeed reports no USB voltage. Although the cable *is* connected. And since AFAIK
there is no special circuit breaker between VBUS and the twl4030 madc that
is strange. I have not measured by a multimeter if VBUS is indeed missing or breaks
down to 13mV. Might be the power supply that shuts off... or if the BCI transistors are
not controlled properly. Or the OTG charge pump plays some role.


More information about the Letux-kernel mailing list