Turbo button?


ouzle

Very Active Member
Joined
Jun 3, 2019
Messages
130
Location
England
Is there any point adding a retro "turbo button" on the Pyra? I'm thinking of when the governor is set to "On Demand", are there times you'd rather the pyra only run at up-to 1GHz and not on demand to 1.5GHz?

I don't think it saves battery for a given task because the task takes longer to run at a lower clock frequency (and I think the power usage is linear with clock frequency?). But, if you're waiting for something, like a phone call, you might want to limit the on-demand CPU freq. You can set the governor to 250MHz, but that cripples everything. Setting the governor to 500 or 750MHz is better, but doesn't let the on-demand governor idle when load is low.

Is there a setting to limit the On-demand frequency? Is there any point in doing so?

One thing capping the frequency at 1GHz would do is to make the pyra run cooler and consistently for a long running task. Would you just set the governor to 1GHz then though?
Post automatically merged:

governor.png
 

ouzle

Very Active Member
Joined
Jun 3, 2019
Messages
130
Location
England
Maybe charging the pyra when in use is one reason. If your charger can only deliver 2A and the pyra is running at dual core 1.5GHz, there's not enough current to charge the battery. Throttling to 1GHz lets the battery charge whilst you're still running. But again. would you just set the governor to 1GHz while you carry on with the game?
 

levi

Still fresh, damnit!
Joined
Oct 6, 2008
Messages
14,364
Location
Somewhere off the coast of the EU
On the Pandora I got used to switching my max CPU up to 1.2GHz for a game and then back down to 1.1GHz for better reliability, until I didcovered that not all NEON operations worked at 1.2GHz on my machine, so then it generally lived at 1.1GHz max. But on the Pandora, the ondemand governer was exclusively used, so it actually ran quite burstily, dropping back to sub 500Mhz when finished.

I suspect that assuming power draw is linear wrt clock frequency might be a mistake. It's presumably not impossible to test, so if you're using that prediction in anything serious, I'd suggest testing it out.
 
Last edited:

Djoga'Ro

moonstruck
Joined
Apr 3, 2016
Messages
2,000
Regarding the question if efficiency changes with the clock rate, I don't know exactly. But I'd assume in semiconductors the resistance grows with the temperature, too.

So, I'd think the cpu needs higher voltages than to maintain the required currentses - filling and emptying the capacitors. If so, I'd expect significant changes in efficiency. Since
P = UI, I = U / R
=> P = U^2 / I (EDIT Children, that's why you shouldn't stay awake for over 30 h, before you take a math test.)
=> P = U^2 / R
Plus, the voltages probably already need to be higher, so that the capacitors fill and empty faster. So, U needs to be higher^2. :) ?
 
Last edited:

ouzle

Very Active Member
Joined
Jun 3, 2019
Messages
130
Location
England
One way to do this is to modify the /usr/share/pyra/scripts/pyra-thermal.sh again to watch a turbo flag in a file. We can toggle the turbo flag with another script. You can then call the toggle script from a keyboard shortcut or desktop icon:

Bash:
#!/bin/bash
# Read core and battery temp and pick approperiate cpu freq and charging rates
# Monitors /var/run/pyra-enable-turbo for "0" or "1" to set max freq to 1GHz or 1.5GHz
interval=20
core="core_thermal"
battery="bq24297"
varturbo="/var/run/pyra-enable-turbo"

normalFreq=1000
maxFreq=1500
maxCharge=3000000

readTurboState()
{
    # Read the turbo state from file
    touch ${varturbo}
    chmod a+w ${varturbo}
    t=$(< ${varturbo})

    turbo=0
 
    if [[ -z "$t" ]] ; then    
        echo 0 > ${varturbo}
    fi;
 
    if [[ "$t" -eq 1 ]] ; then
        turbo=1
    fi
}

setMaxFreq()
{
    [[ $1 -lt $reqfreq ]] && f=$1 || f=$reqfreq
    echo set $f
    if [[ "$1" -le "$maxFreq" ]] ; then
        current_maxFreq=$1
    fi
}

setMaxCharge()
{
    if [ "$1" -le "$maxCharge" ] ; then
        current_maxCharge=$1
    fi
}

doThermal()
{
    core_temp=$(cat "${core_dev}")
    battery_temp=$(cat "${battery_dev}")

    readTurboState
    if [[ "$turbo" -eq 1 ]]; then
        reqfreq="$maxFreq"
    else
        reqfreq="$normalFreq"
    fi

    #Check Battery, from hottest to coldest
    if [ ${battery_temp} -gt 50000 ]
    then
            setMaxCharge 500000
    else    
        setMaxCharge ${maxCharge}
    fi

    #Check Core, from hottest to coldest
    if [ ${core_temp} -gt 97000 ]
    then
            setMaxFreq 250
    elif [ ${core_temp} -gt 92000 ]
    then
            setMaxFreq 500
    elif [ ${core_temp} -gt 87000 ] || ${battery_temp} -gt 50000 ]
    then
            setMaxFreq 750
    elif [ ${core_temp} -gt 82000 ]
    then
            setMaxFreq 1000
    elif [ ${core_temp} -gt 77000 ]
    then
            setMaxFreq 1250
    else
            setMaxFreq 1500
    fi

    if [ "$daemon" -eq 0 ]
    then
            echo ${core}:${core_temp} ${battery}:${battery_temp}
            echo MaxFreq: ${current_maxFreq} MaxCharge: ${current_maxCharge}
    fi

    cpufreq-set -u ${current_maxFreq}MHz
    echo ${current_maxCharge} > /dev/usb_max_current

}

if [ "$1" = "daemon" ]
then
    daemon=1
    shift
else
    daemon=0
fi

for i in /sys/class/thermal/thermal_zone*
do
    name=$(cat ${i}/type)
    if [ "${name}" = "${core}" ]
    then
        core_dev="${i}/temp"
    fi

    if [ "${name}" = "${battery}" ]
    then
        battery_dev="${i}/temp"
    fi
done

if [ -z "${core_dev}" ]
then
        echo could not find ${core}
        exit 1
fi

if [ -z "${battery_dev}" ]
then
        echo could not find ${battery}
        exit 1
fi

if [ "$daemon" -eq 1 ]
then
    while true
    do
        doThermal
     
        for i in seq 1 ${interval}; do
            sleep 1
         
            # Stop waiting if turbo state changes
            oldturbo="$turbo"
            readTurboState
            if [[ oldturbo -ne turbo ]]; then break; fi        
        done
    done
else
    doThermal
fi

Bash:
#!/bin/bash
varturbo="/var/run/pyra-enable-turbo"

readTurboState()
{
    # Read the turbo state from file
    touch ${varturbo}
    t=$(< ${varturbo})

    turbo=0
 
    if [[ -z "$t" ]] ; then    
        echo 0 > ${varturbo}
    fi;
 
    if [[ "$t" -eq 1 ]] ; then
        turbo=1
    fi
}

readTurboState
[[ $turbo -eq 1 ]] && turbo=0 || turbo=1
[[ $turbo -eq 1 ]] && echo on || echo off
echo ${turbo} > ${varturbo}

 
Last edited:

matzesu

Forum Addict!
Staff member
Joined
Oct 24, 2008
Messages
11,225
Age
37
Location
Germany,, Saarland, at home
Well, i used this Widged once on my Pyra, and i made some changes to some other options, but then i wanted to shutdown and its refused to shutdown, and ended in the login screen so i deleted the widged...
But to trottle the Pyra a bit to let it charge whyle you work something in Libre Office might be a good idea..

But the Widged only shows one CPU Core, so do you need to have 2 of them, and trottle each seperatly?
 

matzesu

Forum Addict!
Staff member
Joined
Oct 24, 2008
Messages
11,225
Age
37
Location
Germany,, Saarland, at home
Ok as i used the Pyra this morning the first time as my after wake up Internet Device instead of my Iphone, i testet this Widged, i set it to 1 ghz, and it charged whyle i was using firefox, its just a bit slow whit just 1 ghz..
Is this 1 ghz for booth cores? Or do i still have 2 x 1 ghz then?
I need a longer Micro USB Cable then..
 

levi

Still fresh, damnit!
Joined
Oct 6, 2008
Messages
14,364
Location
Somewhere off the coast of the EU
Certainly on most x86 boxen I've used, the oscillator controls both cores, so they run at the same speed. I'd guess a big-little setup would require independent clocks, but the OMAP5 should just be a straightforward SMP chip (at least it we ignore the M4 cores which run a different instruction set anyway, so wouldn't in any sense be symmetric), so I'd expect one master clock for the A15 cores.
 

matzesu

Forum Addict!
Staff member
Joined
Oct 24, 2008
Messages
11,225
Age
37
Location
Germany,, Saarland, at home
Ok so when I want to have only one widget on my task bar, I only need one, if I don’t want to know the current speed ..

I wonder: on Stock Pyra Debian, the Widgets on the Task Bar are not active, so this means it wasn’t intended from Evildragon, that whe use them?
Are there any features on the Pyra Debian that whe shouldn’t use, because they are not optimized?
It would be quite difficult for Developers to make something for a system when the specs vary that much because the users have different setup ^^
 

matzesu

Forum Addict!
Staff member
Joined
Oct 24, 2008
Messages
11,225
Age
37
Location
Germany,, Saarland, at home
i wonder: When i set the CPU to 250 mhz, is this slow enough to avoid it from getting hot, so i could in theory put it in my Pocket??
Display Backlight, and Keyboard Backlight would be off...
I could then make some tests during the Weekend, how long the Pyra can stay on whit 250 mhz..
 

ouzle

Very Active Member
Joined
Jun 3, 2019
Messages
130
Location
England
That's right, 250MHz makes the battery last longer and the pyra will cool down fastest. If you choose "Power Save" it means use 250MHz.

EDs pyra-thermal script stops the pyra overheating too. If the processor or battery gets too hot it automatically slows the processor down. That makes it safe to carry in your pocket even if you are set to 1.5GHz.
 

matzesu

Forum Addict!
Staff member
Joined
Oct 24, 2008
Messages
11,225
Age
37
Location
Germany,, Saarland, at home
ok so its now possible to use the Pyra whitout shutdown?
ok i will then try out how much battery % this needs a day..
It would make the Pyra much more attractive if i dont need to boot up everytime i need the Pyra

But the Shoulderbuttons are exposed,, so i would suggest to use the brightness controll so a button press in your pants want light up the screen
 

matzesu

Forum Addict!
Staff member
Joined
Oct 24, 2008
Messages
11,225
Age
37
Location
Germany,, Saarland, at home
Dit a quick test : 2 hours in Pants, CPU to Powersave Mode, LCD off, Keyboard Off,
All Connections deactivated,
It’s got still a bit warm, but not hot, but it’s used 13 % of the battery..
so I think this might be good when you want to use it after a few hours, but not for every day..
 
Top