linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: print cpu frequency in /proc/cpuinfo
@ 2013-12-13  8:43 Vinayak Kale
  2013-12-13 10:36 ` Will Deacon
  0 siblings, 1 reply; 7+ messages in thread
From: Vinayak Kale @ 2013-12-13  8:43 UTC (permalink / raw)
  To: linux-arm-kernel

Print the cpu frequency field in /proc/cpuinfo.

Signed-off-by: Vinayak Kale <vkale@apm.com>
---
 arch/arm64/kernel/setup.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index bd9bbd0..bca982b 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -41,6 +41,7 @@
 #include <linux/memblock.h>
 #include <linux/of_fdt.h>
 #include <linux/of_platform.h>
+#include <linux/cpufreq.h>
 
 #include <asm/cputype.h>
 #include <asm/elf.h>
@@ -278,9 +279,19 @@ static const char *hwcap_str[] = {
 	NULL
 };
 
+static unsigned int get_cpufreq_khz(unsigned int cpu)
+{
+#ifdef CONFIG_CPU_FREQ
+	return cpufreq_quick_get(cpu);
+#else
+	return 0;
+#endif
+}
+
 static int c_show(struct seq_file *m, void *v)
 {
 	int i;
+	unsigned int cpufreq_khz;
 
 	seq_printf(m, "Processor\t: %s rev %d (%s)\n",
 		   cpu_name, read_cpuid_id() & 15, ELF_PLATFORM);
@@ -294,6 +305,10 @@ static int c_show(struct seq_file *m, void *v)
 #ifdef CONFIG_SMP
 		seq_printf(m, "processor\t: %d\n", i);
 #endif
+		cpufreq_khz = get_cpufreq_khz(i);
+		if (cpufreq_khz)
+			seq_printf(m, "cpu MHz\t\t: %u.%02u\n",
+				cpufreq_khz / 1000, (cpufreq_khz % 1000));
 	}
 
 	/* dump out the processor features */
-- 
1.5.6.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-12-16  5:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-13  8:43 [PATCH] arm64: print cpu frequency in /proc/cpuinfo Vinayak Kale
2013-12-13 10:36 ` Will Deacon
2013-12-13 13:12   ` Vinayak Kale
2013-12-13 14:16   ` Rob Herring
2013-12-13 14:24     ` Russell King - ARM Linux
2013-12-13 15:13       ` Rob Herring
2013-12-16  5:13     ` Vinayak Kale

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).