summaryrefslogtreecommitdiff
path: root/apps/debug_menu.c
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/debug_menu.c
parent2f3801be3426c5cd743f237ec92b8feb9b5f0344 (diff)
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/debug_menu.c')
-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,
{
int cpu = (selected_item - 5) / (state_count + 1);
int cpu_line = (selected_item - 5) % (state_count + 1);
-#if defined(DX50) || defined(DX90)
+
+ /* scaling info */
int min_freq = min_scaling_frequency(cpu);
int cur_freq = current_scaling_frequency(cpu);
+ /* fallback if scaling frequency is not available */
+ if(cur_freq <= 0)
+ cur_freq = frequency_linux(cpu);
int max_freq = max_scaling_frequency(cpu);
char governor[20];
bool have_governor = current_scaling_governor(cpu, governor, sizeof(governor));
@@ -256,16 +260,6 @@ static const char* get_cpuinfo(int selected_item, void *data,
cur_freq > 0 ? cur_freq/1000 : -1,
max_freq > 0 ? max_freq/1000 : -1);
}
-#else
- int freq1 = frequency_linux(cpu, false);
- int freq2 = frequency_linux(cpu, true);
- if (cpu_line == 0)
- {
- sprintf(buffer, " CPU%d: Cur/Scal freq: %d/%d MHz", cpu,
- freq1 > 0 ? freq1/1000 : -1,
- freq2 > 0 ? freq2/1000 : -1);
- }
-#endif
else
{
cpustatetimes_linux(cpu, states, ARRAYLEN(states));