From a312ca1c5002f70c7e8cf9fcb802bbf7689dfca2 Mon Sep 17 00:00:00 2001 From: Udo Schläpfer Date: Wed, 21 Jan 2015 20:35:03 +0100 Subject: CPUFreq scaling governor interface for Linux/Android hosted devices. For a usage example see http://gerrit.rockbox.org/r/#/c/1074/ Change-Id: I1d61e0eba6552a9b5d6e15a2e3169435b2f7079d --- firmware/target/hosted/cpufreq-linux.h | 58 ++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 firmware/target/hosted/cpufreq-linux.h (limited to 'firmware/target/hosted/cpufreq-linux.h') diff --git a/firmware/target/hosted/cpufreq-linux.h b/firmware/target/hosted/cpufreq-linux.h new file mode 100644 index 0000000000..f62e0225dd --- /dev/null +++ b/firmware/target/hosted/cpufreq-linux.h @@ -0,0 +1,58 @@ +/*************************************************************************** + * __________ __ ___ + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2015 by Udo Schläpfer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * + * Interface for the Linux CPUFreq kernel modul. + * See https://www.kernel.org/doc/Documentation/cpu-freq/ + * + ****************************************************************************/ + + +#ifndef __CPUFREQ_LINUX_H__ +#define __CPUFREQ_LINUX_H__ + + +#include + + +/* + Get the available governors for cpu. + governors Preallocated string for the available governors. On succes this will look like + "performance ondemand powersave", each word beeing a governor that can be used with + cpufreq_set_governor. + governors_size Size of governors. + cpu The cpu, starting with 0, for which to get the available governors. CPUFREQ_ALL_CPUS is not + supported, you must supply a cpu. See cpucount_linux in cpuinfo-linux.h. +*/ +void cpufreq_available_governors(char* governors, int governors_size, int cpu); + + +/* + Set the cpufreq governor for cpu. + governor The governor to set. This must be one of the available governors returned by + cpufreq_available_governors. + cpu The cpu, starting with 0, for which to set the governor. CPUFREQ_ALL_CPUS to set + the governor for all cpus. See cpucount_linux in cpuinfo-linux.h. +*/ +void cpufreq_set_governor(const char* governor, int cpu); + + +static const int CPUFREQ_ALL_CPUS = -1; + + +#endif -- cgit v1.2.3