* Re: [PATCH v2 3/3] devfreq: Add current freq callback in device profile
@ 2012-09-17 10:34 MyungJoo Ham
2012-09-17 20:04 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: MyungJoo Ham @ 2012-09-17 10:34 UTC (permalink / raw)
To: Rajagopal Venkat, mturquette@linaro.org, 박경민,
rjw@sisk.pl
Cc: patches@linaro.org, linaro-dev@lists.linaro.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 4247 bytes --]
> From: Rajagopal Venkat <rajagopal.venkat@linaro.org>
>
> Devfreq returns governor predicted frequency as current frequency
> via sysfs interface. But device may not support all frequencies
> that governor predicts. So add a callback in device profile to get
> current freq from driver. Also add a new sysfs node to expose
> governor predicted next target frequency.
>
> Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
> ---
> Documentation/ABI/testing/sysfs-class-devfreq | 11 ++++++++++-
> drivers/devfreq/devfreq.c | 14 ++++++++++++++
> include/linux/devfreq.h | 3 +++
> 3 files changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-class-devfreq b/Documentation/ABI/testing/sysfs-class-devfreq
> index 89283b1..e6cf08e 100644
> --- a/Documentation/ABI/testing/sysfs-class-devfreq
> +++ b/Documentation/ABI/testing/sysfs-class-devfreq
> @@ -19,7 +19,16 @@ Date: September 2011
> Contact: MyungJoo Ham <myungjoo.ham@samsung.com>
> Description:
> The /sys/class/devfreq/.../cur_freq shows the current
> - frequency of the corresponding devfreq object.
> + frequency of the corresponding devfreq object. Same as
> + target_freq when get_cur_freq() is not implemented by
> + devfreq driver.
> +
> +What: /sys/class/devfreq/.../target_freq
> +Date: September 2012
> +Contact: Rajagopal Venkat <rajagopal.venkat@linaro.org>
> +Description:
> + The /sys/class/devfreq/.../target_freq shows the next governor
> + predicted target frequency of the corresponding devfreq object.
>
> What: /sys/class/devfreq/.../polling_interval
> Date: September 2011
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 309c46e..049e273 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -401,6 +401,19 @@ static ssize_t show_governor(struct device *dev,
> static ssize_t show_freq(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> + unsigned long freq;
> + struct devfreq *devfreq = to_devfreq(dev);
> +
> + if (devfreq->profile->get_cur_freq &&
> + !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq))
> + return sprintf(buf, "%lu\n", freq);
> +
> + return sprintf(buf, "%lu\n", devfreq->previous_freq);
> +}
> +
> +static ssize_t show_target_freq(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> return sprintf(buf, "%lu\n", to_devfreq(dev)->previous_freq);
> }
>
> @@ -504,6 +517,7 @@ static ssize_t show_max_freq(struct device *dev, struct device_attribute *attr,
> static struct device_attribute devfreq_attrs[] = {
> __ATTR(governor, S_IRUGO, show_governor, NULL),
> __ATTR(cur_freq, S_IRUGO, show_freq, NULL),
> + __ATTR(target_freq, S_IRUGO, show_target_freq, NULL),
> __ATTR(polling_interval, S_IRUGO | S_IWUSR, show_polling_interval,
> store_polling_interval),
> __ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq),
> diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
> index 7c7e179..d12ed41 100644
> --- a/include/linux/devfreq.h
> +++ b/include/linux/devfreq.h
> @@ -66,6 +66,8 @@ struct devfreq_dev_status {
> * explained above with "DEVFREQ_FLAG_*" macros.
> * @get_dev_status The device should provide the current performance
> * status to devfreq, which is used by governors.
> + * @get_cur_freq The device should provide the current frequency
> + * at which it is operating.
> * @exit An optional callback that is called when devfreq
> * is removing the devfreq object due to error or
> * from devfreq_remove_device() call. If the user
> @@ -79,6 +81,7 @@ struct devfreq_dev_profile {
> int (*target)(struct device *dev, unsigned long *freq, u32 flags);
> int (*get_dev_status)(struct device *dev,
> struct devfreq_dev_status *stat);
> + int (*get_cur_freq)(struct device *dev, unsigned long *freq);
> void (*exit)(struct device *dev);
> };
>
> --
> 1.7.11.3
>
>
>
>
>
>
>
>
ÿôèº{.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] 3+ messages in thread* Re: [PATCH v2 3/3] devfreq: Add current freq callback in device profile
2012-09-17 10:34 [PATCH v2 3/3] devfreq: Add current freq callback in device profile MyungJoo Ham
@ 2012-09-17 20:04 ` Rafael J. Wysocki
0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2012-09-17 20:04 UTC (permalink / raw)
To: myungjoo.ham
Cc: Rajagopal Venkat, mturquette@linaro.org, 박경민,
patches@linaro.org, linaro-dev@lists.linaro.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
On Monday, September 17, 2012, MyungJoo Ham wrote:
> > From: Rajagopal Venkat <rajagopal.venkat@linaro.org>
> >
> > Devfreq returns governor predicted frequency as current frequency
> > via sysfs interface. But device may not support all frequencies
> > that governor predicts. So add a callback in device profile to get
> > current freq from driver. Also add a new sysfs node to expose
> > governor predicted next target frequency.
> >
> > Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org>
>
> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
OK, I'm taking this as an acked-by (signed-off-by would be appropriate if
the patch went through your hands).
Does it apply to [3/3] only or to all of the patches in the series?
Rafael
> > ---
> > Documentation/ABI/testing/sysfs-class-devfreq | 11 ++++++++++-
> > drivers/devfreq/devfreq.c | 14 ++++++++++++++
> > include/linux/devfreq.h | 3 +++
> > 3 files changed, 27 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/ABI/testing/sysfs-class-devfreq b/Documentation/ABI/testing/sysfs-class-devfreq
> > index 89283b1..e6cf08e 100644
> > --- a/Documentation/ABI/testing/sysfs-class-devfreq
> > +++ b/Documentation/ABI/testing/sysfs-class-devfreq
> > @@ -19,7 +19,16 @@ Date: September 2011
> > Contact: MyungJoo Ham <myungjoo.ham@samsung.com>
> > Description:
> > The /sys/class/devfreq/.../cur_freq shows the current
> > - frequency of the corresponding devfreq object.
> > + frequency of the corresponding devfreq object. Same as
> > + target_freq when get_cur_freq() is not implemented by
> > + devfreq driver.
> > +
> > +What: /sys/class/devfreq/.../target_freq
> > +Date: September 2012
> > +Contact: Rajagopal Venkat <rajagopal.venkat@linaro.org>
> > +Description:
> > + The /sys/class/devfreq/.../target_freq shows the next governor
> > + predicted target frequency of the corresponding devfreq object.
> >
> > What: /sys/class/devfreq/.../polling_interval
> > Date: September 2011
> > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> > index 309c46e..049e273 100644
> > --- a/drivers/devfreq/devfreq.c
> > +++ b/drivers/devfreq/devfreq.c
> > @@ -401,6 +401,19 @@ static ssize_t show_governor(struct device *dev,
> > static ssize_t show_freq(struct device *dev,
> > struct device_attribute *attr, char *buf)
> > {
> > + unsigned long freq;
> > + struct devfreq *devfreq = to_devfreq(dev);
> > +
> > + if (devfreq->profile->get_cur_freq &&
> > + !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq))
> > + return sprintf(buf, "%lu\n", freq);
> > +
> > + return sprintf(buf, "%lu\n", devfreq->previous_freq);
> > +}
> > +
> > +static ssize_t show_target_freq(struct device *dev,
> > + struct device_attribute *attr, char *buf)
> > +{
> > return sprintf(buf, "%lu\n", to_devfreq(dev)->previous_freq);
> > }
> >
> > @@ -504,6 +517,7 @@ static ssize_t show_max_freq(struct device *dev, struct device_attribute *attr,
> > static struct device_attribute devfreq_attrs[] = {
> > __ATTR(governor, S_IRUGO, show_governor, NULL),
> > __ATTR(cur_freq, S_IRUGO, show_freq, NULL),
> > + __ATTR(target_freq, S_IRUGO, show_target_freq, NULL),
> > __ATTR(polling_interval, S_IRUGO | S_IWUSR, show_polling_interval,
> > store_polling_interval),
> > __ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq),
> > diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
> > index 7c7e179..d12ed41 100644
> > --- a/include/linux/devfreq.h
> > +++ b/include/linux/devfreq.h
> > @@ -66,6 +66,8 @@ struct devfreq_dev_status {
> > * explained above with "DEVFREQ_FLAG_*" macros.
> > * @get_dev_status The device should provide the current performance
> > * status to devfreq, which is used by governors.
> > + * @get_cur_freq The device should provide the current frequency
> > + * at which it is operating.
> > * @exit An optional callback that is called when devfreq
> > * is removing the devfreq object due to error or
> > * from devfreq_remove_device() call. If the user
> > @@ -79,6 +81,7 @@ struct devfreq_dev_profile {
> > int (*target)(struct device *dev, unsigned long *freq, u32 flags);
> > int (*get_dev_status)(struct device *dev,
> > struct devfreq_dev_status *stat);
> > + int (*get_cur_freq)(struct device *dev, unsigned long *freq);
> > void (*exit)(struct device *dev);
> > };
> >
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 0/3] devfreq: Add support for devices which can idle
@ 2012-09-13 13:55 Rajagopal Venkat
2012-09-13 13:55 ` [PATCH v2 3/3] devfreq: Add current freq callback in device profile Rajagopal Venkat
0 siblings, 1 reply; 3+ messages in thread
From: Rajagopal Venkat @ 2012-09-13 13:55 UTC (permalink / raw)
To: mturquette, myungjoo.ham, kyungmin.park, rjw
Cc: patches, linaro-dev, linux-pm, linux-kernel, Rajagopal Venkat
From: Rajagopal Venkat <rajagopal.venkat@linaro.org>
This patchset updates devfreq core to add support for devices
which can idle. When device idleness is detected perhaps
through runtime-pm, need some mechanism to suspend devfreq
load monitoring and resume when device is back online.
patch 1 introduce core design changes - per device work, decouple
delayed work from core and event based interaction.
patch 2 add devfreq suspend and resume apis.
patch 3 add new sysfs attribute for governor predicted next target
frequency and callback for current device frequency.
The existing devfreq apis are kept intact. Two new apis
devfreq_suspend_device() and devfreq_resume_device() are
added to support suspend/resume of device devfreq.
Changes since v1:
- revised locking mechanism
- added kerneldoc comments for load monitoring helper functions
- Fixed minor review comments
--
Rajagopal Venkat (3):
devfreq: Core updates to support devices which can idle
devfreq: Add suspend and resume apis
devfreq: Add current freq callback in device profile
Documentation/ABI/testing/sysfs-class-devfreq | 15 +-
drivers/devfreq/devfreq.c | 413 +++++++++++---------------
drivers/devfreq/governor.h | 11 +
drivers/devfreq/governor_performance.c | 16 +-
drivers/devfreq/governor_powersave.c | 16 +-
drivers/devfreq/governor_simpleondemand.c | 40 +++
drivers/devfreq/governor_userspace.c | 23 +-
include/linux/devfreq.h | 46 ++-
8 files changed, 291 insertions(+), 289 deletions(-)
--
1.7.11.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 3/3] devfreq: Add current freq callback in device profile
2012-09-13 13:55 [PATCH v2 0/3] devfreq: Add support for devices which can idle Rajagopal Venkat
@ 2012-09-13 13:55 ` Rajagopal Venkat
0 siblings, 0 replies; 3+ messages in thread
From: Rajagopal Venkat @ 2012-09-13 13:55 UTC (permalink / raw)
To: mturquette, myungjoo.ham, kyungmin.park, rjw
Cc: patches, linaro-dev, linux-pm, linux-kernel, Rajagopal Venkat
From: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Devfreq returns governor predicted frequency as current frequency
via sysfs interface. But device may not support all frequencies
that governor predicts. So add a callback in device profile to get
current freq from driver. Also add a new sysfs node to expose
governor predicted next target frequency.
Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org>
---
Documentation/ABI/testing/sysfs-class-devfreq | 11 ++++++++++-
drivers/devfreq/devfreq.c | 14 ++++++++++++++
include/linux/devfreq.h | 3 +++
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/Documentation/ABI/testing/sysfs-class-devfreq b/Documentation/ABI/testing/sysfs-class-devfreq
index 89283b1..e6cf08e 100644
--- a/Documentation/ABI/testing/sysfs-class-devfreq
+++ b/Documentation/ABI/testing/sysfs-class-devfreq
@@ -19,7 +19,16 @@ Date: September 2011
Contact: MyungJoo Ham <myungjoo.ham@samsung.com>
Description:
The /sys/class/devfreq/.../cur_freq shows the current
- frequency of the corresponding devfreq object.
+ frequency of the corresponding devfreq object. Same as
+ target_freq when get_cur_freq() is not implemented by
+ devfreq driver.
+
+What: /sys/class/devfreq/.../target_freq
+Date: September 2012
+Contact: Rajagopal Venkat <rajagopal.venkat@linaro.org>
+Description:
+ The /sys/class/devfreq/.../target_freq shows the next governor
+ predicted target frequency of the corresponding devfreq object.
What: /sys/class/devfreq/.../polling_interval
Date: September 2011
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 309c46e..049e273 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -401,6 +401,19 @@ static ssize_t show_governor(struct device *dev,
static ssize_t show_freq(struct device *dev,
struct device_attribute *attr, char *buf)
{
+ unsigned long freq;
+ struct devfreq *devfreq = to_devfreq(dev);
+
+ if (devfreq->profile->get_cur_freq &&
+ !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq))
+ return sprintf(buf, "%lu\n", freq);
+
+ return sprintf(buf, "%lu\n", devfreq->previous_freq);
+}
+
+static ssize_t show_target_freq(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
return sprintf(buf, "%lu\n", to_devfreq(dev)->previous_freq);
}
@@ -504,6 +517,7 @@ static ssize_t show_max_freq(struct device *dev, struct device_attribute *attr,
static struct device_attribute devfreq_attrs[] = {
__ATTR(governor, S_IRUGO, show_governor, NULL),
__ATTR(cur_freq, S_IRUGO, show_freq, NULL),
+ __ATTR(target_freq, S_IRUGO, show_target_freq, NULL),
__ATTR(polling_interval, S_IRUGO | S_IWUSR, show_polling_interval,
store_polling_interval),
__ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq),
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index 7c7e179..d12ed41 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -66,6 +66,8 @@ struct devfreq_dev_status {
* explained above with "DEVFREQ_FLAG_*" macros.
* @get_dev_status The device should provide the current performance
* status to devfreq, which is used by governors.
+ * @get_cur_freq The device should provide the current frequency
+ * at which it is operating.
* @exit An optional callback that is called when devfreq
* is removing the devfreq object due to error or
* from devfreq_remove_device() call. If the user
@@ -79,6 +81,7 @@ struct devfreq_dev_profile {
int (*target)(struct device *dev, unsigned long *freq, u32 flags);
int (*get_dev_status)(struct device *dev,
struct devfreq_dev_status *stat);
+ int (*get_cur_freq)(struct device *dev, unsigned long *freq);
void (*exit)(struct device *dev);
};
--
1.7.11.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-17 19:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-17 10:34 [PATCH v2 3/3] devfreq: Add current freq callback in device profile MyungJoo Ham
2012-09-17 20:04 ` Rafael J. Wysocki
-- strict thread matches above, loose matches on Subject: below --
2012-09-13 13:55 [PATCH v2 0/3] devfreq: Add support for devices which can idle Rajagopal Venkat
2012-09-13 13:55 ` [PATCH v2 3/3] devfreq: Add current freq callback in device profile Rajagopal Venkat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox