linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [for-next PATCH V2] PM / devfreq: Add sysfs node to expose available frequencies
@ 2012-10-26  6:16 MyungJoo Ham
  2012-10-31  0:45 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: MyungJoo Ham @ 2012-10-26  6:16 UTC (permalink / raw)
  To: Nishanth Menon, linux-pm
  Cc: Rajagopal Venkat, 박경민,
	Rafael J. Wysocki, Kevin Hilman, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 1031 bytes --]

> devfreq governors such as ondemand are controlled by a min and
> max frequency, while governors like userspace governor allow us
> to set a specific frequency.
> However, for the same specific device, depending on the SoC, the
> available frequencies can vary.
> 
> So expose the available frequencies as a snapshot over sysfs to
> allow informed decisions.
> 
> This was inspired by cpufreq framework's equivalent for similar
> usage sysfs node: scaling_available_frequencies.
> 
> Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> 
> Signed-off-by: Nishanth Menon <nm@ti.com>

Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [for-next PATCH V2] PM / devfreq: Add sysfs node to expose available frequencies
  2012-10-26  6:16 [for-next PATCH V2] PM / devfreq: Add sysfs node to expose available frequencies MyungJoo Ham
@ 2012-10-31  0:45 ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2012-10-31  0:45 UTC (permalink / raw)
  To: myungjoo.ham
  Cc: Nishanth Menon, linux-pm, Rajagopal Venkat,
	박경민,
	Kevin Hilman, linux-kernel

On Friday, October 26, 2012 06:16:36 AM MyungJoo Ham wrote:
> > devfreq governors such as ondemand are controlled by a min and
> > max frequency, while governors like userspace governor allow us
> > to set a specific frequency.
> > However, for the same specific device, depending on the SoC, the
> > available frequencies can vary.
> > 
> > So expose the available frequencies as a snapshot over sysfs to
> > allow informed decisions.
> > 
> > This was inspired by cpufreq framework's equivalent for similar
> > usage sysfs node: scaling_available_frequencies.
> > 
> > Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
> > Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> > Cc: Kyungmin Park <kyungmin.park@samsung.com>
> > Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> > Cc: Kevin Hilman <khilman@ti.com>
> > Cc: linux-pm@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > 
> > Signed-off-by: Nishanth Menon <nm@ti.com>
> 
> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>

Are you going to handle this patch?

Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* Re: [for-next PATCH V2] PM / devfreq: Add sysfs node to expose available frequencies
  2012-10-31  2:11 MyungJoo Ham
@ 2012-10-31  9:15 ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2012-10-31  9:15 UTC (permalink / raw)
  To: myungjoo.ham
  Cc: Nishanth Menon, linux-pm, Rajagopal Venkat,
	박경민,
	Kevin Hilman, linux-kernel

On Wednesday, October 31, 2012 02:11:06 AM MyungJoo Ham wrote:
> > On Friday, October 26, 2012 06:16:36 AM MyungJoo Ham wrote:
> > > > devfreq governors such as ondemand are controlled by a min and
> > > > max frequency, while governors like userspace governor allow us
> > > > to set a specific frequency.
> > > > However, for the same specific device, depending on the SoC, the
> > > > available frequencies can vary.
> > > > 
> > > > So expose the available frequencies as a snapshot over sysfs to
> > > > allow informed decisions.
> > > > 
> > > > This was inspired by cpufreq framework's equivalent for similar
> > > > usage sysfs node: scaling_available_frequencies.
> > > > 
> > > > Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
> > > > Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> > > > Cc: Kyungmin Park <kyungmin.park@samsung.com>
> > > > Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> > > > Cc: Kevin Hilman <khilman@ti.com>
> > > > Cc: linux-pm@vger.kernel.org
> > > > Cc: linux-kernel@vger.kernel.org
> > > > 
> > > > Signed-off-by: Nishanth Menon <nm@ti.com>
> > > 
> > > Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
> > 
> > Are you going to handle this patch?
> 
> Yes, I've just setup the git repository this week
> and I'm willing to handle this one.
> 
> It is applied at
> http://git.kernel.org/?p=linux/kernel/git/mzx/devfreq.git;a=shortlog;h=refs/heads/for-rafael

OK

Please let me know when you want me to pull from your tree.

Please also note that the release of v3.7-rc6 is the deadline for non-bugfix
changes targeted at v3.8. :-)

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* [for-next PATCH V2] PM / devfreq: Add sysfs node to expose available frequencies
       [not found] <[for-next PATCH] PM / devfreq: Add sysfs node to expose available frequencies>
@ 2012-10-26  0:48 ` Nishanth Menon
  0 siblings, 0 replies; 4+ messages in thread
From: Nishanth Menon @ 2012-10-26  0:48 UTC (permalink / raw)
  To: linux-pm
  Cc: Nishanth Menon, Rajagopal Venkat, MyungJoo Ham, Kyungmin Park,
	Rafael J. Wysocki, Kevin Hilman, linux-kernel

devfreq governors such as ondemand are controlled by a min and
max frequency, while governors like userspace governor allow us
to set a specific frequency.
However, for the same specific device, depending on the SoC, the
available frequencies can vary.

So expose the available frequencies as a snapshot over sysfs to
allow informed decisions.

This was inspired by cpufreq framework's equivalent for similar
usage sysfs node: scaling_available_frequencies.

Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Kevin Hilman <khilman@ti.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Signed-off-by: Nishanth Menon <nm@ti.com>
---
Applies on top of Rafael's linux-next branch:
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
linux-next                b960e9a Merge branch 'pm-sleep-next' into linux-next

Example output from Beagleboard XM (3730) using a dummy test driver
http://pastebin.pandaboard.org/index.php/view/85100576 :

/sys/devices/platform/iva.0/devfreq/iva.0 # cat available_frequencies 
260000000 520000000 660000000
/sys/devices/platform/iva.0/devfreq/iva.0 # cat available_frequencies|tr ' ' '-'
260000000-520000000-660000000

V2 :
	- review comment update from v1
	- protected the sysfs from buffer overflow - just in case..
V1: https://patchwork.kernel.org/patch/1648001/

 Documentation/ABI/testing/sysfs-class-devfreq |    9 +++++++
 drivers/devfreq/devfreq.c                     |   32 +++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-class-devfreq b/Documentation/ABI/testing/sysfs-class-devfreq
index e6cf08e..e672ccb 100644
--- a/Documentation/ABI/testing/sysfs-class-devfreq
+++ b/Documentation/ABI/testing/sysfs-class-devfreq
@@ -51,3 +51,12 @@ Description:
 		The /sys/class/devfreq/.../userspace/set_freq shows and
 		sets the requested frequency for the devfreq object if
 		userspace governor is in effect.
+
+What:		/sys/class/devfreq/.../available_frequencies
+Date:		October 2012
+Contact:	Nishanth Menon <nm@ti.com>
+Description:
+		The /sys/class/devfreq/.../available_frequencies shows
+		the available frequencies of the corresponding devfreq object.
+		This is a snapshot of available frequencies and not limited
+		by the min/max frequency restrictions.
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index d02ee7e..104018e 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -571,9 +571,41 @@ static ssize_t show_max_freq(struct device *dev, struct device_attribute *attr,
 	return sprintf(buf, "%lu\n", to_devfreq(dev)->max_freq);
 }
 
+static ssize_t show_available_freqs(struct device *d,
+				    struct device_attribute *attr,
+				    char *buf)
+{
+	struct devfreq *df = to_devfreq(d);
+	struct device *dev = df->dev.parent;
+	struct opp *opp;
+	ssize_t count = 0;
+	unsigned long freq = 0;
+
+	rcu_read_lock();
+	do {
+		opp = opp_find_freq_ceil(dev, &freq);
+		if (IS_ERR(opp))
+			break;
+
+		count += scnprintf(&buf[count], (PAGE_SIZE - count - 2),
+				   "%lu ", freq);
+		freq++;
+	} while (1);
+	rcu_read_unlock();
+
+	/* Truncate the trailing space */
+	if (count)
+		count--;
+
+	count += sprintf(&buf[count], "\n");
+
+	return count;
+}
+
 static struct device_attribute devfreq_attrs[] = {
 	__ATTR(governor, S_IRUGO, show_governor, NULL),
 	__ATTR(cur_freq, S_IRUGO, show_freq, NULL),
+	__ATTR(available_frequencies, S_IRUGO, show_available_freqs, NULL),
 	__ATTR(target_freq, S_IRUGO, show_target_freq, NULL),
 	__ATTR(polling_interval, S_IRUGO | S_IWUSR, show_polling_interval,
 	       store_polling_interval),
-- 
1.7.9.5


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

end of thread, other threads:[~2012-10-31  9:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-26  6:16 [for-next PATCH V2] PM / devfreq: Add sysfs node to expose available frequencies MyungJoo Ham
2012-10-31  0:45 ` Rafael J. Wysocki
  -- strict thread matches above, loose matches on Subject: below --
2012-10-31  2:11 MyungJoo Ham
2012-10-31  9:15 ` Rafael J. Wysocki
     [not found] <[for-next PATCH] PM / devfreq: Add sysfs node to expose available frequencies>
2012-10-26  0:48 ` Nishanth Menon

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).