From patchwork Mon Oct 23 01:32:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 10021911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D411760381 for ; Mon, 23 Oct 2017 01:33:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6BD0286A8 for ; Mon, 23 Oct 2017 01:33:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB6A9286DC; Mon, 23 Oct 2017 01:33:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6474E286A8 for ; Mon, 23 Oct 2017 01:33:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932188AbdJWBcV (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 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20171023013216epoutp0383221df80d55d4642d64caff604a763a~wDvi-B5yS1352713527epoutp03Z; Mon, 23 Oct 2017 01:32:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20171023013216epoutp0383221df80d55d4642d64caff604a763a~wDvi-B5yS1352713527epoutp03Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1508722336; bh=77jpwG3Pr3zNypHk9tJkx/lDXW5OJZ7s0GmUglkw19w=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=vU736henipFkZbmxOYfetXxEYPrGRSIPCWL3EMFXp8isnlZJYcMzq2pGCxpF3GTtJ B+Qec9FWxu6s61wiN8bRpI/Ra0z6ZIJP+NbbJmH1KjxaLtYaTt5HI6z2gNX2ucqK8N zgqjsIo/PHZJtsl1xZZPN0T+A9+G6lLNaQXdpxRw= Received: from epsmges2p4.samsung.com (unknown [182.195.40.64]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20171023013216epcas1p1f39be2c3e2313bb70aa5de5e780ee237~wDvim0dGO1571515715epcas1p18; Mon, 23 Oct 2017 01:32:16 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 81.CD.04158.F964DE95; Mon, 23 Oct 2017 10:32:16 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20171023013215epcas2p1abdf1f948cc704f113d741e08d42a15b~wDvh_sQWH0866108661epcas2p1M; Mon, 23 Oct 2017 01:32:15 +0000 (GMT) X-AuditID: b6c32a48-8edff7000000103e-be-59ed469f057d Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 58.27.03859.F964DE95; Mon, 23 Oct 2017 10:32:15 +0900 (KST) Received: from localhost.localdomain ([10.113.62.212]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OY90045G5LPR020@mmp2.samsung.com>; Mon, 23 Oct 2017 10:32:15 +0900 (KST) 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+FzfAbBGBAInOtauYQIqYBZoYJfbfu8EO khAW8JDoOPqaGcRmEVCVOPq5hwnE5hVwlZi1vo8d4iQ5iQ97HoHZnAJuEnfXfmUEGSQhMIFN 4tm+dqgiF4lrzzezQtjCEq+Ob4GKS0s8W7URqqGdUWLznHssEE4Ho8T9lY1QHcYSp7oawVYz C/BJdBz+yw7xJ69ER5sQRImHxII/e5ggbEeJY+0voYE0E+j/l5PYJzBKLWBkWMUollpQnJue WmxUYKJXnJhbXJqXrpecn7uJEZxOtDx2MB4453OIUYCDUYmHl8HwbaQQa2JZcWXuIUYJDmYl Ed45FkAh3pTEyqrUovz4otKc1OJDjKbA0JnILCWanA9MdXkl8YYmlgYmZmZG5mYWwPQgzlu3 7VqEkEB6YklqdmpqQWoRTB8TB6dUA2PNxz31gt/m3a/683SqfYMab27snAItbaNnXIs1hdJm T2mtdtP+qmQWqvNrTZZjV4r/MoEV+1I14mL4Z9ZlcUU7+61WSa85LvGv73KiYnue7m+Nrh8Z S7JFn+buSgq13bvl/aerE09zvNu6Qb/yZDK34enc64Kqvrv93vVNri8++eBQig33OiWW4oxE Qy3mouJEAO1An9Q9AwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphluLIzCtJLcpLzFFi42I5/e+xoO58t7eRBrs+K1hMvHGFxeL6l+es FpPuT2CxONv0ht3i8q45bBafe48wWtxuXMFm8XjFW3YHDo/Fe14yeWxa1cnm0bdlFaPH501y ASxRXDYpqTmZZalF+nYJXBmvz75mLVgvUtHZco2xgfGyQBcjB4eEgInE1GPlXYxcHEIC6xgl uue8ZIdwfjBKzN/YztLFyMnBJqAlsf/FDTYQW0TAT2L7/PWMIEXMAk2MEsv7b4ElhAU8JDqO vmYGsVkEVCWOfu5hArF5BVwlZq3vYwexJQTkJD7seQRmcwq4Sdxd+5URxBYCqvn76T/TBEae BYwMqxglUwuKc9Nzi40KjPJSy/WKE3OLS/PS9ZLzczcxAsNo22Gt/h2Mj5fEH2IU4GBU4uFl MHwbKcSaWFZcmXuIUYKDWUmEd44FUIg3JbGyKrUoP76oNCe1+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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;