diff options
Diffstat (limited to 'firmware/target/hosted/cpuinfo-linux.c')
-rw-r--r-- | firmware/target/hosted/cpuinfo-linux.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/firmware/target/hosted/cpuinfo-linux.c b/firmware/target/hosted/cpuinfo-linux.c index 70d0e25139..e0a6bd76da 100644 --- a/firmware/target/hosted/cpuinfo-linux.c +++ b/firmware/target/hosted/cpuinfo-linux.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
@@ -137,27 +137,14 @@ int cpucount_linux(void) | |||
137 | return get_nprocs(); | 137 | return get_nprocs(); |
138 | } | 138 | } |
139 | 139 | ||
140 | int cpufrequency_linux(int cpu) | 140 | int frequency_linux(int cpu, bool scaling) |
141 | { | 141 | { |
142 | char path[64]; | 142 | char path[64]; |
143 | char temp[10]; | 143 | char temp[10]; |
144 | int cpu_dev, ret = -1; | 144 | int cpu_dev, ret = -1; |
145 | snprintf(path, sizeof(path), "/sys/devices/system/cpu/cpu%d/cpufreq/cpuinfo_cur_freq", cpu); | 145 | snprintf(path, sizeof(path), |
146 | cpu_dev = open(path, O_RDONLY); | 146 | "/sys/devices/system/cpu/cpu%d/cpufreq/%s_cur_freq", |
147 | if (cpu_dev < 0) | 147 | cpu, scaling ? "scaling" : "cpuinfo"); |
148 | return -1; | ||
149 | if (read(cpu_dev, temp, sizeof(temp)) >= 0) | ||
150 | ret = atoi(temp); | ||
151 | close(cpu_dev); | ||
152 | return ret; | ||
153 | } | ||
154 | |||
155 | int scalingfrequency_linux(int cpu) | ||
156 | { | ||
157 | char path[64]; | ||
158 | char temp[10]; | ||
159 | int cpu_dev, ret = -1; | ||
160 | snprintf(path, sizeof(path), "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq", cpu); | ||
161 | cpu_dev = open(path, O_RDONLY); | 148 | cpu_dev = open(path, O_RDONLY); |
162 | if (cpu_dev < 0) | 149 | if (cpu_dev < 0) |
163 | return -1; | 150 | return -1; |