aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/devfreq/devfreq.c
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2017-10-22 21:32:10 -0400
committerMyungJoo Ham <myungjoo.ham@samsung.com>2017-10-26 04:08:40 -0400
commit416b46a2627ae8de1466f90787dede6f9c5a1bfa (patch)
treeafe1701ce9bc7b57af453c924e450fbc84acf23b /drivers/devfreq/devfreq.c
parentea572f816032bef9ff2641a439a45651a20eab73 (diff)
PM / devfreq: Show the all available frequencies
The commit a76caf55e5b35 ("thermal: Add devfreq cooling") allows the devfreq device to use the cooling device. When the cooling down are required, the devfreq_cooling.c disables the OPP entry with the dev_pm_opp_disable(). In result, 'available_frequencies'[1] sysfs node never came to show the all available frequencies. [1] /sys/class/devfreq/.../available_frequencies So, this patch uses the 'freq_table' in the 'struct devfreq_dev_profile' in order to show the all available frequencies. - If 'freq_table' is NULL, devfreq core initializes them by using OPP values. - If 'freq_table' is initialized, devfreq core just uses the 'freq_table'. And this patch adds some comment about the sort way of 'freq_table'. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/devfreq/devfreq.c')
-rw-r--r--drivers/devfreq/devfreq.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index b2920cd2b78e..381f92e5e794 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -1194,22 +1194,16 @@ static ssize_t available_frequencies_show(struct device *d,
1194 char *buf) 1194 char *buf)
1195{ 1195{
1196 struct devfreq *df = to_devfreq(d); 1196 struct devfreq *df = to_devfreq(d);
1197 struct device *dev = df->dev.parent;
1198 struct dev_pm_opp *opp;
1199 ssize_t count = 0; 1197 ssize_t count = 0;
1200 unsigned long freq = 0; 1198 int i;
1201 1199
1202 do { 1200 mutex_lock(&df->lock);
1203 opp = dev_pm_opp_find_freq_ceil(dev, &freq);
1204 if (IS_ERR(opp))
1205 break;
1206 1201
1207 dev_pm_opp_put(opp); 1202 for (i = 0; i < df->profile->max_state; i++)
1208 count += scnprintf(&buf[count], (PAGE_SIZE - count - 2), 1203 count += scnprintf(&buf[count], (PAGE_SIZE - count - 2),
1209 "%lu ", freq); 1204 "%lu ", df->profile->freq_table[i]);
1210 freq++;
1211 } while (1);
1212 1205
1206 mutex_unlock(&df->lock);
1213 /* Truncate the trailing space */ 1207 /* Truncate the trailing space */
1214 if (count) 1208 if (count)
1215 count--; 1209 count--;