Adjust the charging speed to your likings

Search This thread

Doomkopf

Senior Member
May 14, 2016
289
124
Hey guys,

this thread is supposed to show you exactly, how you can change the charging voltage and charging current of the Xiaomi Redmi 5 Plus (vince). This could very well also work with other phones, as I first heard of them in a Magisk module, NOT related to this phone. This is my first thread on xda and I'm not a native speaker, so please excuse mistakes :)

So, there are two files associated with the kernel, that control voltage and current. For most kernels for vince, these files exist (DA, Zucc, Genom, and maybe also the others... doesn't work on Kirks Kernel) at the moment. Of course I don't know if these files still exist when a new android version is brought to this phone ^^

So let's start. The two files I mentioned are located here:
Current: /sys/devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:qcom,qpnp-smbcharger/power_supply/battery/constant_charge_current_max
Voltage: /sys/devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:qcom,qpnp-smbcharger/power_supply/battery/voltage_max

For Linux 3.18 Kernels:
Current: /sys/devices/soc/qpnp-smbcharger-18/power_supply/battery/constant_charge_current_max (stock value: 2000000 = 2000mA)
Voltage: /sys/devices/soc/qpnp-smbcharger-18/power_supply/battery/voltage_max (stock value: 4380 = 4,38V)

The values in constant_charge_current_max are measured in mA/1000. So that means, if you want to set 2000mA, you have to type 2000000 in this file.
The values in voltage_max are in mV, so if you want to set for example 4,2V as a maximum, you would have to type 4200 in this file.

MY RECOMMENDATIONS:
To set good values on these interfaces, we have to understand them correctly. Let's start with the voltage. The charging voltage (in order to charge) always has to be higher than the voltage the battery has. The battery of this specific phone ranges from 4,3V to 3,7V (4,3V on 100%, gradually going to 3,7V when reaching 0% (not sure about the 3,7V, correct me if you can :p )). I wouldn't change it. The voltage needs to be 4380 mA if you want you phone to charge until it's full. Even if you don't want that, I'd take another way to stop your phone from charging any further (there are good magisk modules that do exactly that, even with more features).

Now let's speak about the charging current, the holy grail of charging haha :laugh: Basically, if you want faster charging, go with values higher than 2000mA. I'd take 2500mA max, as the battery can get very hot. If you want your phone to stay cool while charging, which causes the battery to last way longer (https://www.sciencedirect.com/science/article/abs/pii/S0378775314004352), I'd recommend finding a charging current which keeps your temperature at about 25°C, which is the optimal temperature (see the reference, it's not a long text). For me, this is 1850mA, but if you live somewhere where it's very cold or hot, this can vary significantly. In the end, this is personal preference and should depend on how long you want to keep your phone, and how important charging speed is to you.
As for all kernel or /sys values, these will be reset on every reboot, so you'll have to find a way to set in on every boot. I tried creating a init.d file, but even though I set the permissions of the init.d file etc, it failed every time. So personally, I use Custom Controls in Kernel Adiutor, but I think EXKM has something similar. Of course I can only show the way with Kernel Adiutor and FKM in the following, as I don't have EXKM.

How to set these values with Kernel Adiutor:

For this, you have to enable the Custom Controls in Kernel Adiutor settings, if you disabled it previously.

Let's start with the current:
Go in the Custom Controls menu, click on the + and then "create". For this type of value, we need a seekbar. The title is irrelevant really, I'd choose "Charging Current". As a min, choose 0, and as max, choose the exact same value you want to use (if you're still unsure, just take 2000000/2500000, depending on if you want to increase it or not). I do this, because it is very hard to get the seekbar to an exact value (for example 1850000), because the numbers are so high. So i just set the max to what I want, and just max out the seekbar.
In "Progress", you have to put in exactly this:

For 3.18 kernels:

#!/system/bin/sh
head /sys/devices/soc/qpnp-smbcharger-18/power_supply/battery/constant_charge_current_max

Press test to confirm you typed it in correctly. Otherwise you also won't be able to set this control :)

in "Applying", put in exactly this:

#!/system/bin/sh
progress=$1
echo $progress > /sys/devices/soc/qpnp-smbcharger-18/power_supply/battery/constant_charge_current_max

Don't forget to delete the # before the second line (progress=$1), otherwise this will set nothing.

For 4.9 kernels:

#!/system/bin/sh
head /sys/devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:qcom,qpnp-smbcharger/power_supply/battery/constant_charge_current_max

Press test to confirm you typed it in correctly. Otherwise you also won't be able to set this control :)

in "Applying", put in exactly this:

#!/system/bin/sh
progress=$1
echo $progress > /sys/devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:qcom,qpnp-smbcharger/power_supply/battery/constant_charge_current_max

Don't forget to delete the # before the second line (progress=$1), otherwise this will set nothing.

That's it, you can use this control now ^^ But if you want this to set on every boot, after setting it up, you have to click on the 3 dots of this control and check "On boot".

Basically, for the voltage, I'd take 0 as minimum, and 4400 as maximum, and change the file location to the voltage (on progress and applying), and the rest is the same!
So, that's it! It's possible that someone will write a magisk module for that some day, but until then, I think this is a very easy solution. Have fun with it!

How to set these values with Franco Kernel Manager:
These screenshots are provided by @Niamotullah
CRL7VAW.jpg

fRlQ5yH.jpg

sNpiAUi.jpg

7lOjpVO.jpg
 
Last edited:

bot88

Senior Member
Nov 26, 2014
127
26
So i setup everything in kernel auditor and there is no save button besides in progress and applying fields, and when i press back button no custom control appears. Am i doing something wrong?
 

Doomkopf

Senior Member
May 14, 2016
289
124
So i setup everything in kernel auditor and there is no save button besides in progress and applying fields, and when i press back button no custom control appears. Am i doing something wrong?

Probably you didn't press "test" after typing in everything in "progress" :)
 

Doomkopf

Senior Member
May 14, 2016
289
124
Which kernel supports these files.
Can I set the charge rate with Kirks kernel kernel auditor

Look at the OP. Zucc currently doesn't work, but it used to and the dev told me that he tries to implement it in the Linux 4.9 Kernel again.
With Genom and Dark Ages it works.
IDK about Kirks Kernel, never tried it. But you told me it doesn't work ^^ Check with your filemanager if you have those files please
 

bot88

Senior Member
Nov 26, 2014
127
26
Can you attach a screenshot? Can't help you this way ^^

Sorry my bad, when i checked those files manually i figured the kernel "dark ages" i was using doesn't have those files, now I'm using "genom" kernel which is much better and stable. Also gives me default charging rate of 1800mah without modification of any files. After settings up this control 2500mah as maximum i tested different charging rates at different states of battery. As follows
34% = 2470mah
47% = 2240mah
69% = 1800mah
88% = 1430mah
96% = 836mah
4.2 volts in all states.
Given results are pure observation without any specific app made by just looking charging info given at lockscreen (feature provided by some custom ROMs in this case Havoc os2.1)
Thus i can't confirm if they are consistent throughout whole charging cycle.

Charger used: a third part charger rated at 5v 2.4amps.

You mileage may vary, my test also confirm that cables can also affect outcomes. Such as original one plus one cable from (1+1 first generation phone) does not go abve than 1500mah even when suitable charger is used. Only cable which works for me is a $15 cable i bought from store the other day, which is quite expensive but quality speaks for it self.
:good: :fingers-crossed: peace out
 

Doomkopf

Senior Member
May 14, 2016
289
124
Sorry my bad, when i checked those files manually i figured the kernel "dark ages" i was using doesn't have those files, now I'm using "genom" kernel which is much better and stable. Also gives me default charging rate of 1800mah without modification of any files. After settings up this control 2500mah as maximum i tested different charging rates at different states of battery. As follows
34% = 2470mah
47% = 2240mah
69% = 1800mah
88% = 1430mah
96% = 836mah
4.2 volts in all states.
Given results are pure observation without any specific app made by just looking charging info given at lockscreen (feature provided by some custom ROMs in this case Havoc os2.1)
Thus i can't confirm if they are consistent throughout whole charging cycle.

Charger used: a third part charger rated at 5v 2.4amps.

You mileage may vary, my test also confirm that cables can also affect outcomes. Such as original one plus one cable from (1+1 first generation phone) does not go abve than 1500mah even when suitable charger is used. Only cable which works for me is a $15 cable i bought from store the other day, which is quite expensive but quality speaks for it self.
:good: :fingers-crossed: peace out

Dark Ages doesn't have it? That's weird. I think I used lastest stable version and it worked
Yea, the problem is 4,2V :) I explained in my voltage recommendations why 4,2V is problematic. The voltage has to be a certain amount higher than the voltage of the battery (which I also mentioned in the OP). I'd recommend setting it to the standard, 4380(mV), so your battery charged faster when at higher percentages.
 

Barbersh

Member
Feb 21, 2019
13
0
Vienna
Wow, thank you very interesting information. True, I’m afraid to overclock the charge strongly so as not to squeeze the battery hard.
 

Doomkopf

Senior Member
May 14, 2016
289
124
As you guys may have noticed, Linux 4.9 got ported to our device. It broke my setup (Kernel Adiutor said it can't get an integer value out of the file), but it still works! The symlinks got changed, so these are the new paths to the files:

/sys/devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:qcom,qpnp-smbcharger/power_supply/battery/constant_charge_current_max

/sys/devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:qcom,qpnp-smbcharger/power_supply/battery/voltage_max

Enjoy!
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    Hey guys,

    this thread is supposed to show you exactly, how you can change the charging voltage and charging current of the Xiaomi Redmi 5 Plus (vince). This could very well also work with other phones, as I first heard of them in a Magisk module, NOT related to this phone. This is my first thread on xda and I'm not a native speaker, so please excuse mistakes :)

    So, there are two files associated with the kernel, that control voltage and current. For most kernels for vince, these files exist (DA, Zucc, Genom, and maybe also the others... doesn't work on Kirks Kernel) at the moment. Of course I don't know if these files still exist when a new android version is brought to this phone ^^

    So let's start. The two files I mentioned are located here:
    Current: /sys/devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:qcom,qpnp-smbcharger/power_supply/battery/constant_charge_current_max
    Voltage: /sys/devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:qcom,qpnp-smbcharger/power_supply/battery/voltage_max

    For Linux 3.18 Kernels:
    Current: /sys/devices/soc/qpnp-smbcharger-18/power_supply/battery/constant_charge_current_max (stock value: 2000000 = 2000mA)
    Voltage: /sys/devices/soc/qpnp-smbcharger-18/power_supply/battery/voltage_max (stock value: 4380 = 4,38V)

    The values in constant_charge_current_max are measured in mA/1000. So that means, if you want to set 2000mA, you have to type 2000000 in this file.
    The values in voltage_max are in mV, so if you want to set for example 4,2V as a maximum, you would have to type 4200 in this file.

    MY RECOMMENDATIONS:
    To set good values on these interfaces, we have to understand them correctly. Let's start with the voltage. The charging voltage (in order to charge) always has to be higher than the voltage the battery has. The battery of this specific phone ranges from 4,3V to 3,7V (4,3V on 100%, gradually going to 3,7V when reaching 0% (not sure about the 3,7V, correct me if you can :p )). I wouldn't change it. The voltage needs to be 4380 mA if you want you phone to charge until it's full. Even if you don't want that, I'd take another way to stop your phone from charging any further (there are good magisk modules that do exactly that, even with more features).

    Now let's speak about the charging current, the holy grail of charging haha :laugh: Basically, if you want faster charging, go with values higher than 2000mA. I'd take 2500mA max, as the battery can get very hot. If you want your phone to stay cool while charging, which causes the battery to last way longer (https://www.sciencedirect.com/science/article/abs/pii/S0378775314004352), I'd recommend finding a charging current which keeps your temperature at about 25°C, which is the optimal temperature (see the reference, it's not a long text). For me, this is 1850mA, but if you live somewhere where it's very cold or hot, this can vary significantly. In the end, this is personal preference and should depend on how long you want to keep your phone, and how important charging speed is to you.
    As for all kernel or /sys values, these will be reset on every reboot, so you'll have to find a way to set in on every boot. I tried creating a init.d file, but even though I set the permissions of the init.d file etc, it failed every time. So personally, I use Custom Controls in Kernel Adiutor, but I think EXKM has something similar. Of course I can only show the way with Kernel Adiutor and FKM in the following, as I don't have EXKM.

    How to set these values with Kernel Adiutor:

    For this, you have to enable the Custom Controls in Kernel Adiutor settings, if you disabled it previously.

    Let's start with the current:
    Go in the Custom Controls menu, click on the + and then "create". For this type of value, we need a seekbar. The title is irrelevant really, I'd choose "Charging Current". As a min, choose 0, and as max, choose the exact same value you want to use (if you're still unsure, just take 2000000/2500000, depending on if you want to increase it or not). I do this, because it is very hard to get the seekbar to an exact value (for example 1850000), because the numbers are so high. So i just set the max to what I want, and just max out the seekbar.
    In "Progress", you have to put in exactly this:

    For 3.18 kernels:

    #!/system/bin/sh
    head /sys/devices/soc/qpnp-smbcharger-18/power_supply/battery/constant_charge_current_max

    Press test to confirm you typed it in correctly. Otherwise you also won't be able to set this control :)

    in "Applying", put in exactly this:

    #!/system/bin/sh
    progress=$1
    echo $progress > /sys/devices/soc/qpnp-smbcharger-18/power_supply/battery/constant_charge_current_max

    Don't forget to delete the # before the second line (progress=$1), otherwise this will set nothing.

    For 4.9 kernels:

    #!/system/bin/sh
    head /sys/devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:qcom,qpnp-smbcharger/power_supply/battery/constant_charge_current_max

    Press test to confirm you typed it in correctly. Otherwise you also won't be able to set this control :)

    in "Applying", put in exactly this:

    #!/system/bin/sh
    progress=$1
    echo $progress > /sys/devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:qcom,qpnp-smbcharger/power_supply/battery/constant_charge_current_max

    Don't forget to delete the # before the second line (progress=$1), otherwise this will set nothing.

    That's it, you can use this control now ^^ But if you want this to set on every boot, after setting it up, you have to click on the 3 dots of this control and check "On boot".

    Basically, for the voltage, I'd take 0 as minimum, and 4400 as maximum, and change the file location to the voltage (on progress and applying), and the rest is the same!
    So, that's it! It's possible that someone will write a magisk module for that some day, but until then, I think this is a very easy solution. Have fun with it!

    How to set these values with Franco Kernel Manager:
    These screenshots are provided by @Niamotullah
    CRL7VAW.jpg

    fRlQ5yH.jpg

    sNpiAUi.jpg

    7lOjpVO.jpg
    2
    As you guys may have noticed, Linux 4.9 got ported to our device. It broke my setup (Kernel Adiutor said it can't get an integer value out of the file), but it still works! The symlinks got changed, so these are the new paths to the files:

    /sys/devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:qcom,qpnp-smbcharger/power_supply/battery/constant_charge_current_max

    /sys/devices/platform/soc/200f000.qcom,spmi/spmi-0/spmi0-02/200f000.qcom,spmi:qcom,pmi8950@2:qcom,qpnp-smbcharger/power_supply/battery/voltage_max

    Enjoy!
    1
    Good job mate! Keep up the work!
    8t really works and I get full control over charging speed now.
    1
    Is there any way to do this thing without root ?
    Maybe by changing some files through twrp and adb.?
    I'd say no, because those values always reset after a reboot so they shouldn't stick if you set it in twrp and reboot to your system :D Maybe there is a way, but I don't see one :/
    1
    Thanks.. it's really helps me..
    I did it using franco kernel manager

    Thanks again for providing the screenshots! They have been added to the OP :)