• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root Broken out rom CPU clock settings fix

I did not realize the optimizer utilized this script to do what it does. That being said, and nothing at all against kanaida, but I find his app unnecessary. Pretty much everything it does can be easily be done without the app. Setting clock speeds can be done without his app also, the purpose of this was to make cpu settings stick.

Of course if you paid for the optimizer app you are going to want to be able to use it. I will put up a copy of the file so that people needing it to use the connect optimizer can put it back. I don't use it or need it so it doesn't effect me.

my app requires mpdesicion to be running, by you deleting the script, it never starts (i'm gonna update it to show a legit error though). It has nothing to do with the rest of the lines by the way :) mpdesicion is a service that controls when and how to turn on the second core (I think qualcomm specific), as well as ocasionally making cpu changes based on it's own logic. My app can control this service using the manual 1 or 2 cores enabled.

Another possible side effect is having only a single core on at next reboot. Without any obvious way to turn the other one on.
 
my app requires mpdesicion to be running, by you deleting the script, it never starts (i'm gonna update it to show a legit error though). It has nothing to do with the rest of the lines by the way :) mpdesicion is a service that controls when and how to turn on the second core (I think qualcomm specific), as well as ocasionally making cpu changes based on it's own logic. My app can control this service using the manual 1 or 2 cores enabled.

Another possible side effect is having only a single core on at next reboot. Without any obvious way to turn the other one on.

I had thought about that; the possibility of only having one core after ditching the script, but after testing a bit, and several reboots after getting rid of the script both cores are accessible still without user intervention, so it doesn't seem to of had that effect thank god.

Just so you know, I was not knocking your app. I just don't have use for it myself; I'm stuck in my own ways and use other utilities to handle what I would use your optimizer for, mainly rom toolbox.

I am, however, a fan of options.
 
yep me too. I'm writing something like setcpu as we speak... except for multiple processors (no limits on cores). I've got qualcomm ones figured out, just need to get my hands on a tegra device now to see if they're different (use something other than mpdecision).

There are zero options out there to do this (as an app) other than by hand talking right with the drivers and writing one myself.
 
yep me too. I'm writing something like setcpu as we speak... except for multiple processors (no limits on cores). I've got qualcomm ones figured out, just need to get my hands on a tegra device now to see if they're different (use something other than mpdecision).

There are zero options out there to do this (as an app) other than by hand talking right with the drivers and writing one myself.

Sounds interesting, If you need testing or need anything let me know, I'm always around and always tinkering with my devices lol, I'm not shy when it comes to getting dirty.
 
did some research and watching logs carefully i've found the following:

mpdecision is basically decides if the 2nd cpu needs to come on or shot off (hotplug)

thermald checks temperature and changes the cpu clock as needed, it uses the pm sensor. It also constantly writes to the logs. I believe this is also responsible for shutting down the device when it heats up too much. I think with this rom though, for the most part it's just eating cpu by polling so much.

It's constantly writing this:
CPU[0] frequency limited to 1512000

and
CPU[1] frequency limited to 1512000
if cpu 2 is on.

As an experiment i've disabled my daemon, i'll keep it like that for a day to see if it saves battery. I won't be running anything that heats it up badly like maps or 3d games.
 
actually that file needs edited not just deleted ;)

if you look at it :

Code:
#!/system/bin/sh
# Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above copyright
#       notice, this list of conditions and the following disclaimer in the
#       documentation and/or other materials provided with the distribution.
#     * Neither the name of Code Aurora nor
#       the names of its contributors may be used to endorse or promote
#       products derived from this software without specific prior written
#       permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

target=`getprop ro.product.device`
case "$target" in
    "msm7201a_ffa" | "msm7201a_surf" | "msm7627_ffa" | "msm7627_surf" | "msm7627a" | \
    "qsd8250_surf" | "qsd8250_ffa" | "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "qsd8650a_st1x")
        echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
        chown system /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
        ;;
esac

case "$target" in
    "msm7201a_ffa" | "msm7201a_surf")
        echo 500000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
        ;;
esac

case "$target" in
    "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
        echo 75000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
        echo 1 > /sys/module/pm2/parameters/idle_sleep_mode
        ;;
esac

case "$target" in
    "msm8660_surf" | "msm8660_csfb" | "cayman")
     echo 1 > /sys/module/rpm_resources/enable_low_power/L2_cache
     echo 1 > /sys/module/rpm_resources/enable_low_power/pxo
     echo 2 > /sys/module/rpm_resources/enable_low_power/vdd_dig
     echo 2 > /sys/module/rpm_resources/enable_low_power/vdd_mem
     echo 1 > /sys/module/rpm_resources/enable_low_power/rpm_cpu
     echo 1 > /sys/module/pm_8x60/modes/cpu0/power_collapse/suspend_enabled
     echo 1 > /sys/module/pm_8x60/modes/cpu1/power_collapse/suspend_enabled
     echo 1 > /sys/module/pm_8x60/modes/cpu0/standalone_power_collapse/suspend_enabled
     echo 1 > /sys/module/pm_8x60/modes/cpu1/standalone_power_collapse/suspend_enabled
     echo 1 > /sys/module/pm_8x60/modes/cpu0/power_collapse/idle_enabled
     echo 1 > /sys/module/pm_8x60/modes/cpu1/power_collapse/idle_enabled
     echo 1 > /sys/module/pm_8x60/modes/cpu0/standalone_power_collapse/idle_enabled
     echo 1 > /sys/module/pm_8x60/modes/cpu1/standalone_power_collapse/idle_enabled
     echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
     echo 50000 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate
     echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
     echo 90 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/up_threshold
     echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
     echo 4 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
     chown system /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
     chown system /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate
     echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
     echo 384000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
     [COLOR="red"][B]chown system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq[/B][/COLOR]
     chown system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
     [COLOR="Red"][B]chown system /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq[/B][/COLOR]
     chown system /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
     chown root.system /sys/devices/system/cpu/mfreq
     chmod 220 /sys/devices/system/cpu/mfreq
     chown root.system /sys/devices/system/cpu/cpu1/online
     chmod 664 /sys/devices/system/cpu/cpu1/online
        ;;
esac

case "$target" in
    "msm7627_ffa" | "msm7627_surf" | "msm7627a")
        echo 25000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
        ;;
esac

case "$target" in
    "qsd8250_surf" | "qsd8250_ffa" | "qsd8650a_st1x")
        echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
        ;;
esac

case "$target" in
    "qsd8650a_st1x")
        mount -t debugfs none /sys/kernel/debug
    ;;
esac

emmc_boot=`getprop ro.emmc`
case "$emmc_boot"
    in "1")
        chown system /sys/devices/platform/rs300000a7.65536/force_sync
        chown system /sys/devices/platform/rs300000a7.65536/sync_sts
        chown system /sys/devices/platform/rs300100a7.65536/force_sync
        chown system /sys/devices/platform/rs300100a7.65536/sync_sts
    ;;
esac


# Post-setup services
case "$target" in
    "msm8660_surf" | "msm8660_csfb" | "cayman")
        start mpdecision
        start thermald
    ;;
esac

you can see it does other things other than set cpu speeds. I dont see where a max is set but you can clearly see where min is set.

not sure of the needed changes just yet, but just deleting will most likely lead to other issues elsewhere. ;)

After checking in the file /system/etc/init.qcom.post_boot.sh and also checking the logcat from kanaida, compared to my logcat as well.

log states:
  • E/ThermalDaemon( 1005): CPU[0] frequency limited to 1512000
  • E/ThermalDaemon( 1005): CPU[1] frequency limited to 1512000

Going through the /system/etc/init.qcom.post_boot.sh I noticed to lines of code that has a reference to scaling max frequency. *Also highlighted in the original text of the above file for reference.

  • chown system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
  • chown system /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq


I believe that these are the system persistent files pertaining to the MAX level allowed for the CPU. Maybe mtmichaelson can confirm this as he originally created the ROM and Kernel.

Further checking of these 2 files show a value of 1512000. I believe that these 2 files are marking the upper level that the CPU is allowed access. Hence why when placing the CPU at 1836 it automatically scales back down to the 1512 file. These files constantly write that max CPU can only be 1512. I have noticed that even if I try to underclock my CPU it defaults back to 1512.

Given that, if the files are changed to a different value, they may constantly refresh setcpu, no-frill, etc, to the newly changed value. I am unsure of how these programs actually write the changes to the file(s) that are being used or even what files are changed. Seems to be some form of issue with the kernel itself but I will do my best to continue troubleshooting on my end with my limited knowledge to see if it is a system persistent write issue or not.

I will be testing this on my own phone tonight when I get a chance but if anyone else would care to give it a shot I would not be able to stop you.

*If anyone does test this before I get a chance either PM with the results or just post if it worked. I have the original files backed up if need be.
 
Lets say you deleted this file. Would a benchmark score be lower if one core isn't in use?
like from antutu benchmark?

Also, would an app like Micro CPU Monitor pick up if the second core is active or not?
 
Lets say you deleted this file. Would a benchmark score be lower if one core isn't in use?
like from antutu benchmark?

Also, would an app like Micro CPU Monitor pick up if the second core is active or not?

I would think it would yea. Highly doubt we could get scores of almost 8k with one core @1.8 ghz. LG esteem only sees scores averaging in the 4000's with one core @2.1ghz.

System info pane in quadrant standard says both cores are available.
 
over, the workaround you gave worked just fine with setcpu. I used the profiles for battery < 101% and highest priority. But, right after when I would charge my phone and or disconnect from charging the max cpu setting would go but to default 1512 or at a value higher then the setting I manually put in on setcpu. so, I also made a profile for charging,cpu max 384 min 384 with priority set at 91. I used these profiles for about a day and so far the setting I manually put in are sticking with improved battery life. I prefer using setcpu then any other apps cause the value stick alot better. The only thing is that I cant get a profile for screen shut off to work so, my cpu is always at max 756 and min 384.
 
I'm trying to delete that file but rom toolbox pro and every other file explorer says i don't have enough permission. I'm rooted and the apps get permission. what can it be?
 
i used this fix as well for BP 1.2, except i vaguely remember the file being in a different directory.....but i could be wrong. I don't recall.

Anyhow, someone sent me a modfied copy of the boot file, I just hope that this location is the right one.
 
I'm trying to delete that file but rom toolbox pro and every other file explorer says i don't have enough permission. I'm rooted and the apps get permission. what can it be?

Did you ever figure this out? It might be because you are in the etc folder of the parent directory. You need to go into the system folder of the parent directory and then the etc folder of that one. The file shows up in both places but can only be deleted in the system folder and etc.
 
Back
Top Bottom