From patchwork Mon May 7 12:52:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Escande X-Patchwork-Id: 10384079 X-Patchwork-Delegate: agross@codeaurora.org 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 2679860318 for ; Mon, 7 May 2018 12:52:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FF03283C7 for ; Mon, 7 May 2018 12:52:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2453D28AF8; Mon, 7 May 2018 12:52:33 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable 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 39CAB28A57 for ; Mon, 7 May 2018 12:52:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752360AbeEGMwa (ORCPT ); Mon, 7 May 2018 08:52:30 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35123 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752248AbeEGMw3 (ORCPT ); Mon, 7 May 2018 08:52:29 -0400 Received: by mail-wm0-f68.google.com with SMTP id o78-v6so15257014wmg.0 for ; Mon, 07 May 2018 05:52: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:mime-version :content-transfert-encoding; bh=vhtF1BFQVi+0HvwC2dsnRxUfMVtfq5kw438tFw2Ll5E=; b=gMyk9LHCQz89CAU3CXaNcwpzc8zwKarDTYyMeVMjkjng0FvucHXJy4UTSOY+nYl9YA kpnXFvxi6PdV2zUcPy5VwQuht+D7CBK6KFsfw3auEzFX7qAkI4z5pIRwwuvsNj2pRC8H 1B2G/bbqdAYiYv3eVbuxWlZMfcht9pGpI7Y5U= 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:mime-version :content-transfert-encoding; bh=vhtF1BFQVi+0HvwC2dsnRxUfMVtfq5kw438tFw2Ll5E=; b=aGBNApqr61tF+v8wHxX/7P1HoG9uzMR00CHkQf34mBBV6O5tHM0qWQgzT3g/Rikhuv eCZte6PierFchkLA/JHuhkwZd6S2DQYmjuU3hLgCdqz+ZgxhGvTHI2Dhh62bYcnBu7VJ Leu/PYzTOyo1zQhBr2+3Qo7TibN7ehVyorwxDV+JKEGB2xPx+hTNdCq1YacqBlGqqh4W 9k8Lv/NOmX5LdV2tzbaFqI50M4wPXQfg1aHKOR/3luNqLNBm690X3yB/bfxamW2E+H6F NbP2gr9TYipPP7WESfeXlaBGC1f4VcISLu6CEK6BVTOLZli4MXmVZippYLgQEJenR1eC G+4w== X-Gm-Message-State: ALKqPwfPZFzpO+mT2fAuHn2rsrWSsSQXP6cwiJzFdnHfVbDZgtw/c4aZ SuqoQ6F1A/fyNS7SKoWU7sLRlw== X-Google-Smtp-Source: AB8JxZpGThLwrZS7XJBU6nCwmuW4SSCEZHAO00+R1AtlQg2yYEQjCevxS9ch2TYVyMkGB5HdQ8Qfxg== X-Received: by 2002:a1c:eed9:: with SMTP id j86-v6mr678918wmi.97.1525697547861; Mon, 07 May 2018 05:52:27 -0700 (PDT) Received: from localhost.localdomain (aig34-1-88-167-228-121.fbx.proxad.net. [88.167.228.121]) by smtp.gmail.com with ESMTPSA id r200sm10614630wmb.39.2018.05.07.05.52.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 May 2018 05:52:27 -0700 (PDT) From: Thierry Escande To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Sricharan Ramabadhran , Bjorn Andersson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [RFC] PM / OPP: Ignore missing supplies if a prop_name is set Date: Mon, 7 May 2018 14:52:23 +0200 Message-Id: <20180507125223.18508-1-thierry.escande@linaro.org> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Content-Transfert-Encoding: 8bit Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For a given frequency and prop_name, if a voltage supply entry is missing in the opp-table defined in DT, the frequency was added anyway to the opp tables with a voltage setting of 0. With this patch, if a prop_name is set, frequencies with no corresponding prop_name are ignored without failing. Signed-off-by: Thierry Escande --- For Qualcomm apq8064 SoCs, the opp-tables defined in the dts file contain all frequencies supported by all SoC versions. But not all SoCs support all frequencies and they are filtered out by a prop_name containing a speed bin value and a pvs value both read from a fuse register sets in factory. The speed bin defines the SoC version and the voltage setting is defined by the pvs value in the form: opp-384000000 { opp-hz = /bits/ 64 <384000000>; opp-microvolt-speed0-pvs0-v0 = <950000>; opp-microvolt-speed0-pvs1-v0 = <900000>; ... opp-microvolt-speed1-pvs0-v0 = <950000>; opp-microvolt-speed1-pvs1-v0 = <950000>; ... opp-microvolt-speed2-pvs0-v0 = <950000>; opp-microvolt-speed2-pvs1-v0 = <950000>; opp-microvolt-speed2-pvs2-v0 = <925000>; opp-microvolt-speed2-pvs3-v0 = <900000>; ... }; Since some opp-freq entries may not have properties for a particular speed value the idea is to ignore a frequency if it does not contain a property as "opp-microvolt-prop_name" nor one as "opp-microvolt" without failing if the opp_table has a prop_name defined. Otherwise, there would be unsupported frequencies reported as supported with a voltage setting of zero. This could affect SoCs that have a prop_name defined and no "opp-microvolt" entry in the opp-table. I didn't spot any of these but I'd like to have your opinion. --- drivers/opp/of.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index cb716aa2f44b..2efe69d619f3 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -132,6 +132,14 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, /* Missing property isn't a problem, but an invalid entry is */ if (!prop) { + /* + * A prop_name is specified but no property found with + * or without prop_name. Return ENOENT so the caller + * knows the entry is missing. + */ + if (opp_table->prop_name) + return -ENOENT; + if (!opp_table->regulator_count) return 0; @@ -325,8 +333,11 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, new_opp->clock_latency_ns = val; ret = opp_parse_supplies(new_opp, dev, opp_table); - if (ret) + if (ret) { + if (ret == -ENOENT) + ret = 0; goto free_opp; + } ret = _opp_add(dev, new_opp, opp_table); if (ret) {