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: 7118311 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 DF91C9F46B for ; Thu, 3 Sep 2015 18:14:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01B3220689 for ; Thu, 3 Sep 2015 18:14:30 +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 10D1420830 for ; Thu, 3 Sep 2015 18:14:29 +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 1ZXZ0D-0006NG-Cn; Thu, 03 Sep 2015 18:12:49 +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 1ZXZ03-0005f3-HJ for linux-arm-kernel@lists.infradead.org; Thu, 03 Sep 2015 18:12:40 +0000 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> for linux-arm-kernel@lists.infradead.org; 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" 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== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150903_111239_734081_16464632 X-CRM114-Status: GOOD ( 14.07 ) 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 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) {