From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932253AbdJWBcV (ORCPT ); Sun, 22 Oct 2017 21:32:21 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:22951 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932173AbdJWBcS (ORCPT ); Sun, 22 Oct 2017 21:32:18 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20171023013216epoutp0383221df80d55d4642d64caff604a763a~wDvi-B5yS1352713527epoutp03Z X-AuditID: b6c32a48-8edff7000000103e-be-59ed469f057d 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 v5 5/7] PM / devfreq: Show the all available frequencies Date: Mon, 23 Oct 2017 10:32:10 +0900 Message-id: <1508722332-10628-6-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1508722332-10628-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrFKsWRmVeSWpSXmKPExsWy7bCmqe4Ct7eRBpfuc1pMvHGFxeL6l+es FpPuT2CxONv0ht3i8q45bBafe48wWtxuXMFm8XjFW3YHDo/Fe14yeWxa1cnm0bdlFaPH501y ASxRqTYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkouPgG6bpk5QGco KZQl5pQChQISi4uV9O1sivJLS1IVMvKLS2yVog0NjfQMDcz1jIyM9EyMY62MTIFKElIzXp99 zVqwXqSis+UaYwPjZYEuRk4OCQETifnz/7N1MXJxCAnsYJS42jyXGcL5zigxd/5Rli5GDrCq qcfKQRqEBDYwSvy5LgZR84NRYu21VjaQBJuAlsT+FzfAbBGBA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UYKDWUmEd44FUIg3JbGyKrUoP76oNCe1+BCjNAeLkjgvf/6xSCGB9MSS 1OzU1ILUIpgsEwenVAMjm1yxEdvr/VYVCruMk29LPrlXE9f656qnpMXNi+HRiapOj9Qmieyv yubO9To9d+UkU7nylZH7/t3a0fG6rivmkvEGO6OFsxj2PWLcGpH0+4PV0v+RJzpPrbdZ/yit u+VRseuT2B0q9zeZv4ktVLx1mXfrcVvdgHweL7+rDRtyL7+9ZW6/4VulEktxRqKhFnNRcSIA 7bguah8CAAA= X-CMS-MailID: 20171023013215epcas2p1abdf1f948cc704f113d741e08d42a15b X-Msg-Generator: CA CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20171023013215epcas2p1abdf1f948cc704f113d741e08d42a15b X-RootMTR: 20171023013215epcas2p1abdf1f948cc704f113d741e08d42a15b References: <1508722332-10628-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 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 Acked-by: MyungJoo Ham --- drivers/devfreq/devfreq.c | 16 +++++----------- include/linux/devfreq.h | 5 +++-- 2 files changed, 8 insertions(+), 13 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, 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; + int i; - do { - opp = dev_pm_opp_find_freq_ceil(dev, &freq); - if (IS_ERR(opp)) - break; + mutex_lock(&df->lock); - 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]); + mutex_unlock(&df->lock); /* Truncate the trailing space */ if (count) count--; diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 997a9eb34191..19520625ea94 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -84,8 +84,9 @@ struct devfreq_dev_status { * from devfreq_remove_device() call. If the user * has registered devfreq->nb at a notifier-head, * this is the time to unregister it. - * @freq_table: Optional list of frequencies to support statistics. - * @max_state: The size of freq_table. + * @freq_table: Optional list of frequencies to support statistics + * and freq_table must be generated in ascending order. + * @max_state: The size of freq_table. */ struct devfreq_dev_profile { unsigned long initial_freq; -- 1.9.1