From patchwork Tue Sep 8 16:41:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 7142511 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B446E9F1BF for ; Tue, 8 Sep 2015 16:42:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A151320834 for ; Tue, 8 Sep 2015 16:42:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4A7D20458 for ; Tue, 8 Sep 2015 16:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755442AbbIHQmE (ORCPT ); Tue, 8 Sep 2015 12:42:04 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:47820 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755237AbbIHQmB (ORCPT ); Tue, 8 Sep 2015 12:42:01 -0400 Received: from epcpsbgm1new.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NUD01P03ADRFL80@mailout3.samsung.com>; Wed, 09 Sep 2015 01:41:59 +0900 (KST) X-AuditID: cbfee61a-f79a06d000005c6f-76-55ef0fd72f37 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 65.C3.23663.7DF0FE55; Wed, 9 Sep 2015 01:41:59 +0900 (KST) Received: from AMDC1976.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NUD00BDDACMIH50@mmp2.samsung.com>; Wed, 09 Sep 2015 01:41:59 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Thomas Abraham , Kukjin Kim , Kukjin Kim , Viresh Kumar , Krzysztof Kozlowski , Marek Szyprowski , "Rafael J. Wysocki" Cc: Sylwester Nawrocki , Michael Turquette , Tomasz Figa , Lukasz Majewski , Heiko Stuebner , Chanwoo Choi , Kevin Hilman , Javier Martinez Canillas , Tobias Jakobi , Anand Moon , linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH v5 3/4] cpufreq-dt: add suspend frequency support Date: Tue, 08 Sep 2015 18:41:03 +0200 Message-id: <1441730464-7947-4-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1441730464-7947-1-git-send-email-b.zolnierkie@samsung.com> References: <1441730464-7947-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHLMWRmVeSWpSXmKPExsVy+t9jQd3r/O9DDe41KFpsnLGe1eL6l+es Fv8fvWa1ePN2DZPF6xeGFr0LrrJZ9D9+zWzx9fAKRos3DzczWmx6fI3V4mPPPVaLy7vmsFl8 7j3CaDHj/D4mi3Ubb7FbrD1yl93i4ilXizOnL7FaHH7TzmrRsYzRom31B1aLVbv+MFps/Orh IO7x/kYru8fOWXfZPTat6mTzuHNtD5vH5iX1Hv+OsXts6QcKb7nazuLRt2UVo8f2a/OYPT5v kgvgjuKySUnNySxLLdK3S+DKmPo0tWAVX0Xja9YGxh6eLkZODgkBE4lXSw8yQdhiEhfurWfr YuTiEBKYxSix58IisISQwC9GiY6LaSA2m4CVxMT2VYwgRSICi5gkFu7fygriMAs8Y5FofdfN ClIlLOAo8eLBU2YQm0VAVeLx84tgcV4Bd4n9R3dArZOTOHlsMlicU8BDouX3DKht7hJdJ1cz TmDkXcDIsIpRIrUguaA4KT3XMC+1XK84Mbe4NC9dLzk/dxMjOFaeSe1gPLjL/RCjAAejEg9v g9e7UCHWxLLiytxDjBIczEoivNm/gUK8KYmVValF+fFFpTmpxYcYpTlYlMR5ZVc+CxUSSE8s Sc1OTS1ILYLJMnFwSjUwMh1Y6VnPwbSsiT9kjVCLk2bk5IPXPoVumSg526Tj94y451X7Nuxh znMs8Fp9aPHMmYvvXS032Tzn0l6dGAXGNRWLL7O+nx19R+cs45Ol/dW9M+7xhufM6TRaMPfO Ua/WY8eUDguxPhS51yJQq7n+L/8jD6nc7422MS6O8a+VP+w5ExX5oeCKjxJLcUaioRZzUXEi AFovoEyRAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add suspend frequency support and if needed set it to the frequency obtained from the suspend opp (can be defined using opp-v2 bindings and is optional). Cc: Thomas Abraham Cc: Javier Martinez Canillas Cc: Krzysztof Kozlowski Cc: Marek Szyprowski Cc: Tobias Jakobi Acked-by: Viresh Kumar Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/cpufreq/cpufreq-dt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index c3583cd..9b5e7c9 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -196,6 +196,7 @@ static int cpufreq_init(struct cpufreq_policy *policy) struct device *cpu_dev; struct regulator *cpu_reg; struct clk *cpu_clk; + struct dev_pm_opp *suspend_opp; unsigned long min_uV = ~0, max_uV = 0; unsigned int transition_latency; bool need_update = false; @@ -329,6 +330,13 @@ static int cpufreq_init(struct cpufreq_policy *policy) policy->driver_data = priv; policy->clk = cpu_clk; + + rcu_read_lock(); + suspend_opp = dev_pm_opp_get_suspend_opp(cpu_dev); + if (suspend_opp) + policy->suspend_freq = dev_pm_opp_get_freq(suspend_opp) / 1000; + rcu_read_unlock(); + ret = cpufreq_table_validate_and_show(policy, freq_table); if (ret) { dev_err(cpu_dev, "%s: invalid frequency table: %d\n", __func__, @@ -419,6 +427,7 @@ static struct cpufreq_driver dt_cpufreq_driver = { .ready = cpufreq_ready, .name = "cpufreq-dt", .attr = cpufreq_dt_attr, + .suspend = cpufreq_generic_suspend, }; static int dt_cpufreq_probe(struct platform_device *pdev)