Re: [Gta04-owner] Whose GTA04 think that battery is removed? Please report.

2017-05-03 Thread Andreas Kemnade
On Wed, 3 May 2017 19:08:48 +0200
Andreas Kemnade  wrote:


> > > Well, as far as I understand even the bci does not detect a battery
> > > disconnect directly. I disabled the corresponding bit in BCIMFEN4.
> > > (BTW: There are some restrictions writing to that register, so read
> > > back to check!) Still a battery "disconnection"
> > > clearing WATCHDOGEN in that register inhibits that disconnection.
> > > For some unknown reason that watchdog triggers (somehow trouble with
> > > MADC). It resets the state machine of the charger. And as a side effect
> > > there seems to be that disconnect.
> > > 
> > > So the key point is understanding
> > > a) that watchdog.
> > > b) access arbitation to madc.
> > > - maybe some measurement is started and not finished
> > >   when it is suspended, but why this happens only on a5
> > >   not a4?
> > > c) madc power management
> > > - madc is enabled once but seems not to be disabled on suspend?
> > > - some other resource is disabled but needed by madc,
> > 
> > We have the generic-adc-battery driver as well and it uses madc.
> > 
> ok, that can be simply disabled...
> rmmod done
> unbound twl4030_madc driver
> 
> the battery still gets "disconnected"
> Conclusion: madc operations from kernel not guilty.
> At least the generic adc battery driver is not suspicious.
> 
> So perhaps resources needed by madc are erronously powered down?
> 
hmm, looking at the schematics I found one interesting difference.
EN pin of X502 is controlled by vpll1. And madc operation might need
some clock.

root@letux:/sys/class/regulator# cat regulator.18/uevent 
OF_NAME=regulator-vpll1
OF_FULLNAME=/ocp@6800/i2c@4807/twl@48/regulator-vpll1
OF_COMPATIBLE_0=ti,twl4030-vpll1
OF_COMPATIBLE_N=1
root@letux:/sys/class/regulator# cat regulator.18/suspend_mem_state 
disabled

hmm, how can I change the latter to "enabled"? 
regulator-always-on seems not to be sufficient:
root@letux:/sys/firmware/devicetree# find | grep 
vpll1./base/ocp@6800/i2c@4807/twl@48/regulator-vpll1
./base/ocp@6800/i2c@4807/twl@48/regulator-vpll1/compatible
./base/ocp@6800/i2c@4807/twl@48/regulator-vpll1/regulator-always-on
./base/ocp@6800/i2c@4807/twl@48/regulator-vpll1/name

Regards,
Andreas


pgpwxgfswjcGd.pgp
Description: OpenPGP digital signature
___
Gta04-owner mailing list
Gta04-owner@goldelico.com
http://lists.goldelico.com/mailman/listinfo.cgi/gta04-owner


Re: [Gta04-owner] Whose GTA04 think that battery is removed? Please report.

2017-05-03 Thread Andreas Kemnade
On Wed, 3 May 2017 18:20:00 +0200
"H. Nikolaus Schaller"  wrote:

> 
> > Am 03.05.2017 um 17:15 schrieb Andreas Kemnade :
> > 
> > Hi,
> > 
> > On Wed, 3 May 2017 13:05:59 +0200
> > "H. Nikolaus Schaller"  wrote:
> > 
> >> 
> >>> Am 29.04.2017 um 21:03 schrieb Andreas Kemnade :
> >>> 
> >>> Hi,
> >>> 
> >>> my GTA04A5 thinks its battery is disconnected when it is suspended
> >>> while it is charging.
> >>> The Letux 3704 does not do that. Same kernels!
> >>> 
> >>> This phenomenom does only happen on the gta04a5 when the bit
> >>> WATCHDOGEN in BCIMFEN4 is enabled.
> >>> 
> >>> The bit is enabled by default. I am wondering whether this is a problem
> >>> related to the GTA04A5 hardware or my device.
> >>> 
> >>> Battery "disconnection" leads to immediate wakeup and charging stop.
> >>> 
> >>> Or the battery of the Letux3704 has stronger ties to the device so that
> >>> it cannot be disconnected by the kernel ;-)
> >>> 
> >>> Hmm, newer chip revision of the tps65950?
> >> 
> >> I am not aware of. We used the same A3 variant. And the only significant 
> >> change
> >> in the charging circuits is to use a different transistor. But that should 
> >> not
> >> end in a battery-disconnect detection (maybe we should try to find out what
> >> situation does trigger that).
> >> 
> > Well, as far as I understand even the bci does not detect a battery
> > disconnect directly. I disabled the corresponding bit in BCIMFEN4.
> > (BTW: There are some restrictions writing to that register, so read
> > back to check!) Still a battery "disconnection"
> > clearing WATCHDOGEN in that register inhibits that disconnection.
> > For some unknown reason that watchdog triggers (somehow trouble with
> > MADC). It resets the state machine of the charger. And as a side effect
> > there seems to be that disconnect.
> > 
> > So the key point is understanding
> > a) that watchdog.
> > b) access arbitation to madc.
> > - maybe some measurement is started and not finished
> >   when it is suspended, but why this happens only on a5
> >   not a4?
> > c) madc power management
> > - madc is enabled once but seems not to be disabled on suspend?
> > - some other resource is disabled but needed by madc,
> 
> We have the generic-adc-battery driver as well and it uses madc.
> 
ok, that can be simply disabled...
rmmod done
unbound twl4030_madc driver

the battery still gets "disconnected"
Conclusion: madc operations from kernel not guilty.
At least the generic adc battery driver is not suspicious.

So perhaps resources needed by madc are erronously powered down?

BTW: disabling the watchdog:
one way I found: turn on linear charging (doesn't matter if it is
connected), run
twl-i2c.sh MAIN_CHARGE w 0x11 0x3E ; twl-i2c.sh MAIN_CHARGE w 0x15 0x62
turn back to your desired charge mode.
Now you can suspend.

Regards,
Andreas


pgpYtJ5DshnFD.pgp
Description: OpenPGP digital signature
___
Gta04-owner mailing list
Gta04-owner@goldelico.com
http://lists.goldelico.com/mailman/listinfo.cgi/gta04-owner


Re: [Gta04-owner] Whose GTA04 think that battery is removed? Please report.

2017-05-03 Thread H. Nikolaus Schaller

> Am 03.05.2017 um 17:15 schrieb Andreas Kemnade :
> 
> Hi,
> 
> On Wed, 3 May 2017 13:05:59 +0200
> "H. Nikolaus Schaller"  wrote:
> 
>> 
>>> Am 29.04.2017 um 21:03 schrieb Andreas Kemnade :
>>> 
>>> Hi,
>>> 
>>> my GTA04A5 thinks its battery is disconnected when it is suspended
>>> while it is charging.
>>> The Letux 3704 does not do that. Same kernels!
>>> 
>>> This phenomenom does only happen on the gta04a5 when the bit
>>> WATCHDOGEN in BCIMFEN4 is enabled.
>>> 
>>> The bit is enabled by default. I am wondering whether this is a problem
>>> related to the GTA04A5 hardware or my device.
>>> 
>>> Battery "disconnection" leads to immediate wakeup and charging stop.
>>> 
>>> Or the battery of the Letux3704 has stronger ties to the device so that
>>> it cannot be disconnected by the kernel ;-)
>>> 
>>> Hmm, newer chip revision of the tps65950?
>> 
>> I am not aware of. We used the same A3 variant. And the only significant 
>> change
>> in the charging circuits is to use a different transistor. But that should 
>> not
>> end in a battery-disconnect detection (maybe we should try to find out what
>> situation does trigger that).
>> 
> Well, as far as I understand even the bci does not detect a battery
> disconnect directly. I disabled the corresponding bit in BCIMFEN4.
> (BTW: There are some restrictions writing to that register, so read
> back to check!) Still a battery "disconnection"
> clearing WATCHDOGEN in that register inhibits that disconnection.
> For some unknown reason that watchdog triggers (somehow trouble with
> MADC). It resets the state machine of the charger. And as a side effect
> there seems to be that disconnect.
> 
> So the key point is understanding
> a) that watchdog.
> b) access arbitation to madc.
> - maybe some measurement is started and not finished
>   when it is suspended, but why this happens only on a5
>   not a4?
> c) madc power management
> - madc is enabled once but seems not to be disabled on suspend?
> - some other resource is disabled but needed by madc,

We have the generic-adc-battery driver as well and it uses madc.

I have put Marek on CC.

> but again why
>   only on a5?

Maybe some race condition (RAM faster/slower)?

> 
> I even have a workaround patch in my tree which clears that WATCHDOGEN,
> but I have not found a good place in code to do that because it is
> enabled again at some unknown time. So it does not work properly.
> 
> Regards,
> Andreas

BR,
Nikolaus


___
Gta04-owner mailing list
Gta04-owner@goldelico.com
http://lists.goldelico.com/mailman/listinfo.cgi/gta04-owner


Re: [Gta04-owner] Whose GTA04 think that battery is removed? Please report.

2017-05-03 Thread Andreas Kemnade
Hi,

On Wed, 3 May 2017 13:05:59 +0200
"H. Nikolaus Schaller"  wrote:

> 
> > Am 29.04.2017 um 21:03 schrieb Andreas Kemnade :
> > 
> > Hi,
> > 
> > my GTA04A5 thinks its battery is disconnected when it is suspended
> > while it is charging.
> > The Letux 3704 does not do that. Same kernels!
> > 
> > This phenomenom does only happen on the gta04a5 when the bit
> > WATCHDOGEN in BCIMFEN4 is enabled.
> > 
> > The bit is enabled by default. I am wondering whether this is a problem
> > related to the GTA04A5 hardware or my device.
> > 
> > Battery "disconnection" leads to immediate wakeup and charging stop.
> > 
> > Or the battery of the Letux3704 has stronger ties to the device so that
> > it cannot be disconnected by the kernel ;-)
> > 
> > Hmm, newer chip revision of the tps65950?
> 
> I am not aware of. We used the same A3 variant. And the only significant 
> change
> in the charging circuits is to use a different transistor. But that should not
> end in a battery-disconnect detection (maybe we should try to find out what
> situation does trigger that).
> 
Well, as far as I understand even the bci does not detect a battery
disconnect directly. I disabled the corresponding bit in BCIMFEN4.
(BTW: There are some restrictions writing to that register, so read
back to check!) Still a battery "disconnection"
clearing WATCHDOGEN in that register inhibits that disconnection.
For some unknown reason that watchdog triggers (somehow trouble with
MADC). It resets the state machine of the charger. And as a side effect
there seems to be that disconnect.

So the key point is understanding
a) that watchdog.
b) access arbitation to madc.
  - maybe some measurement is started and not finished
when it is suspended, but why this happens only on a5
not a4?
c) madc power management
  - madc is enabled once but seems not to be disabled on suspend?
  - some other resource is disabled but needed by madc, but again why
only on a5?


I even have a workaround patch in my tree which clears that WATCHDOGEN,
but I have not found a good place in code to do that because it is
enabled again at some unknown time. So it does not work properly.

Regards,
Andreas


pgp2moE1U9djm.pgp
Description: OpenPGP digital signature
___
Gta04-owner mailing list
Gta04-owner@goldelico.com
http://lists.goldelico.com/mailman/listinfo.cgi/gta04-owner


Re: [Gta04-owner] Whose GTA04 think that battery is removed? Please report.

2017-05-03 Thread H. Nikolaus Schaller

> Am 29.04.2017 um 21:03 schrieb Andreas Kemnade :
> 
> Hi,
> 
> my GTA04A5 thinks its battery is disconnected when it is suspended
> while it is charging.
> The Letux 3704 does not do that. Same kernels!
> 
> This phenomenom does only happen on the gta04a5 when the bit
> WATCHDOGEN in BCIMFEN4 is enabled.
> 
> The bit is enabled by default. I am wondering whether this is a problem
> related to the GTA04A5 hardware or my device.
> 
> Battery "disconnection" leads to immediate wakeup and charging stop.
> 
> Or the battery of the Letux3704 has stronger ties to the device so that
> it cannot be disconnected by the kernel ;-)
> 
> Hmm, newer chip revision of the tps65950?

I am not aware of. We used the same A3 variant. And the only significant change
in the charging circuits is to use a different transistor. But that should not
end in a battery-disconnect detection (maybe we should try to find out what
situation does trigger that).

Ah, another difference: we have a different supercap. But it is difficult to
construct a connection to battery-disconnect during suspend.


Here some test results (but I don't know if they do the same test):

root@letux:~# echo mem > /sys/power/state
[  172.594757] PM: Syncing filesystems ... done.
[  172.683074] PM: Preparing system for sleep (mem)
[  172.742736] Freezing user space processes ... (elapsed 0.013 seconds) done.
[  172.764984] Freezing remaining freezable tasks ... (elapsed 0.010 seconds) 
done.
[  172.783355] PM: Suspending system (mem)
[  172.787536] Suspending console(s) (use no_console_suspend to debug)
[  172.834960] wlcore: down
[  172.869598] queueing ieee80211 work while going to suspend
[  172.876190] queueing ieee80211 work while going to suspend
[  173.000610] WWAN suspend
[  173.011322] PM: suspend of devices complete after 202.697 msecs
[  173.039093] PM: late suspend of devices complete after 27.709 msecs
[  173.069732] musb-omap2430 480ab000.usb_otg_hs: runtime PM trying to suspend 
device but active child
[  173.070281] usbhs_omap 48064000.usbhshost: runtime PM trying to suspend 
device but active child
[  173.079071] PM: noirq suspend of devices complete after 39.916 msecs
[  173.079254] Disabling non-boot CPUs ...
[  173.079315] Successfully put all powerdomains to target state
[  173.079315] Suspended for 0.046 seconds
[  173.112304] PM: noirq resume of devices complete after 28.808 msecs
[  173.134948] twl4030_bci 4807.i2c:twl@48:bci: battery disconnected
[  173.154083] PM: early resume of devices complete after 17.517 msecs
[  173.174499] WWAN resume
[  173.186492] GPS resuming 0 0 1
[  173.214996] iio_charge:-749
[  174.006591] wlcore: PHY firmware version: Rev 8.2.0.0.237
[  174.172027] wlcore: firmware booted (Rev 8.9.0.0.70)
[  174.277160] PM: resume of devices complete after 1122.833 msecs
[  174.412750] PM: Finishing wakeup.
[  174.416259] Restarting tasks ... done.
[  174.506713] thermal thermal_zone1: failed to read out thermal zone (1)
root@letux:~# echo mem > /sys/power/state
[  192.525970] PM: Syncing filesystems ... done.
[  193.023162] PM: Preparing system for sleep (mem)
[  193.039855] Freezing user space processes ... (elapsed 0.005 seconds) done.
[  193.052642] Freezing remaining freezable tasks ... (elapsed 0.003 seconds) 
done.
[  193.063812] PM: Suspending system (mem)
[  193.068054] Suspending console(s) (use no_console_suspend to debug)
[  193.084136] wlcore: down
[  193.091766] queueing ieee80211 work while going to suspend
[  193.092254] queueing ieee80211 work while going to suspend
[  193.140533] WWAN suspend
[  193.144042] PM: suspend of devices complete after 63.049 msecs
[  193.158294] PM: late suspend of devices complete after 14.190 msecs
[  193.170440] musb-omap2430 480ab000.usb_otg_hs: runtime PM trying to suspend 
device but active child
[  193.170562] usbhs_omap 48064000.usbhshost: runtime PM trying to suspend 
device but active child
[  193.173400] PM: noirq suspend of devices complete after 15.045 msecs
[  193.173400] Disabling non-boot CPUs ...
[  193.173431] Successfully put all powerdomains to target state
[  193.173431] Suspended for 4.760 seconds
[  193.184448] PM: noirq resume of devices complete after 10.803 msecs
[  193.207550] PM: early resume of devices complete after 10.070 msecs
[  193.213439] WWAN resume
[  193.218780] GPS resuming 0 0 1
[  193.236236] iio_charge:-747
[  193.837676] wlcore: PHY firmware version: Rev 8.2.0.0.237
[  193.955932] wlcore: firmware booted (Rev 8.9.0.0.70)
[  194.004150] PM: resume of devices complete after 796.447 msecs
[  194.127014] PM: Finishing wakeup.
[  194.130493] Restarting tasks ... done.
[  194.158630] thermal thermal_zone1: failed to read out thermal zone (1)
root@letux:~# root@letux:~# cat /sys/class/power_supply/twl4030_usb/uevent
POWER_SUPPLY_NAME=twl4030_usb
POWER_SUPPLY_STATUS=Not charging
POWER_SUPPLY_ONLINE=0
POWER_SUPPLY_INPUT_CURRENT_LIMIT=798505
root@letux:~#

The GTA04A5 was charging before. On the first suspend command 

[Gta04-owner] Whose GTA04 think that battery is removed? Please report.

2017-04-29 Thread Andreas Kemnade
Hi,

my GTA04A5 thinks its battery is disconnected when it is suspended
while it is charging. 
The Letux 3704 does not do that. Same kernels!

This phenomenom does only happen on the gta04a5 when the bit
WATCHDOGEN in BCIMFEN4 is enabled. 

The bit is enabled by default. I am wondering whether this is a problem
related to the GTA04A5 hardware or my device.

Battery "disconnection" leads to immediate wakeup and charging stop.

Or the battery of the Letux3704 has stronger ties to the device so that
it cannot be disconnected by the kernel ;-)

Hmm, newer chip revision of the tps65950?

Puzzled,
Andreas


pgpgL16CSItJr.pgp
Description: OpenPGP digital signature
___
Gta04-owner mailing list
Gta04-owner@goldelico.com
http://lists.goldelico.com/mailman/listinfo.cgi/gta04-owner