[KERNEL] 2.6.32: CPU Vdd levels ("undervolt") sysfs interface

Search This thread

snq-

Retired Recognized Developer
Aug 13, 2010
581
853
(for devs only)

remember iscaela's "undervolt" hack for the stock - closed source - HTC kernel?
the following quick & dirty kernel mod will allow your users to query and set cpu supply voltages for each frequency through a sysfs interface

the patch is available here: 2.6.32-vddlevels.patch

after applying the patch the "CONFIG_CPU_FREQ_VDD_LEVELS" option will be available in the kernel configuration (set it to 'y')

usage:
query: (output: first column: frequency (kHz), second column: vdd* (mV))
Code:
cat /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
  128000:  950
  245000:  950
  384000:  975
  422400:  975
  460800: 1000
  499200: 1025
  537600: 1025
  576000: 1050
  614400: 1075
  652800: 1100
  691200: 1125
  729600: 1150
  768000: 1175
  806400: 1200
  844800: 1200
  883200: 1225
  921600: 1225
  960000: 1250
  998400: 1275
 1036800: 1275
 1075200: 1275
 1113600: 1300
 1152000: 1300
 1190400: 1300

incrementing/decrementing all levels by a specified amount* (mV):
Code:
echo '-25' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
echo '+25' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels

adjusting the supply voltage* (second value, mV) at a specific frequency (first value, kHz):
Code:
echo '998400 1250' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels

*: vdd values must be a multiple of 25 (enforced by the interface; the regulator doesn't accept other values - found out in the hard way)

please note that the values set through this interface will only be written to the acpu table - they will only become effective when the specific frequency is (re)set by cpufreq

i took the input parser from iscaela's code - thanks for it
do not apply this patch if you plan to use avs

to query the constraints of the regulator ("max_microvolts", "min_microvolts") or the voltage currently supplied to the cpu ("microvolts" (uV)):
Code:
grep '.' /sys/class/i2c-adapter/i2c-0/0-0048/regulator/regulator.0/*


--
dedicated to the cheeky buggers at #leedroid-roms
 
Last edited:

melethron

Senior Member
Sep 13, 2010
854
193
Nice (i think ^^ )

Two Questions:

1. What is "avs"

2. So this makes it possible to change vdd "on the fly" ?
I hadn't issues (reboot/stability) due to undervolting in LeeDroid 2.2a so i can use this to set the vdd levels of the 2.2a Kernel in LeeDroid 2.2e?
 

snq-

Retired Recognized Developer
Aug 13, 2010
581
853
adaptive voltage scaling ~ cpu supply voltage is actively adjusted based on frequency and temperature

2. So this makes it possible to change vdd "on the fly" ?
yes

I hadn't issues (reboot/stability) due to undervolting in LeeDroid 2.2a so i can use this to set the vdd levels of the 2.2a Kernel in LeeDroid 2.2e?
yes. please note that settings don't persist across reboots, so you might want to create a script under /system/etc/init.d for setting your optimal vdd levels at boot time
 

melethron

Senior Member
Sep 13, 2010
854
193
Nice,

could you post the voltages of the 2.2a Kernel? I didn't find them anymore...

Btw: Smartass Governor is really nice. Highly responsive. Your Kernel rocks.
 

goochj

Senior Member
Sep 17, 2010
98
16
montreal
I'd also like to know what voltages the 2.2a kernel was using. I've got the init.d script lowering the voltage by 100mv lower than 2.2e stock voltages, How low can I go!
 

TheGhost1233

Senior Member
Apr 23, 2010
1,193
203
Oke i have been doing some searching about the hole undervolting thing. What i found was that undervolting has no real risks unlike overclocking, what i read is that when you go to low your pc/phone(found mostly pc stuff) will freeze up. Since this interface will reset the voltages after a reboot there shouldn't be a real problem i believe.
However before i go and change my voltages i would like to know if this is right and there is no realistic risk involved with undervolting, and i won't damage my hardware.

Thanks
 

mr.r9

Senior Member
Oct 8, 2006
576
49
^Undervolting will result in instability if it's extreme with no hardware faults. On the other hand, Over-volting, if extreme, will result in hardware faults.
In any case, there are a few Kerenals you can try without needing this patch because it is aimed at developers & not users.
 

tyween

Retired Recognized Developer
Sep 12, 2010
1,135
2,706
Can someone post an init.d script for lowering vdd_levels? I am having a problem writing one.
 

voided

Senior Member
Nov 6, 2005
120
12
Missing clock speed after apply

Hi

Thank you for providing the codes for undervolt but I have missing clockspeed after i tried to combine you patch with MJ S10.4 kernel.

Hope you can advise. Thanks in advance
 

Top Liked Posts

  • There are no posts matching your filters.
  • 17
    (for devs only)

    remember iscaela's "undervolt" hack for the stock - closed source - HTC kernel?
    the following quick & dirty kernel mod will allow your users to query and set cpu supply voltages for each frequency through a sysfs interface

    the patch is available here: 2.6.32-vddlevels.patch

    after applying the patch the "CONFIG_CPU_FREQ_VDD_LEVELS" option will be available in the kernel configuration (set it to 'y')

    usage:
    query: (output: first column: frequency (kHz), second column: vdd* (mV))
    Code:
    cat /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
      128000:  950
      245000:  950
      384000:  975
      422400:  975
      460800: 1000
      499200: 1025
      537600: 1025
      576000: 1050
      614400: 1075
      652800: 1100
      691200: 1125
      729600: 1150
      768000: 1175
      806400: 1200
      844800: 1200
      883200: 1225
      921600: 1225
      960000: 1250
      998400: 1275
     1036800: 1275
     1075200: 1275
     1113600: 1300
     1152000: 1300
     1190400: 1300

    incrementing/decrementing all levels by a specified amount* (mV):
    Code:
    echo '-25' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
    echo '+25' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels

    adjusting the supply voltage* (second value, mV) at a specific frequency (first value, kHz):
    Code:
    echo '998400 1250' > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels

    *: vdd values must be a multiple of 25 (enforced by the interface; the regulator doesn't accept other values - found out in the hard way)

    please note that the values set through this interface will only be written to the acpu table - they will only become effective when the specific frequency is (re)set by cpufreq

    i took the input parser from iscaela's code - thanks for it
    do not apply this patch if you plan to use avs

    to query the constraints of the regulator ("max_microvolts", "min_microvolts") or the voltage currently supplied to the cpu ("microvolts" (uV)):
    Code:
    grep '.' /sys/class/i2c-adapter/i2c-0/0-0048/regulator/regulator.0/*


    --
    dedicated to the cheeky buggers at #leedroid-roms
    2
    As always.. Nice work snq-! :D
    1
    Is it possible to write the whole table in a shorter form?
    Code:
    cat /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
      128000:  950
      245000:  950
      384000:  975
      422400:  975
      460800: 1000
      499200: 1025
      537600: 1025
      576000: 1050
      614400: 1075
      652800: 1100
      691200: 1125
      729600: 1150
      768000: 1175
      806400: 1200
      844800: 1200
      883200: 1225
      921600: 1225
      960000: 1250
      998400: 1275
     1036800: 1275
     1075200: 1275
     1113600: 1300
     1152000: 1300
     1190400: 1300

    Something like this:
    cat << EOF > /sys/devices/system/cpu/cpu0/cpufreq/vdd_levels
    128000 950
    245000 950
    384000 975
    [...]
    EOF
    I tried it but it only applies the first line. The other values remain untouched.