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: 135096 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp3128998lji; Mon, 7 May 2018 05:52:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqyOiEk+nPqxqO92TJI6ClUS4ucVI8i7SPA7RIlRGLbFl/wlU0ONEe4Ebe6DcC8UFjiIbS1 X-Received: by 2002:a65:5b4d:: with SMTP id y13-v6mr30091987pgr.152.1525697551231; Mon, 07 May 2018 05:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525697551; cv=none; d=google.com; s=arc-20160816; b=dGgOyWka40t03x3FedV1zuad0O60fHh6HBi1iDLZSntYOIEx5heC5PvbHAI0VYhd4b IuTvQxWG/EPLZsDlh02tjiibeUp2HSwSrsBSrc332+t1xuGsrGDPWWzU0y9RjVmIGAjq pqIeq9zF4HoZAKNkZ76sNe/UOqHk3kP4cOm+c/N4tRkvefMdEvNe9XICMv+DaJ89GTZn TBALl3DSFJuMZJkTiE2rQjHKpZjL5MAvIrOpyZK+P4coq1sO0JeP5KkVtzEskbccZKa7 8yvzLNVtwps9f0aOeZ3/qO+zXeADx3Kx6uatEicBL3M78JaHxrEK9hQXLM5fDY3iBDm3 6bmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfert-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=vhtF1BFQVi+0HvwC2dsnRxUfMVtfq5kw438tFw2Ll5E=; b=x64AFOIs//YrxgC0P+76zl9N6OkvhutaqNnBP26DeooIa2cVyOPx/txvbdbG6CoC2s mTyxmqtkLCn78U0qif6kuPKAxIElQtyeL9zlylETmEuecNJYl3vVAdB6MA1wcyqXNucq QWyLJFWrrG9BFKSdweHxNsa5DzAfOFMh6UjO5Ovw2SZtjO4D/PqlvYu9+I8ChqyU85Pl 91ZnHafRIlqp/YzAaDgOR39jX935ucv6Zyd1MCPpv/Yd9QCn8UBBwQU77OzgrMq0WQaz Dx7muKDPxWVhP6kJ4BVePtaa+LSB2J0sHQCzUPHLzGUHApM1PHttKfoRQbUtFVbzl/71 XT9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gMyk9LHC; 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 r18-v6si7728987pge.7.2018.05.07.05.52.31; Mon, 07 May 2018 05:52:31 -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=gMyk9LHC; 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 S1752260AbeEGMw3 (ORCPT + 10 others); Mon, 7 May 2018 08:52:29 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:39014 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752230AbeEGMw3 (ORCPT ); Mon, 7 May 2018 08:52:29 -0400 Received: by mail-wm0-f68.google.com with SMTP id f8-v6so15211869wmc.4 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=sK9cUd5xfcakUUCOmVSDrzrdr1uA1rKC3FKjw20nCZeMeyliw8n4avUMhvMd6uuYec bMwCllSZQtJiWc/j3EcgJiMy8TDTci4eaRtUKC3/+hECber4p8bKCzez5dONrgHF3daP +K9y0+QBRTZpg58iStQc33tA6EFwj+UsuVZs6D7gsiwe4VE7VdEARa6cczcjAOcc+VbF VhfbK2nS874AXu2CbnMV7RA5trOmH97K37ikKSxW5EExlHY3/chHNnNf/uZfNI1NXL7E +VkoCgFl43/pK/D319udUobIvSyug6FpmmFamAuVMkXc7ho647NO2jjAqvZ37ISvF3m4 HBnA== X-Gm-Message-State: ALKqPweVVGb2VM9kRGeb2TPeroQnPIv+A1SrY3C1R+iZImp1D5l6sxFB wovyAp4ms0ERrX5kkFhU2mQSAA== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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(-) -- 2.14.1 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) {