From patchwork Thu Sep 3 18:11:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 7118241 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 691F3BEEC1 for ; Thu, 3 Sep 2015 18:13:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8E711207DE for ; Thu, 3 Sep 2015 18:13:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 74EFA20690 for ; Thu, 3 Sep 2015 18:13:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758066AbbICSMX (ORCPT ); Thu, 3 Sep 2015 14:12:23 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:58923 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758213AbbICSMT (ORCPT ); Thu, 3 Sep 2015 14:12:19 -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 <0NU4005W758HB140@mailout3.samsung.com>; Fri, 04 Sep 2015 03:12:17 +0900 (KST) X-AuditID: cbfee61a-f79a06d000005c6f-bb-55e88d81c283 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id BC.B1.23663.18D88E55; Fri, 4 Sep 2015 03:12:17 +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 <0NU40099I57Y1C20@mmp2.samsung.com>; Fri, 04 Sep 2015 03:12:17 +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 v3 1/3] PM / OPP: add dev_pm_opp_get_suspend_opp() helper Date: Thu, 03 Sep 2015 20:11:30 +0200 Message-id: <1441303892-32004-2-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1441303892-32004-1-git-send-email-b.zolnierkie@samsung.com> References: <1441303892-32004-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRmVeSWpSXmKPExsVy+t9jQd3G3hehBhc7xSw2zljPanH9y3NW i/+PXrNavHm7hsni9QtDi94FV9ks+h+/Zrb4engFo8Wbh5sZLTY9vsZq8bHnHqvF5V1z2Cw+ 9x5htJhxfh+TxbqNt9gt1h65y25x8ZSrxZnTl1gtDr9pZ7XoWMZo0bb6A6vFql1/GC02fvVw EPd4f6OV3WPnrLvsHptWdbJ53Lm2h81j85J6j3/H2D229AOFt1xtZ/Ho27KK0WP7tXnMHp83 yQVwR3HZpKTmZJalFunbJXBl9Oy+wFawUqTi743ABsaJgl2MHBwSAiYSf2cldTFyApliEhfu rWfrYuTiEBKYxSjx/esGJgjnF6PEpxcnWUCq2ASsJCa2r2IESYgILGKSWLh/KyuIwyzwjEWi 9V03K8hYYQFPiT8H40AaWARUJTYeu8wOYvMKeEg8af/BBLFOTuLksclg5ZxA5QefSoCEhYBK Fl54zziBkXcBI8MqRonUguSC4qT0XMO81HK94sTc4tK8dL3k/NxNjOBIeSa1g/HgLvdDjAIc jEo8vIyeL0KFWBPLiitzDzFKcDArifDuaQcK8aYkVlalFuXHF5XmpBYfYpTmYFES55Vd+SxU SCA9sSQ1OzW1ILUIJsvEwSnVwLhJI4OByZuprHnlVCf+tWFB5zXNOKU8l3ue0zrY1fom50/g 2Qj5Fy3H2HMLHW7zPUidbH1x+X1tR62rMy6+fVMy2X/2TLmUztNPVvk1/qyRqJvjkRDSd471 E1ej3QnGLRyrTdnKmqake/MtOfZk0sml1Wtmsk82nJvQIZPB8F/pPfP+X5NW3lFiKc5INNRi LipOBADDOC5vkAIAAA== 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 dev_pm_opp_get_suspend_opp() helper to obtain suspend opp. 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/base/power/opp.c | 28 ++++++++++++++++++++++++++++ include/linux/pm_opp.h | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index eb25449..eaafca7 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -341,6 +341,34 @@ unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev) EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency); /** + * dev_pm_opp_get_suspend_opp() - Get suspend opp + * @dev: device for which we do this operation + * + * Return: This function returns pointer to the suspend opp if it is + * defined, otherwise it returns NULL. + * + * Locking: This function takes rcu_read_lock(). + */ +struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev) +{ + struct device_opp *dev_opp; + struct dev_pm_opp *suspend_opp; + + rcu_read_lock(); + + dev_opp = _find_device_opp(dev); + if (IS_ERR(dev_opp)) + suspend_opp = NULL; + else + suspend_opp = dev_opp->suspend_opp; + + rcu_read_unlock(); + + return suspend_opp; +} +EXPORT_SYMBOL_GPL(dev_pm_opp_get_suspend_opp); + +/** * dev_pm_opp_get_opp_count() - Get number of opps available in the opp list * @dev: device for which we do this operation * diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index cab7ba5..e817722 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -34,6 +34,7 @@ bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp); int dev_pm_opp_get_opp_count(struct device *dev); unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev); +struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev); struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev, unsigned long freq, @@ -80,6 +81,11 @@ static inline unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev) return 0; } +static inline struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev) +{ + return NULL; +} + static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev, unsigned long freq, bool available) {