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: 7137071 Return-Path: X-Original-To: patchwork-linux-arm@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 229F89F314 for ; Mon, 7 Sep 2015 15:47:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 490E920680 for ; Mon, 7 Sep 2015 15:47:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D1542065F for ; Mon, 7 Sep 2015 15:47:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZYybF-0000Wq-7j; Mon, 07 Sep 2015 15:44:53 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZYybB-0008UO-Oh for linux-arm-kernel@lists.infradead.org; Mon, 07 Sep 2015 15:44:50 +0000 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> for linux-arm-kernel@lists.infradead.org; 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" 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= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150907_084449_980972_1ECC604C X-CRM114-Status: GOOD ( 14.88 ) X-Spam-Score: -6.9 (------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lukasz Majewski , Kevin Hilman , Heiko Stuebner , Javier Martinez Canillas , Anand Moon , Michael Turquette , linux-pm@vger.kernel.org, Tomasz Figa , linux-kernel@vger.kernel.org, Chanwoo Choi , b.zolnierkie@samsung.com, Tobias Jakobi , linux-arm-kernel@lists.infradead.org, Sylwester Nawrocki , linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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)