mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konstantin Krivyakin <k.krivyakin@samsung.com>
To: k.krivyakin@samsung.com, i.zhbanov@samsung.com,
	e.voevodin@samsung.com, kyungmin.park@samsung.com,
	linux-kernel@vger.kernel.org
Subject: [PATCH RFC 1/3] Add interface to receive current cpu power
Date: Thu, 04 Jul 2013 19:17:17 +0400	[thread overview]
Message-ID: <1372951039-10375-2-git-send-email-k.krivyakin@samsung.com> (raw)
In-Reply-To: <1372951039-10375-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


  reply	other threads:[~2013-07-04 15:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-04 15:17 [PATCH RFC 0/3] Per-process power consumption measurement facility Konstantin Krivyakin
2013-07-04 15:17 ` Konstantin Krivyakin [this message]
2013-07-05  0:49   ` [PATCH RFC 1/3] Add interface to receive current cpu power Kyungmin Park
2013-07-04 15:17 ` [PATCH RFC 2/3] Add power consumption counter in task_struct Konstantin Krivyakin
2013-07-05  0:50   ` Kyungmin Park
2013-07-04 15:17 ` [PATCH RFC 3/3] Update current cpu power when cpu freq change for exynos Konstantin Krivyakin
2013-07-05  0:51   ` Kyungmin Park
2013-07-05  0:48 ` [PATCH RFC 0/3] Per-process power consumption measurement facility Kyungmin Park
2013-07-30  8:17 Konstantin Krivyakin
2013-07-30  8:17 ` [PATCH RFC 1/3] Add interface to receive current cpu power Konstantin Krivyakin

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=1372951039-10375-2-git-send-email-k.krivyakin@samsung.com \
    --to=k.krivyakin@samsung.com \
    --cc=e.voevodin@samsung.com \
    --cc=i.zhbanov@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.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®