diff options
author | Rajagopal Venkat <rajagopal.venkat@linaro.org> | 2012-10-25 19:50:26 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-14 18:35:04 -0500 |
commit | 7f98a905dca6e4f144cdd4462edeac00c2bdc379 (patch) | |
tree | 4841af3592cbd0b21f50a40f17900dfc9fc40804 /drivers/devfreq/devfreq.c | |
parent | 206c30cfeb7c05dfb9fdfd81b1deb933627e43c1 (diff) |
PM / devfreq: Add current freq callback in device profile
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>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/devfreq/devfreq.c')
-rw-r--r-- | drivers/devfreq/devfreq.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 999600da21c7..f2f8a976c465 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c | |||
@@ -464,6 +464,19 @@ static ssize_t show_governor(struct device *dev, | |||
464 | static ssize_t show_freq(struct device *dev, | 464 | static ssize_t show_freq(struct device *dev, |
465 | struct device_attribute *attr, char *buf) | 465 | struct device_attribute *attr, char *buf) |
466 | { | 466 | { |
467 | unsigned long freq; | ||
468 | struct devfreq *devfreq = to_devfreq(dev); | ||
469 | |||
470 | if (devfreq->profile->get_cur_freq && | ||
471 | !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq)) | ||
472 | return sprintf(buf, "%lu\n", freq); | ||
473 | |||
474 | return sprintf(buf, "%lu\n", devfreq->previous_freq); | ||
475 | } | ||
476 | |||
477 | static ssize_t show_target_freq(struct device *dev, | ||
478 | struct device_attribute *attr, char *buf) | ||
479 | { | ||
467 | return sprintf(buf, "%lu\n", to_devfreq(dev)->previous_freq); | 480 | return sprintf(buf, "%lu\n", to_devfreq(dev)->previous_freq); |
468 | } | 481 | } |
469 | 482 | ||
@@ -563,6 +576,7 @@ static ssize_t show_max_freq(struct device *dev, struct device_attribute *attr, | |||
563 | static struct device_attribute devfreq_attrs[] = { | 576 | static struct device_attribute devfreq_attrs[] = { |
564 | __ATTR(governor, S_IRUGO, show_governor, NULL), | 577 | __ATTR(governor, S_IRUGO, show_governor, NULL), |
565 | __ATTR(cur_freq, S_IRUGO, show_freq, NULL), | 578 | __ATTR(cur_freq, S_IRUGO, show_freq, NULL), |
579 | __ATTR(target_freq, S_IRUGO, show_target_freq, NULL), | ||
566 | __ATTR(polling_interval, S_IRUGO | S_IWUSR, show_polling_interval, | 580 | __ATTR(polling_interval, S_IRUGO | S_IWUSR, show_polling_interval, |
567 | store_polling_interval), | 581 | store_polling_interval), |
568 | __ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq), | 582 | __ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq), |