mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
cpufreq: add methods to set the governor for a specified set of CPUs
Sometimes it could be required to change the governor for a set of different CPUs. This patch provides an utility method to easily and achieve that with a single method call. Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This commit is contained in:
parent
db14589886
commit
4dcb4974e5
@ -326,3 +326,26 @@ class CpufreqModule(Module):
|
|||||||
self.target.write_value(sysfile, value)
|
self.target.write_value(sysfile, value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise ValueError('Frequency must be an integer; got: "{}"'.format(frequency))
|
raise ValueError('Frequency must be an integer; got: "{}"'.format(frequency))
|
||||||
|
|
||||||
|
def set_governor_for_cpus(self, cpus, governor, **kwargs):
|
||||||
|
"""
|
||||||
|
Set the governor for the specified list of CPUs.
|
||||||
|
See https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt
|
||||||
|
|
||||||
|
:param cpus: The list of CPU for which the governor is to be set.
|
||||||
|
"""
|
||||||
|
online_cpus = self.target.list_online_cpus()
|
||||||
|
for cpu in online_cpus:
|
||||||
|
self.set_governor(cpu, governor, kwargs)
|
||||||
|
|
||||||
|
def set_frequency_for_cpus(self, cpus, freq, exact=False):
|
||||||
|
"""
|
||||||
|
Set the frequency for the specified list of CPUs.
|
||||||
|
See https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt
|
||||||
|
|
||||||
|
:param cpus: The list of CPU for which the frequency has to be set.
|
||||||
|
"""
|
||||||
|
online_cpus = self.target.list_online_cpus()
|
||||||
|
for cpu in online_cpus:
|
||||||
|
self.set_frequency(cpu, freq, exact)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user