yashsingh1/xdaforums huggingface dataset:
[Nexus 4 Android Development] thracemerin:
Thanks to kszaq in motley's thread, I have managed to update the prima driver to the latest v3.2.2.2 version along with the driver binaries, this has been reported to fix the issues with delayed notifications while on WiFi.

The builds are in post 2.

Happy Flashing! :victory:

Important Note:

1) These are not anykernel builds, you must flash the correct one. If you are on CM or a CM based ROM flash the CM version, otherwise flash the stock version, you will bootloop if you do this wrong.

2) This alters binaries that come with your ROM, it is highly recommended that you do a nandroid prior to flashing these kernels, I'm not responsible if you brick and don't have a way to recover.

3) Because of #2 if you decide to go to a different kernel you will need to flash your ROM again or WiFi will probably not work.

4) Instead of #3, you can flash this: wlan_revert.zip prior to switching kernels, which should put you back on the old WLan binaries.

Additional Note: You will see a new wakelock appear while on WiFi called 'qcom_rx_wakelock' this is normal and should remain fairly minimal, if it gets out of control please let me know.
[Nexus 4 Android Development] rycus86:
Do we need to flash the final v1 zip when applying the wifi fix or the hsic fix is also contained in it?

Thanks!
[Nexus 4 Android Development] thracemerin:
It includes everything from v1, just need to flash the WiFi fix version.
[Nexus 4 Android Development] DvTonder:
Great news. If this is confirmed to work, let's get this submitted to gerrit :)
[Nexus 4 Android Development] thracemerin:
Re: [Kernel][GPL][anykernel] msm_hsic_host wakelock fix (Now with WiFi notification f

Its promising, I want to give it a little more time before I say its confirmed so we don't get into the issue we had with the initial hsic patch issues on CM.
[Nexus 4 Android Development] mariotme:
Re: [Kernel][GPL][anykernel] msm_hsic_host wakelock fix (Now with WiFi notification f

You are a gentleman Sir :D
[Nexus 4 Android Development] jakejm79:
Is anyone else having any mobile radio/text message issues. My mobile radio will periodically drop out when I am connected to wifi (which maintains an active data connection fine). Also it seems to take an age for my SMS messages to be sent (like about 30 seconds) and then they will fail if the radio drops out, it helps sometimes if I toggle wifi on/off. I am also ending up with a huge number of duplicate SMS messages.

Reverting back to the previous fix and everything is back to normal.

I tried to recreate the mobile radio dropping to get a logcat, but it appears to happen at random and have had no luck yet.
[Nexus 4 Android Development] thracemerin:
I haven't had this happen, but I don't send many SMS messages, I'll try and see if I can reproduce it.
[Nexus 4 Android Development] rycus86:
Re: [Kernel][GPL][anykernel] msm_hsic_host wakelock fix (Now with WiFi notification f

The wifi fix looks good on my device. I also don't send much sms so I don't know about them.
[Nexus 4 Android Development] jakejm79:
Yes I didn't notice much last night (when I first flashed the fix) since I wasn't using my phone much. But this morning I was texting multiple people and I would notice it would take a long time to send (well it would say sending in the MMS app for about 30 seconds, but after about 10-15 I would receive one if I sent it to my GV #, but it wont send the next one till the previous one is marked with a sent time). Reverting back to previous and it updates to the time sent in less than 10 seconds and no drop outs.

Also it seems to effect incoming SMS messages too, I wouldn't receive any for a while, then if I toggled wifi or the like I would get a flood of like 5 at once.

On a side note the push notifications on wifi even with the screen off was almost instant :D
[Nexus 4 Android Development] thracemerin:
I'm not seeing this, but then again I just send out a few test SMS and sent a few back, I'll continue looking into it.
[Nexus 4 Android Development] jakejm79:
I am on the M2 CM10.1 build so maybe that is attributing to our differences.
[Nexus 4 Android Development] m_gl:
THX a lot. Your kernel works fine for me, Wifi delay ist fixed. Before your kernel tried the patched Motley 49 and this one didn´t work for me, Wifi delay wasn´t fixed (CM10.1).
[Nexus 4 Android Development] thracemerin:
I guess some people have been saying that WiFi Direct/Miracast isn't working properly with the new prima v3.2.2.2 driver because it altered a device specific file, since I don't have a Miracast capable device I'm not able to test this personally, if anyone in the thread is able to test this for me and let me know if it works I'd appreciate it greatly, there may already be a fix for this, I just want to confirm it is in fact broken first.
[Nexus 4 Android Development] sotong:
This kernel so far solves my delayed wifi notifications. I tried kszaq's modified Motley but i was still facing delays. One side effect however, is that i get a slowdown on the phone (especially on typing), when opening messages from the pull down notification bar (The modified Motley had no issues). If i open it the usual way, no lags. Anyone else facing this? I have reflashed my phone a few times and experimented with the 2 different kernels, all the same results so far.
[Nexus 4 Android Development] jakejm79:
So I have now been using the newest version again for about 24 hours and have had none of my previous problems, so it looks like it was Network related, or more likely (since it was fine immediately after I flashed the old fix) that there was something awry that would have been fixed with a reboot. Anyway no loss of signal in 24 hours that I have noticed and my text messages seem to send in about 4-5 seconds. I haven't texted as heavily as yesterday morning, but still quite a bit.
[Nexus 4 Android Development] thracemerin:
I did find a few posts where people were saying they had troubles with SMS on CM10.1, but since I very rarely send an SMS I can't say whether it was fixed since the M2 release or not, but if your problem is solved that's a plus.

I had this when I initially flashed it, but I didn't do anything to solve it and it went away. I've also flashed it again since I installed a new nightly for CM and the problem didn't come back, so IDK what the deal is with that.
[Nexus 4 Android Development] Skkip:
@thracemerin

Regarding the WiFi notification fix, in the motley kernel thread kszaq said his new version does not include WCNSS_qcom_wlan_nv.bin from CAF... Did you try your kernel without it?

I only saw that you pm'ed him because of that.

Right now i reverted 3.2.2 because i wasn't that satisfied with replacing the firmware files.

Hope you can enlighten me on that :)

Thx in advance
[Nexus 4 Android Development] thracemerin:
Well, kszaq said that some users reported that WiFi direct and Miracast don't work with the CAF version of WCNSS_qcom_wlan_nv.bin, where if you switch back to the one that ships with the device they begin to work properly again, since I don't own a device I could test this with I can't confirm or deny that he's right, I'm hoping someone can test this for me and let me know the results. He also told me that switching back to the stock version didn't affect the WiFi fix, so if you want to test it you can pull it from the revert zip and put it in the correct directory to test.

Since the files are precompiled and closed source I can't confirm what changed inside them, so I don't know for sure that there is anything in there that would be specific to the N4.
[Nexus 4 Android Development] k1lonbo:
This new kernel update made me love even more the N4... i can now connect to 802.1x EAP and PEAP networks... and until i use this last kernel update i was not able to connect!!!

Great work!

PS- For the one that doesnt know what iam talking about... in this forum/topic

https://code.google.com/p/android/issues/detail?id=36284

In post 33 google confirms that some driver problem exists and make impossible to connect to some 802.1x networks...

Whit this kernel, i finally can connect to my University wifi network. :)
[Nexus 4 Android Development] thracemerin:
Well, that's an interesting side effect, but I'm glad to hear it works.
[Nexus 4 Android Development] k1lonbo:
I was so desparated that i have tried almost every rom and kernel... And when i see "wifi fix" i just go for it... i tried and its working... with the same rom i was after flashing this kernel!!
[Nexus 4 Android Development] darkamikaze:
So I tried kszaq's fixes on a newly flashed PA with no dice. It actually made it worse for me causing loss of internet connection despite still being connected to the router whenever I wake the device from deep sleep. Toggling WiFi fixed the issue..

I'm trying yours now on another fresh install and it's slightly better but not quite so. I'm not getting the internet connection loss at screen wake anymore, however my device gets stuck at 384Mhz at screen wake causing the phone to lag severely. Reboot fixes the issue.

I'm also testing AirDroid in this setup. After a reboot, I start AirDroid, turn screen off and everything seems to work FANTASTICALLY compared to the stock kernel with no WiFi during screen off. This goes away however after I wake the device again (stuck at 384MHz again) and put the screen off. AirDroid becomes unresponsive again x\.

Another test, rebooted device. Let screen sleep on it's own. pings don't respond and request times out. This personally doesn't matter as long as the push of a notification behaves properly which seems to occur with the first instance of AirDroid.

Thanks for keepin' on chuggin though!
[Nexus 4 Android Development] thracemerin:
Keep in mind that kszaq's version is based on _motley's kernel which uses thalamus' auto_hotplug, this is based on stock which uses mpdecision, both handle the CPUs differently, though there should be no reason why it's getting stuck on 384mhz, I'll look into it, thanks for your report.
[Nexus 4 Android Development] thracemerin:
I have a thought, for those of you having lag issues, if you were on a custom kernel (ie Motley (_motley's or kszaq's), Franco, Faux, Harsh, etc...) they may have modified the powerHAL library and it may be causing the problems with mpdecision, try reinstalling your ROM to get back to the stock powerHAL and see if that fixes it. If you were on stock and/or haven't flashed any kernels other than this one, that shouldn't be the problem, but I was on _motley's kernel, then switched to this one and experienced the lag, what fixed it was reflashing CM which would have put the stock powerHAL back.

Edit: attached flashable stock powerHAL, you can try flashing this instead of the above method.
[Nexus 4 Android Development] darkamikaze:
Tried reflashing the stock powerhal (though I came from the stock PA kernel) for kicks and giggles.. still getting stuck at 384MHz at screen off/on X_x.
[Nexus 4 Android Development] thracemerin:
on the stock one, right? I think I realized the problem. basically, I'm stupid. Do you have the ability to flash something via fastboot to test a theory?
[Nexus 4 Android Development] thracemerin:
This is redundant, see post 2.
[Nexus 4 Android Development] caliban2:
Hm, my phone doesn't get stuck @384 though...

Just flashed this kernel (finally, wifi during standby! ^^) over an otherwise stock CM-nightly.
[Nexus 4 Android Development] thracemerin:
It's a problem with the stock zip, I'm almost 100% sure.
[Nexus 4 Android Development] caliban2:
AW: [Kernel][GPL][anykernel] msm_hsic_host wakelock fix (Now with WiFi notification f

My mistake, overread the stock-part. :)

On CM it's kinda boring, but the good kind of boring - everything seems fine after three hours, including messages. Bedtime here, so I'll see tomorrow how it behaves in the long run.
[Nexus 4 Android Development] darkamikaze:
Congratulations thracemerin.

Your kernel is now my daily driver. WiFi fix is completely working so far.

Tested a bunch of screen offs. AirDroid still working flawlessly.

Deep Sleep shows in CPU Spy. Just gotta update that stock zip with that boot img? lol
[Nexus 4 Android Development] thracemerin:
Ok, so that fixed it then?
[Nexus 4 Android Development] darkamikaze:
yep! flawlesss

thanks!
[Nexus 4 Android Development] thracemerin:
awesome, ill update the zip in a bit.
[Nexus 4 Android Development] thesebastian:
Re: [Kernel][GPL][anykernel] msm_hsic_host wakelock fix (Now with WiFi notification f

If i flash this to Google Stock 4.2.2:

hsic_fix_nexus4_wlan_stock.zip

Am i able to edit gamma using Franco utility?

Or can I just flash Paranoid Android Kernel after applying the stock.zip?
[Nexus 4 Android Development] thracemerin:
Neither
[Nexus 4 Android Development] thracemerin:
A corrected stock version has been posted in post 2, if you were using the previous version, get this one instead, it will fix the lag problem some people have reported. If you were using the CM version, there is no need to do anything.

Happy flashing! :victory:

Edit: in case you were wondering, I put the original in boot.img that contained a ramdisk with no mpdecision binary, oops :p
[Nexus 4 Android Development] darkamikaze:
hmm maybe it was too early to call but after a few minutes of screen off AirDroid said not responding. Turned the screen on and it came back.

My device is also doing what it was doing before which was when I turn the screen on from deep sleep, WiFi is disconnected and toggling wifi fixes it. :/ Qualcom is soo closee yet so farr..

Noticed pinging my device results in time out instead of host unreachable.
[Nexus 4 Android Development] thracemerin:
Odd, I dont seem to be able to reproduce the results with AirDroid, I had my screen off for about 10 mins and I could still use it when I sent it files, etc...
[Nexus 4 Android Development] Fr33L4nc3r:
Hum, seems I just got the explanation why transferring files over wifi between Solid Explorer and my PC using samba sharing was always failing for files that needed more than 30-40 seconds to transfer (screen timeout set to 30), such as CM nightlies.

Will try tonight.

Thanks again for your work thracemerin :good:
[Nexus 4 Android Development] mobilehavoc:
Re: [Kernel][GPL][anykernel] msm_hsic_host wakelock fix (Now with WiFi notification f

Flashed the stock one and I thought it was working at first but doesn't seem to be. Will try more tonight and rebooting my network equipment.
[Nexus 4 Android Development] AcmE85:
Unfortunately the new wifi driver does not work for me.

I tested your kernel, and the modded motley ones with clean roms.

Eventually my notifications arrive around 10 minutes delayed

or shortly after I power on the display.
[Nexus 4 Android Development] mobilehavoc:
Re: [Kernel][GPL][anykernel] msm_hsic_host wakelock fix (Now with WiFi notification f

Just to add to this. The only setup that works somewhat consistently is to enable broadcasts. That's about it.

I'll test again tonight with this kernel but not looking promising for me.
[Nexus 4 Android Development] thesebastian:
Re: [Kernel][GPL][anykernel] msm_hsic_host wakelock fix (Now with WiFi notification f

Thracemerin, Could you make a stock kernel with new WiFi drivers and halfbreed colors please? (For Google stock Occam ROM)
[Nexus 4 Android Development] giajp:
R: [Kernel][GPL][anykernel] msm_hsic_host wakelock fix (Now with WiFi notification fi

Contrasty is better :D

Sent from my Google Nexus 4 using CyanogenMod 10.1
[Nexus 4 Android Development] thracemerin:
I just flashed the new CM nightly and my kernel, my phone was then asleep with the screen off for over an hour, I then tried to ping it from another computer on the network, it responded immediately, I was also able to send myself gtalk and gmail messages from my other device without the notifications being delayed at all, so I'm not sure why some people are having issues with this still, I'll continue to look into it, thanks everyone for your reports.
[Nexus 4 Android Development] thracemerin:
At the moment I won't, while I'm doing testing I have no desire to make all kinds of different versions in order to please everyone's view of which colors are better.
[Nexus 4 Android Development] spncrmoo:
Thanks, working now, will post back tomorrow with some results.

Could this thread not go into original development? I feel like not enough people are seeing this in here, it should be a big deal! Well done, thanks :]
[Nexus 4 Android Development] thracemerin:
Other than a little research on which stuff to merge I didn't really do any work, like the code isn't mine so based on the XDA rules I figured it went here, I'll ask a mod for clarification.
[Nexus 4 Android Development] Richieboy67:
Re: [Kernel][GPL][anykernel][WIP] msm_hsic_host wakelock fix

Anyone using this with Paranoid?
[Nexus 4 Android Development] thracemerin:
I haven't personally tested it, but I don't see why it wouldn't work unless they've modified the ramdisk in some strange way.
[Nexus 4 Android Development] AcmE85:
I am on a train ride home right now. Reception is rather low in this region but my data connection has never been more stable!

Thanks!

For camparison: On Thursday I was travelling the same way. I had to go to flightmode and back a couple times to bring back data on latest cm10.1 stock kernel.
[Nexus 4 Android Development] Nebucatnetzer:
It really seems to work awesome! :good: :laugh:
[Nexus 4 Android Development] dwang:
the 3g hsic wakelock fixes don't seem to be translating into better 3g battery life.

I compared harsh's kernel with motley's kernel and both are getting the same deep sleep battery drain.

http://xdaforums.com/showpost.php?p=36927826&postcount=610
[Nexus 4 Android Development] thracemerin:
During this test you did, what services were running? If you have sync off, location off, no background apps using data which is what your test appears to be testing, you're right the difference is going to likely be fairly insignificant, it's when you are using the phone or have many active apps that wake up and put the modem to sleep that it's going to make a big difference since the patches that Harsh originally merged and I've merged to this just work on how the phone suspends the modem (and more generally the USB devices) not on how the radio interface actually works. Faux123 pointed out on his G+ that this is only half the fix really, the other half needs to come from Google/LG in the form of a new baseband that properly takes advantage of the better USB interface.

You also need to consider how those 2 kernels manage the CPUs, if one is offlining all by 1 core while the screen is off and the other is not, how much they uV those cores, other settings, it's very possible that one running in awake but low power mode does in fact use as much power as the other in deep sleep mode, the only fair comparison between kernels here is stock vs this kernel, because there are no other changes.
[Nexus 4 Android Development] dwang:
I have all google apps syncing in the background, msft exchange syncing every hour.

I don't see how any of that makes any difference. Both are in cpu deep idle mode (90% idle from bbs), so none of what you said makes any difference. So the only thing that is being tested is the 3g radio and the hsic wakelocks. And based on my tests, these patches aren't doing much. There's not even a 1% difference in battery percentage between the two.

The hsic wakelocks have been essentially cut in half, yet no difference in battery life.

My feeling is the hsic wakelocks aren't really contributing too much to the power drain of the phone and most of the drain is still coming from the radio and it doesn't seem like there is much that can be done. Maybe a new radio will help, maybe not.
[Nexus 4 Android Development] thracemerin:
How does what I said make no difference?

On Motley (top 3 wake locks)

hsic ~32mins

radio ~16 mins

power manager: ~6mins

total awake: ~54mins

On Harsh

radio: ~14mins

hsic: ~10mins

power manager: ~5mins

total awake: ~29mins

That means Motley's kernel spent roughly twice as much time in awake/low power mode than Harsh's did, which means their deep sleep times can't be equal. So, you have to look at how Motley's kernel is using roughly the same amount of power during 54 mins of awake time as Harsh's is during 29 mins, and that's where their CPU management, uV, etc... comes in to play.

Just an example (without actually looking at anything CPU related in either kernel). If Kernel A has it's awake with screen off settings tuned to online 1 cpu core and minimum clock only, it's going to use significantly less power than Kernel B that doesn't have a tweak and therefore allows all 4 cores to online with the screen off and ramp to whatever speed the system feels is necessary.

I get what you're saying, but by using 2 kernels with completely different CPU usage models, you are taking a test that should have 1 variable (the hsic patches) and adding numerous other variables to the equation in such a way that you can't make the conclusion you are making. That's why I said the only fair test is stock vs this kernel.
[Nexus 4 Android Development] dwang:
You're assuming that those values are sequential, those wakelocks are happening in parallel. I don't think you can add them all together like that.

And each component probably has a different drain on battery, so each min of drain with hsic does not equal the same amount of drain with the radio, etc.

If you take out the hsic, which is the biggest difference, the time is 22min vs 19min, so they are essentially the same given that both phones were on battery for ~5 hours.

So my original statement stands, the hsic wakelocks doesn't seem to be contributing that much to power drain. Its mostly the radio.
[Nexus 4 Android Development] thracemerin:
I didn't say that the baseband (which is a proprietary binary) isn't the problem, in fact I agree with Faux123 that at best this fixes 1/2 of the problem, in both your shots your signal was yellow which means it wasn't superb (the same for both certainly, but that doesn't make it good) which of course means that the radio is going to have to work harder to transfer the data than it would if the signal were green. All we are able to do is fix whether or not the USB bus suspends properly when the modem is done using it, on stock it doesn't seem to, but if all that's happening is the USB bus is idle and the CPU is awake but in low power mode, the actual drain is low, you are right. If the phone is awake (because the USB bus didn't suspend) but nothing is actually happening other than it waiting for the USB bus to suspend, it will use slightly more power than it would if it were asleep, but the difference would be minimal enough that it wouldn't be too terribly noticeable in a 5 hour idle test, over a significantly longer test I'd be willing to venture that you'd see more significant results in terms of the difference.
[Nexus 4 Android Development] dwang:
Re: [Kernel][GPL][anykernel][WIP] msm_hsic_host wakelock fix

One thing I do want to say is I truly appreciate everybody's hard work in trying to fix this.

This is what makes android so much better than iOS. Community spirit and sharing.

I'm not trying minimize anybody's hard work. Just sharing my findings with the community.
[Nexus 4 Android Development] thracemerin:
I appreciate your view on this, and I don't think our points of view are that different, I think perhaps I did a bad job of expressing what I really meant.
[Nexus 4 Android Development] dwang:
It is possible that motley's kernel is slightly more efficient than harsh's kernel.

Motley's lowest cpu state is 304@725000 vs 384@750000, but how much extra battery life would that contribute? I think 1% at most, probably a lot less than that.

I'm just disappointed at how much more power the 3g radio drains vs wifi. With wifi I get 98% battery after 5 hours of deep sleep vs 93% with 3g. I was hoping the 3g hsic patches would take it closer to 96% or something like.