From patchwork Mon Jan 26 09:25:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 5707241 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 41D00C058E for ; Mon, 26 Jan 2015 09:25:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7BC712012B for ; Mon, 26 Jan 2015 09:25:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7FAAA20131 for ; Mon, 26 Jan 2015 09:25:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752184AbbAZJZr (ORCPT ); Mon, 26 Jan 2015 04:25:47 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:42292 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752164AbbAZJZo (ORCPT ); Mon, 26 Jan 2015 04:25:44 -0500 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NIS00M6J26UTYA0@mailout1.samsung.com>; Mon, 26 Jan 2015 18:25:42 +0900 (KST) X-AuditID: cbfee61b-f79d76d0000024d6-e1-54c608164119 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 7D.F3.09430.61806C45; Mon, 26 Jan 2015 18:25:42 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NIS003BU26HE750@mmp2.samsung.com>; Mon, 26 Jan 2015 18:25:42 +0900 (KST) From: Lukasz Majewski To: Eduardo Valentin , Viresh Kumar Cc: Zhang Rui , Linux PM list , "linux-samsung-soc@vger.kernel.org" , Bartlomiej Zolnierkiewicz , Lukasz Majewski , Kukjin Kim , Amit Daniel Kachhap , Abhilash Kesavan , Abhilash Kesavan , Kukjin Kim , Chanwoo Choi , Lukasz Majewski Subject: [PATCH] cpufreq: exynos: Use simple approach to asses if cpu cooling can be used Date: Mon, 26 Jan 2015 10:25:27 +0100 Message-id: <1422264327-17483-1-git-send-email-l.majewski@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1422015260-14225-1-git-send-email-l.majewski@samsung.com> References: <1422015260-14225-1-git-send-email-l.majewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDLMWRmVeSWpSXmKPExsVy+t9jQV0xjmMhBuvn6lo8XrOYyaLhaojF xhnrWS2uf3nOajH/yjVWizV/lSx6F1xls+h//JrZ4s0jbos3DzczWnzuPcJoMeP8PiaLJw/7 2Cw2fvVw4PPYOesuu8fiPS+ZPDat6mTzuHNtD5vHumlvmT36tqxi9Pi8SS6APYrLJiU1J7Ms tUjfLoEr4/TtBcwF1/kqzn0LbmD8x93FyMkhIWAisX/RN2YIW0ziwr31bF2MXBxCAtMZJa4s XsEC4XQxSfTsv8kCUsUmoCfx+e5Tpi5GDg4RgRCJ9UfUQWqYBeaySOzdtQqsRlggWqJnz3Ow qSwCqhKPduxnBLF5BdwktjYvgtqmKNH9bAIbiM0p4C7RcfgZWK8QUM3FruNsExh5FzAyrGIU TS1ILihOSs810itOzC0uzUvXS87P3cQIDtNn0jsYVzVYHGIU4GBU4uHVaDwaIsSaWFZcmXuI UYKDWUmEt3wKUIg3JbGyKrUoP76oNCe1+BCjNAeLkjivkn1biJBAemJJanZqakFqEUyWiYNT qoFxzpEyH7UTSVOT60XZ50f/PLXpns6JsA3nehqL98i/uvSaV+xe9C//3dP3C550jC27eWVp C0vlQbt7vw2mheT4Cvzp+JC6RW/Rlei788y0a2budX61I+5F5CybG9t1Hv5axbq2o55xL9+c Fd0feH2NLizIeskmfCr2jsRJ5ZKm9kdBhZmZdyQDlFiKMxINtZiLihMBpFHAr08CAAA= Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit: e725d26c4857e5e41975b5e74e64ce6ab09a7121 provided possibility to use device tree to asses if cpu can be used as cooling device. Since the code was somewhat awkward, simpler approach has been proposed. Test HW: Exynos 4412 - Odroid U3. Suggested-by: Viresh Kumar Signed-off-by: Lukasz Majewski Acked-by: Viresh Kumar --- drivers/cpufreq/exynos-cpufreq.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index 5e98c6b..b640da0 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c @@ -159,7 +159,7 @@ static struct cpufreq_driver exynos_driver = { static int exynos_cpufreq_probe(struct platform_device *pdev) { - struct device_node *cpus, *np; + struct device_node *cpu0, *np; int ret = -EINVAL; exynos_info = kzalloc(sizeof(*exynos_info), GFP_KERNEL); @@ -206,28 +206,19 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) if (ret) goto err_cpufreq_reg; - cpus = of_find_node_by_path("/cpus"); - if (!cpus) { - pr_err("failed to find cpus node\n"); + cpu0 = of_get_cpu_node(0, NULL); + if (!cpu0) { + pr_err("failed to find cpu0 node\n"); return 0; } - np = of_get_next_child(cpus, NULL); - if (!np) { - pr_err("failed to find cpus child node\n"); - of_node_put(cpus); - return 0; - } - - if (of_find_property(np, "#cooling-cells", NULL)) { - cdev = of_cpufreq_cooling_register(np, + if (of_find_property(cpu0, "#cooling-cells", NULL)) { + cdev = of_cpufreq_cooling_register(cpu0, cpu_present_mask); if (IS_ERR(cdev)) pr_err("running cpufreq without cooling device: %ld\n", PTR_ERR(cdev)); } - of_node_put(np); - of_node_put(cpus); return 0;