From patchwork Wed Sep 18 10:58:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep KarkadaNagesha X-Patchwork-Id: 2905471 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2E00DBFF05 for ; Wed, 18 Sep 2013 11:01:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0081720326 for ; Wed, 18 Sep 2013 11:01:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83C0C2034F for ; Wed, 18 Sep 2013 11:01:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751881Ab3IRLBv (ORCPT ); Wed, 18 Sep 2013 07:01:51 -0400 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:60648 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751818Ab3IRLBu (ORCPT ); Wed, 18 Sep 2013 07:01:50 -0400 Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.49]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id r8IAvvkk012051; Wed, 18 Sep 2013 11:57:59 +0100 (BST) From: Sudeep KarkadaNagesha To: linux-pm@vger.kernel.org, devicetree@vger.kernel.org Cc: Sudeep.KarkadaNagesha@arm.com, Sudeep KarkadaNagesha , Rob Herring , Pawel Moll , Mark Rutland , Kumar Gala , Stephen Warren , "Rafael J. Wysocki" , Nishanth Menon Subject: [PATCH 2/3] PM / OPP: add support to specify phandle of another node for OPP Date: Wed, 18 Sep 2013 11:58:12 +0100 Message-Id: <1379501893-12669-3-git-send-email-Sudeep.KarkadaNagesha@arm.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1379501893-12669-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> References: <1379501893-12669-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sudeep KarkadaNagesha Currently we need to replicate the OPP entries in all the nodes even though they share OPPs being in the same clock domain. Few drivers like cpufreq depend on physical cpu0 node to specify the OPPs and only that node is referred irrespective of the logical cpu accessing it. Alternatively to support cpuhotplug path, few drivers parse all the cpu nodes for OPPs. Instead we can specify the phandle of the node which contains the OPP tuples. This patch adds support to the new property 'operating-points-phandle' which specifies the phandle pointing to another node which contains the actual OPP tuples. Cc: Rob Herring Cc: Pawel Moll Cc: Mark Rutland Cc: Kumar Gala Cc: Stephen Warren Cc: "Rafael J. Wysocki" Cc: Nishanth Menon Signed-off-by: Sudeep KarkadaNagesha --- drivers/base/power/opp.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index ef89897..a450e2f 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -708,12 +708,20 @@ struct srcu_notifier_head *opp_get_notifier(struct device *dev) int of_init_opp_table(struct device *dev) { const struct property *prop; + struct device_node *opp_node; const __be32 *val; int nr; - prop = of_find_property(dev->of_node, "operating-points", NULL); - if (!prop) + opp_node = of_parse_phandle(dev->of_node, + "operating-points-phandle", 0); + if (!opp_node) /* if no OPP phandle, search for OPPs in current node */ + opp_node = dev->of_node; + prop = of_find_property(opp_node, "operating-points", NULL); + if (!prop) { + dev_warn(dev, "node %s missing operating-points property\n", + opp_node->full_name); return -ENODEV; + } if (!prop->value) return -ENODATA;