Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751801AbdHXBom (ORCPT ); Wed, 23 Aug 2017 21:44:42 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:45180 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751152AbdHXBnC (ORCPT ); Wed, 23 Aug 2017 21:43:02 -0400 X-AuditID: b6c32a47-f79db6d000003732-c4-599e2f24141c From: Chanwoo Choi To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com Cc: rafael.j.wysocki@intel.com, chanwoo@kernel.org, inki.dae@samsung.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 09/12] PM / devfreq: Show whole available frequencies Date: Thu, 24 Aug 2017 10:42:56 +0900 Message-id: <1503538979-22693-10-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1503538979-22693-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0hTYRjHe3fOzo6X6WGaviiJHIpQ2Nzm1GNoWHlZZGL0pWVhBz040W2y sw3tQ6iJ6USZkWCgM9TCRnmZU9QUSRMzUROjFEsjL2UpBpbdFNs8+u3//N/fc3t5cETk4Afg 2VoDo9fSuSTmjnYPh1Di42FWlbR1yp+qnn2DUu9+fOZTdxctKDVRvC6gZvrqMGqr8gWg5ota MGqpZUMQhyub+td4SrutHFNWOWxAuWUPSkWvMjFqhs5k9MGMNkOXma3NiiUvXE4/lx4RKZWJ ZdFUFBmspTVMLBmfnCpOzM51jkEGm+hco9NKpVmWDDsdo9cZDUywWscaYsk0mUwukUmjJHK5 XKIIv35KHuFEbjDqrs0lQV6JML+mfQQtBJPuZuCGQ0IBm55Y+Zz2g68X2jAzcMdFRA+AjqJK getBRPwCcGBdfZiws/0X5aB2APtGaw+C3wC+tNiBi8KIUDj4ZRZzaV8iFZY/tfFcEEIUAzi4 MLtf1odI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cYrSZde3ct2CWHYXsfUfPfHnq9mb+j9sN 3Fuvbozeu7Bw9meP6Y1ncz8KXn677Wm+re9x6efHZy97uHRn97f7puG7m65fSmrYcW/1kvn/ U5V/RX8/sfOJrKHfraclx9Zcl5i1k00q5OSJPvHI2bqlT8OfPfnyQqFfiaU4I9FQi7moOBEA /HhyxB8CAAA= X-CMS-MailID: 20170824014300epcas2p2642c98590f3592ba814e421c6584a7b5 X-Msg-Generator: CA X-Sender-IP: 182.195.42.143 X-Local-Sender: =?UTF-8?B?7LWc7LCs7JqwG1RpemVuIFBsYXRmb3JtIExhYihTL1fshLw=?= =?UTF-8?B?7YSwKRvsgrzshLHsoITsnpAbU2VuaW9yIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?Q2hhbndvbyBDaG9pG1RpemVuIFBsYXRmb3JtIExhYi4bU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtTZW5pb3IgRW5naW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG1RFTEUbQzEwVjgxMTE=?= CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20170824014300epcas2p2642c98590f3592ba814e421c6584a7b5 X-RootMTR: 20170824014300epcas2p2642c98590f3592ba814e421c6584a7b5 References: <1503538979-22693-1-git-send-email-cw00.choi@samsung.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1618 Lines: 48 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 whole 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 whole 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'. Signed-off-by: Chanwoo Choi --- drivers/devfreq/devfreq.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 8b0bbfa0a50b..d8ff16419452 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -1209,21 +1209,12 @@ static ssize_t available_frequencies_show(struct device *d, char *buf) { struct devfreq *df = to_devfreq(d); - struct device *dev = df->dev.parent; - struct dev_pm_opp *opp; ssize_t count = 0; - unsigned long freq = 0; - - do { - opp = dev_pm_opp_find_freq_ceil(dev, &freq); - if (IS_ERR(opp)) - break; + int i; - dev_pm_opp_put(opp); + for (i = 0; i < df->profile->max_state; i++) count += scnprintf(&buf[count], (PAGE_SIZE - count - 2), - "%lu ", freq); - freq++; - } while (1); + "%lu ", df->profile->freq_table[i]); /* Truncate the trailing space */ if (count) -- 1.9.1