1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-01 19:02:31 +01:00

Implementing dynamic device modules

Dynamic modules may be loaded automatically on device initialization if
the device supports them. Dynamic modules implent probe() method to
determine whether they are supported by a particular deviced.

devcpufreq and cpuidle have been converted into dynamic modules
This commit is contained in:
Sergei Trofimov
2015-06-18 09:42:40 +01:00
parent 73d85c2b4e
commit d9f45db71e
5 changed files with 80 additions and 23 deletions

View File

@@ -28,6 +28,10 @@ class CpufreqModule(Module):
"""
capabilities = ['cpufreq']
def probe(self, device): # pylint: disable=no-self-use
path = '/sys/devices/system/cpu/cpufreq'
return device.file_exists(path)
def initialize(self, context):
# pylint: disable=W0201
CpufreqModule._available_governors = {}

View File

@@ -86,6 +86,9 @@ class Cpuidle(Module):
root_path = '/sys/devices/system/cpu/cpuidle'
def probe(self, device):
return device.file_exists(self.root_path)
def initialize(self, context):
self.device = self.root_owner
signal.connect(self._on_device_init, signal.RUN_INIT, priority=1)