summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2017-10-06 18:31:35 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2017-10-06 18:31:35 +0200
commit4382f8773eaa94c43dc6cc0f19591d2607a34f20 (patch)
tree8f4505cb16fdcdc3a14deb5b26ad21d20ed99c64 /apps
parent2f3801be3426c5cd743f237ec92b8feb9b5f0344 (diff)
downloadrockbox-4382f8773eaa94c43dc6cc0f19591d2607a34f20.tar.gz
rockbox-4382f8773eaa94c43dc6cc0f19591d2607a34f20.zip
cleanup linux cpuinfo code
sonynwz: quirk for cpufreq broken driver There was some redundancy between frequency_linux(cpu, true) and current_scaling_frequency(), also I see no reason to compile the cpuinfo stuff unconditionally and the scaling info only on DX since it was already printed some partial scaling info anyway. Thus compile all the code unconditionally and simplify the logic in the debug menu. Also avoid putting buffers of size PATH_MAX on stack since it can be quite big and we only requires 64 bytes for those paths. On Sony NWZ, the cpu driver reports frequency in MHz instead of kHz thus we need to make the cpuinfo code aware of that bug. Change-Id: I61af45ab5f179ecc909b4841b9137a915a60193a
Diffstat (limited to 'apps')
-rw-r--r--apps/debug_menu.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 5224dbe267..4947f30695 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -240,9 +240,13 @@ static const char* get_cpuinfo(int selected_item, void *data,
240 { 240 {
241 int cpu = (selected_item - 5) / (state_count + 1); 241 int cpu = (selected_item - 5) / (state_count + 1);
242 int cpu_line = (selected_item - 5) % (state_count + 1); 242 int cpu_line = (selected_item - 5) % (state_count + 1);
243#if defined(DX50) || defined(DX90) 243
244 /* scaling info */
244 int min_freq = min_scaling_frequency(cpu); 245 int min_freq = min_scaling_frequency(cpu);
245 int cur_freq = current_scaling_frequency(cpu); 246 int cur_freq = current_scaling_frequency(cpu);
247 /* fallback if scaling frequency is not available */
248 if(cur_freq <= 0)
249 cur_freq = frequency_linux(cpu);
246 int max_freq = max_scaling_frequency(cpu); 250 int max_freq = max_scaling_frequency(cpu);
247 char governor[20]; 251 char governor[20];
248 bool have_governor = current_scaling_governor(cpu, governor, sizeof(governor)); 252 bool have_governor = current_scaling_governor(cpu, governor, sizeof(governor));
@@ -256,16 +260,6 @@ static const char* get_cpuinfo(int selected_item, void *data,
256 cur_freq > 0 ? cur_freq/1000 : -1, 260 cur_freq > 0 ? cur_freq/1000 : -1,
257 max_freq > 0 ? max_freq/1000 : -1); 261 max_freq > 0 ? max_freq/1000 : -1);
258 } 262 }
259#else
260 int freq1 = frequency_linux(cpu, false);
261 int freq2 = frequency_linux(cpu, true);
262 if (cpu_line == 0)
263 {
264 sprintf(buffer, " CPU%d: Cur/Scal freq: %d/%d MHz", cpu,
265 freq1 > 0 ? freq1/1000 : -1,
266 freq2 > 0 ? freq2/1000 : -1);
267 }
268#endif
269 else 263 else
270 { 264 {
271 cpustatetimes_linux(cpu, states, ARRAYLEN(states)); 265 cpustatetimes_linux(cpu, states, ARRAYLEN(states));