Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1222749 > unrolled thread
| Started by | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| First post | 2015-09-11 14:10 +0200 |
| Last post | 2015-09-11 14:10 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 09/16] PM / OPP: Disable OPPs that aren't supported by the regulators Viresh Kumar <viresh.kumar@linaro.org> - 2015-09-11 14:10 +0200
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2015-09-11 14:10 +0200 |
| Subject | [PATCH 09/16] PM / OPP: Disable OPPs that aren't supported by the regulators |
| Message-ID | <q7vjr-15e-9@gated-at.bofh.it> |
Disable any OPPs where the connected regulators aren't able to provide
the specified voltage.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top | Article view | linux.kernel
csiph-web