[Gta04-owner] Replicant 4.2 kernel patches

Paul Kocialkowski contact at paulk.fr
Thu Apr 24 00:28:55 CEST 2014

The GTA04 kernel used in the "upstream" GTA04 port is now available at:
https://gitorious.org/replicant/kernel_goldelico_gta04/ (branch
replicant-4.2). It is part of the Replicant 4.2 source tree as well.

I'll comment a bit on some of the changes I introduced to solve some
issues that are present with the goldelico kernel (3.12-android4), 
though there is a lot of work ahead of us.

* bq27x00: Always report charge information

When using a new battery for the first time, the accurate flag is not
set since it has to figure out some parameters to compute the charge
correctly and that takes a few charge/discharge cycle. This causes
Android to consider the charge level as 0, which will trigger an instant
shutdown. This is very unfortunate and gives no possibility to go
through the few charge/discharge cycles that are necessary to calibrate
the battery, other than using another system.

I think it's acceptable to always report the charge information even
when it is not accurate. On the other hand, we could modify the Android
framework to consider no charge as unknown (as it does when no battery
is plugged in), but I prefer to introduce as few changes to the
framework as possible. The reason for this is that it makes porting to a
newer version a bigger job.

On the other hand, I understand that keeping a small delta compared to
mainline Linux is important too, even though we cannot expect the
Android kernel to be upstream anytime soon (maybe in the very long run,
mainline will have all we need, but it'll take time).

* bq27x00: Shortly retry more often to update data after inconsistent
states (cee4cb8d2c4f5069cdce035cb9b8cecf7a8d55fe)

The commit message holds a pretty complete explanation of the issue:

This is especially relevant when an external power supply is plugged:
bq27x00_external_power_changed will trigger bq27x00_battery_poll
immediately, though the battery might not have yet detected the change
and will still report discharging status. This makes the driver try to
reach a consistent state for a few seconds by polling the battery every
2 seconds.

The same issue happens when an external power is unplugged: the battery
will still report charging status.

Since the bq27x00 is not driven by interrupt, this change makes it
possible to detect the status change as soon as possible while still
giving up shortly if it cannot reach a consistent state.

* twl4030 charger: Declare supplicants from platform data
* gta04: bq27000-battery supplicant for twl4030 charger

That's simply to make the battery driver aware of the power supply
change. This is important to trigger a status change and make the
battery driver report a status change up to the system, which will then
display that the battery is charging.

Perhaps the other battery driver should implement something like this?
In any case, I doubt we want the charging notification to show up 1
minute after the power supply was connected (that'll totally confuse the
user and will probably make them think the device is not charging at

Thanks to the previous patch, detection usually takes ~4 seconds.

Let's try to find correct solutions to these problems. I'm aware these
are just fast solutions to make things work right now, but the issues
need to be discussed.

Paul Kocialkowski, Replicant developer

Replicant is a fully free Android distribution

Website: http://www.replicant.us/
Redmine: http://redmine.replicant.us/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20140424/0995d8ed/attachment.asc>

More information about the Gta04-owner mailing list