diff options
author | Udo Schläpfer <rockbox-2014.10@desktopwarrior.net> | 2015-01-21 20:35:03 +0100 |
---|---|---|
committer | Gerrit Rockbox <gerrit@rockbox.org> | 2015-01-30 20:15:58 +0100 |
commit | a312ca1c5002f70c7e8cf9fcb802bbf7689dfca2 (patch) | |
tree | f31f5f61c90859d4283903d2c06faa9032b9681a /firmware/target/hosted/cpufreq-linux.h | |
parent | 6d3dc8fce0401da24ad45593e4eb9a68e2cde297 (diff) | |
download | rockbox-a312ca1c5002f70c7e8cf9fcb802bbf7689dfca2.tar.gz rockbox-a312ca1c5002f70c7e8cf9fcb802bbf7689dfca2.zip |
CPUFreq scaling governor interface for Linux/Android hosted devices.
For a usage example see http://gerrit.rockbox.org/r/#/c/1074/
Change-Id: I1d61e0eba6552a9b5d6e15a2e3169435b2f7079d
Diffstat (limited to 'firmware/target/hosted/cpufreq-linux.h')
-rw-r--r-- | firmware/target/hosted/cpufreq-linux.h | 58 |
1 files changed, 58 insertions, 0 deletions
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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___ | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2015 by Udo Schläpfer | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | * | ||
20 | * Interface for the Linux CPUFreq kernel modul. | ||
21 | * See https://www.kernel.org/doc/Documentation/cpu-freq/ | ||
22 | * | ||
23 | ****************************************************************************/ | ||
24 | |||
25 | |||
26 | #ifndef __CPUFREQ_LINUX_H__ | ||
27 | #define __CPUFREQ_LINUX_H__ | ||
28 | |||
29 | |||
30 | #include <stdbool.h> | ||
31 | |||
32 | |||
33 | /* | ||
34 | Get the available governors for cpu. | ||
35 | governors Preallocated string for the available governors. On succes this will look like | ||
36 | "performance ondemand powersave", each word beeing a governor that can be used with | ||
37 | cpufreq_set_governor. | ||
38 | governors_size Size of governors. | ||
39 | cpu The cpu, starting with 0, for which to get the available governors. CPUFREQ_ALL_CPUS is not | ||
40 | supported, you must supply a cpu. See cpucount_linux in cpuinfo-linux.h. | ||
41 | */ | ||
42 | void cpufreq_available_governors(char* governors, int governors_size, int cpu); | ||
43 | |||
44 | |||
45 | /* | ||
46 | Set the cpufreq governor for cpu. | ||
47 | governor The governor to set. This must be one of the available governors returned by | ||
48 | cpufreq_available_governors. | ||
49 | cpu The cpu, starting with 0, for which to set the governor. CPUFREQ_ALL_CPUS to set | ||
50 | the governor for all cpus. See cpucount_linux in cpuinfo-linux.h. | ||
51 | */ | ||
52 | void cpufreq_set_governor(const char* governor, int cpu); | ||
53 | |||
54 | |||
55 | static const int CPUFREQ_ALL_CPUS = -1; | ||
56 | |||
57 | |||
58 | #endif | ||