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: 133030 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp168295ljb; Mon, 9 Apr 2018 04:44:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+x6veBUIEuuneoiF73wSncRxt0e70qgc4VEGHTNTQLEkLBi3yJk5+AQ0dryfryt/8YGih5 X-Received: by 2002:a17:902:d20a:: with SMTP id t10-v6mr5114523ply.151.1523274269705; Mon, 09 Apr 2018 04:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523274269; cv=none; d=google.com; s=arc-20160816; b=ECGQ6xyQH2IiSHQURNM1+Icvjc7mb+LPzEVOsXeJAvFOWAaW3GOsFuttF9Yva3AENx 5qw7QHVRKDUiBlyV/hBIshIuPeV4FQcLgK1B4R7i6CiCRNtso2lJoo7A5ON9wJV3m8Gc WArJRM7eBaNSzK7jhgpALB6qnrXFx8tx/KaytnC6bBHR7Yip2qlTCtzMHLtK/hMk7olJ 122XQKeMtVNSsIGuyk3MesbXIRF0kHTIbHt7ItsLxAHl5eLmwyL8gnfR1NuuBZRxrULr nEQ8oLK4H+JsYkAiNWx7MEIZ95HUj9y0CH0w/crJARzI+nqpjuz5PXGFg+/ksZ5XSfK8 v+kw== 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:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=sLm6WLhZDo0FcUDbqamsSacxR00r3oXmusMjKz4Cd5E=; b=T4FSCnpDVpcYcYYFS4yYE114Z8ENUH1D+E7Fau3qWpmZ1QqlT21/jJ8WyLW+4HdPJG YD/9QMMjT9qfucMyRZr+nDUfx2BVI/pQFuX3kxJgdCwNczJP+uxbgcWbIRUj6C0N6exL ktuYEUyVm1szgznVr1xsNhvrhKMXEG6lGWqj6/+o7v+p6IgEnBBuBKvF3Ta2RH5LiBUd +pp0CIk2++Owync4PHT1VdkdNS31kKIJBkspNC9x7qY/G+8aN0jM1Fx+hQYZQCkFM4IX nkdUzzr5p6tRpj37Ac6kxT+DApO/ml3AaNUcWrQIJYOd2Rc01iqDwQLsDccT9LFPDsaK i7SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=klx+uqQs; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j188si105815pgc.584.2018.04.09.04.44.29; Mon, 09 Apr 2018 04:44:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=@linaro.org header.s=google header.b=klx+uqQs; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751856AbeDILo2 (ORCPT + 11 others); 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-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 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 --- drivers/opp/of.c | 19 +++++++++++++++++++ include/linux/pm_opp.h | 5 +++++ 2 files changed, 24 insertions(+) -- 2.15.0.194.g9af6a3dea062 Reviewed-by: Ulf Hansson 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__ */