[Gta04-owner] Crowdfunding an Ubuntu smartphone

NeilBrown neilb at suse.de
Tue Aug 27 13:06:31 CEST 2013


On Tue, 27 Aug 2013 09:04:11 +0200 Radek Polak <psonek2 at seznam.cz> wrote:

> On Monday, August 26, 2013 11:56:26 PM NeilBrown wrote:
> 
> > On Mon, 26 Aug 2013 13:58:21 +0200 Sven Dyroff <S.Dyroff at phytec.de> wrote:
> > > Hello Radek,
> > > 
> > > > Together with reenumerating modem it makes GTA04 barely usable
> > > > even for a few hardcore supporters but unusable for normal users.
> > > 
> > > Not being reachable reliably is indeed the main barrier that prevents
> > > GTA04 to be usable as daily phone. It results in the requirement, that
> > > you need two phones to carry with you: One for making phone calls and
> > > SMS and the GTA04 for the rest. Otherwise you'll get the problems that
> > > Christ van Willegen described exemplary:
> > > 
> > > "I get a _lot_ of flack about not being reachable from my wife, who
> > > repeatedly calls on me to drop the GTA project and get another phone so I
> > > am reliably reachable again :-("
> > > 
> > > The second big problem indeed is power management. But power usage during
> > > suspend is a minor problem. Much more serious is the fact, that you
> > > cannot charge GTA04 in the same way as you're used from every other
> > > mobile device: Connect a charger to it in the evening and have a fully
> > > charged device in the morning.
> > > 
> > > Is it kernel or is it userspace which can be blamed for the problem, that
> > > after having charged up to 100% GTA04 will discharge again instead of
> > > switching over its power demand to external supply and thus keep its
> > > battery at 100% filling level, like every other mobile device does?
> > 
> > Does every other device really do this?
> 
> From my experience it's more about battery. My old battery charged full then 
> discharged to 0. I bought new battery which IIRC behaved correctly - charging 
> started again at those 75%. But now it does not work for me either:
> 
> root at neo:~# cat /sys/class/power_supply/bq27000-battery/charge_now 
> 556027
> root at neo:~# cat /sys/class/power_supply/bq27000-battery/charge_full
> 1103308
> root at neo:~# cat /sys/bus/platform/devices/twl4030_usb/vbus
> on
> root at neo:~# cat /sys/class/power_supply/bq27000-battery/status     
> Discharging

Could be a bug ... When VBUS is detected the CPU needs to tell the charger to
start charging.  It will keep charging /discharging until power is removed.

You could put a printk in the "if(enable)" branch of
twl4030_charger_enable_usb in drivers/power/twl4030_charger.c and make sure it
is getting enabled at the right time.

It could also be that the voltage threshold hasn't been reached.
The decision of when to start charging is not really based on percentage
charge. It is based on measured voltage.  When voltage drops to 3.95V it
should decide to start charging again.  Then when the current flowing in
drops to 80mA (I think) it stops charging.

What does the 'voltage_now' value show? What about current_now?

> 
> > If you had a device which would last for 5 days in standby, then during the
> > 6-8 hours between when the battery finished charging and when you unplug it
> > in the morning, it would use 8/120 of 1/15th of the battery. If your
> > display shows you battery level with 5 (or even 10) bars, this would still
> > show as full.
> >
> > The reason it is a problem for GTA04 is not that it stops charging and then
> > runs on battery, but that while on battery it uses too much current.
> 
> Yup - it makes the problem much bigger then it is...
> 
> > It is possible to reprogram the hardware to start charging the battery
> > again a bit earlier.  I think it currently restarts at about 75%.
> 
> Maybe we should give it a try.

This untested code might do what you want.

diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
index 02d67cb..a4aa6ea 100644
--- a/drivers/power/twl4030_charger.c
+++ b/drivers/power/twl4030_charger.c
@@ -34,6 +34,7 @@
 #define TWL4030_BCIIREF1	0x27
 #define TWL4030_BCIIREF2	0x28
 #define TWL4030_BCIMFKEY	0x11
+#define TWL4030_BCIMFTH2	0x17
 
 
 
@@ -262,6 +263,19 @@ static int twl4030_charger_enable_usb(struct twl4030_bci *bci, bool enable)
 		if (ret < 0)
 			return ret;
 
+		/* Change charge restart voltage BATOV4 */
+		twl_i2c_write_u8(TWL4030_MODULE_MAIN_CHARGE, 0xE7,
+				 TWL4030_BCIMFKEY);
+		/* Second nibble should be 6.
+		 * First should be 8 for default of 3.95V
+		 * If v is desired voltage, then use
+		 * (v-3.761)/0.0234
+		 * C corresponds to 4.04V
+		 */
+		twl_i2c_write_u8(TWL4030_MODULE_MAIN_CHARGE, 0xC6,
+				 TWL4030_BCIMFTH2);
+
+
 		/* forcing USBFASTMCHG(BCIMFSTS4[2]) to 1 */
 		ret = twl4030_clear_set(TWL4030_MODULE_MAIN_CHARGE, 0,
 			TWL4030_USBFASTMCHG, TWL4030_BCIMFSTS4);


> 
> > It isn't possible to run purely of the mains current as that typically only
> > provides 500mA, and I think the modem can occasionally need bursts in
> > excess of this.
> 
> Btw i wonder how the things are working in Freerunner. IIRC it's battery shows 
> current_now=0 when the phone is charged full (i have FR at home so cant 
> confirm, but i am quite sure).

Good question.  I'm sure it is quite possible to keep the battery fully
charged and in reserve so that it automatically starts feeding the circuit
the instant mains power disappears.  However I'm not sure that is good  for
the battery is it?

Anyway if anyone wants to try the above code and report the result I would be
very interested.  Ideally record the current and voltage values from the
battery and USB port every few minutes so we can see exactly what is
happening.

NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: not available
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20130827/38465919/attachment.bin>


More information about the Gta04-owner mailing list