Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752347AbdIUAfY (ORCPT ); Wed, 20 Sep 2017 20:35:24 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:55658 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751973AbdIUAd6 (ORCPT ); Wed, 20 Sep 2017 20:33:58 -0400 X-AuditID: b6c32a38-f799e6d000004f48-c1-59c308f47549 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-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/8] PM / devfreq: Get the available next frequency on update_devfreq() Date: Thu, 21 Sep 2017 09:33:49 +0900 Message-id: <1505954032-3327-6-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1505954032-3327-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKKsWRmVeSWpSXmKPExsWy7bCmnu4XjsORBhvey1pMvHGFxeL6l+es FpPuT2CxONv0ht3i8q45bBafe48wWtxuXMFm8XjFW3YHDo/Fe14yeWxa1cnm0bdlFaPH501y ASxRqTYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkouPgG6bpk5QGco KZQl5pQChQISi4uV9O1sivJLS1IVMvKLS2yVog0NjfQMDcz1jIyM9EyMY62MTIFKElIzdqy4 zVTQwVvx/MEctgbGh1xdjJwcEgImEvv3rWaDsMUkLtxbD2RzcQgJ7GCUWDLvBTuE851RYtr+ +4wwHQu3r2GBSOxmlGj9uI4JJCEk8INR4tKGQBCbTUBLYv+LG2BjRQQCJDrXrgKrYRZoYpSY uswBxBYWiJGYce0eK4jNIqAqMf3XVrAFvAIuEvvWnWeBWCYn8WHPI3YQm1PAVeLb2S6w8yQE JrBJ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Gv49f7LmfKqScmugk5N4YveD5U+tbAjNsl+3aKt00Xfyq3rdDwTe+ mm7VUNZ7N6Mk3FKC929SkoCW4FXR5uOMsudceBgaz7wLs7nno7d5xaeUR4aR5dkxXXO5j1zO cfwVJ8fsk7NEULGE79/cQHZ+5knGwqqsyy9r+X4ukr/2RO1p9sfsLc+VWIozEg21mIuKEwGg Z0AjIAIAAA== X-CMS-MailID: 20170921003356epcas1p3de34905f87bca5760f80d196a004e1a0 X-Msg-Generator: CA X-Sender-IP: 182.195.42.142 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: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20170921003356epcas1p3de34905f87bca5760f80d196a004e1a0 X-RootMTR: 20170921003356epcas1p3de34905f87bca5760f80d196a004e1a0 References: <1505954032-3327-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: 1622 Lines: 48 The update_devfreq() considers only user frequency (min_freq/max_freq) and the next target_freq provided by the governor. But, The commit a76caf55e5b35 ("thermal: Add devfreq cooling") is able to disable OPP as a cooling device. In result, the update_devfreq() have to consider the 'opp->available' status in order to decicde the next freq by the devfreq_recommended_opp(). Signed-off-by: Chanwoo Choi --- drivers/devfreq/devfreq.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 1c4b377cacfb..3b9662ffe603 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -255,6 +255,7 @@ static int devfreq_notify_transition(struct devfreq *devfreq, int update_devfreq(struct devfreq *devfreq) { struct devfreq_freqs freqs; + struct dev_pm_opp *opp; unsigned long freq, cur_freq; int err = 0; u32 flags = 0; @@ -273,7 +274,7 @@ int update_devfreq(struct devfreq *devfreq) return err; /* - * Adjust the frequency with user freq and QoS. + * Adjust the frequency with user freq, QoS and available freq. * * List from the highest priority * max_freq @@ -289,6 +290,12 @@ int update_devfreq(struct devfreq *devfreq) flags |= DEVFREQ_FLAG_LEAST_UPPER_BOUND; /* Use LUB */ } + opp = devfreq_recommended_opp(devfreq->dev.parent, &freq, flags); + if (IS_ERR(opp)) + return PTR_ERR(opp); + freq = dev_pm_opp_get_freq(opp); + dev_pm_opp_put(opp); + if (devfreq->profile->get_cur_freq) devfreq->profile->get_cur_freq(devfreq->dev.parent, &cur_freq); else -- 1.9.1