Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,737,124 Members 43,149 Now Online
XDA Developers Android and Mobile Development Forum

[Module] SmartassV2/ondemandX governors for Rooted/stock ROM | 2012-02-24

Tip us?
 
AnDyX
Old
(Last edited by AnDyX; 16th May 2012 at 07:47 AM.)
#1  
AnDyX's Avatar
Senior Member - OP
Thanks Meter 453
Posts: 185
Join Date: May 2008
Location: Ruda Śląska
Angry [Module] SmartassV2/ondemandX governors for Rooted/stock ROM | 2012-02-24

This modules are for people with stock kernels because they don't have 'smartass' or ondemandX' governors.

EASY ENGLISH:
Differences between this modules and build in stock kernels:
- allows to set max CPU freq when screen is off (to save battery),
- allows to set starting CPU freq when phone awakes (to speed up awake process),
- allows set/change almost all aspects of governor (to suite needs),
- should be a bit more responsive when parameters are well chosen for smartassv2 governor.

Each governor has some predefinied values - more info in "Available settings".

If governors works or not on other version then 4.0.2.A.0.42 let me know.

Start:
The goal was bring 'smartassv2' and 'ondemandX' governor to work with stock kernel on Neo V.

Most information is in my thread on 'XPERIA X8 Android Development': [Module] | X8 | X10 mini/pro | AX8_SMARTASS v002 | 'smartass' governor | [2011-07-19]

To remind:
Quote:
SmartassV2 (informal description and comparison with the first smartass)

SmartassV2 is a governor (controls the frequency of the CPU at each give moment) which like the first smartass is generally based on the implementation of interactive with some major changes and the addition of a built in sleep profile (behaves a bit differently when screen is off vs. on).

The smartassV2 improves the very naive scheme which the first smartass had: The first smartass (with the values I set for the hero), would cap the max frequency at 352Mhz for sleep and when screen is on, would do the opposite and keep the frequency at 518Mhz or above. For sleep this was very effective but a bit crude and unclean, and there could be some cases where you would need processing power even when screen is off (something is updating and music is playing and etc.). For screen on, smartass1 was too quick to jump to the max available frequency and again would never go below the 518Mhz, so in a nutshell its was using "too high" frequencies.

SmartassV2, introduce (internally) an "ideal" frequency which is the frequency we are "aiming" for, in some sense. The way I see it is that the "ideal" frequency is a hint to the governor what is a good balance between performance and battery life. Now when screen is on, I set (on the hero) the ideal frequency to 518Mhz which will ensure nice responsiveness but limit unnecessary use of higher frequencies when they are not needed. When screen is off, I set the ideal frequency to 352Mhz (0 will disable the screen state tracking all together). From my testing this will "convince" the governor to spend most of the its time during sleep at the lowest available frequencies. Note, that both during sleep and when awake the entire frequency range (as defined by the "user" - i.e. selected with SetCPU) is used by smartassV2. For example, when the CPU is loaded heavily, the highest available frequency will be used regardless if screen is on or off.
Quote:
ondemandX - ondemand governor code from latest linux (3.0 at the moment) source *plus* the suspend/wake logic described above. No further optimization is done.
Info:
- information about governors is here,
- more information about 'smartass' governor is here or here,
- how different governors work is explained here: [Q] SetCPU governors (explained).


Prerequisites:
- Neo V (if works on Neo - let me know),
- root,
- ondemandX should work on any version,
- smartass was compiled against 4.0.2.A.0.42 version, how run on other version will be explained in manuall installation section,
- desire to replace SetCPU - when used only for 'ScreenOff' profile.

Manual installation:
  1. Unzip file
  2. Run copy.cmd file - this should copy modules to /system/lib/modules
  3. run adb shell or terminal - whatever you like and execute su
    Code:
    Select Code
    su
  4. If you have 4.0.2.A.0.42 version proceed to step 6
  5. For smartass governor you need to know address for 'kallsyms_lookup_name'
    run following command:
    Code:
    Select Code
    cat /proc/kallsyms | grep kallsyms_lookup_name
    result should be as follows:
    Code:
    Select Code
    80101aec T module_kallsyms_lookup_name
    801056f0 T kallsyms_lookup_name
    Bolded value (801056f0) is address which we need.
  6. Optional step: lower min CPU freq:
    Code:
    Select Code
    echo 122880 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
  7. Insert ondemandX module:
    Code:
    Select Code
    insmod /system/lib/modules/aneov_ondemandx.ko
    in dmesg command should be line:
    Code:
    Select Code
    <6>[  431.711517] aneov_ondemandX: module v001 for device Xperia Neo V loaded
  8. Insert smartassV2 module:
    • for version 4.0.2.A.0.42 just run command:
      Code:
      Select Code
      insmod /system/lib/modules/aneov_smartass2.ko
      in dmesg command should be line:
      Code:
      Select Code
      <6>[  420.308380] aneov_smartass2: module v001 for device Xperia Neo V loaded
    • for other use 'address' and use following command:
      Code:
      Select Code
      insmod /system/lib/modules/aneov_smartass2.ko lookup_address=0x801056f0
      in dmesg command should be line:
      Code:
      Select Code
      <6>[  420.308380] aneov_smartass2: module v001 for device Xperia Neo V loaded
  9. Now you can enable desired governor. Execute:
    Code:
    Select Code
    echo "smartassV2" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
for smartassV2 or
Code:
Select Code
echo "ondemandX" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
for ondemandX governor.

Lower min cpu freq a bit:
Code:
Select Code
echo 122880 >  /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
Until you're sure that it works with your hardware, don't install it to hw_config.sh.

Available settings:
Will be added later

v001:
- just initial version fixed to work with Neo V.

Disclaimer
I'm not responsible if this module damages your lovely phone. Use it at your own risk! Think before you do something!

Sources at: GitHub

|Xperia U on SlimBean v4.0.0| currently powered by SMARTASS2 / SIO
GIT
Xperia U | SMARTASS | ONDEMANDAX | PEGASUSQ | LULZACTIVEQ | SIO | VR
Neo V | SMARTASSV2 / ONDEMANDX
X8 | AX8NETFILTER | AX8_SMARTASS | AX8MT | AX8NOALS
The Following 7 Users Say Thank You to AnDyX For This Useful Post: [ Click to Expand ]
 
kriko
Old
#2  
kriko's Avatar
Senior Member
Thanks Meter 82
Posts: 316
Join Date: Apr 2008
Thank you!

On .62 firmware, I didn't have to specify lookup_address, since it didn't recognise that option, but it seems to work.

Also a good full article about governors:
http://forum.xda-developers.com/show...76&postcount=1
 
Venael
Old
(Last edited by Venael; 24th February 2012 at 12:48 PM.)
#3  
Member
Thanks Meter 19
Posts: 67
Join Date: Feb 2012
is there any chance to get this as a zip for cwm?


edit:yay! just put it manually into system/lib/modules and changed permissions and it works!
 
mpiekp
Old
#4  
mpiekp's Avatar
Senior Member
Thanks Meter 610
Posts: 1,293
Join Date: Mar 2011
Working .62.


Could you also build an OC module please, that would be awesome.

Sent from my MT11i using Tapatalk
 
AnDyX
Old
#5  
AnDyX's Avatar
Senior Member - OP
Thanks Meter 453
Posts: 185
Join Date: May 2008
Location: Ruda Śląska
Quote:
Originally Posted by mpiekp View Post
Working .62.


Could you also build an OC module please, that would be awesome.

Sent from my MT11i using Tapatalk
If I find source somewhere - or someone point me to sources - I can try.

|Xperia U on SlimBean v4.0.0| currently powered by SMARTASS2 / SIO
GIT
Xperia U | SMARTASS | ONDEMANDAX | PEGASUSQ | LULZACTIVEQ | SIO | VR
Neo V | SMARTASSV2 / ONDEMANDX
X8 | AX8NETFILTER | AX8_SMARTASS | AX8MT | AX8NOALS
The Following User Says Thank You to AnDyX For This Useful Post: [ Click to Expand ]
 
mpiekp
Old
#6  
mpiekp's Avatar
Senior Member
Thanks Meter 610
Posts: 1,293
Join Date: Mar 2011
Sources from any custom kernel, just compile against stock.

Thank you

Sent from my MT11i using Tapatalk
 
rav3n_pl
Old
#7  
Senior Member
Thanks Meter 119
Posts: 405
Join Date: Sep 2011
Location: Wojcieszyce

 
DONATE TO ME
Hell yea, OC module for locked BL would be awesome!
X8 on GCR8.4 and ALFS kernel @ 787MHz
Uploaded on my skydrive
Watch THIS b4 you post.
Fold It! Top10 folder
 
Venael
Old
#8  
Member
Thanks Meter 19
Posts: 67
Join Date: Feb 2012
Any news about OC or UV modes?

Wysłano z MT11i z użyciem Tapatalk
 
chitoka
Old
#9  
chitoka's Avatar
Senior Member
Thanks Meter 23
Posts: 197
Join Date: Dec 2011
Location: guatemala
Will this work with my x8

Sent from my E15i using XDA
 
shardul_seth
Old
#10  
shardul_seth's Avatar
Senior Member
Thanks Meter 1698
Posts: 1,095
Join Date: Jul 2011
Default Intellidemand please!

Could you please make an intellidemand governor also..

Also please see these commits for some changes to smartass2 (more stable) and working lulzactive
My Apps: [APP] USB OTG Helper (MAJOR UPDATE) | Donate version

My ROMs: [Neo/V] Spacious, smooth, light GB and ICS 4.0.4
My Kernels: Suave Kernel and Super Stock ICS

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Port Sony Xperia Themes to CyanogenMod 11 with Ease

In addition the obvious proficiency with graphics, creating agood Android theme … more

Cell Phone SIM Unlock Bill Just Steps Away from President’s Desk

For all those who believe that Cinderella stories don’t actually … more

Get Your Cargo to its Destination in 4×4 Military Operations Reborn

Racing games have evolved quite a bit since the days of Pole … more