From patchwork Fri Dec 13 08:43:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinayak Kale X-Patchwork-Id: 3339021 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0DF139F243 for ; Fri, 13 Dec 2013 08:44:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 132552072E for ; Fri, 13 Dec 2013 08:44:50 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 10D0C205C1 for ; Fri, 13 Dec 2013 08:44:49 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VrOMW-0004HE-Iq; Fri, 13 Dec 2013 08:44:44 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VrOMU-000073-9g; Fri, 13 Dec 2013 08:44:42 +0000 Received: from exprod5og109.obsmtp.com ([64.18.0.188]) by merlin.infradead.org with smtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VrOMR-00006i-Dp for linux-arm-kernel@lists.infradead.org; Fri, 13 Dec 2013 08:44:40 +0000 Received: from mail-pd0-f173.google.com ([209.85.192.173]) (using TLSv1) by exprod5ob109.postini.com ([64.18.4.12]) with SMTP ID DSNKUqrI34Ib6ZpTrGblChL1snzlIX0c8fJ7@postini.com; Fri, 13 Dec 2013 00:44:39 PST Received: by mail-pd0-f173.google.com with SMTP id p10so2106790pdj.32 for ; Fri, 13 Dec 2013 00:44:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=j0yMB0SL1rlzkdbwQoERHgUmrF8x0EPq5pnEOld2w/g=; b=mJ3Um+lbyqisHDQnEukZTkuVi4iGpQgEq3pDVhbxcgds9EQpDS4/los2J9YAr1eiHZ cvgmAx/nt1Hmg34bP6GnU+sYX5fiIUO2p8IGYlOcK6k7FibzwPWPiZ6Z+rSTXJlyvyOu 7ZHHBTVl3bumdqwe3hWBjfDGMr82wAkFkayh6CQEDadrvJ7tssdb1WN1BEgQDMsGvskr BebVHCKqLXW2nCnzP0GyzPzDPXXfGDpfI6zFaUMaJAzLeT6ntrohqBmss73FLZoFVGjA nZpam/5SULKFTFXizLjGMQGFnzpVanX5a7jis/vENoHMPi/gY/34Hu1zW4Ljlpr9Cne1 9X4A== X-Gm-Message-State: ALoCoQlow4vdFJ09omH84Frw5eznB6RMXA7bPAAaC5KBwLTNiuP/WDts0xAzHSb+swkhIqUUc+spm4I9pnZr5S3D8QQWsb2/Ng1IzcPJ6EYhbKGUNcvIzlf4WfMMA8hkw42ylzLK1E3MUYp+PkleaqU8JeB8T8gek/NzVVNudFqJLNEf6lqlY16nA/fXwaagtHjkobmd0UvV X-Received: by 10.66.122.40 with SMTP id lp8mr1894088pab.82.1386924254238; Fri, 13 Dec 2013 00:44:14 -0800 (PST) X-Received: by 10.66.122.40 with SMTP id lp8mr1894075pab.82.1386924254154; Fri, 13 Dec 2013 00:44:14 -0800 (PST) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id vh3sm3064049pbc.8.2013.12.13.00.44.11 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 00:44:13 -0800 (PST) From: Vinayak Kale To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm64: print cpu frequency in /proc/cpuinfo Date: Fri, 13 Dec 2013 14:13:42 +0530 Message-Id: <1386924222-23169-1-git-send-email-vkale@apm.com> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131213_034439_671459_6F343798 X-CRM114-Status: GOOD ( 12.21 ) X-Spam-Score: -4.2 (----) Cc: Catalin.Marinas@arm.com, patches@apm.com, Vinayak Kale , will.deacon@arm.com, jcm@redhat.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Print the cpu frequency field in /proc/cpuinfo. Signed-off-by: Vinayak Kale --- 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 #include #include +#include #include #include @@ -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 */