From cbe80da3a113cc4325feb3348e69790d6dafdd8f Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Thu, 1 Oct 2015 17:59:12 +0100 Subject: [PATCH] cpufreq: make probing more robust On some machines, when a different CPUFreq policy could be configured for each CPU, there is not a top-level 'cpufreq' folder exposed at top level but just per-CPU ones. This patch makes the probing for CPUFreq support more robust by checking on all the supported paths. Signed-off-by: Patrick Bellasi --- devlib/module/cpufreq.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/devlib/module/cpufreq.py b/devlib/module/cpufreq.py index 9aeebe8..a41cff2 100644 --- a/devlib/module/cpufreq.py +++ b/devlib/module/cpufreq.py @@ -29,9 +29,20 @@ class CpufreqModule(Module): @staticmethod def probe(target): - path = '/sys/devices/system/cpu/cpufreq' + + # x86 with Intel P-State driver if target.abi == 'x86_64': path = '/sys/devices/system/cpu/intel_pstate' + if target.file_exists(path): + return True + + # Generic CPUFreq support (single policy) + path = '/sys/devices/system/cpu/cpufreq' + if target.file_exists(path): + return True + + # Generic CPUFreq support (per CPU policy) + path = '/sys/devices/system/cpu/cpu0/cpufreq' return target.file_exists(path) def __init__(self, target):