lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <2cd568e33356b2f409d6af81aaad4e2ee418b905.1441972771.git.viresh.kumar@linaro.org>
Date:	Fri, 11 Sep 2015 17:32:05 +0530
From:	Viresh Kumar <viresh.kumar@...aro.org>
To:	Rafael Wysocki <rjw@...ysocki.net>, nm@...com, sboyd@...eaurora.org
Cc:	linaro-kernel@...ts.linaro.org, linux-pm@...r.kernel.org,
	rob.herring@...aro.org, lee.jones@...aro.org,
	Viresh Kumar <viresh.kumar@...aro.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
	Dmitry Torokhov <dtor@...omium.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Len Brown <len.brown@...el.com>,
	linux-kernel@...r.kernel.org (open list),
	Pavel Machek <pavel@....cz>
Subject: [PATCH 09/16] PM / OPP: Disable OPPs that aren't supported by the regulators

Disable any OPPs where the connected regulators aren't able to provide
the specified voltage.

Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
---
 drivers/base/power/opp/core.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index 42ea5a332ddc..04fe181b8132 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -834,6 +834,34 @@ static int _opp_add_v1(struct device *dev, unsigned long freq, long u_volt,
 	return ret;
 }
 
+static bool opp_supported_by_regulators(struct dev_pm_opp *opp,
+					struct device_opp *dev_opp)
+{
+	struct opp_supply *supply;
+	struct regulator *reg;
+	int count;
+
+	for (count = 0; count < dev_opp->supply_count; count++) {
+		supply = opp->supplies + count;
+		reg = dev_opp->regulators[count];
+
+		/* Regulator may not be available for device */
+		if (IS_ERR(reg))
+			continue;
+
+		if (!regulator_is_supported_voltage(reg, supply->u_volt_min,
+						    supply->u_volt_max)) {
+			pr_warn("%s: OPP minuV: %lu maxuV: %lu, not supported by regulator: %s\n",
+				__func__, supply->u_volt_min,
+				supply->u_volt_max,
+				dev_opp->supply_names[count]);
+			return false;
+		}
+	}
+
+	return true;
+}
+
 /* returns the number of entries used from microvolt */
 static void opp_parse_single_supply(struct opp_supply *supply, bool triplet,
 				    u32 *microvolt, u32 *microamp)
@@ -1016,6 +1044,12 @@ static int _opp_add_static_v2(struct device *dev, struct device_node *np,
 	if (new_opp->clock_latency_ns > dev_opp->clock_latency_ns_max)
 		dev_opp->clock_latency_ns_max = new_opp->clock_latency_ns;
 
+	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);
+	}
+
 	mutex_unlock(&dev_opp_list_lock);
 
 	supply = &new_opp->supplies[0];
-- 
2.4.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ