[Gta04-owner] Wi-Fi issues and workarounds

Paul Kocialkowski contact at paulk.fr
Sun May 25 22:09:03 CEST 2014

Next up on my list was bringing Wi-Fi support to the upstream Replicant
4.2. Thankfully, Lukas already did most of the work on the
userspace-side, but some work was left on the kernel side.

First, suspend/resume was (and still is) broken. I think everyone is
aware of that. It seems to be the last remaining piece to fix to have
every component properly suspending and resuming, which would be a nice
thing to have.
Perhaps I'll try to debug it some time later, though I kinda doubt I'll
succeed. To workaround this issue, I added a kernel wakelock to the
driver, so that the device doesn't suspend when the driver is loaded. I
suppose it makes sense anyway, else it might cut a long download or so
(it went to suspend when downloading an application on F-Droid, which is
probably not what we want).

The related commit[0] is:
commit b73f8dfdc7c2baccd3e7327b4006ee44ccc146ed
Author: Paul Kocialkowski <contact at paulk.fr>
Date:   Sun May 25 19:04:34 2014 +0200

    libertas_sdio: Prevent going to sleep when the driver is loaded
    Signed-off-by: Paul Kocialkowski <contact at paulk.fr>

Most importantly, I also switched the firmware loading from async to
sync. First because Android expects the interface to be fully usable
right after loading the module and I didn't want to keep it loaded all
the time, but also because it can cause a kernel oops if the module is
unloaded before the firmware request callback kicks in. That happened
when lacking the proper configuration for wpa_supplicant, which
triggered a module unload right after loading it. The problem is that
the resources used by the callback are freed when unloading the module.

Relevant commit[1]:
commit c05fa8a302e2bf9d42dd6353c0ada136426d249f
Author: Paul Kocialkowski <contact at paulk.fr>
Date:   Sun May 25 18:43:58 2014 +0200

    libertas_sdio: Load firmware during probe
    Signed-off-by: Paul Kocialkowski <contact at paulk.fr>

There was also an issue with speed (about 4 times slower than another
Wi-Fi device), which was solved by integrating back Neil Brown's patch
(which was originally for 3.7). I adapted as well as I could and it
seems to work as expected (the speed is now normal), however, it
completely breaks resume (the phone doesn't resume at all). Thankfully,
the wakelock ensures it never goes to sleep when the module is loaded,
so the problem doesn't appear. Still, that's something to look at.

The modified commit[2] for 3.12 is:
commit 17e1064b21a0dc8e8c03c0e6ffd7167edaa8eac4
Author: NeilBrown <neilb at suse.de>
Date:   Fri Oct 18 20:06:43 2013 +1100

    omap_hsmmc: enable sdio_irq.
    There are some horrible hacks in here, particularly
    the fact that we still poll.  surprisingly this adds
    20% to throughput.
    Signed-off-by: NeilBrown <neilb at suse.de>

In order to make it possible to load only the libertas_sdio module, I
set its dependencies as builtin[3]:
commit d129095a296ddc38bfec4c5af019fe54f0c88855
Author: Paul Kocialkowski <contact at paulk.fr>
Date:   Sun May 25 19:06:22 2014 +0200

    gta04_defconfig: Builtin Wi-Fi dependencies
    Signed-off-by: Paul Kocialkowski <contact at paulk.fr>

I do not suggest any of this is valid for mainline or even for the
non-android kernel, but it gets the job done here ;)

By the way, what's the status of the libertas_tf driver? It seems rather
incomplete in mainline but should bring advantages over the other
libertas driver. Mostly, the firmware is thinner with libertas_tf and
most of the work is left to the kernel instead of the firmware, which is
nice. It permits to have access point feature. Getting it to work
reliably with the GTA04's chip would be something good to have in the


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/20140525/e6bd536d/attachment.asc>

More information about the Gta04-owner mailing list