[Gta04-owner] Crowdfunding an Ubuntu smartphone

NeilBrown neilb at suse.de
Wed Sep 4 09:37:36 CEST 2013


On Wed, 4 Sep 2013 17:14:48 +1000 NeilBrown <neilb at suse.de> wrote:

> On Tue, 03 Sep 2013 12:47:04 +0200 Adrien Dorsaz <adrien at adorsaz.ch> wrote:
> 
> > Hello,
> > 
> > I've tried to restart QtMoko (software), but the battery is still
> > discharging.
> > 
> > Le dimanche 01 septembre 2013 à 16:09 +1000, NeilBrown a écrit :
> > > 
> > > What does
> > >   cat /sys/class/power_supply/twl4030_usb/uevent
> > 
> > POWER_SUPPLY_NAME=twl4030_usb
> > POWER_SUPPLY_STATUS=Not charging
> > POWER_SUPPLY_ONLINE=0
> > 
> > > 
> > > show when it isn't charging but should be?
> > > 
> > > What does
> > >  cat /sys/devices/platform/omap_i2c.1/i2c-1/1-004b/twl4030_bci/max_current
> > > give?
> > 
> > 599089
> > > 
> > > If you
> > >   echo N > /sys/module/twl4030_charger/parameters/allow_usb
> > >   echo 490000 > /sys/module/twl4030_charger/parameters/default_usb_current
> > > 
> > > then plug in the power (unplugging first if necessary) does it change the 
> > > contents of 
> > >    cat /sys/class/power_supply/twl4030_usb/uevent
> > POWER_SUPPLY_NAME=twl4030_usb
> > POWER_SUPPLY_STATUS=Charging
> > POWER_SUPPLY_ONLINE=1
> > POWER_SUPPLY_VOLTAGE_NOW=4892745
> > POWER_SUPPLY_CURRENT_NOW=850021
> > 
> > Yes it was modified. I've applied commands above, unplugged and then
> > plugged.
> > > or
> > >    cat /sys/class/power_supply/bq27000-battery/uevent 
> > POWER_SUPPLY_NAME=bq27000-battery
> > POWER_SUPPLY_STATUS=Charging
> > POWER_SUPPLY_PRESENT=1
> > POWER_SUPPLY_VOLTAGE_NOW=3824000
> > POWER_SUPPLY_CURRENT_NOW=-480879
> > POWER_SUPPLY_CAPACITY=23
> > POWER_SUPPLY_CAPACITY_LEVEL=Normal
> > POWER_SUPPLY_TEMP=281
> > POWER_SUPPLY_TIME_TO_FULL_NOW=9420
> > POWER_SUPPLY_TECHNOLOGY=Li-ion
> > POWER_SUPPLY_CHARGE_FULL=1099203
> > POWER_SUPPLY_CHARGE_NOW=251328
> > POWER_SUPPLY_CHARGE_FULL_DESIGN=1233792
> > POWER_SUPPLY_CYCLE_COUNT=154
> > POWER_SUPPLY_ENERGY_NOW=803000
> > POWER_SUPPLY_POWER_AVG=0
> > POWER_SUPPLY_HEALTH=Good
> > 
> > Seems good too.
> 
> Something weird here.
> 
> The initial current limit was 600mA.  This is more than a USB port is
> guaranteed to provide.  Maybe the port noticed the excess current and
> switched off.
> 
> Then you told it to limit to 490mA which a USB 2.0 port can provide.  With
> that setting it started charging, but with a current of 850mA !!!  That is
> more than it should allow, and more than the port should provide.
> 
> The battery reports an inflow of 480mA, which suggests 370mA is being used
> by the phone.  That is a little high,  but not unreasonable depending on
> which bits are turned on.
> 
> It really looks like something is going wrong with the max-current setting.
> I'll have another look at that.

Yes... the code is slightly wrong.  It can sometimes set the max current to
twice the value that is requested.  I don't know if this explains all of your
problems, but it might explain some.

diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
index 02d67cb..db7c848 100644
--- a/drivers/power/twl4030_charger.c
+++ b/drivers/power/twl4030_charger.c
@@ -194,7 +200,7 @@ static int regval2ua(int regval, bool cgain)
 static int ua2regval(int ua, bool cgain)
 {
 	int ret;
-	if (cgain & TWL4030_CGAIN)
+	if (cgain)
 		ua /= 2;
 	ret = (ua * 10 + 850 * 10000) / 16618;
 	/* rounding problems */


I've got some other changes to 3.7 pending. I'll try to push them all out in
the next day or so.

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/20130904/8cc6872d/attachment-0001.bin>


More information about the Gta04-owner mailing list