From patchwork Mon Apr 9 11:43:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 10331147 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 EB0AD6037F for ; Mon, 9 Apr 2018 11:44:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEC5728B13 for ; Mon, 9 Apr 2018 11:44:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2DCA28B1B; Mon, 9 Apr 2018 11:44:29 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 5CB2828B18 for ; Mon, 9 Apr 2018 11:44:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751856AbeDILo2 (ORCPT ); Mon, 9 Apr 2018 07:44:28 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:38874 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751728AbeDILo2 (ORCPT ); Mon, 9 Apr 2018 07:44:28 -0400 Received: by mail-pl0-f67.google.com with SMTP id c7-v6so1706102plr.5 for ; Mon, 09 Apr 2018 04:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=sLm6WLhZDo0FcUDbqamsSacxR00r3oXmusMjKz4Cd5E=; b=klx+uqQsPAlKIiCE43xNvm7jGLU8fLXtW4MTNM3F08LX2fH3idFpA8/FQKoO8GEeg0 EbsZvQzfui22r6hHpUcgzcUG+pHgbnMEpammEtAiJd4ULFK2flBeLA5x9d1koXNY0Xl6 TeIMtq9mjYyiTFyK3aNYf/sx8waiEPduF7/bQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=sLm6WLhZDo0FcUDbqamsSacxR00r3oXmusMjKz4Cd5E=; b=m7TjQkw6A5v0KRywUEDyuF2BUcIoQmh/WADCAt7FFDglbQKw6FRVa6xCv1c0H/EIcO iBfWR5Xul1mZP2wzlFieXbZkh6RrKreOB3cqE5+BpBYehhYhUMa5/RnoYKvqj5lbg9HM ajzbwiolvnyz/JM1lEEXh/KKuwBRd1KCO3QzjVKlD7geY6QjgFcC7Nin5z7+3Jxi75AN My0TTNSKzPEf4sERD9mXAlRdff3Y7C9w48a3XI5MR1fMZ0eSn4QqYvmdnd/DEppVwUXS BRpChB+WfxndnwmZGOJUelBGV6KCXtrYcPXIA6qsasyEIBSnR1aG41Hk4+ESG9EItFuD T1HA== X-Gm-Message-State: AElRT7HWNvXxOK/KSB/s7SZ18FmnfwSMGvwkLenIsG75xTvre/FLefiz gg+bdaVt0q4Xfsn65qjZQbLUyw== X-Google-Smtp-Source: AIpwx4/lGWtZoFVy/DEc5B0QMMHdhK5IfIE+LEctSVay12u9ODjuBWWK3S8W5yUGQM8airj4RQlnyA== X-Received: by 2002:a17:902:900a:: with SMTP id a10-v6mr39348910plp.142.1523274267790; Mon, 09 Apr 2018 04:44:27 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id k73sm459290pgc.55.2018.04.09.04.44.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 04:44:27 -0700 (PDT) From: Viresh Kumar To: Ulf Hansson , Stephen Boyd , Viresh Kumar , Nishanth Menon , "Rafael J. Wysocki" Cc: Viresh Kumar , Rajendra Nayak , Vincent Guittot , linux-pm@vger.kernel.org, Jordan Crouse Subject: [PATCH V2 06/11] PM / OPP: Implement dev_pm_opp_get_of_node() Date: Mon, 9 Apr 2018 17:13:46 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: 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 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: Jordan Crouse Signed-off-by: Rajendra Nayak Signed-off-by: Viresh Kumar Reviewed-by: Ulf Hansson --- drivers/opp/of.c | 19 +++++++++++++++++++ include/linux/pm_opp.h | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 6380ec3d695b..de41e68b780f 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -727,3 +727,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 with 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 70686f434c13..8fd34c4398b2 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -310,6 +310,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) { @@ -348,6 +349,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__ */