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: 10255731 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 500A76037D for ; Fri, 2 Mar 2018 21:43:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 405862852D for ; Fri, 2 Mar 2018 21:43:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 351DF28536; Fri, 2 Mar 2018 21:43:42 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E55D92852D for ; Fri, 2 Mar 2018 21:43:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B55A6E145; Fri, 2 Mar 2018 21:43:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id 13DCE6E02A; Fri, 2 Mar 2018 21:43:36 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id F2E98607DC; 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=1520027016; bh=ua7hrJmpVBp7HkaXDKQmXoaX3Ty+QT3Di25qPeFlrIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iNnQ+JzuS2JClj8qsttYVMa6xNbcXJI3e8nvopB/hnLLuSBK/Sz61YDIubL410cRh EyyiN2798Q+gEBBeAeIpENWjEtAC/TAA5H+VlkJgwmC4MJps1GVPaxMyitEKsvzZGb S/VWUfvF8aYid1j+TnHfLMJm3T9gIhwTIE5OXdo8= 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 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> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nm@ti.com, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, sboyd@codeaurora.org, vireshk@kernel.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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__ */