diff options
author | Nishanth Menon <nm@ti.com> | 2012-10-29 16:01:48 -0400 |
---|---|---|
committer | MyungJoo Ham <myungjoo.ham@samsung.com> | 2012-11-20 04:46:24 -0500 |
commit | 50a5b33e0159f8783ef617cdb9d5fbb6a3955b6f (patch) | |
tree | 0063869677d9da4bc78e4b32de852767e4cd15f0 /drivers/devfreq | |
parent | 0359d1afe4013d1a216908b6be4c6695a1db6fd6 (diff) |
PM / devfreq: Add sysfs node to expose available governors
Now that governor list can be variable, knowing the available governors
is useful to be able to select a governor using relevant sysfs node.
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>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r-- | drivers/devfreq/devfreq.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index ff960f084c11..45e053e5b139 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c | |||
@@ -730,6 +730,27 @@ out: | |||
730 | ret = count; | 730 | ret = count; |
731 | return ret; | 731 | return ret; |
732 | } | 732 | } |
733 | static ssize_t show_available_governors(struct device *d, | ||
734 | struct device_attribute *attr, | ||
735 | char *buf) | ||
736 | { | ||
737 | struct devfreq_governor *tmp_governor; | ||
738 | ssize_t count = 0; | ||
739 | |||
740 | mutex_lock(&devfreq_list_lock); | ||
741 | list_for_each_entry(tmp_governor, &devfreq_governor_list, node) | ||
742 | count += scnprintf(&buf[count], (PAGE_SIZE - count - 2), | ||
743 | "%s ", tmp_governor->name); | ||
744 | mutex_unlock(&devfreq_list_lock); | ||
745 | |||
746 | /* Truncate the trailing space */ | ||
747 | if (count) | ||
748 | count--; | ||
749 | |||
750 | count += sprintf(&buf[count], "\n"); | ||
751 | |||
752 | return count; | ||
753 | } | ||
733 | 754 | ||
734 | static ssize_t show_freq(struct device *dev, | 755 | static ssize_t show_freq(struct device *dev, |
735 | struct device_attribute *attr, char *buf) | 756 | struct device_attribute *attr, char *buf) |
@@ -917,6 +938,7 @@ static ssize_t show_trans_table(struct device *dev, struct device_attribute *att | |||
917 | 938 | ||
918 | static struct device_attribute devfreq_attrs[] = { | 939 | static struct device_attribute devfreq_attrs[] = { |
919 | __ATTR(governor, S_IRUGO | S_IWUSR, show_governor, store_governor), | 940 | __ATTR(governor, S_IRUGO | S_IWUSR, show_governor, store_governor), |
941 | __ATTR(available_governors, S_IRUGO, show_available_governors, NULL), | ||
920 | __ATTR(cur_freq, S_IRUGO, show_freq, NULL), | 942 | __ATTR(cur_freq, S_IRUGO, show_freq, NULL), |
921 | __ATTR(available_frequencies, S_IRUGO, show_available_freqs, NULL), | 943 | __ATTR(available_frequencies, S_IRUGO, show_available_freqs, NULL), |
922 | __ATTR(target_freq, S_IRUGO, show_target_freq, NULL), | 944 | __ATTR(target_freq, S_IRUGO, show_target_freq, NULL), |