From patchwork Fri Mar 2 21:43:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 10255727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 849796037D for ; Fri, 2 Mar 2018 21:43:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 731A928531 for ; Fri, 2 Mar 2018 21:43:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67AAE2853E; Fri, 2 Mar 2018 21:43:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8365328531 for ; Fri, 2 Mar 2018 21:43:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752837AbeCBVnh (ORCPT ); Fri, 2 Mar 2018 16:43:37 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:60012 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751841AbeCBVng (ORCPT ); Fri, 2 Mar 2018 16:43:36 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E18E8607E5; Fri, 2 Mar 2018 21:43:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520027015; bh=ua7hrJmpVBp7HkaXDKQmXoaX3Ty+QT3Di25qPeFlrIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kFKLorNGWttxpa7XCXO/ItE+JwB3dXjSgEvK8n/NuLajgjtU5vzwXB/ENNOzOdsi6 77V4MKByWpdDBXKjivSh0xaqsSmm8wa42T4hus4duTP64lO8PuGPK/+uXSE/N/cJ4W z2GX3i7AZPDUo9+qzYhxG5e+Hb9/e7FqPp+iHSVo= Received: from jcrouse-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id F204D60316; Fri, 2 Mar 2018 21:43:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520027015; bh=ua7hrJmpVBp7HkaXDKQmXoaX3Ty+QT3Di25qPeFlrIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kFKLorNGWttxpa7XCXO/ItE+JwB3dXjSgEvK8n/NuLajgjtU5vzwXB/ENNOzOdsi6 77V4MKByWpdDBXKjivSh0xaqsSmm8wa42T4hus4duTP64lO8PuGPK/+uXSE/N/cJ4W z2GX3i7AZPDUo9+qzYhxG5e+Hb9/e7FqPp+iHSVo= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org F204D60316 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jcrouse@codeaurora.org From: Jordan Crouse To: freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org, sboyd@codeaurora.org, vireshk@kernel.org, nm@ti.com, linux-pm@vger.kernel.org Subject: [PATCH 1/3] PM / OPP: Add dev_pm_opp_get_np() Date: Fri, 2 Mar 2018 14:43:27 -0700 Message-Id: <20180302214329.1086-2-jcrouse@codeaurora.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180302214329.1086-1-jcrouse@codeaurora.org> References: <20180302214329.1086-1-jcrouse@codeaurora.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a function to return the device node associated with a specific opp which will facilitate detailing with custom properties in client drivers. Signed-off-by: Jordan Crouse --- drivers/opp/of.c | 20 ++++++++++++++++++++ include/linux/pm_opp.h | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index cb716aa2f44b..5695e7c1d091 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -235,6 +235,26 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, return ret; } +/** + * dev_pm_opp_get_np() - Get the device tree node corresponding to an opp + * @opp: opp for which the node should be returned for + * + * If applicable return the device tree node for the corresponding opp so that + * the client can decode "custom" target specific properties. + * + * Return: A pointer to the device tree or NULL if it doesn't exist + */ +struct device_node *dev_pm_opp_get_np(struct dev_pm_opp *opp) +{ + if (IS_ERR_OR_NULL(opp)) { + pr_err("%s: Invalid parameters\n", __func__); + return NULL; + } + + return opp->np; +} +EXPORT_SYMBOL_GPL(dev_pm_opp_get_np); + /** * dev_pm_opp_of_remove_table() - Free OPP table entries created from static DT * entries diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 6c2d2e88f066..a38423137db2 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -308,6 +308,7 @@ int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask); void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask); int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev); +struct device_node *dev_pm_opp_get_np(struct dev_pm_opp *opp); #else static inline int dev_pm_opp_of_add_table(struct device *dev) { @@ -336,6 +337,11 @@ static inline struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device { return NULL; } + +static inline struct device_node *dev_pm_opp_get_np(struct dev_pm_opp *opp) +{ + return NULL; +} #endif #endif /* __LINUX_OPP_H__ */