From patchwork Mon Nov 2 12:01:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Mazzucato X-Patchwork-Id: 11873775 X-Patchwork-Delegate: viresh.linux@gmail.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 213391130 for ; Mon, 2 Nov 2020 12:02:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 076D0223B0 for ; Mon, 2 Nov 2020 12:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728685AbgKBMCD (ORCPT ); Mon, 2 Nov 2020 07:02:03 -0500 Received: from foss.arm.com ([217.140.110.172]:58586 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728631AbgKBMCD (ORCPT ); Mon, 2 Nov 2020 07:02:03 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 341E030E; Mon, 2 Nov 2020 04:02:02 -0800 (PST) Received: from ubuntu.arm.com (unknown [10.57.53.184]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DF3683F66E; Mon, 2 Nov 2020 04:01:59 -0800 (PST) From: Nicola Mazzucato To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, sudeep.holla@arm.com, rjw@rjwysocki.net, vireshk@kernel.org, robh+dt@kernel.org, sboyd@kernel.org, nm@ti.com, daniel.lezcano@linaro.org Cc: morten.rasmussen@arm.com, chris.redpath@arm.com, nicola.mazzucato@arm.com Subject: [PATCH v3 2/3] opp/of: Allow empty opp-table with opp-shared Date: Mon, 2 Nov 2020 12:01:14 +0000 Message-Id: <20201102120115.29993-3-nicola.mazzucato@arm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201102120115.29993-1-nicola.mazzucato@arm.com> References: <20201102120115.29993-1-nicola.mazzucato@arm.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The opp binding now allows to have an empty opp table and shared-opp to merely describe a hw connection among devices (f/v lines). When initialising an opp table, allow such case by: - treating some errors as warnings - do not mark empty tables as shared - don't fail on empty table Signed-off-by: Nicola Mazzucato --- drivers/opp/of.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 874b58756220..b0230490bb31 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -157,6 +157,11 @@ static void _opp_table_free_required_tables(struct opp_table *opp_table) /* * Populate all devices and opp tables which are part of "required-opps" list. * Checking only the first OPP node should be enough. + * + * Corner case: empty opp table and opp-shared found. In this case we set + * unconditionally the opp table access to exclusive, as the opp-shared property + * is used purely to describe hw connections. Such information will be retrieved + * via dev_pm_opp_of_get_sharing_cpus(). */ static void _opp_table_alloc_required_tables(struct opp_table *opp_table, struct device *dev, @@ -169,7 +174,9 @@ static void _opp_table_alloc_required_tables(struct opp_table *opp_table, /* Traversing the first OPP node is all we need */ np = of_get_next_available_child(opp_np, NULL); if (!np) { - dev_err(dev, "Empty OPP table\n"); + dev_warn(dev, "Empty OPP table\n"); + + opp_table->shared_opp = OPP_TABLE_ACCESS_EXCLUSIVE; return; } @@ -377,7 +384,9 @@ int dev_pm_opp_of_find_icc_paths(struct device *dev, struct icc_path **paths; ret = _bandwidth_supported(dev, opp_table); - if (ret <= 0) + if (ret == -EINVAL) + return 0; /* Empty OPP table is a valid corner-case, let's not fail */ + else if (ret <= 0) return ret; ret = 0;