[KERNEL PATCH - Devs only] Force AC (fast) charging

Search This thread

chad0989

Senior Member
Oct 31, 2010
1,883
9,424
This is for kernel devs only. The patch is useless to those who do not/can not compile their own kernel.

I put together this patch for you guys at the request of a few different members here in the nexus forum. This allows one to force AC charging for any charger that is detected as USB (i.e. car chargers, inductive chargers through the pogo pins). This also works for MHL, HOWEVER you will most likely still be limited by the MHL adapter itself. With modification to the MHL adapter (splice in an additional charger) plus this mod, bunklung was able to charge at ~600-700 mA while mirroring and streaming.

To toggle the fast charge you must download IncrediControl v1.5 beta3 (http://www.incredikernel.com under Latest Downloads). Under the general tab, click on force fast charge, then apply. After you have done that, place your phone on the charger. You will see it is now detected as AC and if and only if the charger can put out more current than it was previously being limited to (more than 500mA) you will be able to use the additional current.

Good luck have fun.

http://www.incredikernel.com/wp-con...nitor/download.php?id=force_fast_charge.patch

NOTE: You may get a freeze/FC in IncrediControl once in while when toggling the charge. This is being worked on. I figured everyone could deal with a FC here or there to get this out earlier.

Fast charge toggle widget. No more need to open the app to toggle!

https://play.google.com/store/apps/details?id=com.incredicontrol.fastchargewidget
 

Attachments

  • 2012-03-14_17-19-25.jpg
    2012-03-14_17-19-25.jpg
    46.7 KB · Views: 1,239
  • 2012-03-14_17-19-29.jpg
    2012-03-14_17-19-29.jpg
    55.9 KB · Views: 1,157
Last edited:

nosit1

Senior Member
May 19, 2010
905
108
Arizona
Great work. Now I just need to figure out how to patch the kernel! Haha. Hopefully someone will rebuild one with it in so I can test with my MHL adaptor.

Sent from my Galaxy Nexus using Tapatalk
 

TRusselo

Inactive Recognized Developer
Jan 20, 2011
4,736
2,931
Edmonton
thats nice, i offered a similar kernel mod to the devs of a captivate kernel they tried telling me making the phone charge on usb the same speed as AC could dammage the battery, phone or pc. oh and they basically called me an idiot for suggesting it.

here is the captivate/i9000 kernel tweak for rapid AC charging

more info in original thread, bottom of 1st page to 2nd page. http://xdaforums.com/showthread.php?t=1384253


Voltage regulator and the charging current part: max8998-private.h, a file that contains charging values in mA:


Code:
#define MAX8998_ICHG_90        0
#define MAX8998_ICHG_380    1
#define MAX8998_ICHG_475    2
#define MAX8998_ICHG_550    3
#define MAX8998_ICHG_570    4
#define MAX8998_ICHG_600    5
#define MAX8998_ICHG_700    6
#define MAX8998_ICHG_800    7
Battery driver part: s5pc110_battery.c and defined AC and USB charging rates (modified by me to 800mA when on AC and 550mA on USB):


Code:
                      if (chg->cable_status == CABLE_TYPE_AC)
                max8998_write_reg(i2c, MAX8998_REG_CHGR1,
                    (MAX8998_TOPOFF_10    << MAX8998_SHIFT_TOPOFF) |
                    (MAX8998_RSTR_DISABLE    << MAX8998_SHIFT_RSTR) |
                    (MAX8998_ICHG_800    << MAX8998_SHIFT_ICHG));
            else if (chg->cable_status == CABLE_TYPE_USB)
                max8998_write_reg(i2c, MAX8998_REG_CHGR1,
                    (MAX8998_TOPOFF_25    << MAX8998_SHIFT_TOPOFF) |
                    (MAX8998_RSTR_DISABLE    << MAX8998_SHIFT_RSTR) |
                    (MAX8998_ICHG_550    << MAX8998_SHIFT_ICHG));
One more thing in i9000 kernel sources: drivers/usb/gadget/android.c


Code:
#ifdef CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE
/* soonyong.cho : This value of max power is referred from S1 */
    [COLOR=Red].bMaxPower    = 0x30, /* 96ma */[/COLOR]
#else /* original */
    [COLOR=YellowGreen].bMaxPower    = 0xFA, /* 500ma */[/COLOR]
#endif /* CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE
from where I removed the condition to make it look like that:
Code:
[COLOR=YellowGreen].bMaxPower    = 0xFA, /* 500ma */[/COLOR]
BEFORE:
96ma.jpg



AFTER:
500ma.jpg
 
Last edited:

gamefreakgcb

Senior Member
Jan 8, 2007
365
34
Will this work for GSM version also?


thats nice, i offered a similar kernel mod to the devs of a captivate kernel they tried telling me making the phone charge on usb the same speed as AC could dammage the battery, phone or pc. oh and they basically called me an idiot for suggesting it.

....

What do you use to monitor the mA on the PC side?
 
Last edited:

Notn4

Senior Member
Jul 11, 2010
93
2
Pietarsaari
is it supposed to show somewhere that i'm on ac? I have this patch enabled but when going into battery settings it shows "charging (USB)"

also TRusselo, where in windows can I find how much mA a USB device is drawing from the port?
 

Natolx

Senior Member
Sep 1, 2010
188
20
is it supposed to show somewhere that i'm on ac? I have this patch enabled but when going into battery settings it shows "charging (USB)"

also TRusselo, where in windows can I find how much mA a USB device is drawing from the port?

It needs to be activated. Ask the guy who makes the kernel you use

Sent from my Galaxy Nexus using Tapatalk
 

chad0989

Senior Member
Oct 31, 2010
1,883
9,424
is it supposed to show somewhere that i'm on ac? I have this patch enabled but when going into battery settings it shows "charging (USB)"

also TRusselo, where in windows can I find how much mA a USB device is drawing from the port?


To toggle the fast charge you must download IncrediControl v1.5 beta3 (http://www.incredikernel.com under Latest Downloads). Under the general tab, click on force fast charge, then apply. After you have done that, place your phone on the charger. You will see it is now detected as AC and if and only if the charger can put out more current than it was previously being limited to (more than 500mA) you will be able to use the additional current.
 

jcmm11

Recognized Contributor
Feb 10, 2012
3,589
3,614
Google Pixel 4a 5G
Tried to download the toggle from Google play, but I'm getting a "device not compatible" banner.

Franco nightly kernel, rooted 4.0.4 (Craig Gomez). The patch is definitely in this kernel.

Thanks in advance. Great patch, by the way.

Sent from my Galaxy Nexus using XDA
 

chad0989

Senior Member
Oct 31, 2010
1,883
9,424
Tried to download the toggle from Google play, but I'm getting a "device not compatible" banner.

Franco nightly kernel, rooted 4.0.4 (Craig Gomez). The patch is definitely in this kernel.

Thanks in advance. Great patch, by the way.

Sent from my Galaxy Nexus using XDA

You're getting it from the widget after its been downloaded, or from the market while trying to download it?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 22
    This is for kernel devs only. The patch is useless to those who do not/can not compile their own kernel.

    I put together this patch for you guys at the request of a few different members here in the nexus forum. This allows one to force AC charging for any charger that is detected as USB (i.e. car chargers, inductive chargers through the pogo pins). This also works for MHL, HOWEVER you will most likely still be limited by the MHL adapter itself. With modification to the MHL adapter (splice in an additional charger) plus this mod, bunklung was able to charge at ~600-700 mA while mirroring and streaming.

    To toggle the fast charge you must download IncrediControl v1.5 beta3 (http://www.incredikernel.com under Latest Downloads). Under the general tab, click on force fast charge, then apply. After you have done that, place your phone on the charger. You will see it is now detected as AC and if and only if the charger can put out more current than it was previously being limited to (more than 500mA) you will be able to use the additional current.

    Good luck have fun.

    http://www.incredikernel.com/wp-con...nitor/download.php?id=force_fast_charge.patch

    NOTE: You may get a freeze/FC in IncrediControl once in while when toggling the charge. This is being worked on. I figured everyone could deal with a FC here or there to get this out earlier.

    Fast charge toggle widget. No more need to open the app to toggle!

    https://play.google.com/store/apps/details?id=com.incredicontrol.fastchargewidget
    2
    Pushed the fastcharge toggle widget to the market for those who were interested. No more need to open an app to toggle when you can just do it from your homescreen!

    https://play.google.com/store/apps/details?id=com.incredicontrol.fastchargewidget
    1
    Market issue fixed. Should be able to download now.
    1
    thx chad!
    Is there a list which kernels already support HAVS or SVS?
    1
    I wonder whether it's possible to activate AC charging while in USB host mode. I looked into tuna_fsa_usb_detected() but don't quite get the muxing and routing yet...

    In USB host mode your phone is powering the external peripheral. AC charge mode would prevent power going to whatever device is connected.

    Chad - What's the chance I can get you to also support A/C charge on USB charger type 'av-365k'? Per Fascinate Dock Mod I've got everything working, but fast charge does not recognize the USB connection and I default to USB slow charge.

    I'm hoping to get your mod put in place, then get it into my default kernel choice of Lean Kernel. I suppose I could just change and compile my own, but then I don't get the updates for Lean Kernel.

    If you need any support or debugging/testing just let me know.

    Thanks,
    Jeff



    EDIT - Nevermind, I just took a look at the kernel source. Looks like it could be done, but by changing 'usbsw' to detected as FSA9480_DETECT_CHARGER I will probably loose my auto "Dock" mode. I think I need to remove the sense line in the dock and use NFC/Tasker to go to dock mode.

    Are you still having issues with this? I can take a look if you are.

    @everyone. The widget has been updated also, its in the market. There's a couple styles to choose from now for those of you who wanted more options.