[kernel patch] Fast charge without disabling USB - Samsung Galaxy Nexus

I've come up with a small patch that changes the fast charging behavior in FastCharge kernels to not disable USB, but still be able to fast-charge the battery. Good if you want to USB tether, while still taking a charge. The old patch fakes out the FSA9480 (and friends) to pretend that there is a charger, not a peripheral, connected; the new patch simply jams the charge current GPIO high in fast charge mode, which has the same effect, but without killing off the actual USB connection.
I prototyped it on TinyKernel, and it seems to work (thanks to tiny4579 for helping me test, since my toolchain seems broken in a bizarre fashion). If you're a kernel developer, you'll want to cherry pick these two patches --
https://github.com/jwise/tinykernel-gnex/commit/5fed4d674e44129502b045b350594552c96acb79
https://github.com/jwise/tinykernel-gnex/commit/8e7e8b4bacfe1ef5d86c52f96232c76fc3d0a181
I don't have a direct way of measuring it, but it seems to be effective through an indirect measurement: staring at a Kill-A-Watt (which my laptop is plugged into), the power measurement jumps by about 3W when I plug in the phone without fast charge enabled, and by about 6W when I plug it in with fast charge enabled. The charge rate also seems commensurately faster.
If you use this patch, feel free to credit me as 'Joshua Wise <joshua at joshuawise dot com>'.
Enjoy!
edit: Please also cherry pick https://github.com/jwise/tinykernel-gnex/commit/8bc251d313001f1e2ba35523d62429c9c0cea12b, to fix an embarrassing bug where I failed to appropriately turn off the charge GPIO when the charger was disconnected.

Will this cause any damage? Something seems... iffy, here.

Great great work here. I am too cheap to donate to Verizon and buy OEM chargers from them so I use fast charge constantly. This is will, I'm sure, be a regular household product among custom kernels everywhere soon!

SomeGuyDude said:
Will this cause any damage? Something seems... iffy, here.
Click to expand...
Click to collapse
It shouldn't.
Both of these patches -- the original, and mine -- work by faking out some part of the system. The original patch worked by faking out the charger detect logic, jamming the USB controller's detection into believing that there was always a 'charger'-type device connected (not an MHL-type, or USB-type device).
This patch works by faking out the charger enable logic. The charger detect logic in the kernel set a series of flags that further and further down the pipe turned into enabling a GPIO that connected to the PMU, which actually was responsible for enforcing a charge rate. My patch tries to reduce the "collateral damage" by making the change as late as possible, only modifying the charge GPIO, rather than the entire detection logic (and, with it, the logic that turns on the USB OTG interface).
You are, of course, absolutely right to ask this; messing with charge code is always scary, and you should always be wary of changes to how the system's power management works. But, in this case, I think that the patch should be at least as safe as the original was.
joshua

You mention mhl, will this work with that as well to hopefully squeak a little more power if available out of a mhl adapter?

meental said:
You mention mhl, will this work with that as well to hopefully squeak a little more power if available out of a mhl adapter?
Click to expand...
Click to collapse
I don't have any MHL devices to test with, but it should.

SomeGuyDude said:
Will this cause any damage? Something seems... iffy, here.
Click to expand...
Click to collapse
People have been doing this since windows mobile. It won't hurt your phone and will only hurt old USB ports that can't output 1000 mA or so.
Edit - should add that it won't hurt your phone as long as it sticks to the AC charge rate .
Great work on the patch OP.
Sent from my Galaxy Nexus using Tapatalk 2

I'm thinking about adding this to my next release.
Sent from my HTC One using Tapatalk 4 Beta

tiny4579 said:
I'm thinking about adding this to my next release.
Sent from my HTC One using Tapatalk 4 Beta
Click to expand...
Click to collapse
I hope all Kernal developers add this haha. Sounds like there are no disadvantages or negatives to it.

moccor said:
I hope all Kernal developers add this haha. Sounds like there are no disadvantages or negatives to it.
Click to expand...
Click to collapse
As the OP said there is a risk when messing with power management (the charging rates in particular). That is the potential negative. What I do like about this patch is that you can enable fast charge and keep USB mode. I didn't know it was possible on this device.
Also there is no a in kernel.

Oops, of course, an embarassing bug -- I didn't disable the fast charge GPIO when the charger was disconnected, which I think was resulting in excessive power draw at idle. (Luckily, it was fast to charge the phone back up again! )
Developers will also want to cherry pick:
https://github.com/jwise/tinykernel-gnex/commit/8bc251d313001f1e2ba35523d62429c9c0cea12b
which fixes that issue.

tiny4579 said:
As the OP said there is a risk when messing with power management (the charging rates in particular). That is the potential negative. What I do like about this patch is that you can enable fast charge and keep USB mode. I didn't know it was possible on this device.
Also there is no a in kernel.
Click to expand...
Click to collapse
Yeah, that's limiting the power it should receive right? I doubt he knows how to edit custom kernals and not know how to follow a simple USB AC adapter. And it should be very easy to compare this side-by-side with the previous fast charge text to show the only thing changed is what he modified to trick the phone, and not any of that power stuff.

I am curious with this patch if it will be able charge while using the GPS, with all radios enabled? Any thoughts?

So is this dead? It was a awesome idea because I myself use Fast-charge almost daily.

moccor said:
So is this dead? It was a awesome idea because I myself use Fast-charge almost daily.
Click to expand...
Click to collapse
No it's not. My kernels have these patches integrated. In fact I was the original tester. Too bad this wasn't around when my GNex was a daily driver as it's quite nice and seems to burst the charging rate without sacrificing USB functions.

Are your kernels the only one with this patch Tiny?

tiny4579 said:
No it's not. My kernels have these patches integrated. In fact I was the original tester. Too bad this wasn't around when my GNex was a daily driver as it's quite nice and seems to burst the charging rate without sacrificing USB functions.
Click to expand...
Click to collapse
Oh cool. I have been waiting for some sort of reply that it was finished or that he had some file to flash to enable it haha. Well, I am gonna try your kernal out tonight+tomorrow, thanks.

Yeah, I've been running it on my phone more or less full-time, and it's saved my ass many times over ...

I'm building my own gnex kernel and this is definitely getting included ... Many thanks Op :thumbup:
Sent from my Galaxy Nexus

bsmitty83 said:
I'm building my own gnex kernel and this is definitely getting included ... Many thanks Op :thumbup:
Sent from my Galaxy Nexus
Click to expand...
Click to collapse
Hey bsmitty! Will you be releasing this kernel, because I'd definitely run it. W00t dinc2 community!

Related

[REQ] We need a Fast Charge Battery Driver

Like most of the others in this section, I come from the WinMo world. I just got my OTA'd Evo and I have to say, the battery takes forever to charge. My Touch Pro2 & Touch Pro both have no2chem's fast charge battery driver(it makes it feel like they fully charge in 5 mins) and since we haven't seen him in a while I thought someone else might be able to develop one for our amazing Evo's!!
Please Help!! Thanks in advance!!
Can you provide more info on this? A full charge in 5 minutes sounds ridiculous but I won't out anything past XDA
TMartin03 said:
Like most of the others in this section, I come from the WinMo world. I just got my OTA'd Evo and I have to say, the battery takes forever to charge. My Touch Pro2 & Touch Pro both have no2chem's fast charge battery driver(it makes it feel like they fully charge in 5 mins) and since we haven't seen him in a while I thought someone else might be able to develop one for our amazing Evo's!!
Please Help!! Thanks in advance!!
Click to expand...
Click to collapse
Haha, I remember that WM driver..NueBattery (no2chem)..
Sent from my PC36100 using XDA App
this has been spoken of before on these forums... it might be in the works, but you are reffering to a fast charge via USB connection rather than wall connection. Wall connection is full speed, USB is throttled down to prevent damage to the USB port on the computer plugged in to.
the process is a great add if you use tether charge a lot, like I do. If I am constantly streaming online on my old winmo phone even with fast charge I would slowly deplete my battery while it was plugged in, I haven't used the EVO much for streaming but I would be afraid to see the results w/o fastcharge.
thats why you buy a couple extra batteries and a wall charger
TMartin03 said:
My Touch Pro2 & Touch Pro both have no2chem's fast charge !
Click to expand...
Click to collapse
yea... same here.... i loved that ****
TMartin03 said:
My Touch Pro2 & Touch Pro both have no2chem's fast charge battery driver(it makes it feel like they fully charge in 5 mins) and since we haven't seen him in a while I thought someone else might be able to develop one for our amazing Evo's!!
Click to expand...
Click to collapse
Wasn't No2chem female?
Edit: Never mind, I'm thinking of another Windows Mobile Dev.
mental26 said:
Wasn't No2chem female?
Edit: Never mind, I'm thinking of another Windows Mobile Dev.
Click to expand...
Click to collapse
a FEMALE?! BlashpHEMOUS!
You stole Boo Boo's Name said:
thats why you buy a couple extra batteries and a wall charger
Click to expand...
Click to collapse
This. Got a replacement battery and charger on ebay for under $10 shipped. Works out great. Just swap the generic out with the stock whenever my battery starts running low. The only time I ever plug in my phone to charge is at night.
Seriously - if somebody is requesting a valuable piece of development in a development forum, what value are you adding trying to sell him batteries!? Do you honestly think he's gonna be like, "Oh hey, yeah, you're right! Who needs a phone to charge fast when I can just carry around a pocket full of spare batteries and a charger! Why didn't I think of that?"
sopenco said:
Seriously - if somebody is requesting a valuable piece of development in a development forum, what value are you adding trying to sell him batteries!? Do you honestly think he's gonna be like, "Oh hey, yeah, you're right! Who needs a phone to charge fast when I can just carry around a pocket full of spare batteries and a charger! Why didn't I think of that?"
Click to expand...
Click to collapse
Perhaps he didn't realize how inexpensively good-quality replacement batteries and chargers can be acquired. Also, a single battery inside a charger case isn't much larger than a wall charger + cable (which by your own assumption he must be carrying around in his pocket).
I understand what you're saying about it being a developer forum and all, but I don't see any harm in offering a feasible solution to a posed problem. I mean, look at Apple. They told people they had to buy a case or stop holding a phone with their left hands!
+1 for this
5 Minutes to charge and 10 minutes of use sounds about right for WiMo
I wish when connect to USB it would trickle charge. that way you don't the drop as soon as you disconnect the phone. so i guess i want to slow things down a bit but just when on USB.
This!
clayginn said:
5 Minutes to charge and 10 minutes of use sounds about right for WiMo
Click to expand...
Click to collapse
Sent from my PC36100 using XDA App
sopenco said:
"Oh hey, yeah, you're right! Who needs a phone to charge fast when I can just carry around a pocket full of spare batteries and a charger! Why didn't I think of that?"
Click to expand...
Click to collapse
Hahahaha ha.
Yes, we need this for sure! Carrying around batteries is NOT the answer.
it wouldn't really charge in 5 minutes, but it would charge about as fast as plugging it into the wall.
and for the person mentioning the developer who was a girl, cmonex legend of hardspl!
+1 on the props to cmonex!
wastingoctober said:
Perhaps he didn't realize how inexpensively good-quality replacement batteries and chargers can be acquired. Also, a single battery inside a charger case isn't much larger than a wall charger + cable (which by your own assumption he must be carrying around in his pocket).
I understand what you're saying about it being a developer forum and all, but I don't see any harm in offering a feasible solution to a posed problem. I mean, look at Apple. They told people they had to buy a case or stop holding a phone with their left hands!
Click to expand...
Click to collapse
this fast charge thing is NOT new to most of us that frequent XDA and other dev/mod forums (PPCGeeks)...and it is perfectly legit to put out a request for...
suggesting an extra battery is good and all...but not always feasible. Apple suggesting what they did was to redirect everyone's attention to THEIR lack of attention on a piece of supposedly high end hardware..that now seems to be flawed. OP has been around for sometime...and the extra battery thing is a good idea already...especially for noobs

LOOK WHAT I FOUND!! Wireless Charging Door Spotted

I found VZW listing this item on their site this afternoon.... let's hope it's going to be available soon
but then I am not sure if i want it... hm...
http://shop.verizonwireless.com/?id=Wireless Charging Inductive Battery Cover 47610
Still cant stand battery doors that make the phone bigger. Thats my main reason for sticking with stock battery. Although cool, i wont be getting this.
been on verizon's site for a while now.. i don't know why they would put it up for so long if its not even going to be in stock any time soon.
wireless charging eh?.. but still requires a charging pad that needs to be plugged in.
i remember hearing a while ago from a verizon tech(one of the guys who works on the towers) saying that eventually the same signal broadcast from the tower will eventually also wirelessly charge our phones.
that i'd like to see
voxigenboy said:
wireless charging eh?.. but still requires a charging pad that needs to be plugged in.
i remember hearing a while ago from a verizon tech(one of the guys who works on the towers) saying that eventually the same signal broadcast from the tower will eventually also wirelessly charge our phones.
that i'd like to see
Click to expand...
Click to collapse
Wireless charging uses induction. To use the towers would require a LOT of power. If people are worried about our phones causing cancer now, I can't wait to see their response to something like this notion of mobile charging.
nimdae said:
Wireless charging uses induction. To use the towers would require a LOT of power. If people are worried about our phones causing cancer now, I can't wait to see their response to something like this notion of mobile charging.
Click to expand...
Click to collapse
Mass genocide. Killing of DInc2 users.
Sent from my SCH-I500 using XDA App
The charging door is finally available for order.
blackb13 said:
The charging door is finally available for order.
Click to expand...
Click to collapse
Yeah, I was actually going to mention that it's now ready for ordering. I might get one next paycheck.

VERY dodgey input while charging

I know this happens on alot of devices. When u plug it in the current from charging interferes with input sensitivity. But it is VERY well pronounced on this phone. This the only thing that's bugging me about this awesome phone.
I just want to make sure I'm not the only one having major difficulties while plugged in. Post your results here please. Thanks
sent from my damn EPIC TOUCH 4G!!!!
Success100 said:
I know this happens on alot of devices. When u plug it in the current from charging interferes with input sensitivity. But it is VERY well pronounced on this phone. This the only thing that's bugging me about this awesome phone.
I just want to make sure I'm not the only one having major difficulties while plugged in. Post your results here please. Thanks
sent from my damn EPIC TOUCH 4G!!!!
Click to expand...
Click to collapse
Yeah its the voltage or amperage whatever on the wall charger. Try and find one with a smaller output
wait so the adapter bundled with the Epic Touch sends more amperage than the thing can handle? and to the point of interfering with button sensitivity?
I do notice it a little bit, but I Have had it plugged in for over an hour now, it happend to me about once or twice. nothing too bad.
I used my tabs charger not thinking...no issues
Sent from my SPH-D710 using Tapatalk
Its not that the stock one is "the wrong" charger. Its that the outlet charger is meant for rapid charges so it puts out alot more than say a usb port. Thats why usb takes alot longer to charge and the wall charger can do it in a couple hours.
Sounds kind of odd... I have used 5 different chargers with the normal epic and never had any kind of issue as the phone has it's own internal current regulation. I had put a 3A charger (WAY overkill) on my epic with no issue. If this is causing your phone issues, I would give it a few days, see if others have the problem and if not, exchange it ASAP.
See I always had that issue with my evo and hero. If I used a 3amp charger the input was whack as hell but if I used my 1.5amp it was perfect. Wonder if its an outlet ground issue or something else.
wingzfan said:
See I always had that issue with my evo and hero. If I used a 3amp charger the input was whack as hell but if I used my 1.5amp it was perfect. Wonder if its an outlet ground issue or something else.
Click to expand...
Click to collapse
Do we know what the chargeing level is on the epic touch? I know for the epic it was 600mA if D+ and D- were shorted and 380mA on data USB if the data pins were not shorted.
it has happened with my last few devices. I will say this thing charges pretty quickly..but yes when it is charging my phone is a pain to use.
As far a charging ratings...well..I aint that smart. lol
Success100 said:
I know this happens on alot of devices. When u plug it in the current from charging interferes with input sensitivity. But it is VERY well pronounced on this phone. This the only thing that's bugging me about this awesome phone.
I just want to make sure I'm not the only one having major difficulties while plugged in. Post your results here please. Thanks
sent from my damn EPIC TOUCH 4G!!!!
Click to expand...
Click to collapse
I noticed this too, sadly I didn't say anything cause I thought it was me hitting a button or something by accident
I have had this with all my htc and android devices. It does it at my house only. When Im at my parents charging it does not interfere. Evo was real bad, epic has been alot better. I have noticed that once it is charged the issue is usually somewhat resolved. It would be awesome if someone found a fix to this. Though im pretty sure it is my old house or the radio towers 3 streets down that I can hear on my landline.
maybe I'm in the minority but I consider this a big issue. I've never experienced anything of the sort with my Epic and, like a previous poster, I've used all sorts of cables and chargers. will have to wait for some more feedback from new users on it, though.
what does "input sensitivity" mean?
dead78 said:
maybe I'm in the minority but I consider this a big issue. I've never experienced anything of the sort with my Epic and, like a previous poster, I've used all sorts of cables and chargers. will have to wait for some more feedback from new users on it, though.
Click to expand...
Click to collapse
its not a huge issue for me...but yes, i think it can be fixed via software update. happened to the Evo when it first launched
Im not noticing anything like that... I guess we will see but so far so good
I am not getting anything like this either.
What exactly are you guys seeing? I'm charging mine now and haven't noticed anything unusual.
Sounds like it might just be "dirty" electricity basically if someone even has it only happen at once location but not another. Not much you can do about that but test it and put filters on... both things cost money. Maybe this phone is more sensative to it than others.
Perhaps we should start a sticky listing any bugs found instead of having a thread for each one discovered?

Slowness In Touchscreen While Charging

I found a kernel in ATT Note that removes ghost touches, so that might be just the thing that slows it down.
Mine gets slow too..I'm got beastmod5 with darkside kernel ..
It lags crazy when using adownloader
Uncharted.
Sent from my SGH-T989 using XDA
alphadog32 said:
I found a kernel in ATT Note that removes ghost touches, so that might be just the thing that slows it down.
Click to expand...
Click to collapse
What was the point of this thread?
And yes I am aware of the issue u speak of being as it is widely known that the phone is less responsive to touch while on the charger.
I found using crappy chargers will really show this issue.
With one the screen is unusable.
It sounds like it converts over to mains power to allow the batter to charge, however the battery is sucking the majority of the power from the line so there is not enough to fully power the unit...
G1ForFun said:
What was the point of this thread?
And yes I am aware of the issue u speak of being as it is widely known that the phone is less responsive to touch while on the charger.
Click to expand...
Click to collapse
That the developers can contact him, or they can just take off the piece oof code, and there, we have good working touchscreen, it will also be ffaster and more responsive always.
Alot of phones do this my g2x did this also
sarni84 said:
Alot of phones do this my g2x did this also
Click to expand...
Click to collapse
Because the kernel makers add the water proof touchscreen optimizer, something like that, that makes it able to use while water is in your screen. But if you disable it, it would be a lot faster.
these strange issues are usually caused by cheapo chargers
it doesn't do this when you charge via a computer USB or wall using the original stuff
a decent build quality of china made wall / USB chargers will also work fine.
it all comes down to the quality of the power regulator in the charger
AllGamer said:
these strange issues are usually caused by cheapo chargers
it doesn't do this when you charge via a computer USB or wall using the original stuff
a decent build quality of china made wall / USB chargers will also work fine.
it all comes down to the quality of the power regulator in the charger
Click to expand...
Click to collapse
Well, it happens to me in all ports, in all USB cables.
Happens to my GS2 on *any* custom ROM with the stock charging pieces. The stock firmware never has touch-lag when charging - ever. YMMV.
This is wht I'm trying to say
For those a bit confused as to what 'Ghost thouch' is, and why it is removed:
Samsung added a bit of code to the touchscreen driver on the non-intl version of the note to detect 'ghost' touch input events, similar to the raindrop detection on the original Motorola Atrix (and others). While a nice idea on paper, this had un-intended consequences when trying to perform multi-touch input that continues longer than around 5 seconds; such as playing some games. It is now disabled in this kernel.
Edit: There also seems to be a pleasant side effect that I hadn't noticed... keyboard input is improved. Makes sense I suppose, since now there isn't this constant check for false touches slowing things down. Let me know if you see this on your device.
Please READ:
Click to expand...
Click to collapse
I have this issue too no matter which rom is being used or which charger im using. If there is a way for me to disable that "water drop" thing im sure many would take kindly to that.
Its a samsung thing. I've had several samsung phones and the touch screens always goes wacky while charging

Charging Issue

Hi guys,
i have some issues with charging my inc2.
it is not accepting any charge anymore, tried diffrent chargers, cables, even on my pc but nothing. The orange charging LED just flashes slowly on and off...
Any ideas?
Need to replace phone or replace charging port.
Sent from my Galaxy Nexus using xda app-developers app
Snake-Plissken said:
Hi guys,
i have some issues with charging my inc2.
it is not accepting any charge anymore, tried diffrent chargers, cables, even on my pc but nothing. The orange charging LED just flashes slowly on and off...
Any ideas?
Click to expand...
Click to collapse
Yes, unfortunately it is a known hardware issue. Over time, the charging port starts coming loose. Like mentioned above, you CAN fix it yourself. There are video tutorials on YouTube and the replacement part can be had for under $10. If your device is still under warranty, Verizon will replace the phone. If it's not under warranty (or if you just want to give it a go), the port replacement process is pretty straightforward.
I might give it a try. Does anybody have a video or a link?
The weird thing is, that the battery is discharging very fast, could it be just a bad battery?
Sent from my GT-N7100 using Tapatalk 2
Could b the back door on your inc 2. I believe you need the back door on to charge cuz it goes thru contacts on the back. I dropped mine one day and charging and getting signal was almost impossible till I figured that out and bought a new one
Ok.
Seems to charge now. Won't touch it until it is full. After that I will check what is going on.
I don't know where this issue came from.never dropped it nothing. It was even in a Otterbox
Sent from my GT-N7100 using Tapatalk 2
The issue stems from regular use. The charging port is essentially held in place only by the connections to the board. Repeatedly plugging and unplugging the power cable causes it to break over time.
actually just replaced the charger port on my incredible 2 today. It really wasn't that difficult at all. If you have any questions feel free to PM me
yeah it has to be replaced. happened to me last month. It's honestly like the worst flaw with this phone
Snake-Plissken said:
Ok.
Seems to charge now. Won't touch it until it is full. After that I will check what is going on.
I don't know where this issue came from.never dropped it nothing. It was even in a Otterbox
Sent from my GT-N7100 using Tapatalk 2
Click to expand...
Click to collapse
Def need to replace it. Same issues I was having at one point with it randomly taking charge. I found that if the charger is plugged in a held a certain level ( i placed the phone on a flat surface with a book under the cord for leverage) it would charge just fine.
If you are rooted and sending back, make sure you revert to stock to avoid any annoyances.
I've managed to solve this issue without messing around with the phone's innards (the last time I did it was a disaster and I was forced to buy an entirely new phone). It's not pretty, but if you twist a rubber band around the micro usb end of your charger, plug your phone in, twist that same rubber band around the phone itself, and make sure the connection very tight, you might get some more life out of your charger port.
Ugh. I can't wait for my upgrade.
Nice name there Dave.
sent from my paranoid android
gdwy89 said:
I've managed to solve this issue without messing around with the phone's innards (the last time I did it was a disaster and I was forced to buy an entirely new phone). It's not pretty, but if you twist a rubber band around the micro usb end of your charger, plug your phone in, twist that same rubber band around the phone itself, and make sure the connection very tight, you might get some more life out of your charger port.
Ugh. I can't wait for my upgrade.
Click to expand...
Click to collapse
While, I give you major kudos points for MacGuyver-ing a solution, that's more of a quick band-aid than a real fix. I could imagine having a rubber band around the phone could potentially hinder usage.
But hey, way to think outside the box! :good:
Card83 said:
While, I give you major kudos points for MacGuyver-ing a solution, that's more of a quick band-aid than a real fix. I could imagine having a rubber band around the phone could potentially hinder usage.
But hey, way to think outside the box! :good:
Click to expand...
Click to collapse
Thank you. You're telling me. Do you know how hard it is to use a touch screen with a rubber band across it? Oy.
Right. The caveat here, of course, is that this technique will only help charge your phone until the charging port becomes so disconnected from the board that no amount of force will reestablish this contact. And this will inevitably happen because you're going to keep plugging and unplugging your phone from the charger which is what created the issue in the first place.
If you know you have big, sweaty, idiot hands (like me) that are going to destroy your phone if you take it apart (like me) and you can tough it out: more power to you. The other alternative is to buy an external battery charger and a second battery. The disadvantages here are pretty obvious (e.g. you have to carry a second battery around; if you forget a second battery, you can't ask another Android user to borrow their phone charger, etc.).

Categories

Resources