mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
module/cpufreq: Add userspace special case for use_governor()
Frequencies are not considered as governor tunables by list_governor_tunables(), so add a special case to restore userspace frequency when using use_governor(). While at it, reword the internal "governor" variable to not clash with the parameter of the same name.
This commit is contained in:
parent
85e0fb08fe
commit
94c1339efd
@ -120,6 +120,12 @@ class CpufreqModule(Module):
|
|||||||
prev_governors = {cpu : (self.get_governor(cpu), self.get_governor_tunables(cpu))
|
prev_governors = {cpu : (self.get_governor(cpu), self.get_governor_tunables(cpu))
|
||||||
for cpu in domains}
|
for cpu in domains}
|
||||||
|
|
||||||
|
# Special case for userspace, frequency is not seen as a tunable
|
||||||
|
userspace_freqs = {}
|
||||||
|
for cpu, (prev_gov, _) in prev_governors.items():
|
||||||
|
if prev_gov == "userspace":
|
||||||
|
userspace_freqs[cpu] = self.get_frequency(cpu)
|
||||||
|
|
||||||
for cpu in domains:
|
for cpu in domains:
|
||||||
self.set_governor(cpu, governor, **kwargs)
|
self.set_governor(cpu, governor, **kwargs)
|
||||||
|
|
||||||
@ -127,8 +133,10 @@ class CpufreqModule(Module):
|
|||||||
yield
|
yield
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
for cpu, (governor, tunables) in prev_governors.items():
|
for cpu, (prev_gov, tunables) in prev_governors.items():
|
||||||
self.set_governor(cpu, governor, **tunables)
|
self.set_governor(cpu, prev_gov, **tunables)
|
||||||
|
if prev_gov == "userspace":
|
||||||
|
self.set_frequency(cpu, userspace_freqs[cpu])
|
||||||
|
|
||||||
def list_governor_tunables(self, cpu):
|
def list_governor_tunables(self, cpu):
|
||||||
"""Returns a list of tunables available for the governor on the specified CPU."""
|
"""Returns a list of tunables available for the governor on the specified CPU."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user