From patchwork Wed May 30 10:09:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 137244 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp5120721lji; Wed, 30 May 2018 03:09:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIYKC4FTtlP7BRDcJE7rq46tHB8/lkQXcIIOtKiPFzFTKp9LiZCPKhjqWyrAbVyuFehqkSk X-Received: by 2002:a63:7e1b:: with SMTP id z27-v6mr1703951pgc.65.1527674958299; Wed, 30 May 2018 03:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527674958; cv=none; d=google.com; s=arc-20160816; b=qV3gCrV4t66C4hnjyu0zv9Eh8KpB6ClrVIwwOYcIkmiM73aWgYzFuwdHE5LDVHnTp5 hMRgtk6rx7wCr9hKBDh2a7VNN0L5PUiozYfff+qd+VQVJ7reyZfC/kwbBNU3R6QuBPh/ Vvy4Y51MA6OU6vXsFN2bl2r5ZdHHtWhJnwjA3NE7W60Vo0qDEkYTCBU4RAeF/nR803iw m0fUauhCcciAZKvioIZxcAVAlLw4NqTxguG8kPkf2tgLcPmtPqlRBG/2XpeFZBSYqDO0 oKDZEg+/Tq71zzcnQVpuksT2lKG63FrzsLxzj1KqYn5eAFeAXJhK50Qx/75XuxLx+1j1 Hfpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=ZyFZLoSG+lQkfUUVzK7pE7MrJKpkWkHnRr5UT9SK9mY=; b=jyCS+YRxk/++BP3lDciFQqKw/CH7lnuUG0JwuEbrEZG5m255SZeC082tM0KM3dVmyx ockLscSUF02tnLGxE0uIDPB0MmWppf36wBYEvsnrsiYKGqH1zkKbmh0T9QCt4wuyjxM8 lnTbzMf2pP2uZMjtuegZWjpvb5RZJvFb8jgC3aOepjR3nTqkSravNVWSA/sgLLn8LV9d 6HNW7eRXe96sh+2VTNf2bgN+mcTxGWzAsEm1Q72l0oaX+C1JuZVyzdTW7T5Mj/BfBHjH PCInMv5W/f4wIhiQl2fHOI5Z82zP4C3Ce29UxG1fUXXYAGi5+bf4waqxLcjdi2eHE1Ue FITQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jjSqaOgl; 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 q18-v6si3872588pgt.529.2018.05.30.03.09.18; Wed, 30 May 2018 03:09:18 -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=jjSqaOgl; 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 S1750854AbeE3KJR (ORCPT + 10 others); Wed, 30 May 2018 06:09:17 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:46301 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750711AbeE3KJP (ORCPT ); Wed, 30 May 2018 06:09:15 -0400 Received: by mail-pg0-f68.google.com with SMTP id a3-v6so7923798pgt.13 for ; Wed, 30 May 2018 03:09:15 -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; bh=ZyFZLoSG+lQkfUUVzK7pE7MrJKpkWkHnRr5UT9SK9mY=; b=jjSqaOglqvN+CprMcQM3MTVIsGBHaitiVZjkKftHXTuhn/DQcP0j8rdFDudLga+sCJ cIyBCqPukDuBzvxkrMGtqUPBB+g6e37TBGMaVYlrGX/TLiR3+/iWX5Uz4cHq7ob3L7pQ 45YWCEEA+UTvJ7R4DmG6wUh7qsFLoqYY5NAqw= 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; bh=ZyFZLoSG+lQkfUUVzK7pE7MrJKpkWkHnRr5UT9SK9mY=; b=YVOfljVqpCRDMzao3Ljbm+EBPVGyMHL2enMRlF8vkVhoZlv3mUgYXqW3PzCgSpsALp RYNu8nasQM0ME76ZssenwQSMsqT5rxBfdFHZev0ltpLRX3baroVVy0T2oxb3rq92MlnH KhLiIUuGdW9daFJvS+psstRPIH/0ppnFzWnwjTDX+4eGpFz4eFtSNo6P6YB5fuIR8ADN 7UmQxbDIgT5juPaR08jdYwbnSyhy8L+3gu+QH3f2bds+vgRbXHV9l8yR4sbZo/ksS392 7iPHvU5BUu+iZ4VjhgIsMjJcDy6w/fdyUyx2Q2uerNH0DVxVpBLnfSVsGCoVox644EQD tvKA== X-Gm-Message-State: ALKqPwdqTxoLmhPhFfficdvg70IP8urXYYiCVURJhS70oHZjITOp+uPm 8z/OgiLxC/XqDGXGBcKs/OACDw== X-Received: by 2002:a65:6645:: with SMTP id z5-v6mr1740839pgv.43.1527674955220; Wed, 30 May 2018 03:09:15 -0700 (PDT) Received: from localhost ([122.172.63.23]) by smtp.gmail.com with ESMTPSA id r26-v6sm25697894pfj.180.2018.05.30.03.09.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 03:09:14 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rajendra Nayak , linux-kernel@vger.kernel.org Subject: [PATCH] OPP: Allow same OPP table to be used for multiple genpd Date: Wed, 30 May 2018 15:39:02 +0530 Message-Id: <8a352fd8787cefcb19c25ca1390301f874797b9c.1527674939.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The OPP binding says: Property: operating-points-v2 ... This can contain more than one phandle for power domain providers that provide multiple power domains. That is, one phandle for each power domain. If only one phandle is available, then the same OPP table will be used for all power domains provided by the power domain provider. But the OPP core isn't allowing the same OPP table to be used for multiple domains. Update dev_pm_opp_of_add_table_indexed() to allow that. Signed-off-by: Viresh Kumar Tested-by: Rajendra Nayak --- drivers/opp/of.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) -- 2.15.0.194.g9af6a3dea062 Reviewed-by: Stephen Boyd diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 6d15f05bfc28..7af0ddec936b 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -554,11 +554,24 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table); int dev_pm_opp_of_add_table_indexed(struct device *dev, int index) { struct device_node *opp_np; - int ret; + int ret, count; +again: opp_np = _opp_of_get_opp_desc_node(dev->of_node, index); - if (!opp_np) + if (!opp_np) { + /* + * If only one phandle is present, then the same OPP table + * applies for all index requests. + */ + count = of_count_phandle_with_args(dev->of_node, + "operating-points-v2", NULL); + if (count == 1 && index) { + index = 0; + goto again; + } + return -ENODEV; + } ret = _of_add_opp_table_v2(dev, opp_np); of_node_put(opp_np);