From patchwork Mon Dec 3 14:31:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Luba X-Patchwork-Id: 10709683 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 CAB8115A6 for ; Mon, 3 Dec 2018 14:32:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B971D2AF39 for ; Mon, 3 Dec 2018 14:32:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA90E2AF44; Mon, 3 Dec 2018 14:32: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=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 440D12AF39 for ; Mon, 3 Dec 2018 14:32:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726635AbeLCOcr (ORCPT ); Mon, 3 Dec 2018 09:32:47 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:47610 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726600AbeLCOcq (ORCPT ); Mon, 3 Dec 2018 09:32:46 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181203143131euoutp025c27276db988bfd5b510700cbc422c84~s2R02VjKQ0761407614euoutp024 for ; Mon, 3 Dec 2018 14:31:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181203143131euoutp025c27276db988bfd5b510700cbc422c84~s2R02VjKQ0761407614euoutp024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1543847491; bh=hQaTflaPAMrXhPUYetvubirH4OuUf8G7UubV1XcVpX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f1h6Yd0d/aw/GaSDBOASRGsMOGXAeTKGW3Fn8s+jvDpO/b8LeFwJFlfCyDI4sfb7+ UizncwVpS1BmHnomTF4SB25mJ2Vb/sReTmxbiLA6ayuNMwOUPCpXKcl/nhEYDSAIv9 Hzthb5t4MmfTAzLOTN0dBb7UkmHZT3fMb6zyV3ag= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181203143130eucas1p24a0d75463ca5060e53476c03cba2b462~s2Rzq4End0423304233eucas1p2V; Mon, 3 Dec 2018 14:31:30 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id EA.CA.04441.24E350C5; Mon, 3 Dec 2018 14:31:30 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20181203143129eucas1p2955b6becc60ee57110cbc52f6e4f60c5~s2Ry5wXfg0265802658eucas1p2w; Mon, 3 Dec 2018 14:31:29 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181203143129eusmtrp1740db19da50ae1b486db1b6a94838b53~s2Ryp7pK91650116501eusmtrp1k; Mon, 3 Dec 2018 14:31:29 +0000 (GMT) X-AuditID: cbfec7f2-5c9ff70000001159-a7-5c053e429b2c Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 21.F8.04128.14E350C5; Mon, 3 Dec 2018 14:31:29 +0000 (GMT) Received: from AMDC3778.DIGITAL.local (unknown [106.120.51.20]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181203143128eusmtip2050810cd61bd1a904e1e5193d81b6d33~s2Rxtc6xo0581705817eusmtip26; Mon, 3 Dec 2018 14:31:28 +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 v2 1/5] devfreq: refactor set_target frequency function Date: Mon, 3 Dec 2018 15:31:11 +0100 Message-Id: <1543847475-7600-2-git-send-email-l.luba@partner.samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543847475-7600-1-git-send-email-l.luba@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSfUzMcRzH+/6ei8vP1fJZyJzZqqm02Xw3tJjND5v5hz9i4/BbNd3J/XqQ hzkhlZTnDCdW5jpHyjnXk3SdQnq4lNKDaW1MCj2hebzrd+a/1/f9eX/en8/3uy9HKr/TgVy8 NknUadUJKsaHstZPNoetiqK3Lv447ItrH4Tg0kslNH5Y+pXGnePvaVzgaKbx0cISBr84qcF5 Ax9J3NJyj8VN6UMs7tbPwZfPVxO4bOAVjV9WXGXw2CkHwpdaHhH4jqOPxTc7nQTuOWJkcN/z J66MxjYaH692sDjj9hcaD7W+oaJBsFZaacF8zYyEK3onJZzOG0VCYdUHQigzZTFCjcHMCveL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rFj9nd3j8ya5AL4oPZui/NKSVIWM/OISW6VoQwsjPUNLCz0jE0s9 Q2PzWCsjUyV9O5uU1JzMstQifbsEvYxXnXeYCpZIVHzsXszUwLhSpIuRk0NCwETi4capTF2M XBxCAksZJSb9+8cKkRCTmLRvOzuELSzx51oXG0TRJ0aJrc+bGbsYOTjYBPQkdqwqBImLCCxn lLj/czY7iMMs8IBZouP5JrBJwgLuEmv3H2cGsVkEVCUeHjgFZvMKeEq8+nmQGWKDnMTNc51g NqeAl8SUFfPBbCGgmpa9K5gnMPItYGRYxSiSWlqcm55bbKRXnJhbXJqXrpecn7uJERix2479 3LKDsetd8CFGAQ5GJR5eh3iWGCHWxLLiytxDjBIczEoivAWFQCHelMTKqtSi/Pii0pzU4kOM pkBHTWSWEk3OByaTvJJ4Q1NDcwtLQ3Njc2MzCyVx3vMGlVFCAumJJanZqakFqUUwfUwcnFIN jDw/dHoMjqjse3PpJtO88iVr4uW3KQvt8Os4fs3pq54TX+jyl/unOp1RWlD1/Nc3mU37GKNf SL9+t/ZB4t0nz/6uvxQ6l7Xg83bJqmOcgsuPx17vXpnbabV3mqr1uZlNTEsWuF/Ysu5R7tZD O387CbVyqG8xC9+hp+OSrGZQt59J+M23qKr9c2uUWIozEg21mIuKEwGk5vXm7gIAAA== X-CMS-MailID: 20181203143129eucas1p2955b6becc60ee57110cbc52f6e4f60c5 X-Msg-Generator: CA X-RootMTR: 20181203143129eucas1p2955b6becc60ee57110cbc52f6e4f60c5 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181203143129eucas1p2955b6becc60ee57110cbc52f6e4f60c5 References: <1543847475-7600-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 is based on earlier work by Tobias Jakobi. Suggested-by: Tobias Jakobi Suggested-by: Chanwoo Choi Signed-off-by: Lukasz Luba Reviewed-by: Chanwoo Choi --- drivers/devfreq/devfreq.c | 62 +++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 1414130..a9fd61b 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -285,6 +285,40 @@ static int devfreq_notify_transition(struct devfreq *devfreq, return 0; } +static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_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; + return err; +} + /* Load monitoring helper functions for governors use */ /** @@ -296,8 +330,7 @@ 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; + unsigned long freq, min_freq, max_freq; int err = 0; u32 flags = 0; @@ -333,31 +366,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, 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 Mon Dec 3 14:31:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Luba X-Patchwork-Id: 10709661 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 DAC6713AF for ; Mon, 3 Dec 2018 14:31:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC32E2AF3B for ; Mon, 3 Dec 2018 14:31:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF9572AF45; Mon, 3 Dec 2018 14:31: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=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 2A87B2AF3B for ; Mon, 3 Dec 2018 14:31:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726652AbeLCOcs (ORCPT ); Mon, 3 Dec 2018 09:32:48 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:60101 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726651AbeLCOcr (ORCPT ); Mon, 3 Dec 2018 09:32:47 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181203143133euoutp0119f7c4c17447109de0318b944aff85fd~s2R2Pcf-g1388213882euoutp01H for ; Mon, 3 Dec 2018 14:31:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181203143133euoutp0119f7c4c17447109de0318b944aff85fd~s2R2Pcf-g1388213882euoutp01H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1543847493; bh=w+BlRpdqKvggRP/1B2UEMzjpnXHjefN/rpyWfn4V+gs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rT0OWUcAqUdu2dodcB0waa/I6EzrtZo+KS4c8QqhqfJb3lzN/B09USE5v54EDHojF TBR5l/qpk8DEVIUMU2vOE22hMpJBLFA/EHrAAgDiaspSRCJBIWMDrNyESiwL4gXIxo 8d6hAe2HRo0ssMszsydce0TfiIRu7Slm74dMRR4Q= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181203143131eucas1p2e077f58c737b03353390c0706b87bfaf~s2R1B1hEV0831808318eucas1p2Q; Mon, 3 Dec 2018 14:31:31 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 46.54.04806.34E350C5; Mon, 3 Dec 2018 14:31:31 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20181203143131eucas1p217f22ac6d19682a54a57658a06980914~s2R0LbfDP0453504535eucas1p2a; Mon, 3 Dec 2018 14:31:31 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181203143131eusmtrp1be9a8eaf8582b45c1a0bdd8701131085~s2R0JW2oO1676416764eusmtrp13; Mon, 3 Dec 2018 14:31:31 +0000 (GMT) X-AuditID: cbfec7f5-79db79c0000012c6-27-5c053e43e466 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 14.F8.04128.24E350C5; Mon, 3 Dec 2018 14:31:30 +0000 (GMT) Received: from AMDC3778.DIGITAL.local (unknown [106.120.51.20]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181203143130eusmtip24e3123475b3b18edc668ea7611719663~s2RzO-rpo0554705547eusmtip2N; Mon, 3 Dec 2018 14:31:29 +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 v2 2/5] devfreq: add support for suspend/resume of a devfreq device Date: Mon, 3 Dec 2018 15:31:12 +0100 Message-Id: <1543847475-7600-3-git-send-email-l.luba@partner.samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543847475-7600-1-git-send-email-l.luba@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0VSfUyMcRz3e17ueYrj6Q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AAAAAA+NgFrrNIsWRmVeSWpSXmKPExsVy+t/xe7pOdqwxBsv2W1kc3KppsXHGelaL 7Ru/sVpc//Kc1WL+kXOsFs2L17NZnOnOteh//JrZ4vz5DewWZ5vesFvcapCxmDVlL5PFpsfX WC0u75rDZvG59wijxYzz+5gs1h65y26x9PpFJovbjSvYLO6eOgo04/QlVovWvUfYLdpWf2C1 eHPhHouDhMe23dtYPdbMW8PoMbvhIovHhP5PjB6L97xk8ti0qpPNY//cNewem5fUe/w7xu5x 8N0eJo8tV9tZPPq2rGL0WLH6O7vH501yAXxRejZF+aUlqQoZ+cUltkrRhhZGeoaWFnpGJpZ6 hsbmsVZGpkr6djYpqTmZZalF+nYJehknHrWwF/QrVNz/to+xgXGTVBcjJ4eEgIlE+5nL7F2M XBxCAksZJZ62nWWDSIhJTNq3nR3CFpb4c62LDaLoE6NE96e7zF2MHBxsAnoSO1YVgsRFBJYz Stz/ORtsErPAA2aJjuebWEG6hQWCJZbvvQM2lUVAVeLliSPMIDavgKfEvvkPoDbISdw81wkW 5xTwkpiyYj6YLQRU07J3BfMERr4FjAyrGEVSS4tz03OLjfSKE3OLS/PS9ZLzczcxAiN227Gf W3Ywdr0LPsQowMGoxMPrEM8SI8SaWFZcmXuIUYKDWUmEt6AQKMSbklhZlVqUH19UmpNafIjR FOioicxSosn5wGSSVxJvaGpobmFpaG5sbmxmoSTOe96gMkpIID2xJDU7NbUgtQimj4mDU6qB MXDvgedBu46w5mqKy89TF7pgm8jE22IuU+S36cAac+eDEa8tBW64y64W9nITsj201neO/usn YjwPWdqFQzIFI0Xdlkwpb35ttJm33qGqeJGX3M3dM0zXLtgQrFF40eP0iz+37zO/Wroy4/OS jGW6jw4cvz9bZ73mLY1/we0H7/7IPvaRzXtFvRJLcUaioRZzUXEiAEuEnMXuAgAA X-CMS-MailID: 20181203143131eucas1p217f22ac6d19682a54a57658a06980914 X-Msg-Generator: CA X-RootMTR: 20181203143131eucas1p217f22ac6d19682a54a57658a06980914 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181203143131eucas1p217f22ac6d19682a54a57658a06980914 References: <1543847475-7600-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. It uses atomic variables to make sure no race condition affects the process. The patch is based on earlier work by Tobias Jakobi. Suggested-by: Tobias Jakobi Suggested-by: Chanwoo Choi Signed-off-by: Lukasz Luba Reviewed-by: Chanwoo choi Reviewed-by: Chanwoo Choi --- drivers/devfreq/devfreq.c | 51 +++++++++++++++++++++++++++++++++++++++-------- include/linux/devfreq.h | 7 +++++++ 2 files changed, 50 insertions(+), 8 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index a9fd61b..36bed24 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -316,6 +316,10 @@ static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_freq, "Couldn't update frequency transition information.\n"); devfreq->previous_freq = new_freq; + + if (devfreq->suspend_freq) + devfreq->resume_freq = cur_freq; + return err; } @@ -667,6 +671,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); @@ -867,14 +874,28 @@ EXPORT_SYMBOL(devm_devfreq_remove_device); */ int devfreq_suspend_device(struct devfreq *devfreq) { + int ret; + if (!devfreq) return -EINVAL; - if (!devfreq->governor) - return 0; + if (devfreq->governor) { + ret = devfreq->governor->event_handler(devfreq, + DEVFREQ_GOV_SUSPEND, NULL); + if (ret) + return ret; + } + + if (devfreq->suspend_freq) { + if (atomic_inc_return(&devfreq->suspend_count) > 1) + return 0; + + ret = devfreq_set_target(devfreq, devfreq->suspend_freq, 0); + if (ret) + return ret; + } - return devfreq->governor->event_handler(devfreq, - DEVFREQ_GOV_SUSPEND, NULL); + return 0; } EXPORT_SYMBOL(devfreq_suspend_device); @@ -888,14 +909,28 @@ EXPORT_SYMBOL(devfreq_suspend_device); */ int devfreq_resume_device(struct devfreq *devfreq) { + int ret; + if (!devfreq) return -EINVAL; - if (!devfreq->governor) - return 0; + if (devfreq->resume_freq) { + if (atomic_dec_return(&devfreq->suspend_count) >= 1) + return 0; - return devfreq->governor->event_handler(devfreq, - DEVFREQ_GOV_RESUME, NULL); + ret = devfreq_set_target(devfreq, devfreq->resume_freq, 0); + if (ret) + return ret; + } + + if (devfreq->governor) { + ret = devfreq->governor->event_handler(devfreq, + DEVFREQ_GOV_RESUME, NULL); + if (ret) + return ret; + } + + return 0; } EXPORT_SYMBOL(devfreq_resume_device); diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index e4963b0..d985199 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -131,6 +131,9 @@ struct devfreq_dev_profile { * @scaling_min_freq: Limit minimum frequency requested by OPP interface * @scaling_max_freq: Limit maximum frequency requested by OPP interface * @stop_polling: devfreq polling status of a device. + * @suspend_freq: frequency of a device set during suspend phase. + * @resume_freq: frequency of a device set in resume phase. + * @suspend_count: suspend requests counter for a device. * @total_trans: Number of devfreq transitions * @trans_table: Statistics of devfreq transitions * @time_in_state: Statistics of devfreq states @@ -167,6 +170,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 Mon Dec 3 14:31:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Luba X-Patchwork-Id: 10709677 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 1E52013AF for ; Mon, 3 Dec 2018 14:32:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FA022AF39 for ; Mon, 3 Dec 2018 14:32:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 031AC2AF44; Mon, 3 Dec 2018 14:32:00 +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 E9AF92AF42 for ; Mon, 3 Dec 2018 14:31:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726680AbeLCOcu (ORCPT ); Mon, 3 Dec 2018 09:32:50 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:60127 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726668AbeLCOct (ORCPT ); Mon, 3 Dec 2018 09:32:49 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181203143134euoutp012d67c4c0b955006a96505efb3948d9de~s2R3y8Enw1581415814euoutp01C for ; Mon, 3 Dec 2018 14:31:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181203143134euoutp012d67c4c0b955006a96505efb3948d9de~s2R3y8Enw1581415814euoutp01C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1543847494; bh=0I7yOkjnylKsWD3hf1wE4Adwd3h2KU4vdxpPqXXSlbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gBw7ripbkIJX7mONdqguBPTuhGNS5dMbc+FmRh6cMu7JNtAL2SP7vKHj6trlwaNZ/ 0ZK2Q1zCDgf3YofUdIb64sfS3yqZxDYa86nAFWm/Bi3SsBJnKdHL6jFTqiIw+McD+C bUt8/AdqM3uy3MlIwDNc/zkIrTJ8zCRKIKQU62xU= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181203143133eucas1p25f169b6fbd4bf3b2925e6fa6f17c7cbf~s2R2po8KE0427504275eucas1p2k; Mon, 3 Dec 2018 14:31:33 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 1E.CA.04441.54E350C5; Mon, 3 Dec 2018 14:31:33 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181203143132eucas1p128c029a7c7461e1127924a08e4a71811~s2R14QSqb1910119101eucas1p1-; Mon, 3 Dec 2018 14:31:32 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181203143132eusmtrp141134970a039111c121a4698eb845a61~s2R1iRyhb1676416764eusmtrp1A; Mon, 3 Dec 2018 14:31:32 +0000 (GMT) X-AuditID: cbfec7f2-5c9ff70000001159-b2-5c053e45d853 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id A2.43.04284.44E350C5; Mon, 3 Dec 2018 14:31:32 +0000 (GMT) Received: from AMDC3778.DIGITAL.local (unknown [106.120.51.20]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181203143131eusmtip282e19bf102766be513b751a76b8cc1af~s2R0mXo4L0581705817eusmtip28; Mon, 3 Dec 2018 14:31:31 +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 v2 3/5] devfreq: add devfreq_suspend/resume() functions Date: Mon, 3 Dec 2018 15:31:13 +0100 Message-Id: <1543847475-7600-4-git-send-email-l.luba@partner.samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543847475-7600-1-git-send-email-l.luba@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSe1BMYRjGfedeWk5bo9d97AxThtSMxjcYt3E5+MNlDDNkWHWmol21RxFm bEwh1RrXwqJC2ZbV2tZOipFNEXZbl5BcBtMQosg9djvhv9/7vM/zPjPffByp7KQHcAnadaJO q05UMf6U/do31+gZk+joiM4awFfKw3BZnoXGF8o6adz4qYXGx5y3abytyMLgm7s02PCilcQu 1zkW39r6lsWP9IPwoX1VBLa+uE/jOxVHGNyR40Q4z3WJwGeczSw+2dhA4Kb0EgY336jx3qj3 0DijysnizNIPNH7rfkJNAcF+0U4L5qNmJBzWN1DCbkM7EooqXxOC1bSTES4bzaxw/sQWoesa K1x5X0kItnvbKSHXZkJCSekXVuiwDpnfZ6n/xFgxMSFV1I2ZtNI//nDxD5RUG7LB3vSd1qPH QVnIjwN+LNz4ZqCzkD+n5EsQNBae7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+Md4S5GTg4JAROJqVPXsHQx cnEICSxllLi+oZ8dIiEmMWnfdihbWOLPtS42iKJPjBKv/u4B6uDgYBPQk9ixqhAkLiKwnFHi /s/Z7CAOs8ADZomO55tYQbqFBdwl9v69zQhiswioSszsW88I0swr4Clx81c4xAI5iZvnOplB bE4BL4kpK+aD2UJAJS17VzBPYORbwMiwilEktbQ4Nz232FCvODG3uDQvXS85P3cTIzBetx37 uXkH46WNwYcYBTgYlXh4HeJZYoRYE8uKK3MPMUpwMCuJ8BYUAoV4UxIrq1KL8uOLSnNSiw8x mgLdNJFZSjQ5H5hK8kriDU0NzS0sDc2NzY3NLJTEec8bVEYJCaQnlqRmp6YWpBbB9DFxcEo1 ME55XuO+U+lnUdG11852XUf5JR6fVbRjOnfh8z/hl4/SJlU/nJCRKHFm380Xls3PVa/evuCk 89miyP76x0jNWPXPpw9nXakUuSw/6bJLUM6tZZ0TN5k7eRY71rSc/rJW+ADP/SOdJ+zV/x4+ zN8xKUn9susRPuFlm0QZJnY1873q+t+e1lH0rkmJpTgj0VCLuag4EQC1+Oc57QIAAA== X-CMS-MailID: 20181203143132eucas1p128c029a7c7461e1127924a08e4a71811 X-Msg-Generator: CA X-RootMTR: 20181203143132eucas1p128c029a7c7461e1127924a08e4a71811 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181203143132eucas1p128c029a7c7461e1127924a08e4a71811 References: <1543847475-7600-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 is based on earlier work by Tobias Jakobi. Suggested-by: Tobias Jakobi Suggested-by: Chanwoo Choi Signed-off-by: Lukasz Luba --- drivers/devfreq/devfreq.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/linux/devfreq.h | 6 ++++++ 2 files changed, 48 insertions(+) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 36bed24..7d60423 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -935,6 +935,48 @@ 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_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; + + 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 d985199..fbffa74 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -205,6 +205,9 @@ 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 @@ -331,6 +334,9 @@ static inline int devfreq_resume_device(struct devfreq *devfreq) return 0; } +static inline void devfreq_suspend(void) {} +static inline void devfreq_resume(void) {} + static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq, u32 flags) { From patchwork Mon Dec 3 14:31:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Luba X-Patchwork-Id: 10709663 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 646F513AF for ; Mon, 3 Dec 2018 14:31:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51D432AF39 for ; Mon, 3 Dec 2018 14:31:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 436E52AF42; Mon, 3 Dec 2018 14:31:41 +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 C46DD2AF39 for ; Mon, 3 Dec 2018 14:31:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726670AbeLCOcv (ORCPT ); Mon, 3 Dec 2018 09:32:51 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:60144 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726655AbeLCOcu (ORCPT ); Mon, 3 Dec 2018 09:32:50 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181203143136euoutp01d547af4d9ee0551d5c279c1a4c39a92c~s2R5DT7OY1512915129euoutp019 for ; Mon, 3 Dec 2018 14:31:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181203143136euoutp01d547af4d9ee0551d5c279c1a4c39a92c~s2R5DT7OY1512915129euoutp019 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1543847496; bh=XyvB6qv76N9Eb6Xx/D6063pygN/u38E8+8VRq5JHg5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ah868BTSvoo0irHk7DciKVwngz+IMP5oFUMA902KptpR0xIbd2xGP/NLJkLp0W9Ng XxV8LpIXZzm4Fd6TcyWah6UT5ydbf4hTuyPovIbZB9+WiOjxWLoDxI6x2e3rH1RzIc YH6bj7MESiiUoYfwfMdOVcYs8xfSeVzjh7FIQ8v4= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181203143135eucas1p2b77246d452e31c5ea4880efc1eb8cb47~s2R38ALYu0427604276eucas1p2f; Mon, 3 Dec 2018 14:31:35 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 42.D1.04294.64E350C5; Mon, 3 Dec 2018 14:31:34 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181203143134eucas1p1edd70b0f4dca115f6f154555d8829427~s2R3NEGvv1908319083eucas1p1b; Mon, 3 Dec 2018 14:31:34 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181203143134eusmtrp1afaec282fc3abdf73a40e467b3ccbbe1~s2R28KDKp1680116801eusmtrp1B; Mon, 3 Dec 2018 14:31:34 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-5a-5c053e465c42 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id C4.43.04284.54E350C5; Mon, 3 Dec 2018 14:31:33 +0000 (GMT) Received: from AMDC3778.DIGITAL.local (unknown [106.120.51.20]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181203143132eusmtip2d0a4832f588c8ce344b70e4187a65528~s2R1-I8w60555005550eusmtip29; Mon, 3 Dec 2018 14:31:32 +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 v2 4/5] drivers: power: suspend: call devfreq suspend/resume Date: Mon, 3 Dec 2018 15:31:14 +0100 Message-Id: <1543847475-7600-5-git-send-email-l.luba@partner.samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543847475-7600-1-git-send-email-l.luba@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSe0hTURzHO/exex0tbsvyV0bBoIdClhFxKHtBxDUior+sDF110dRN3dXM HuSy1CxTzGqupoaVa64snTaWWk7Tyty06P3AMJBe5ousEGu3a/Xf53zO9/fgcFhSPUjPYHfr UwSDXpugUSiputYfngXrVtKRiz70hOKm2iB8w1RF45s3vtH42XAvjUtbPDTOLK9S4IfHdTi/ 5xOJvd7rDO44/JnBLzNmYnNRA4Gre57S+LHrvAIP5bUgbPI2EvhqyxsGX3rWReBXRqsCv3lw 19ej/RGNjza0MDirsp/GnzvfUquBr7tVR/P2Ejviz2V0UXxB/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2rGL0WLH6O7vH501yAXxRejZF+aUlqQoZ+cUltkrRhhZGeoaWFnpGJpZ6 hsbmsVZGpkr6djYpqTmZZalF+nYJehm9U1YyFzRyVTycJ93AuJeji5GdQ0LARGJWRBcjF4eQ wFJGia+X/zJ2MXIChcUkJu3bzg5hC0v8udbFBlH0iVFi35JtzF2MHBxsAnoSO1YVgsRFBJYz Stz/OZsdxGEWeMAs0fF8EytIkbCAj8S/vZUgg1gEVCXOnT/NBGLzCnhKrP9/C2qBnMTNc53M IDangJfElBXzwWwhoJqWvSuYJzDyLWBkWMUoklpanJueW2yoV5yYW1yal66XnJ+7iREYqduO /dy8g/HSxuBDjAIcjEo8vA7xLDFCrIllxZW5hxglOJiVRHgLCoFCvCmJlVWpRfnxRaU5qcWH GE2BjprILCWanA9MInkl8YamhuYWlobmxubGZhZK4rznDSqjhATSE0tSs1NTC1KLYPqYODil GhgDz74wc+3btujlCQcOnhUZZf1CHXvaMgUXdrT4L18reb1uHnd+mlBav0BsBKuhRXbTe/ud Kzs1v1n2Xfn1NDu6wafcneO/U8+5R9puxn3T1W99a9t689dym1OrArWrQ1IVwz66v4yqfHJw 62ZJCcd3R25cYWwrSDmdsfbRZ1+ZCdZtIlIzvyixFGckGmoxFxUnAgAqUMvi6gIAAA== X-CMS-MailID: 20181203143134eucas1p1edd70b0f4dca115f6f154555d8829427 X-Msg-Generator: CA X-RootMTR: 20181203143134eucas1p1edd70b0f4dca115f6f154555d8829427 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181203143134eucas1p1edd70b0f4dca115f6f154555d8829427 References: <1543847475-7600-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 is based on earlier work by Tobias Jakobi. Suggested-by: Tobias Jakobi Reviewed-by: Chanwoo Choi Signed-off-by: Lukasz Luba --- 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 Mon Dec 3 14:31:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Luba X-Patchwork-Id: 10709671 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 7214A1731 for ; Mon, 3 Dec 2018 14:31:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AF942AF44 for ; Mon, 3 Dec 2018 14:31:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D87E2AF39; Mon, 3 Dec 2018 14:31:55 +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 E1B002AF42 for ; Mon, 3 Dec 2018 14:31:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726693AbeLCOcx (ORCPT ); Mon, 3 Dec 2018 09:32:53 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:47697 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726655AbeLCOcw (ORCPT ); Mon, 3 Dec 2018 09:32:52 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181203143137euoutp023a9b3d5d6fdc77120d785c0e3420970a~s2R6pC0Ru0777807778euoutp02p for ; Mon, 3 Dec 2018 14:31:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181203143137euoutp023a9b3d5d6fdc77120d785c0e3420970a~s2R6pC0Ru0777807778euoutp02p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1543847498; bh=G8VKN1fu3uT4saAk4T2R+C4N9HJlxwCGvfKToQ8oqPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ljUXF7jQLiCVFiWlEwcW3kqOoWomKOKfxhV7dl2bSC8orHsmjr9wxgLeq3byBWOsY oOiuI62Vf/7Zo56fb5/Ux84qZ5vSv2SJqKPa08UMqi22aJPN2+GVHHYU1ODgolBIkb SF8+vunZ1fi1q9/1Tr2kjuq4VnqLKLVmQVAQbNKU= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181203143136eucas1p27e1fa616f1ed3a287db22893e1b36b54~s2R5knNjE1206312063eucas1p2B; Mon, 3 Dec 2018 14:31:36 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 26.D1.04294.84E350C5; Mon, 3 Dec 2018 14:31:36 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181203143135eucas1p165fe6183ae90de7906f9683cb41ff4c1~s2R4r6PP_1712417124eucas1p1r; Mon, 3 Dec 2018 14:31:35 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181203143135eusmtrp151383fb7c18e3a5f664d19aafedd3987~s2R4bIfko1680116801eusmtrp1I; Mon, 3 Dec 2018 14:31:35 +0000 (GMT) X-AuditID: cbfec7f4-c77a99c0000010c6-66-5c053e484219 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 98.F8.04128.74E350C5; Mon, 3 Dec 2018 14:31:35 +0000 (GMT) Received: from AMDC3778.DIGITAL.local (unknown [106.120.51.20]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181203143134eusmtip2b70fc582bd265d68d5c9fca5d1b74e4f~s2R3d_Gsb0580205802eusmtip2x; Mon, 3 Dec 2018 14:31:34 +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 v2 5/5] arm: dts: exynos4: opp-suspend in DMC and leftbus Date: Mon, 3 Dec 2018 15:31:15 +0100 Message-Id: <1543847475-7600-6-git-send-email-l.luba@partner.samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543847475-7600-1-git-send-email-l.luba@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSfUzMcRzHfX9P9yt+7ec0fSZju4lqXPIw32GeN7+sP8zGjIbDb5fprtxP lGwqD5WnUjhKkkO36yydOu1UJpcQdwp5Wp7y7BhKYjH38zvz3+v7fr8/D/vsy5LqHnoYu864 UTQZdUkaJphyXv3hGSfMoBPGV+8Ix5dro3D1kSoaX6jupfH9njc0LnN7aLzdUsXgm3sMOL/r A4m93nMqfCvbp8KPMofj4oMNBHZ0ddD4jusYg7v3uRE+4m0k8Fl3pwqfvt9G4MdZVgZ33mj2 92htp/HOBrcK76r8TGPf7SfULBCcF520YD9uR0JJZhslFOR/RYKl/h0hOGx5jHCp1K4Szp/a Jvy+qhIuf6onhJp7OZSwv8aGBGvld5XQ7RixMGRZ8PS1YtK6TaIpZsaq4MR2Sx9KcQ1M++nr QJkoO2g3CmKBnwQXvEeRzGreiuCld6nCPQjKT0TuRsF+7kZQeuYN9a/A/raeVIwKBF/67bTy 8FdYy3L8DssyvBbqbBvkglDegqC9LkrOkPw1ElxfCgnZGMLHQV9nLi3nKT4CmrPiZZnzy2+d DqQMGwEPPXmkzEH8AjhoLfs7GPjTLOxxvQhsNA/MdxpphYfA+5YalcLDobVobyAjwa1cG6Pw Vsi5XhfITIMrLW1/dyD5KKhyxcgI/GwofD1bwRB48HGwHCb9WOg0k4rMQe4utdIjEmr23iYU HgoV9sOB3gJ8ev4hcKlSBJbah0QBGln8f9YJhGwoTEyVDHpRmmAUN2slnUFKNeq1a5INDuT/ i62/W3rqkKt/dRPiWaQZxM1aSSWoad0mKd3QhIAlNaFcyga/xK3VpW8RTckrTalJotSEwllK E8ZlDHi2XM3rdRvF9aKYIpr+uQQbNCwTTXnKhRRHpselueKXGK6sD517d/636PPNnFHS7/D5 YrNKnvZmxJg9Zu3UpjFhxyP6X8/R5Z2pZcorteKBWJYzw6+u8lfXwrMHTYobneh50T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uZFxCveUk1XPOCEktxRqKhFnNRcSIA7hsgUu0CAAA= X-CMS-MailID: 20181203143135eucas1p165fe6183ae90de7906f9683cb41ff4c1 X-Msg-Generator: CA X-RootMTR: 20181203143135eucas1p165fe6183ae90de7906f9683cb41ff4c1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181203143135eucas1p165fe6183ae90de7906f9683cb41ff4c1 References: <1543847475-7600-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 is based on earlier work by Tobias Jakobi. Suggested-by: Tobias Jakobi Suggested-by: Chanwoo Choi Reviewed-by: Chanwoo Choi Signed-off-by: Lukasz Luba --- 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; }; };