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

H. Nikolaus Schaller hns at goldelico.com
Wed Jul 20 20:07:57 CEST 2016


> Am 20.07.2016 um 12:08 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> 
>> Am 20.07.2016 um 11:17 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>> 
>> Hi Andreas,
>> 
>>> 
>>>> [   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. 
>> 
>> I can't even set the ITHEN bit!
>> 
>> [  279.510040] twl4030_madc_set_current_generator read regval = 12
>> [  279.517547] twl4030_madc_set_current_generator write regval = 1a
>> [  279.527343] twl4030_madc_set_current_generator read back regval = 12

it is not lost in software but by hardware:

[   67.609069] twl_i2c_read 2 23->97[1] -> 12...
[   67.613647] twl4030_madc_set_current_generator read regval = 12
[   67.620941] twl4030_madc_set_current_generator write regval = 1a
[   67.628112] twl_i2c_write 2 23->97[1] -> 1a...
[   67.637786] twl_i2c_read 2 23->97[1] -> 12...
[   67.637817] twl4030_madc_set_current_generator read back regval = 12

>> 
>> manually:
>> 
>> root at letux:~# i2cget -f 0 0x4a 0x97 
>> 0x12
>> root at letux:~# i2cset -f 0 0x4a 0x97 0x1f 
>> root at letux:~# i2cget -f 0 0x4a 0x97 
>> 0x13
>> root at letux:~# i2cset -f 0 0x4a 0x97 0x00 
>> root at letux:~# i2cget -f 0 0x4a 0x97 
>> 0x00
>> root at letux:~# i2cset -f 0 0x4a 0x97 0xff
>> root at letux:~# i2cget -f 0 0x4a 0x97 
>> 0x13
>> root at letux:~# 
>> 
>> So I can only toggle the TYPEN (ADCIN0), MESBAT, MESVAC bits
>> in the state the twl4030 is initialized.
>> 
>> But not ITHEN (ADCIN1) or MESVBUS.
>> 
>> here we have a connection between VBUS and Temp measurements...
>> 
>> Description says:
>> 
>> MESVBUS  Connects resistive divider VBUS input
>> Note: MESVBUS is enabled automatically when VBUSOVEN monitoring function is started.
>> 
>> This might also imply that it is automatically reset at some times.
>> 
>> But there is no note about automatic control of ITHEN.
>> 
>> Any ideas? Some background process resetting these bits instead of leaving them untouched?

It looks as if the basic twl_i2c_write + twl_i2c_read already ignores the changed bit.
And there is no other write process in between.

Well, there is a small chance that this is a problem of regmap. But this would mean
that twl_i2c_write + twl_i2c_read do not work properly.

And the manual i2cget/set commands show the same effect and they bypass regmap.

>> Next, I think I will compare with the 4.3 kernel on the same device.
> 
> Here:
> 
> root at letux:~# i2cget -f 0 0x4a 0x97 
> 0x1b
> root at letux:~# i2cset -f 0 0x4a 0x97 0xff
> root at letux:~# i2cget -f 0 0x4a 0x97 
> 0x1b
> root at letux:~# i2cset -f 0 0x4a 0x97 0x00
> root at letux:~# i2cget -f 0 0x4a 0x97 
> 0x0b
> root at letux:~# i2cset -f 0 0x4a 0x97 0xff
> root at letux:~# i2cget -f 0 0x4a 0x97 
> 0x1b
> root at letux:~# 
> 
> So it is more or less the same that not all bits can be changed and even only TYPEN.
> But ITHEN is set and I get a 26C reading from ADCIN1.
> 
> I think we come closer to the core of the onion...

So I think we have to find out in which strange state the twl4030 is so that ITHEN
can't be enabled. I have not yet found any hint in the programming manual.

BR,
Nikolaus



More information about the Letux-kernel mailing list