From patchwork Fri Mar 16 04:08:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 131896 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp255751ljb; Thu, 15 Mar 2018 21:08:55 -0700 (PDT) X-Google-Smtp-Source: AG47ELs2wuMLSsBLHDpXTOlkWXQ0+dNUbdBZZzNaTKiC6rKhdp287UolleEu7yhHtl5H9MCW7PWJ X-Received: by 2002:a17:902:5a4e:: with SMTP id f14-v6mr457111plm.116.1521173335688; Thu, 15 Mar 2018 21:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521173335; cv=none; d=google.com; s=arc-20160816; b=WBvlZNs8JbfW3uDnmuAfhDiLRw5/GkxwFvJWMMcOvcl4VvVF+fM9f6pMNzx7C4S+d8 vjMhmYeIbArUxd7I0KjwSQaAWF08N1g1+9pBnO8qmU+UytBPkDwCu6QMhfIjFJC4/7ma 2fjJuoyMHg+U9JfSi810umwDSCZRF7pdFxHlXcxGaKi7eXjpt+JlD9dVFNWk4704h/5e CLYoq8+UPlW/psFfTO0/Crj7+o3JuV2iyntNs34jfCKyLaA2Cv9T6Vw7JQbNtVX/4nLK YC/9krh6r2jg9qdYDfsCx9ZAmCvucO+neOtjSIGgfukXj+OfAC5696Q9o7zlu3bhIQ5+ w9Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=db7JC5o3l1aaIo7CbHOyZ4ZqjVFK066VxoVUugYVZLM=; b=o/m7HbZ4BUkuZsVpw3F2JKoXKp8eg/7//V+ZfBn2KIoEw4KBjRqOv3lDHtm2stOo/e 6fspJhiPRlRVHAP3rfR9gmuIM7kJ2kNJPBA3d27zvY/zunI0rsUrclcBy1KtqdlIPPrz zvNihQK7w7tQT8pi29hJIqIVGv9fq7vHEpXdlgrGtdwZ1HGS26L/3BKdJxXWVHkeN9y7 Gq/zUZelpikjvDmUxssC6LqhGZX6CLzPnBgF0Yfzq/gb4MAiFnm57tnmW/n454Mx8IS7 EBNJIa73u74XzlMOfhbhz6u2yGjB2+ileGRU442CiWfGUe+jwlX3YFv/HRo4uIdOutpc Qr1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=aB8/mvhG; dkim=pass header.i=@codeaurora.org header.s=default header.b=Xs1c2iJD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1-v6si5793609pll.57.2018.03.15.21.08.55; Thu, 15 Mar 2018 21:08:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=aB8/mvhG; dkim=pass header.i=@codeaurora.org header.s=default header.b=Xs1c2iJD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751416AbeCPEIt (ORCPT + 28 others); Fri, 16 Mar 2018 00:08:49 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:48934 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750748AbeCPEIr (ORCPT ); Fri, 16 Mar 2018 00:08:47 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7D20D60C65; Fri, 16 Mar 2018 04:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521173326; bh=8scnGyx72aKiOYRUUC8LfDI91ddLx4YKdiZ8oo5mM8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aB8/mvhGDkucA6d0Nkaq5Njq2BivS2QVh0NJKHnbhbdXfwQcnobiTyMTUnC/A79F6 1pccGF5AfA4SXUa1YBNwVhKIrdeSfnTojPRTMYoIVA17rgzS0YsT1v6cEYDne9gTeC HOhNugTD/jQ+ntMi2mVYpioC+KvAbOGsiSaUXwzA= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from blr-ubuntu-173.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: rnayak@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8B10260452; Fri, 16 Mar 2018 04:08:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521173325; bh=8scnGyx72aKiOYRUUC8LfDI91ddLx4YKdiZ8oo5mM8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xs1c2iJDY0LlNKNX+u/BrJ6G5nmWK8mdgmX5JWJubFKmgGQ35kckaKYdcK1J42N3D HV9F+k9EsbL8xvYp0ig46DJ3lrtEq1B/zNifMHbYDQ16zoSO1xcgwzU262jWIhWgVt L7XYT/CnNeT+sNO4lYdsHHzCEubuBkxrGWJfFuCM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8B10260452 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=rnayak@codeaurora.org From: Rajendra Nayak To: viresh.kumar@linaro.org, sboyd@kernel.org, andy.gross@linaro.org, ulf.hansson@linaro.org Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Rajendra Nayak Subject: [PATCH 1/7] PM / OPP: Add dev_pm_opp_get_of_node() Date: Fri, 16 Mar 2018 09:38:18 +0530 Message-Id: <20180316040824.21472-2-rnayak@codeaurora.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180316040824.21472-1-rnayak@codeaurora.org> References: <20180316040824.21472-1-rnayak@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Viresh Kumar This adds a new helper to let the power domain drivers to access opp->np, so that they can read platform specific properties from the node. Signed-off-by: Viresh Kumar Signed-off-by: Rajendra Nayak --- drivers/opp/of.c | 19 +++++++++++++++++++ include/linux/pm_opp.h | 5 +++++ 2 files changed, 24 insertions(+) -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 21265af55117..b17715bc3c0a 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -736,3 +736,22 @@ struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device *dev, return opp; } EXPORT_SYMBOL_GPL(of_dev_pm_opp_find_required_opp); + +/** + * dev_pm_opp_get_of_node() - Gets the DT node corresponding to an opp + * @opp: opp for which DT node has to be returned for + * + * Return: DT node corresponding to the opp, else 0 on success. + * + * The caller needs to put the node of_node_put() after using it. + */ +struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp) +{ + if (IS_ERR_OR_NULL(opp)) { + pr_err("%s: Invalid parameters\n", __func__); + return NULL; + } + + return of_node_get(opp->np); +} +EXPORT_SYMBOL_GPL(dev_pm_opp_get_of_node); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 528a7d9cf2ef..099b31960dec 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -300,6 +300,7 @@ 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 dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device *dev, struct device_node *np); +struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp); #else static inline int dev_pm_opp_of_add_table(struct device *dev) { @@ -338,6 +339,10 @@ static inline struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device * { return NULL; } +static inline struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp) +{ + return NULL; +} #endif #endif /* __LINUX_OPP_H__ */