Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755628AbaD1BmE (ORCPT ); Sun, 27 Apr 2014 21:42:04 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:39418 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753015AbaD1Bl6 (ORCPT ); Sun, 27 Apr 2014 21:41:58 -0400 X-AuditID: cbfee690-b7fcd6d0000026e0-c2-535db1e3184f Date: Mon, 28 Apr 2014 01:41:55 +0000 (GMT) From: MyungJoo Ham Subject: Re: [PATCH v2] PM / devfreq: Use freq_table for available_frequencies To: Saravana Kannan , =?euc-kr?Q?=B9=DA=B0=E6=B9=CE?= Cc: "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-msm@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Reply-to: myungjoo.ham@samsung.com MIME-version: 1.0 X-MTR: 20140428013700674@myungjoo.ham Msgkey: 20140428013700674@myungjoo.ham X-EPLocale: ko_KR.euc-kr X-Priority: 3 X-EPWebmail-Msg-Type: personal X-EPWebmail-Reply-Demand: 0 X-EPApproval-Locale: X-EPHeader: ML X-EPTrCode: X-EPTrName: X-MLAttribute: X-RootMTR: 20140428013700674@myungjoo.ham X-ParentMTR: X-ArchiveUser: X-CPGSPASS: N Content-type: text/plain; charset=euc-kr MIME-version: 1.0 Message-id: <4324793.197151398649314597.JavaMail.weblogic@epv6ml10> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnleLIzCtJLcpLzFFi42JZI2JSovt4Y2ywwbajxhaXd81hc2D0+LxJ LoAxissmJTUnsyy1SN8ugSvj4owljAUtMhV7pqxmbWBcIt3FyMkhJKAusWjJSTYQW0LARGJ2 Zy8zhC0mceHeeqA4F1DNUkaJxxPesMAUfb73CSoxh1Fi0pRPYN0sAqoSmz7uB+rm4GAT0JOY +TkZJCws4Ccx++91VhBbRCBfonfnTSaQXmaBPiaJlfMfsUFcoSSxZt8r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R2PkU qpVPYs3CtywwY3adWs4M03t/y1wmEJtZQFFiSvdDdghbS+LLj31s6N7iFXCW2L+mn30Co9ws JKlZSNpnIWlHVrOAkWUVo2hqQXJBcVJ6haFecWJucWleul5yfu4mRnB6erZwB+OX89aHGAU4 GJV4eCPmxAYLsSaWFVfmHmKU4GBWEuFdPhcoxJuSWFmVWpQfX1Sak1p8iDEZGIETmaVEk/OB qTOvJN7Q2NjEzMTU0sTCwNScNGElcd67N5OChATSE0tSs1NTC1KLYLYwcXBKNTAmzG/2lJ+5 5GPSnn85h21FPkiF7082m3J3+0KbKsk/yxM0jb0bdfatzjh0veaQVdjj/wcKLt+xY+XzZDoc fcZVxnjrM5GMl6Grtp+8zSPZYvPr9GlOxt7slKPuaqrO1pfm7r00x+b5xe0s6za8F9/kF7Q3 Mlfy0KE7r4yTi4Sy9xvGZyZzrpJRYinOSDTUYi4qTgQACP6KXpMDAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id s3S1gFFO019121 > 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 > --- > 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?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?