From patchwork Wed Nov 21 18:01:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Luba X-Patchwork-Id: 10692915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E79116B1 for ; Wed, 21 Nov 2018 18:02:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89CB52C424 for ; Wed, 21 Nov 2018 18:02:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86C902C430; Wed, 21 Nov 2018 18:02:59 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 877D32C42C for ; Wed, 21 Nov 2018 18:02:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732854AbeKVEh1 (ORCPT ); Wed, 21 Nov 2018 23:37:27 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:38042 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732852AbeKVEh1 (ORCPT ); Wed, 21 Nov 2018 23:37:27 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181121180203euoutp0126e6948fa6d87141ed344d595e40321b~pNaNrtmnl0765407654euoutp01L for ; Wed, 21 Nov 2018 18:02:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181121180203euoutp0126e6948fa6d87141ed344d595e40321b~pNaNrtmnl0765407654euoutp01L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1542823323; bh=oORLA3xIklIVwCz1S5SVDzYoqoM0P6trXJ3cqtDIJMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kYu6bT+5N/+GPcs9sJeGSfoFt7ZlhM9HFTWl4bSECRNpXWm3lQ/YqyHXz1PYmzjoB gn/4zCKE/iqSPE85JSJ2N+i6xyusDNIGiPTOtaSTZEan0wxCUsHt6x0zghHYZAIzCo vLlcFzNJsowBbfwEOXYhf/M5VTNCBba29PxLXcbY= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181121180202eucas1p17a1d057c3e02a04be49c6cda2bb314a5~pNaMdoqy03116331163eucas1p1Y; Wed, 21 Nov 2018 18:02:01 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 46.D7.04441.99D95FB5; Wed, 21 Nov 2018 18:02:01 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181121180201eucas1p1f1f96941c3d16a96722e65d5c21bfe80~pNaLnqHcb1762417624eucas1p1X; Wed, 21 Nov 2018 18:02:01 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181121180200eusmtrp1f9c45123686b2d8dc0ffcc4064919291~pNaLX8YLs2594725947eusmtrp1l; Wed, 21 Nov 2018 18:02:00 +0000 (GMT) X-AuditID: cbfec7f2-5e3ff70000001159-91-5bf59d990b99 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id F9.7C.04128.89D95FB5; Wed, 21 Nov 2018 18:02:00 +0000 (GMT) Received: from AMDC3778.DIGITAL.local (unknown [106.120.51.20]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181121180159eusmtip29e2c5e45e6cec76b3ae8f36b8cd39c9d~pNaKfGZ3v1293112931eusmtip2V; Wed, 21 Nov 2018 18:01:59 +0000 (GMT) From: Lukasz Luba To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org Cc: tjakobi@math.uni-bielefeld.de, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz, gregkh@linuxfoundation.org, keescook@chromium.org, anton@enomsg.org, ccross@android.com, tony.luck@intel.com, robh+dt@kernel.org, mark.rutland@arm.com, kgene@kernel.org, krzk@kernel.org, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, Lukasz Luba Subject: [PATCH 1/6] devfreq: add basic fileds supporting suspend functionality Date: Wed, 21 Nov 2018 19:01:36 +0100 Message-Id: <1542823301-23563-2-git-send-email-l.luba@partner.samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542823301-23563-1-git-send-email-l.luba@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSWUwTURSGvbPT2DpUIldESJpIwASUxIcbMUaDD+MWNW4BErXgBFRaSgdU 1GjRWAouIKKgsphUpJYaoNZCABeggsomEEVFXNBEWVR2JShKnapv3/nPf85/cnMZXD5OejF7 1Am8Vq2MVVASwl4/0Rp4KW8sYvHzd/6o5nYAKsspIVF52TiJOkc/kqjA0UKiE8YSCjWdUqH0 9/04am0tpVHz8QEavdR5o8tZdzBkff+MRB2VuRQaOeMAKKf1LoZuOrppVNjZhqGuZBOFuh8/ mN7R2E6ik3ccNNIXD5Jo4MlrYgXk7FV2krPkWwB3RddGcBnpw4AzVvdinNWcSnH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SC+CL0rMpyi8tSVXIyC8usVWKNrQw0jO0tNAzMrHU MzQ2j7UyMlXSt7NJSc3JLEst0rdL0Ms4s+wbW8Fhvoo3kxqZGxiX8nQxcnJICJhILH99hK2L kYtDSGApo8S1j19ZIRJiEpP2bWeHsIUl/lzrgir6xCix++16oCIODjYBPYkdqwpB4iICyxkl 7v+czQ7iMAs8YJboeL4JbJKwgL/E8peHwGwWAVWJNZdWMYHYvAJeEv9e3GGB2CAncfNcJzOI zSngLfF51QRGEFsIqObKvIWsExj5FjAyrGIUSS0tzk3PLTbSK07MLS7NS9dLzs/dxAiM2G3H fm7Zwdj1LvgQowAHoxIPr0bk12gh1sSy4srcQ4wSHMxKIrwdUUAh3pTEyqrUovz4otKc1OJD jKZAR01klhJNzgcmk7ySeENTQ3MLS0NzY3NjMwslcd7zBpVRQgLpiSWp2ampBalFMH1MHJxS DYxrbUOvqD7lWaV407c2xvquaPul7G2a6jdqX03w/X3vgBmvRdHvyJ4y94wWcXW5pe8ZRIMm J+s9LNGWvVP4wOPWj44PP3dUvH7FIXR9xt+5R7dmyYrcd+HPYWZJ4ZLrvLnp69uNIflrpzHV zJt6Mj/xeabPNRZ7pss29bw3tzWJfUl2O+LfeFSJpTgj0VCLuag4EQCYBQT07gIAAA== X-CMS-MailID: 20181121180201eucas1p1f1f96941c3d16a96722e65d5c21bfe80 X-Msg-Generator: CA X-RootMTR: 20181121180201eucas1p1f1f96941c3d16a96722e65d5c21bfe80 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181121180201eucas1p1f1f96941c3d16a96722e65d5c21bfe80 References: <1542823301-23563-1-git-send-email-l.luba@partner.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 patch prepares devfreq device for handling suspend/resume functionality. The new fields will store needed information during this process. Devfreq framework handles opp-suspend DT entry and there is no need of modyfications in the drivers code. The patch draws on Tobias Jakobi's work posted ~2 years ago, who tried to solve issue with devfreq device's frequency during suspend/resume. During the discussion on LKML some corner cases and comments appeared related to the design. This patch address them keeping in mind suggestions from Chanwoo Choi. Suggested-by: Tobias Jakobi Suggested-by: Chanwoo Choi Signed-off-by: Lukasz Luba --- drivers/devfreq/devfreq.c | 3 +++ include/linux/devfreq.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 1414130..e20e7e4 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -657,6 +657,9 @@ struct devfreq *devfreq_add_device(struct device *dev, } devfreq->max_freq = devfreq->scaling_max_freq; + devfreq->suspend_freq = dev_pm_opp_get_suspend_opp_freq(dev); + atomic_set(&devfreq->suspend_count, 0); + dev_set_name(&devfreq->dev, "devfreq%d", atomic_inc_return(&devfreq_no)); err = device_register(&devfreq->dev); diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index e4963b0..7fe96f9 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -167,6 +167,10 @@ struct devfreq { unsigned long scaling_max_freq; bool stop_polling; + unsigned long suspend_freq; + unsigned long resume_freq; + atomic_t suspend_count; + /* information for device frequency transition */ unsigned int total_trans; unsigned int *trans_table; From patchwork Wed Nov 21 18:01:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Luba X-Patchwork-Id: 10692907 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7390916B1 for ; Wed, 21 Nov 2018 18:02:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 625EB2C424 for ; Wed, 21 Nov 2018 18:02:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 564B72C426; Wed, 21 Nov 2018 18:02:39 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 DF2D72C41A for ; Wed, 21 Nov 2018 18:02:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732876AbeKVEh3 (ORCPT ); Wed, 21 Nov 2018 23:37:29 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:38065 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732856AbeKVEh2 (ORCPT ); Wed, 21 Nov 2018 23:37:28 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181121180204euoutp01d7074783d44d847a5efb6664e3176207~pNaPCwUwY0765407654euoutp01P for ; Wed, 21 Nov 2018 18:02:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181121180204euoutp01d7074783d44d847a5efb6664e3176207~pNaPCwUwY0765407654euoutp01P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1542823324; bh=caHqBywNIZe62FMEK8RKMURrBXS1eVzbboJZjefYi04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LxcMmjh0JD9Ndb77YJZQ/4b+/pYQnwh1jArZjMzGMM4jJjSBkutUcgdDwBWZhJOPb 945JKx45uiXe4fFPk/SGVnFesaRIZZ9k0+wQJpiCaMDkoSdLoyDFZbGSWolY56CQbO o0m6aTlnTz+i6g5Lt2cysRV01yXRYqaetJ8+3WtU= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181121180203eucas1p2ba2f74fb5af5c1e14081ed6b5bfd8125~pNaN9ck9e3244932449eucas1p2F; Wed, 21 Nov 2018 18:02:03 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id A6.89.04294.B9D95FB5; Wed, 21 Nov 2018 18:02:03 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20181121180202eucas1p27d3aa58411abeae03181c38b91fc67de~pNaNBC26v0549405494eucas1p2h; Wed, 21 Nov 2018 18:02:02 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181121180202eusmtrp15bf75ed2f2fd162596003c6b5f9a68a9~pNaMxfkOg2594725947eusmtrp1n; Wed, 21 Nov 2018 18:02:02 +0000 (GMT) X-AuditID: cbfec7f4-835ff700000010c6-bf-5bf59d9bc85d Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id AB.7C.04128.A9D95FB5; Wed, 21 Nov 2018 18:02:02 +0000 (GMT) Received: from AMDC3778.DIGITAL.local (unknown [106.120.51.20]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181121180201eusmtip2aab775dd1624480b29c934938be1a814~pNaL5vPVR1643316433eusmtip2O; Wed, 21 Nov 2018 18:02:01 +0000 (GMT) From: Lukasz Luba To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org Cc: tjakobi@math.uni-bielefeld.de, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz, gregkh@linuxfoundation.org, keescook@chromium.org, anton@enomsg.org, ccross@android.com, tony.luck@intel.com, robh+dt@kernel.org, mark.rutland@arm.com, kgene@kernel.org, krzk@kernel.org, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, Lukasz Luba Subject: [PATCH 2/6] devfreq: refactor set_target frequency function Date: Wed, 21 Nov 2018 19:01:37 +0100 Message-Id: <1542823301-23563-3-git-send-email-l.luba@partner.samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542823301-23563-1-git-send-email-l.luba@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSe1BMURzHnfvYe0vLtSo/MZgdRnmUDOOM13j0xx3+YDAGmWFxJ7Eb7ZX3 jC0j1VbySEZFM2GzZdK2slIo1Za0lchrSt7SMrRL00jsdcN/n/N9/H5nzhyWVPXQAWxk1C5B H6XRqhXeVElNr2NqZva38Gk5H1S44loQLjpTSOPrRd9p/Nj9nsbnqxw0PpxbqMD3jTp87HUX iRsbrzK4Ic7J4GeG0fjsqXICW1630rilNEuBXSlVCJ9pvEXgK1VtDL74uJnAz2PzFLjtXrVn Rv0DGh8pr2JwfP4XGjub2qkFwJfcLKH5gnMFiM80NFN82rFuxOeWdRK8xZyo4G9nFzB88YVD fH8Nw1d8LiN466OjFJ9qNSM+L7+H4V2WMcuHrPOeu0XQRu4W9CHzN3pvzXoTS+y0Beztie1k DOi4fxLyYoGbATfev2AkVnF5CFwGnyTk7WE3goa+bko+uBB8rL1E/22k16SQsmFCYM39Rf6r 1HUUoyTEsgouGGzmaKngy+UieGALkjIkV0tC6dcThGQM58LA/TwTSUxxE+BeTuEfXcktgYb2 dwPbxsBTRyIpsRe3FFzmNCQNAu4yC86Xr0g5FAYP41oZmYfDR7t1gEdD/clkSmYRGhLMCpkP wtE620BmDty1N9PSpUkuCApLQ2R5IRxvKWIkGbgh8OTTMEkmPXiiJIOUZSUkxKvkdCBYk5sI mf3BVHB6YDgP6T8cjPw85xAYL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vqg0J7X4 EKMp0FETmaVEk/OBqSSvJN7Q1NDcwtLQ3Njc2MxCSZz3vEFllJBAemJJanZqakFqEUwfEwen VAPjBouZHAEqkz/tLvgbpDvHcoWsqYAC4yYZt0t6V3vV5YM1AsJYG39IuCUIHNu9ZBJ39cNt TqIMCZ07n964uz1tWq/dreAe3hfrzN57839fbmSwd1qr3RX9D5euzbrBESc/MTInnqFRe9dG uVc3Vxum5qfvmn/ahqNMq1joscrkBLXptbMfKO9UYinOSDTUYi4qTgQAR714yO0CAAA= X-CMS-MailID: 20181121180202eucas1p27d3aa58411abeae03181c38b91fc67de X-Msg-Generator: CA X-RootMTR: 20181121180202eucas1p27d3aa58411abeae03181c38b91fc67de X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181121180202eucas1p27d3aa58411abeae03181c38b91fc67de References: <1542823301-23563-1-git-send-email-l.luba@partner.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 refactoring is needed for the new client in devfreq: suspend. To avoid code duplication, move it to the new local function devfreq_set_target. The patch draws on Tobias Jakobi's work posted ~2 years ago, who tried to solve issue with devfreq device's frequency during suspend/resume. During the discussion on LKML some corner cases and comments appeared related to the design. This patch address them keeping in mind suggestions from Chanwoo Choi. Suggested-by: Tobias Jakobi Suggested-by: Chanwoo Choi Signed-off-by: Lukasz Luba --- drivers/devfreq/devfreq.c | 62 ++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index e20e7e4..cf9c643 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -285,6 +285,42 @@ static int devfreq_notify_transition(struct devfreq *devfreq, return 0; } +static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_freq, + unsigned long *prev_freq, u32 flags) +{ + struct devfreq_freqs freqs; + unsigned long cur_freq; + int err = 0; + + if (devfreq->profile->get_cur_freq) + devfreq->profile->get_cur_freq(devfreq->dev.parent, &cur_freq); + else + cur_freq = devfreq->previous_freq; + + freqs.old = cur_freq; + freqs.new = new_freq; + devfreq_notify_transition(devfreq, &freqs, DEVFREQ_PRECHANGE); + + err = devfreq->profile->target(devfreq->dev.parent, &new_freq, flags); + if (err) { + freqs.new = cur_freq; + devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE); + return err; + } + + freqs.new = new_freq; + devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE); + + if (devfreq_update_status(devfreq, new_freq)) + dev_err(&devfreq->dev, + "Couldn't update frequency transition information.\n"); + + devfreq->previous_freq = new_freq; + *prev_freq = cur_freq; + + return err; +} + /* Load monitoring helper functions for governors use */ /** @@ -296,7 +332,6 @@ static int devfreq_notify_transition(struct devfreq *devfreq, */ int update_devfreq(struct devfreq *devfreq) { - struct devfreq_freqs freqs; unsigned long freq, cur_freq, min_freq, max_freq; int err = 0; u32 flags = 0; @@ -333,31 +368,8 @@ int update_devfreq(struct devfreq *devfreq) flags |= DEVFREQ_FLAG_LEAST_UPPER_BOUND; /* Use LUB */ } - if (devfreq->profile->get_cur_freq) - devfreq->profile->get_cur_freq(devfreq->dev.parent, &cur_freq); - else - cur_freq = devfreq->previous_freq; - - freqs.old = cur_freq; - freqs.new = freq; - devfreq_notify_transition(devfreq, &freqs, DEVFREQ_PRECHANGE); + return devfreq_set_target(devfreq, freq, &cur_freq, flags); - err = devfreq->profile->target(devfreq->dev.parent, &freq, flags); - if (err) { - freqs.new = cur_freq; - devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE); - return err; - } - - freqs.new = freq; - devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE); - - if (devfreq_update_status(devfreq, freq)) - dev_err(&devfreq->dev, - "Couldn't update frequency transition information.\n"); - - devfreq->previous_freq = freq; - return err; } EXPORT_SYMBOL(update_devfreq); From patchwork Wed Nov 21 18:01:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Luba X-Patchwork-Id: 10692909 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D35461751 for ; Wed, 21 Nov 2018 18:02:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C13A92C422 for ; Wed, 21 Nov 2018 18:02:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B57A32C426; Wed, 21 Nov 2018 18:02:39 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 6148D2C41A for ; Wed, 21 Nov 2018 18:02:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732871AbeKVEiB (ORCPT ); Wed, 21 Nov 2018 23:38:01 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:38097 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732872AbeKVEh3 (ORCPT ); Wed, 21 Nov 2018 23:37:29 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181121180206euoutp012b7374f9f56840901fbdae6893ee90a5~pNaQPU-MH0765407654euoutp01S for ; Wed, 21 Nov 2018 18:02:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181121180206euoutp012b7374f9f56840901fbdae6893ee90a5~pNaQPU-MH0765407654euoutp01S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1542823326; bh=TC4iv9GmwSHsehFTeXbZMrcoHrnEKqBkOFvwBCjFgEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QxeWXAT/PVQVYFbL6LC9XU8+LWZPTzgKGBoL530dShlA27jh2FsUsAQC9T/aOXmQW 67PxatvFYT+ixNndCcUqn+gTuyIZImIgaLbHw5AfX8JzxmQRPrfzWP94//5tAmRQHA rt8/yb0FFtPmaDGYwRPWvoxiww+J7p+LUT7cKgL0= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181121180204eucas1p29f01fa667282f71e870be3b662344d1c~pNaPEsQ9i1318113181eucas1p2P; Wed, 21 Nov 2018 18:02:04 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id A9.B3.04806.C9D95FB5; Wed, 21 Nov 2018 18:02:04 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181121180204eucas1p1c5891d498aa59c0e10dd3ba4727a4382~pNaOXcXWN3115831158eucas1p1T; Wed, 21 Nov 2018 18:02:04 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20181121180203eusmtrp205083d871e555b0038b775a845c138bb~pNaOH68rp0880408804eusmtrp26; Wed, 21 Nov 2018 18:02:03 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-d6-5bf59d9c12be Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 4C.48.04284.B9D95FB5; Wed, 21 Nov 2018 18:02:03 +0000 (GMT) Received: from AMDC3778.DIGITAL.local (unknown [106.120.51.20]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181121180202eusmtip2ee65eeaddffccee4e927d3dfba791f47~pNaNPk8pt1293112931eusmtip2W; Wed, 21 Nov 2018 18:02:02 +0000 (GMT) From: Lukasz Luba To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org Cc: tjakobi@math.uni-bielefeld.de, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz, gregkh@linuxfoundation.org, keescook@chromium.org, anton@enomsg.org, ccross@android.com, tony.luck@intel.com, robh+dt@kernel.org, mark.rutland@arm.com, kgene@kernel.org, krzk@kernel.org, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, Lukasz Luba Subject: [PATCH 3/6] devfreq: add support for suspend/resume of a devfreq device Date: Wed, 21 Nov 2018 19:01:38 +0100 Message-Id: <1542823301-23563-4-git-send-email-l.luba@partner.samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542823301-23563-1-git-send-email-l.luba@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0VSaWwMYRj2zezsTJdtxqJ91Zl1RCWKKL4gjiAdRFLXn/YHQ0eJ7padFkVi XN1uL02DNvQgPTNd2q5atbSitq2rt7tRokEUdaxWJE3ZMYt/z/u8z/O87/fmY0hDPxXE7DTH CRYzH2PU6jTOhp8tM3Jy+yJnDSROwreuBOPK7HIKX63sp/CT7+8onO9upvCxgnItfpBiwie7 P5C4paWCxk1HP9L4uTQWnz1VQ2BH92MKd7hytNiT5kY4u6WWwBfdL2hc9KSNwJ1HSrX4xb16 b8b9dgqfqHHTOLHsC4U/tnZplgLnvO6kOHueHXHnpDYNl3HyG+IKbrwnOIds03I3c+00d7nw MDfYQHO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XIyC8usVWKNrQw0jO0tNAzMrHU MzQ2j7UyMlXSt7NJSc3JLEst0rdL0Mt4uayHteCRUMWmqZsZGxjv8XUxcnJICJhING/oZOti 5OIQEljKKPF17ydmiISYxKR929khbGGJP9e6oIo+MUp8nvwTKMHBwSagJ7FjVSFIXERgOaPE /Z+z2UEcZoEHzBIdzzexgnQLCwRIvJ3ZBWazCKhKNKx5yghi8wp4Sazq6WOC2CAncfNcJ9hm TgFvic+rJoDVCAHVXJm3kHUCI98CRoZVjCKppcW56bnFhnrFibnFpXnpesn5uZsYgRG77djP zTsYL20MPsQowMGoxMOrEfk1Wog1say4MvcQowQHs5IIb0cUUIg3JbGyKrUoP76oNCe1+BCj KdBRE5mlRJPzgckkryTe0NTQ3MLS0NzY3NjMQkmc97xBZZSQQHpiSWp2ampBahFMHxMHp1QD 46z0npwZl9uePOU1eWHlpNnJ1firrIOraca5U99mBFevr/E7YHyGwXtOtkn3hZ3fVP2088oY Y7Z+v7WRrTg3Wu2FsdTLiect9M9fEZMXcaxTqBe1kd874f/CU5nLvys+dd+Zek7894xKBdU1 M600Vr3eYCMn99n+HNtXHScXe/PfW1f/+j/PSomlOCPRUIu5qDgRAEGu3tTuAgAA X-CMS-MailID: 20181121180204eucas1p1c5891d498aa59c0e10dd3ba4727a4382 X-Msg-Generator: CA X-RootMTR: 20181121180204eucas1p1c5891d498aa59c0e10dd3ba4727a4382 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181121180204eucas1p1c5891d498aa59c0e10dd3ba4727a4382 References: <1542823301-23563-1-git-send-email-l.luba@partner.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 patch adds support for handling suspend/resume process. It uses atomic variables to make sure no race condition affects the process. The patch draws on Tobias Jakobi's work posted ~2 years ago, who tried to solve issue with devfreq device's frequency during suspend/resume. During the discussion on LKML some corner cases and comments appeared related to the design. This patch address them keeping in mind suggestions from Chanwoo Choi. Suggested-by: Tobias Jakobi Suggested-by: Chanwoo Choi Signed-off-by: Lukasz Luba --- drivers/devfreq/devfreq.c | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index cf9c643..7e09de8 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -872,14 +872,33 @@ EXPORT_SYMBOL(devm_devfreq_remove_device); */ int devfreq_suspend_device(struct devfreq *devfreq) { - if (!devfreq) - return -EINVAL; + int ret; + unsigned long prev_freq; + u32 flags = 0; + + if (!devfreq) + return -EINVAL; + + if (devfreq->governor) { + ret = devfreq->governor->event_handler(devfreq, + DEVFREQ_GOV_SUSPEND, NULL); + if (ret) + return ret; + } - if (!devfreq->governor) - return 0; + if (devfreq->suspend_freq) { + if (atomic_inc_return(&devfreq->suspend_count) > 1) + return 0; - return devfreq->governor->event_handler(devfreq, - DEVFREQ_GOV_SUSPEND, NULL); + ret = devfreq_set_target(devfreq, devfreq->suspend_freq, + &prev_freq, flags); + if (ret) + return ret; + + devfreq->resume_freq = prev_freq; + } + + return 0; } EXPORT_SYMBOL(devfreq_suspend_device); @@ -893,9 +912,23 @@ EXPORT_SYMBOL(devfreq_suspend_device); */ int devfreq_resume_device(struct devfreq *devfreq) { + int ret; + unsigned long prev_freq; + u32 flags = 0; + if (!devfreq) return -EINVAL; + if (devfreq->suspend_freq) { + if (atomic_dec_return(&devfreq->suspend_count) >= 1) + return 0; + + ret = devfreq_set_target(devfreq, devfreq->resume_freq, + &prev_freq, flags); + if (ret) + return ret; + } + if (!devfreq->governor) return 0; From patchwork Wed Nov 21 18:01:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Luba X-Patchwork-Id: 10692905 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 758491751 for ; Wed, 21 Nov 2018 18:02:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6159A2C3B8 for ; Wed, 21 Nov 2018 18:02:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 553D12C420; Wed, 21 Nov 2018 18:02:37 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 DAC2F2C401 for ; Wed, 21 Nov 2018 18:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730823AbeKVEh6 (ORCPT ); Wed, 21 Nov 2018 23:37:58 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:60214 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732887AbeKVEhb (ORCPT ); Wed, 21 Nov 2018 23:37:31 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181121180207euoutp0230e78c41b469611ed016862fa251fde8~pNaRwwBAB1795517955euoutp02E for ; Wed, 21 Nov 2018 18:02:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181121180207euoutp0230e78c41b469611ed016862fa251fde8~pNaRwwBAB1795517955euoutp02E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1542823327; bh=axMoCdjjhQCxHj2Q1e8pQzBP0D1acRsUCt4LxqCbmyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MwK0PQhaPHWj6hoEkprkeWu/62ovg6f226P9H4PVg18+eiwGqHkTjT/bJ++z7J4Ua IksdapoVw8ZsHbkdAxNkWNGQl1YC0sa8vNXxJ8BTY1loZe5Tml1+V+YRT7IZrp5fYt MbEaxYVNo+vImmok6xRCtN2m6W4vYwSobQmnbOBc= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181121180206eucas1p143bfcd4572435bcb997b49b95d6d17dc~pNaQrRJhe3116331163eucas1p1g; Wed, 21 Nov 2018 18:02:06 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 19.89.04294.E9D95FB5; Wed, 21 Nov 2018 18:02:06 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181121180205eucas1p1dc52369476400cd07058d232bd8dbcd7~pNaPq-yFi3115931159eucas1p1W; Wed, 21 Nov 2018 18:02:05 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20181121180205eusmtrp2c0f09882ef4f00cb548235e0fe26c4b3~pNaPbcUsd0880108801eusmtrp2I; Wed, 21 Nov 2018 18:02:05 +0000 (GMT) X-AuditID: cbfec7f4-835ff700000010c6-c5-5bf59d9eb799 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 0E.48.04284.D9D95FB5; Wed, 21 Nov 2018 18:02:05 +0000 (GMT) Received: from AMDC3778.DIGITAL.local (unknown [106.120.51.20]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181121180204eusmtip2a122851a9fd70407df58db04269308ad~pNaOjDyEp1642316423eusmtip2P; Wed, 21 Nov 2018 18:02:04 +0000 (GMT) From: Lukasz Luba To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org Cc: tjakobi@math.uni-bielefeld.de, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz, gregkh@linuxfoundation.org, keescook@chromium.org, anton@enomsg.org, ccross@android.com, tony.luck@intel.com, robh+dt@kernel.org, mark.rutland@arm.com, kgene@kernel.org, krzk@kernel.org, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, Lukasz Luba Subject: [PATCH 4/6] devfreq: add devfreq_suspend/resume() functions Date: Wed, 21 Nov 2018 19:01:39 +0100 Message-Id: <1542823301-23563-5-git-send-email-l.luba@partner.samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542823301-23563-1-git-send-email-l.luba@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSbVBMYRTHe+7L3tuyubboDA3NKlONytuHZyYMow93MCbjUy3D0lVGm+xV hGFFSqEGU4a2mKRsJSVbthdaS/T+MnnJbIMYQxhshRlir7v49nv+5/zP/8yZhyXVY/QMdnvi bsGQqEvQKJSU5f737tBC05h2vqlEhVtuBuPqc1U0rqsep/Hj0Tc0LrJ30fhIcZUCd2Trcc7w CIm7u68zuDPtPYMHjX74/NkmAtcMP6Jxv7VAgZ0n7Qif624mcKXdweCSx70Efna4TIEdbfdc M9r7aJzeZGfwsfJPNH7fM0QtB97SYKH5isIKxF8w9lJ8bs4XxBc3viX4GvNxBX/bVMHwNy4f 4ifuM3zLx0aCrx3IoPhTtWbEl5V/ZXhnzaworxjlklghYXuKYAhftlkZb6l8RSQ1++19kTOB jOidbxbyZIFbDNnDPQqJ1VwZgoy2eVlI6eJRBHbna0J+OBHY8qzor8PZ04jkQikC5+AP4p9l cLyTykIsq+DCo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aPE /Z+z2UEcZoEHzBIdzzexgnQLC7hInGn+wAhiswioSuxtmgw2lVfAS2LOvTksEBvkJG6e62QG sTkFvCU+r5oAVi8EVHNl3kLWCYx8CxgZVjGKpJYW56bnFhvqFSfmFpfmpesl5+duYgRG7LZj PzfvYLy0MfgQowAHoxIPr0bk12gh1sSy4srcQ4wSHMxKIrwdUUAh3pTEyqrUovz4otKc1OJD jKZAR01klhJNzgcmk7ySeENTQ3MLS0NzY3NjMwslcd7zBpVRQgLpiSWp2ampBalFMH1MHJxS DYy+u9/F2lf+YvblDnt3JGqp5aarQV+OGuu8evzzw0JXWceIZ1pRa8y1L69YpbAqftOlgOay /SUa2y4aKJTHn9vGf+ipvvrUJfKl/++IXtXaXKQ085iP0LN5bY2rAy9ap1Rbzi70tuS2mi9a y1LY/evvRZMd599LPDtmZ9RqP1Fa5fSjAr/ZLGZKLMUZiYZazEXFiQAcq5Dr7gIAAA== X-CMS-MailID: 20181121180205eucas1p1dc52369476400cd07058d232bd8dbcd7 X-Msg-Generator: CA X-RootMTR: 20181121180205eucas1p1dc52369476400cd07058d232bd8dbcd7 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181121180205eucas1p1dc52369476400cd07058d232bd8dbcd7 References: <1542823301-23563-1-git-send-email-l.luba@partner.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 This patch adds implementation for global suspend/resume for devfreq framework. System suspend will next use these functions. The patch draws on Tobias Jakobi's work posted ~2 years ago, who tried to solve issue with devfreq device's frequency during suspend/resume. During the discussion on LKML some corner cases and comments appeared related to the design. This patch address them keeping in mind suggestions from Chanwoo Choi. Suggested-by: Tobias Jakobi Suggested-by: Chanwoo Choi Signed-off-by: Lukasz Luba --- drivers/devfreq/devfreq.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/devfreq.h | 7 +++++++ 2 files changed, 56 insertions(+) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 7e09de8..2f4391c 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -44,6 +44,9 @@ static LIST_HEAD(devfreq_governor_list); static LIST_HEAD(devfreq_list); static DEFINE_MUTEX(devfreq_list_lock); +/* Flag showing state of suspend/resume */ +static bool devfreq_suspended; + /** * find_device_devfreq() - find devfreq struct using device pointer * @dev: device pointer used to lookup device devfreq. @@ -938,6 +941,52 @@ int devfreq_resume_device(struct devfreq *devfreq) EXPORT_SYMBOL(devfreq_resume_device); /** + * devfreq_suspend() - Suspend devfreq governors and devices + * + * Called during system wide Suspend/Hibernate cycles for suspending governors + * and devices preserving the state for resume. On some platforms the devfreq + * device must have precise state (frequency) after resume in order to provide + * fully operating setup. + */ +void devfreq_suspend(void) +{ + struct devfreq *devfreq; + int ret; + + mutex_lock(&devfreq_list_lock); + list_for_each_entry(devfreq, &devfreq_list, node) { + ret = devfreq_suspend_device(devfreq); + if (ret) + dev_warn(&devfreq->dev, "device suspend failed\n"); + } + mutex_unlock(&devfreq_list_lock); + + devfreq_suspended = true; +} + +/** + * devfreq_resume() - Resume devfreq governors and devices + * + * Called during system wide Suspend/Hibernate cycle for resuming governors and + * devices that are suspended with devfreq_suspend(). + */ +void devfreq_resume(void) +{ + struct devfreq *devfreq; + int ret; + + devfreq_suspended = false; + + mutex_lock(&devfreq_list_lock); + list_for_each_entry(devfreq, &devfreq_list, node) { + ret = devfreq_resume_device(devfreq); + if (ret) + dev_warn(&devfreq->dev, "device resume failed\n"); + } + mutex_unlock(&devfreq_list_lock); +} + +/** * devfreq_add_governor() - Add devfreq governor * @governor: the devfreq governor to be added */ diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 7fe96f9..4f0fea8 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -202,6 +202,10 @@ extern void devm_devfreq_remove_device(struct device *dev, extern int devfreq_suspend_device(struct devfreq *devfreq); extern int devfreq_resume_device(struct devfreq *devfreq); + +extern void devfreq_suspend(void); +extern void devfreq_resume(void); + /** * update_devfreq() - Reevaluate the device and configure frequency * @devfreq: the devfreq device @@ -396,6 +400,9 @@ static inline int devfreq_update_stats(struct devfreq *df) { return -EINVAL; } + +static inline void devfreq_suspend(void) {} +static inline void devfreq_resume(void) {} #endif /* CONFIG_PM_DEVFREQ */ #endif /* __LINUX_DEVFREQ_H__ */ From patchwork Wed Nov 21 18:01:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Luba X-Patchwork-Id: 10692889 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D285C16B1 for ; Wed, 21 Nov 2018 18:02:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0DB32C365 for ; Wed, 21 Nov 2018 18:02:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B518C2C3FC; Wed, 21 Nov 2018 18:02:13 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 517AB2C3DA for ; Wed, 21 Nov 2018 18:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732910AbeKVEhd (ORCPT ); Wed, 21 Nov 2018 23:37:33 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:38140 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732895AbeKVEhd (ORCPT ); Wed, 21 Nov 2018 23:37:33 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181121180209euoutp01ea1bf8f000f777fa54659506c2600255~pNaTDHpIW0775807758euoutp01N for ; Wed, 21 Nov 2018 18:02:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181121180209euoutp01ea1bf8f000f777fa54659506c2600255~pNaTDHpIW0775807758euoutp01N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1542823329; bh=3eynck/Mbf+ZgIWq9XJF/pjnq3tsISXoGoWYpyo2FUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jtG+xexeE9AQba+OvgiiqFQgGLv6JqcP2ma+gpOJ5tjlGxkuHKI4+eObV0YG3bDQ8 zRNBjlUc4rz/sOpn/7dOvT4ucHe2t5Hq5fOP4zHOffgMCoIl88nYG0FSAhn9CbjnOJ lDTXHswEd1+EsXqbPB/9o0Jcr+3gYZunajL3amRs= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181121180207eucas1p1984d3830de52a6d5783c34bbe03355ba~pNaR54O4K0464304643eucas1p1G; Wed, 21 Nov 2018 18:02:07 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id EA.89.04294.F9D95FB5; Wed, 21 Nov 2018 18:02:07 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20181121180206eucas1p265865226e3938a28e842e8367233dc2e~pNaRBfqc-0549405494eucas1p2m; Wed, 21 Nov 2018 18:02:06 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181121180206eusmtrp1888e0e8f99a9e105bba70175f01f43a4~pNaQx2BEb2594725947eusmtrp1q; Wed, 21 Nov 2018 18:02:06 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-c8-5bf59d9f0fb0 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id CD.7C.04128.E9D95FB5; Wed, 21 Nov 2018 18:02:06 +0000 (GMT) Received: from AMDC3778.DIGITAL.local (unknown [106.120.51.20]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181121180205eusmtip2c70961094a7fbf7d8744cc6b268294be~pNaP26cYI1293112931eusmtip2X; Wed, 21 Nov 2018 18:02:05 +0000 (GMT) From: Lukasz Luba To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org Cc: tjakobi@math.uni-bielefeld.de, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz, gregkh@linuxfoundation.org, keescook@chromium.org, anton@enomsg.org, ccross@android.com, tony.luck@intel.com, robh+dt@kernel.org, mark.rutland@arm.com, kgene@kernel.org, krzk@kernel.org, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, Lukasz Luba Subject: [PATCH 5/6] drivers: power: suspend: call devfreq suspend/resume Date: Wed, 21 Nov 2018 19:01:40 +0100 Message-Id: <1542823301-23563-6-git-send-email-l.luba@partner.samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542823301-23563-1-git-send-email-l.luba@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSf0yMcRzH+z4/7nkuLk9X05cs242tQtcZ8yVM44+HttZm/lBMR88KXXFP RYSTqev8KL+SSCat61zlUldSWtdx/dD1wxSFmcSiGq60xpo7T63/Xt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/4jdXi+pfnrBbzj5xjtWhevJ7N4kx3rkX/49fMFufPb2C3ONv0ht3iVoOMxawpe5ksNj2+ xmpxedccNovPvUcYLWac38dksfbIXXaLpdcvMlncblzBZnH31FGgGacvsVq07j3CbtG2+gOr xZsL91gcJDy27d7G6rFm3hpGj9kNF1k8JvR/YvRYvOclk8emVZ1sHvvnrmH32Lyk3uPfMXaP g+/2MHlsudrO4tG3ZRWjx4rV39k9Pm+SC+CL0rMpyi8tSVXIyC8usVWKNrQw0jO0tNAzMrHU MzQ2j7UyMlXSt7NJSc3JLEst0rdL0MuYMXcbU8E57oqdxwUbGJ9ydjFyckgImEj8fNbH2sXI xSEksJRR4nLPWXaIhJjEpH3boWxhiT/Xutggij4xSlx9uYq5i5GDg01AT2LHqkKQuIjAckaJ +z9ns4M4zAIPmCU6nm9iBekWFvCUOLexgwXEZhFQlXjUcYgZxOYV8JLY+m4/K8QGOYmb5zrB 4pwC3hKfV01gBLGFgGquzFvIOoGRbwEjwypGkdTS4tz03GIjveLE3OLSvHS95PzcTYzAeN12 7OeWHYxd74IPMQpwMCrx8GpEfo0WYk0sK67MPcQowcGsJMLbEQUU4k1JrKxKLcqPLyrNSS0+ xGgKdNREZinR5HxgKskriTc0NTS3sDQ0NzY3NrNQEuc9b1AZJSSQnliSmp2aWpBaBNPHxMEp 1cAYu4BZwGti+qTzl/Idb4qY6q07snsRX/MrfrFV/Z/WWj6Zpt7hEaxhE6AeVdew9HTrt9h1 P3ZuuRwXPLFk4wSxGZLn9vwQqdL4+eXH5LXHN5fnb194XHnL7z9Wt/+sK91apsj/5/rL58pf /TZoGkRzP1x26uHD9TN5mQvDXyqofpq9SO1j8rFTx5RYijMSDbWYi4oTAcxK99ztAgAA X-CMS-MailID: 20181121180206eucas1p265865226e3938a28e842e8367233dc2e X-Msg-Generator: CA X-RootMTR: 20181121180206eucas1p265865226e3938a28e842e8367233dc2e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181121180206eucas1p265865226e3938a28e842e8367233dc2e References: <1542823301-23563-1-git-send-email-l.luba@partner.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 Devfreq framework supports suspend of its devices. Call the the devfreq interface and allow devfreq devices preserve/restore their states during suspend/resume. The patch draws on Tobias Jakobi's work posted ~2 years ago, who tried to solve issue with devfreq device's frequency during suspend/resume. During the discussion on LKML some corner cases and comments appeared related to the design. This patch address them keeping in mind suggestions from Chanwoo Choi. Suggested-by: Tobias Jakobi Signed-off-by: Lukasz Luba Reviewed-by: Chanwoo Choi --- drivers/base/power/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index a690fd4..0992e67 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "../base.h" @@ -1078,6 +1079,7 @@ void dpm_resume(pm_message_t state) dpm_show_time(starttime, state, 0, NULL); cpufreq_resume(); + devfreq_resume(); trace_suspend_resume(TPS("dpm_resume"), state.event, false); } @@ -1852,6 +1854,7 @@ int dpm_suspend(pm_message_t state) trace_suspend_resume(TPS("dpm_suspend"), state.event, true); might_sleep(); + devfreq_suspend(); cpufreq_suspend(); mutex_lock(&dpm_list_mtx); From patchwork Wed Nov 21 18:01:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Luba X-Patchwork-Id: 10692893 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C330B5A4 for ; Wed, 21 Nov 2018 18:02:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B10992C3E8 for ; Wed, 21 Nov 2018 18:02:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A49A72C406; Wed, 21 Nov 2018 18:02:19 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 460BE2C41A for ; Wed, 21 Nov 2018 18:02:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732913AbeKVEhe (ORCPT ); Wed, 21 Nov 2018 23:37:34 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:60191 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732888AbeKVEhd (ORCPT ); Wed, 21 Nov 2018 23:37:33 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181121180210euoutp0242d68d0a8ec81016c577243371bbef47~pNaUTXbKS1795517955euoutp02H for ; Wed, 21 Nov 2018 18:02:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181121180210euoutp0242d68d0a8ec81016c577243371bbef47~pNaUTXbKS1795517955euoutp02H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1542823330; bh=qggsqlasb+ZB/6Cp6CuX0fwsS0GDjW2gfsWln0LyFq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=stmSg/u8/MwLYZ94mB+HHc3qazwZKIi2j+7ePahihmVLuV/c4AamikfAFt/5boTrE +/IbR43wKwHcY1SYQ15Qk9kkQSY2OPsIyN6E44Le2TB54sJumuWIhabEBgaVMZbEOM ZwEC12PxIAZ2gvcwl+VtlBxpKOarmZubkV3gumYA= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181121180209eucas1p1d853ab615626002510a03881fe6e14f1~pNaTNlI7j1762417624eucas1p1g; Wed, 21 Nov 2018 18:02:09 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 7C.89.04294.0AD95FB5; Wed, 21 Nov 2018 18:02:08 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181121180208eucas1p11482a783ab1b1bceb8c9f6a1f50682c3~pNaSP_TVv3115931159eucas1p1Z; Wed, 21 Nov 2018 18:02:08 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181121180207eusmtrp161dc8d370b03e6455a15ba273a48071f~pNaSAW94I2594725947eusmtrp1r; Wed, 21 Nov 2018 18:02:07 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-ca-5bf59da057ad Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 7F.7C.04128.F9D95FB5; Wed, 21 Nov 2018 18:02:07 +0000 (GMT) Received: from AMDC3778.DIGITAL.local (unknown [106.120.51.20]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181121180207eusmtip27d65ca12b1f53f0fe3942e0c93d2b410~pNaRI7Dnc1642316423eusmtip2Q; Wed, 21 Nov 2018 18:02:07 +0000 (GMT) From: Lukasz Luba To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org Cc: tjakobi@math.uni-bielefeld.de, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz, gregkh@linuxfoundation.org, keescook@chromium.org, anton@enomsg.org, ccross@android.com, tony.luck@intel.com, robh+dt@kernel.org, mark.rutland@arm.com, kgene@kernel.org, krzk@kernel.org, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, Lukasz Luba Subject: [PATCH 6/6] arm: dts: exynos4: set opp-suspend for DMC and leftbus Date: Wed, 21 Nov 2018 19:01:41 +0100 Message-Id: <1542823301-23563-7-git-send-email-l.luba@partner.samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542823301-23563-1-git-send-email-l.luba@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSa0hTYRjHe8/d5eQ4pV40DAaBJmlF4AtKF/LDIQn8EESa5KqDhc5qJ68F zcprlpZdvDvzNufKXLpsaqGtLG15CdMsQzDS0sLczATTNo/Wt9/zf/7/53l4eRlc9pv0YE7G nuVVsYoYOSUhjC/me7ZoSmbDtw5dCkTtTT6oIb+eRI8afpFo0DZOojLzGxJdqqin0OsrSpQz Nomjnp4HNLJcnKLRsHoDKrzZhiHD2DsSvTUVU8h61QxQfs8TDN0zj9CoarAPQx9StBQa6Xpu n9HdT6LUNjON0uqmSTTV+4nYDTlji5Hk9KV6wBWp+wguN2cGcBWtXzHOoMukuKclepp7WHmB W3xBc+0/WjGucSCd4K416gCnrZujOavBK9QlTBJ0nI85Gc+r/HdGSk5Mv79Hn06XJrb036LV QCfJAk4MZHfAm2PTVBaQMDJWC+A3QykpFjYAh7umgFhYAUx5PIyvRp5dz8PERg2A+vwC6l9k 8m6DPc8wFOsHm3VnHAF3tgLA/mYfhwdnX+LQ9PMG5mi4sSFwXD28zAS7CU6UzZAOlrL74Pfy eVLc5gXfv8lc3uxk91t1ucsnQbaWgebPHbRoCoY2TdMKu8FvnY0rvAF252UTIgvQkqGjRD4P 0181r3gC4bPOvuWjcdYH1pv8RXkPnL82QDlkyLrAoe+uDhm34w3jH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6OFWBPLiitzDzFKcDArifB2RAGFeFMSK6tSi/Lji0pzUosP MZoCHTWRWUo0OR+YTPJK4g1NDc0tLA3Njc2NzSyUxHnPG1RGCQmkJ5akZqemFqQWwfQxcXBK NTCenSfwj03pQd+0j9nbGg9+VFv/8fbEidXvXk1/e8Vusj3L3NKOSckvQ9Y2XGFbujJ6l1JU j5mW5dozzA7ZTl7aJitmx+axtv3etXN60M/ejk+yVtlNuwqEb7cUPni+fqXGcduJ4Xs+inKG rH/PUGN9332+sHylW9DsUKnTR1iTK9ST+QJ37xVRYinOSDTUYi4qTgQAzHcrO+4CAAA= X-CMS-MailID: 20181121180208eucas1p11482a783ab1b1bceb8c9f6a1f50682c3 X-Msg-Generator: CA X-RootMTR: 20181121180208eucas1p11482a783ab1b1bceb8c9f6a1f50682c3 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181121180208eucas1p11482a783ab1b1bceb8c9f6a1f50682c3 References: <1542823301-23563-1-git-send-email-l.luba@partner.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 Mark the state for devfreq device while entring suspend/resume process. The patch draws on Tobias Jakobi's work posted ~2 years ago, who tried to solve issue with devfreq device's frequency during suspend/resume. During the discussion on LKML some corner cases and comments appeared related to the design. This patch address them keeping in mind suggestions from Chanwoo Choi. Suggested-by: Tobias Jakobi Suggested-by: Chanwoo Choi Signed-off-by: Lukasz Luba Reviewed-by: Chanwoo Choi --- arch/arm/boot/dts/exynos4210.dtsi | 2 ++ arch/arm/boot/dts/exynos4412.dtsi | 2 ++ 2 files changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi index b6091c2..4429b72 100644 --- a/arch/arm/boot/dts/exynos4210.dtsi +++ b/arch/arm/boot/dts/exynos4210.dtsi @@ -298,6 +298,7 @@ opp-400000000 { opp-hz = /bits/ 64 <400000000>; opp-microvolt = <1150000>; + opp-suspend; }; }; @@ -367,6 +368,7 @@ }; opp-200000000 { opp-hz = /bits/ 64 <200000000>; + opp-suspend; }; }; }; diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi index 51f72f0..908c0c4 100644 --- a/arch/arm/boot/dts/exynos4412.dtsi +++ b/arch/arm/boot/dts/exynos4412.dtsi @@ -432,6 +432,7 @@ opp-400000000 { opp-hz = /bits/ 64 <400000000>; opp-microvolt = <1050000>; + opp-suspend; }; }; @@ -520,6 +521,7 @@ opp-200000000 { opp-hz = /bits/ 64 <200000000>; opp-microvolt = <1000000>; + opp-suspend; }; };