Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1329913

[PATCH V3 02/16] PM / OPP: Disable OPPs that aren't supported by the regulator

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Viresh Kumar <viresh.kumar@linaro.org>
Newsgroups linux.kernel
Subject [PATCH V3 02/16] PM / OPP: Disable OPPs that aren't supported by the regulator
Date Tue, 09 Feb 2016 06:10:03 +0100
Message-ID <r08IP-7Ps-9@gated-at.bofh.it> (permalink)
References <r08IN-7Ps-3@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=q1I3lYpdQGxUrPK2+oeUNnSrrJ+c3SwcD5jjcrPcbRI=; b=QYxCwNNhK6+WlWqYo8cYV9HvskAK/XPQEd3riFjVvV5MqDBBnXEQb+067dL0ObpG0H 8FZgvIZGAMMhSS8l4PUJCHb4AaGRJbN7XETWeVvbfu5FVWoA0Ywj5aG1N3Il5ok42RvH zqlikzAtzeOhLboXC2/m2ddXKlAMaFpP8WN9g=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=q1I3lYpdQGxUrPK2+oeUNnSrrJ+c3SwcD5jjcrPcbRI=; b=TLHTZHjDQlwFEjHDmWLU+fkdUTd8ByIXE5rbQA8lrqHjQ2Gjz4HMyRv1k7cg1BjURp ZVl7sZnPsvdlDMSS4SoGdhgmqvQyiNGrzSk+pHVtsTiGVHogyEhZNbN+pyexrx+933Eg CeNB6aMQPN+c2Elihf8aqjcgnG4wnLg3XuUSauuR3EonUtB5AHsmaXrpefIkdAYQsSa8 0A4owzJ4jtBKH62jj6mO/9cUwA3cvC4RIbIlqSv2L/zbNhT48koQPiHyhvECugl1lyI5 6R94tiJI2X0ijXkT0EYLTcyDqDf3idaOzth3qD2YPYQ13NI3Vu2TT2Hs7WlGLcvP8K6v TWVQ==
X-Gm-Message-State AG10YOTwlWlFb6KI4aXgHp9xS3HuHRo9uZxzy8SJ+s31iJO6/T0RX1sC5MUyO5eir85PKCZ5
X-Received by 10.98.42.10 with SMTP id q10mr47703699pfq.73.1454994074099; Mon, 08 Feb 2016 21:01:14 -0800 (PST)
X-Mailer git-send-email 2.7.1.370.gb2aa7f8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 51
Organization linux.* mail to news gateway
X-Original-Cc linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Stephen Boyd <sboyd@codeaurora.org>, nm@ti.com, Viresh Kumar <viresh.kumar@linaro.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Len Brown <len.brown@intel.com>, linux-kernel@vger.kernel.org (open list), Pavel Machek <pavel@ucw.cz>, Viresh Kumar <vireshk@kernel.org>
X-Original-Date Tue, 9 Feb 2016 10:30:34 +0530
X-Original-Message-ID <4046978926e8e61e56489e8ed348d1725cbfd499.1454992186.git.viresh.kumar@linaro.org>
X-Original-References <cover.1454992186.git.viresh.kumar@linaro.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1329913

Show key headers only | View raw


Disable any OPPs where the connected regulator isn't able to provide the
specified voltage.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/base/power/opp/core.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index 1e22b71abf1e..71545becfca1 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -687,6 +687,22 @@ static struct dev_pm_opp *_allocate_opp(struct device *dev,
 	return opp;
 }
 
+static bool _opp_supported_by_regulators(struct dev_pm_opp *opp,
+					 struct device_opp *dev_opp)
+{
+	struct regulator *reg = dev_opp->regulator;
+
+	if (!IS_ERR(reg) &&
+	    !regulator_is_supported_voltage(reg, opp->u_volt_min,
+					    opp->u_volt_max)) {
+		pr_warn("%s: OPP minuV: %lu maxuV: %lu, not supported by regulator\n",
+			__func__, opp->u_volt_min, opp->u_volt_max);
+		return false;
+	}
+
+	return true;
+}
+
 static int _opp_add(struct device *dev, struct dev_pm_opp *new_opp,
 		    struct device_opp *dev_opp)
 {
@@ -728,6 +744,12 @@ static int _opp_add(struct device *dev, struct dev_pm_opp *new_opp,
 		dev_err(dev, "%s: Failed to register opp to debugfs (%d)\n",
 			__func__, ret);
 
+	if (!_opp_supported_by_regulators(new_opp, dev_opp)) {
+		new_opp->available = false;
+		dev_warn(dev, "%s: OPP not supported by regulators (%lu)\n",
+			 __func__, new_opp->rate);
+	}
+
 	return 0;
 }
 
-- 
2.7.1.370.gb2aa7f8

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH V3 02/16] PM / OPP: Disable OPPs that aren't supported by the regulator Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-09 06:10 +0100

csiph-web