From: Konstantin Krivyakin <k.krivyakin@samsung.com>
To: linux-kernel@vger.kernel.org, rjw@sisk.pl,
viresh.kumar@linaro.org, mingo@redhat.com, peterz@infradead.org,
kgene.kim@samsung.com, linux-pm@vger.kernel.org
Cc: k.krivyakin@samsung.com, i.zhbanov@samsung.com,
e.voevodin@samsung.com, kyungmin.park@samsung.com,
akpm@linux-foundation.org
Subject: [PATCH RFC 1/3] Add interface to receive current cpu power
Date: Tue, 30 Jul 2013 12:17:37 +0400 [thread overview]
Message-ID: <1375172259-9641-2-git-send-email-k.krivyakin@samsung.com> (raw)
In-Reply-To: <1375172259-9641-1-git-send-email-k.krivyakin@samsung.com>
Signed-off-by: Konstantin Krivyakin <k.krivyakin@samsung.com>
---
drivers/cpufreq/cpufreq.c | 17 +++++++++++++++++
include/linux/cpufreq.h | 6 ++++++
2 files changed, 23 insertions(+)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 6a015ad..4180e89 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1538,6 +1538,23 @@ int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list)
}
EXPORT_SYMBOL(cpufreq_unregister_notifier);
+/**
+ * cpu_power_get - get current CPU power
+ * @cpu: CPU number
+ */
+u64 cpu_power_get(int cpu)
+{
+ struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
+ u64 ret_power = 0;
+
+ if (policy) {
+ ret_power = policy->current_power;
+ cpufreq_cpu_put(policy);
+ }
+
+ return ret_power;
+}
+EXPORT_SYMBOL(cpu_power_get);
/*********************************************************************
* GOVERNORS *
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 4d7390b..67323af 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -107,6 +107,7 @@ struct cpufreq_policy {
unsigned int max; /* in kHz */
unsigned int cur; /* in kHz, only needed if cpufreq
* governors are used */
+ u64 current_power;
unsigned int policy; /* see above */
struct cpufreq_governor *governor; /* see below */
void *governor_data;
@@ -365,6 +366,7 @@ static inline unsigned int cpufreq_get(unsigned int cpu)
#ifdef CONFIG_CPU_FREQ
unsigned int cpufreq_quick_get(unsigned int cpu);
unsigned int cpufreq_quick_get_max(unsigned int cpu);
+u64 cpu_power_get(int cpu);
#else
static inline unsigned int cpufreq_quick_get(unsigned int cpu)
{
@@ -374,6 +376,10 @@ static inline unsigned int cpufreq_quick_get_max(unsigned int cpu)
{
return 0;
}
+static inline u64 cpu_power_get(unsigned int cpu)
+{
+ return 0;
+}
#endif
/*********************************************************************
--
1.7.9.5
next prev parent reply other threads:[~2013-07-30 8:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-30 8:17 [PATCH RFC 0/3] Per-process power consumption measurement facility Konstantin Krivyakin
2013-07-30 8:17 ` Konstantin Krivyakin [this message]
2013-07-30 8:17 ` [PATCH RFC 2/3] Add power consumption counter in task_struct Konstantin Krivyakin
2013-07-30 8:17 ` [PATCH RFC 3/3] Update current cpu power when cpu freq change for exynos Konstantin Krivyakin
2013-07-30 8:52 ` [PATCH RFC 0/3] Per-process power consumption measurement facility Peter Zijlstra
2013-07-30 12:10 ` Igor Zhbanov
2013-07-30 13:31 ` Rafael J. Wysocki
-- strict thread matches above, loose matches on Subject: below --
2013-07-04 15:17 Konstantin Krivyakin
2013-07-04 15:17 ` [PATCH RFC 1/3] Add interface to receive current cpu power Konstantin Krivyakin
2013-07-05 0:49 ` Kyungmin Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1375172259-9641-2-git-send-email-k.krivyakin@samsung.com \
--to=k.krivyakin@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=e.voevodin@samsung.com \
--cc=i.zhbanov@samsung.com \
--cc=kgene.kim@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rjw@sisk.pl \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®