Skip to content

Commit

Permalink
[display] Add automatic cpu governor policy
Browse files Browse the repository at this point in the history
MCE has cpu scaling governor feature that was meant to be used for
activating performance governor during bootup / shutdown and otherwise
select interactive governor. It was never taken in active use as is
was found to interfere with more advanced already existing android
side services. However - after fixing some obvious faults - having such
feature available might be useful for some device ports.

Make it possible to configure the following governor modes:
- performance - maximum performance
- interactive - high performance
- inactive    - medium performance
- powersave   - low performance

Implement policy that switches active governor based on device
state.

Utilize a run-time setting for:
- disabling the whole feature
- explicitly selecting one of the modes
- automatically switching between the modes depending on device state

Also provide:
- an annotated example configuration file
- python script for generating skeleton configuration files

Signed-off-by: Simo Piiroinen <[email protected]>
  • Loading branch information
spiiroin committed Feb 24, 2022
1 parent e5297ca commit 9d384be
Show file tree
Hide file tree
Showing 5 changed files with 423 additions and 75 deletions.
63 changes: 63 additions & 0 deletions inifiles/cpu-governor.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Configuration file for MCE - CPU Governor control data
#
# Having configuration is completely optional.
#
# Also note that defining a configuration might not work
# as expected for example when:
# - there is some other daemon adjusting frequencies
# (adjustments get overridden / otherwise out of sync)
# - sysfs control files appear/disapper dynamically
# (configured files do not exist when they would be written to)
#
# The mode can be selected explicitly or automatically based
# on device state
#
# mcetool --set-cpu-scaling-governor=<mode>
#
# Where mode is one of:
# - disabled - The feature is disabled
# - performance - "Default" configuration is applied
# - interactive - "Interactive" configuration is applied
# - inactive - "Inactive" configuration is applied
# - idle - "Idle" configuration is applied
# - automatic - Configuration is selected based on device state

# "Default" values are applied when:
# - device is booting up / shutting down
# - mce is starting up / about to exit
[CPUScalingGovernorDefault]
path1=/sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq
data1=432000

# Up to 32 path/data pairs can be defined. Writing is done
# in the given order. Each block is handled as-defined, i.e.
# if it is somehow benefitial they can have different sets
# of files to write to.
#path2=xxx
#data2=yyy
# :
#path32=xxx
#data32=yyy

# When the "Default" is not enforced, other values can be
# either selected explicitly, or automatically based on
# device state.

# In automatic mode "Interactive" values are applied when:
# - display is on and there is user activity
# - during display power up / down
[CPUScalingGovernorInteractive]
path1=/sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq
data1=432000

# In automatic mode "Inactive" values are applied when:
# - display is on and there is no user activity
[CPUScalingGovernorInactive]
path1=/sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq
data1=384000

# In automatic mode "Idle" values are applied when:
# - display is off
[CPUScalingGovernorIdle]
path1=/sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq
data1=216000
Loading

0 comments on commit 9d384be

Please sign in to comment.