From patchwork Wed Oct 11 03:09:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 9998633 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 26AB660230 for ; Wed, 11 Oct 2017 03:11:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 214AA2885D for ; Wed, 11 Oct 2017 03:11:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1629128862; Wed, 11 Oct 2017 03:11:36 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 B76472885D for ; Wed, 11 Oct 2017 03:11:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932625AbdJKDKu (ORCPT ); Tue, 10 Oct 2017 23:10:50 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:64243 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756239AbdJKDJt (ORCPT ); Tue, 10 Oct 2017 23:09:49 -0400 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20171011030947epoutp01d5a8e27d6ec05c3a9c611cd9ec34ae74~sZVQ9KK1b1238612386epoutp01z; Wed, 11 Oct 2017 03:09:47 +0000 (GMT) Received: from epsmges1p3.samsung.com (unknown [182.195.40.70]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20171011030947epcas1p290d7c77b215690f344c81c8352527a37~sZVQnV-yF3000830008epcas1p2Q; Wed, 11 Oct 2017 03:09:47 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id 22.5F.04214.B7B8DD95; Wed, 11 Oct 2017 12:09:47 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20171011030947epcas1p1133ca20bb9356453c331751b3e3bba4b~sZVQUiehE3201032010epcas1p1u; Wed, 11 Oct 2017 03:09:47 +0000 (GMT) X-AuditID: b6c32a37-c8dff70000001076-90-59dd8b7bda72 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 1D.CD.06995.A7B8DD95; Wed, 11 Oct 2017 12:09:46 +0900 (KST) Received: from localhost.localdomain ([10.113.62.212]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OXN00GRY24AU990@mmp1.samsung.com>; Wed, 11 Oct 2017 12:09:46 +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 v3 5/8] PM / devfreq: Get the available next frequency on update_devfreq() Date: Wed, 11 Oct 2017 12:09:21 +0900 Message-id: <1507691364-3899-6-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1507691364-3899-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrBKsWRmVeSWpSXmKPExsWy7bCmrm51991Ig8VPhC0m3rjCYnH9y3NW i0n3J7BYnG16w25xedccNovPvUcYLW43rmCzeLziL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ZxejxeZNc AEsUl01Kak5mWWqRvl0CV8bi1avZCtp5K5a9/sDcwPiQq4uRk0NCwERi5sk1TF2MXBxCAjsZ JaadesMI4fxglNjyeDoTSBWbgJbE/hc32EBsEQE/ie3z14MVMQs0MUos778FlhAWiJE4MLOR vYuRg4NFQFWisU0KxOQVcJHouc8HsUxO4sOeR+wgNqeAq8TkWafAbCGgkh+rXzJOYORZwMiw ilEytaA4Nz232KjAMC+1XK84Mbe4NC9dLzk/dxMjMIi2Hdbq28F4f0n8IUYBDkYlHl6B63ci hVgTy4orcw8xSnAwK4nwWhTejRTiTUmsrEotyo8vKs1JLT7EKM3BoiTOezvvWKSQQHpiSWp2 ampBahFMlomDU6qBMdsybG+Hem335OnlvUuqNpx5O+ksd1cja9rGqZMvNj4+uyVk0VML3TOd h9gsl/+5pLVx7m7m2AcCv1knz+BT9NPd/YCLp7Z1l+J+toaL14wPOfBwZKz+IPrDtug+X+PB Ew2zSw4dTzrm7nA6/1ji4oX+trfmqrr2q2z4cWHWu60XzgXcZMzrKldiKc5INNRiLipOBAAt mPsFHgIAAA== X-CMS-MailID: 20171011030947epcas1p1133ca20bb9356453c331751b3e3bba4b 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: 20171011030947epcas1p1133ca20bb9356453c331751b3e3bba4b X-RootMTR: 20171011030947epcas1p1133ca20bb9356453c331751b3e3bba4b References: <1507691364-3899-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 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