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:
@@ -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 = {}
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user