From patchwork Mon Sep 7 15:41:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 7137011 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F2EB7BEEC1 for ; Mon, 7 Sep 2015 15:44:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2ACAF206EF for ; Mon, 7 Sep 2015 15:44:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3342220635 for ; Mon, 7 Sep 2015 15:44:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753229AbbIGPob (ORCPT ); Mon, 7 Sep 2015 11:44:31 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:51847 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752740AbbIGPo3 (ORCPT ); Mon, 7 Sep 2015 11:44:29 -0400 Received: from epcpsbgm2new.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NUB02HWRD1ZZF40@mailout3.samsung.com>; Tue, 08 Sep 2015 00:44:28 +0900 (KST) X-AuditID: cbfee61b-f79d56d0000048c5-b9-55edb0dc8d12 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id C9.83.18629.CD0BDE55; Tue, 8 Sep 2015 00:44:28 +0900 (KST) Received: from AMDC1976.DIGITAL.local ([106.120.53.102]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NUB00JN0CXOGQ30@mmp1.samsung.com>; Tue, 08 Sep 2015 00:44:27 +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 v4 3/4] cpufreq-dt: add suspend frequency support Date: Mon, 07 Sep 2015 17:41:40 +0200 Message-id: <1441640501-13613-4-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1441640501-13613-1-git-send-email-b.zolnierkie@samsung.com> References: <1441640501-13613-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgkeLIzCtJLcpLzFFi42I5/e+xgO6dDW9DDbbf4rfYOGM9q8X1L89Z Lf4/es1q8ebtGiaL1y8MLXoXXGWz6H/8mtni6+EVjBZvHm5mtNj0+Bqrxceee6wWl3fNYbP4 3HuE0WLG+X1MFus23mK3WHvkLrvFxVOuFmdOX2K1OPymndWiYxmjRdvqD6wWq3b9YbTY+NXD Qdzj/Y1Wdo+ds+6ye2xa1cnmcefaHjaPzUvqPf4dY/fY0g8U3nK1ncWjb8sqRo/t1+Yxe3ze JBfAHcVlk5Kak1mWWqRvl8CVcfOefMERvoqOrvWsDYwLeboYOTkkBEwkrk6cwgxhi0lcuLee rYuRi0NIYCmjxLttcxkhnF+MEnfX/2MFqWITsJKY2L4KLCEisIhJYuH+rawgDrPAMxaJ1nfd YFXCAo4SV3Z+ALNZBFQl/vw7ywZi8wp4SHy70QO1T07i5LHJYDWcAp4SJ+/sAqsRAqrZ9u0f 6wRG3gWMDKsYJVILkguKk9JzjfJSy/WKE3OLS/PS9ZLzczcxguPlmfQOxsO73A8xCnAwKvHw GvS+CRViTSwrrsw9xCjBwawkwhs7922oEG9KYmVValF+fFFpTmrxIUZpDhYlcV7Zlc9ChQTS E0tSs1NTC1KLYLJMHJxSDYys3+7w6PmvaJ38fdfxkj65e15iLWYOF5j+XD/z/u4X7RuZ2XcW ffmTcqDtQfD6j5dW5S45X2FeNGP7ahtpUQsFxu1mMjyWdRPd1hXuLKhcXGCo6CB02P7aapXA BongO1vyv6g+ulrz/uCCR6tXv3zlN+vtlF2tNV/fxhr93sfpWWcd+L8piG2tEktxRqKhFnNR cSIA4wJTzJMCAAA= 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: Viresh Kumar Cc: Thomas Abraham Cc: Javier Martinez Canillas Cc: Krzysztof Kozlowski Cc: Marek Szyprowski Cc: Tobias Jakobi Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/cpufreq/cpufreq-dt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index c3583cd..e08ae40 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,9 @@ static struct cpufreq_driver dt_cpufreq_driver = { .ready = cpufreq_ready, .name = "cpufreq-dt", .attr = cpufreq_dt_attr, +#ifdef CONFIG_PM + .suspend = cpufreq_generic_suspend, +#endif }; static int dt_cpufreq_probe(struct platform_device *pdev)