[Gta04-owner] My 3.18 GTA04 kernel...
NeilBrown
neilb at suse.de
Sat Dec 20 02:48:00 CET 2014
Hi,
I've just pushed out a new 3.18-gta04 branch to
git://neil.brown.name/gta04
with my current devel code. It isn't suitable for regular use as it still
uses too much current in suspend, but it's there for looking at if anyone is
interested.
It contains the 'tty slave' and other code that I recently posted.
It also contains substantial rewrites to the 'charger' code.
It now tries to detect a 'charger' as being different from a computer.
If it detects a charger, it will draw as much current as it can providing the
voltage stays above 4.75V. Even from a computer it will only draw the
allowed 500mA is the voltage stays above 4.75V.
Unfortunately there are two piece still missing from the charging picture.
There are two ways that a charger can be detected. One is by there being a
resistor-to-ground on the ID pin. This bit I have working fairly well.
The other is by the D+ and D- pins being shorted.
The TWL4030 is supposed to be able to detect this.
It has a 'PSM' - Phone State Machine (I think).
This state machine is supposed to poke different currents into different
places on the USB cable, measure voltages at other places, and determine
what sort of cable is plugged in.
One of the states is 'ph_charger' which is reached when D+ and D- are
shorted. When this state is reached it should raise an interrupt.
I haven't manage to get it to do that yet. I can't seem to activate the PSM
at all. I think.
So that is one piece. The other piece is determining properly how much
current the normal upstream USB port will provide.
The way USB normally works is the the host always provides 100mA so the
device can power on. It then asks the device what it can do, to which the
device provides a list of configurations which provide lots of details
including the max power will be required.
The host then chooses one and activates it (or doesn't).
So for the GTA04 to find out what current the host can provide, it should
provide a small list of configurations, which request 1000mA, 500mA, 200mA,
100mA, 50mA, 8mA (or similar). Then depending on which one the host chooses,
that much current can be drawn.
We don't do this yet. Instead the GTA04 always says it needs
CONFIG_USB_GADGET_VBUS_DRAW
mA. If the host is happy with that the connection is enabled and the charger
can work. If not, you cannot use the USB at all.
In my defconfig, I set that to 500. That means it can charge OK from a
computer, but if you plug into an unpowered hub the USB connection won't work
at all.
(To get the old behaviour where it always tries to draw 500mA, set
CONFIG_USB_GADGET_VBUS_DRAW to 8, and set the twl4030_charger.allow_usb
module parameter to Y. This will even work reasonably well on an unpowered
hub as it will try to draw current to charge, but will give up if the voltage
drops).
So there is more work to do here, but I feel it is progressing in a good
direction.
There are several other things I want to look into:
- When the MMC driver tries to turn on the Wifi chip, if it ever fails then
the wifi becomes inaccessible until next boot.
- The MMC driver tries to turn the wifi chip on every time we resume from
suspend. That is a waste of time/power.
- audio, including jack detection, needs to be implemented in a
devicetree-acceptable way
- Currently the bluetooth will only power down if hciattach is killed.
It would be nice if it powered down on 'hciconfig down'. I'd like
to find a way to achieve that.
- I'm certain the internal USB (connecting the GSM module) is not doing
power management very well. I don't think that is the only power problem
but I want to investigate it.
- probably lots of other little things..
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20141220/deb98a54/attachment.asc>
More information about the Gta04-owner
mailing list