From: MyungJoo Ham <myungjoo.ham@samsung.com> To: "Saravana Kannan" <skannan@codeaurora.org>, 박경민 <kyungmin.park@samsung.com> Cc: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org> Subject: Re: [PATCH v2] PM / devfreq: Use freq_table for available_frequencies Date: Mon, 28 Apr 2014 01:41:55 +0000 (GMT) [thread overview] Message-ID: <4324793.197151398649314597.JavaMail.weblogic@epv6ml10> (raw) > 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 it's available. > > OPP find frequency APIs also skips frequencies that have been temporarily > disabled (say, due to thermal, etc). Since available_frequencies is > supposed to show the entire list of available frequencies without taking > temporary limits into consideration, preference is given to freq_table when > available. > > Signed-off-by: Saravana Kannan <skannan@codeaurora.org> > --- > drivers/devfreq/devfreq.c | 29 ++++++++++++++++++----------- > 1 file changed, 18 insertions(+), 11 deletions(-) > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > index 2042ec3..527cbe2 100644 > --- a/drivers/devfreq/devfreq.c > +++ b/drivers/devfreq/devfreq.c > @@ -912,20 +912,27 @@ 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; > ssize_t count = 0; > unsigned long freq = 0; > > - rcu_read_lock(); > - do { > - opp = dev_pm_opp_find_freq_ceil(dev, &freq); > - if (IS_ERR(opp)) > - break; > - > - count += scnprintf(&buf[count], (PAGE_SIZE - count - 2), > - "%lu ", freq); > - freq++; > - } while (1); > - rcu_read_unlock(); > + if (df->profile->freq_table) { > + for (i = 0; i < df->profile->max_state; i++) > + count += scnprintf(&buf[count], (PAGE_SIZE - count - 2), > + "%u ", df->profile->freq_table[i]); You are hereby changing the semmantics of the original available_frequencies node. When a frequency/voltage pair has been disabled (opp_disable), probably by opp_disable(), the frequency is no more "available". However, when the driver author supplied freq_table as well as OPP in order to see the statistics, the node will behave differently. Please do not affect the current users as long as it does not give additional benefit or fix a bug. Cheers, MyungJoo. > + } else { > + rcu_read_lock(); > + do { > + opp = dev_pm_opp_find_freq_ceil(dev, &freq); > + if (IS_ERR(opp)) > + break; > + > + count += scnprintf(&buf[count], (PAGE_SIZE - count - 2), > + "%lu ", freq); > + freq++; > + } while (1); > + rcu_read_unlock(); > + } > > /* Truncate the trailing space */ > if (count) > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > hosted by The Linux Foundation >
WARNING: multiple messages have this Message-ID (diff)
From: MyungJoo Ham <myungjoo.ham@samsung.com> To: "Saravana Kannan" <skannan@codeaurora.org>, 박경민 <kyungmin.park@samsung.com> Cc: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org> Subject: Re: [PATCH v2] PM / devfreq: Use freq_table for available_frequencies Date: Mon, 28 Apr 2014 01:41:55 +0000 (GMT) [thread overview] Message-ID: <4324793.197151398649314597.JavaMail.weblogic@epv6ml10> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 2699 bytes --] > 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 it's available. > > OPP find frequency APIs also skips frequencies that have been temporarily > disabled (say, due to thermal, etc). Since available_frequencies is > supposed to show the entire list of available frequencies without taking > temporary limits into consideration, preference is given to freq_table when > available. > > Signed-off-by: Saravana Kannan <skannan@codeaurora.org> > --- > drivers/devfreq/devfreq.c | 29 ++++++++++++++++++----------- > 1 file changed, 18 insertions(+), 11 deletions(-) > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > index 2042ec3..527cbe2 100644 > --- a/drivers/devfreq/devfreq.c > +++ b/drivers/devfreq/devfreq.c > @@ -912,20 +912,27 @@ 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; > ssize_t count = 0; > unsigned long freq = 0; > > - rcu_read_lock(); > - do { > - opp = dev_pm_opp_find_freq_ceil(dev, &freq); > - if (IS_ERR(opp)) > - break; > - > - count += scnprintf(&buf[count], (PAGE_SIZE - count - 2), > - "%lu ", freq); > - freq++; > - } while (1); > - rcu_read_unlock(); > + if (df->profile->freq_table) { > + for (i = 0; i < df->profile->max_state; i++) > + count += scnprintf(&buf[count], (PAGE_SIZE - count - 2), > + "%u ", df->profile->freq_table[i]); You are hereby changing the semmantics of the original available_frequencies node. When a frequency/voltage pair has been disabled (opp_disable), probably by opp_disable(), the frequency is no more "available". However, when the driver author supplied freq_table as well as OPP in order to see the statistics, the node will behave differently. Please do not affect the current users as long as it does not give additional benefit or fix a bug. Cheers, MyungJoo. > + } else { > + rcu_read_lock(); > + do { > + opp = dev_pm_opp_find_freq_ceil(dev, &freq); > + if (IS_ERR(opp)) > + break; > + > + count += scnprintf(&buf[count], (PAGE_SIZE - count - 2), > + "%lu ", freq); > + freq++; > + } while (1); > + rcu_read_unlock(); > + } > > /* Truncate the trailing space */ > if (count) > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > hosted by The Linux Foundation > ÿôèº{.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¥
next reply other threads:[~2014-04-28 1:41 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-04-28 1:41 MyungJoo Ham [this message] 2014-04-28 1:41 ` [PATCH v2] PM / devfreq: Use freq_table for available_frequencies MyungJoo Ham 2014-04-29 20:00 ` Saravana Kannan 2014-04-29 20:00 ` Saravana Kannan 2014-05-05 18:18 ` Saravana Kannan 2014-05-05 18:18 ` Saravana Kannan -- strict thread matches above, loose matches on Subject: below -- 2014-05-08 10:02 MyungJoo Ham 2014-05-19 23:01 ` Saravana Kannan 2014-05-19 23:01 ` Saravana Kannan 2014-04-15 6:30 Re: [PATCH] " 함명주 2014-04-15 19:29 ` [PATCH v2] " Saravana Kannan 2014-04-15 19:29 ` Saravana Kannan
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=4324793.197151398649314597.JavaMail.weblogic@epv6ml10 \ --to=myungjoo.ham@samsung.com \ --cc=kyungmin.park@samsung.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pm@vger.kernel.org \ --cc=skannan@codeaurora.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.