linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / devfreq: Use freq_table for available_frequencies
@ 2014-04-11  2:54 Saravana Kannan
  2014-04-14 20:51 ` Saravana Kannan
  0 siblings, 1 reply; 5+ messages in thread
From: Saravana Kannan @ 2014-04-11  2:54 UTC (permalink / raw)
  To: linux-arm-kernel

Some devices use freq_table instead of OPP. For those devices, the
available_frequencies file shows up empty. Fix that by using freq_table to
generate the available_frequencies data when OPP is not present.

Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
---
 drivers/devfreq/devfreq.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 2042ec3..a715d15 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -912,19 +912,26 @@ static ssize_t available_frequencies_show(struct device *d,
 	struct devfreq *df = to_devfreq(d);
 	struct device *dev = df->dev.parent;
 	struct dev_pm_opp *opp;
+	unsigned int i = 0, max_state = df->profile->max_state;
+	bool use_opp;
 	ssize_t count = 0;
 	unsigned long freq = 0;
 
 	rcu_read_lock();
+	use_opp = dev_pm_opp_get_opp_count(dev) > 0;
 	do {
-		opp = dev_pm_opp_find_freq_ceil(dev, &freq);
-		if (IS_ERR(opp))
-			break;
+		if (use_opp) {
+			opp = dev_pm_opp_find_freq_ceil(dev, &freq);
+			if (IS_ERR(opp))
+				break;
+		} else {
+			freq = df->profile->freq_table[i++];
+		}
 
 		count += scnprintf(&buf[count], (PAGE_SIZE - count - 2),
 				   "%lu ", freq);
 		freq++;
-	} while (1);
+	} while (use_opp || (!use_opp && i < max_state));
 	rcu_read_unlock();
 
 	/* Truncate the trailing space */
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply related	[flat|nested] 5+ messages in thread
[parent not found: <8568895.444151397525760132.JavaMail.weblogic@epml02>]
[parent not found: <1368716.232331397543409452.JavaMail.weblogic@epv6ml06>]

end of thread, other threads:[~2014-04-17  0:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-11  2:54 [PATCH] PM / devfreq: Use freq_table for available_frequencies Saravana Kannan
2014-04-14 20:51 ` Saravana Kannan
     [not found] <8568895.444151397525760132.JavaMail.weblogic@epml02>
2014-04-15  5:16 ` Saravana Kannan
     [not found] <1368716.232331397543409452.JavaMail.weblogic@epv6ml06>
2014-04-15 18:41 ` Saravana Kannan
2014-04-17  0:12   ` Saravana Kannan

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