From: Viresh Kumar <viresh.kumar@linaro.org>
To: Rafael Wysocki <rjw@rjwysocki.net>, nm@ti.com, sboyd@codeaurora.org
Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
rob.herring@linaro.org, lee.jones@linaro.org,
Viresh Kumar <viresh.kumar@linaro.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Dmitry Torokhov <dtor@chromium.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>
Subject: [PATCH 09/16] PM / OPP: Disable OPPs that aren't supported by the regulators
Date: Fri, 11 Sep 2015 17:32:05 +0530 [thread overview]
Message-ID: <2cd568e33356b2f409d6af81aaad4e2ee418b905.1441972771.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1441972771.git.viresh.kumar@linaro.org>
In-Reply-To: <cover.1441972771.git.viresh.kumar@linaro.org>
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
next prev parent reply other threads:[~2015-09-11 12:03 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1441972771.git.viresh.kumar@linaro.org>
2015-09-11 12:01 ` [PATCH 01/16] PM / OPP: Add 'supply-names' binding Viresh Kumar
2015-09-14 20:22 ` Rob Herring
2015-09-15 2:47 ` Viresh Kumar
2015-10-08 9:27 ` Viresh Kumar
2015-10-16 0:22 ` Stephen Boyd
2015-10-16 6:02 ` Viresh Kumar
2015-10-16 19:16 ` Stephen Boyd
2015-10-17 4:10 ` Viresh Kumar
2015-10-21 13:18 ` Viresh Kumar
2015-10-22 16:39 ` Mark Brown
2015-10-27 8:19 ` Viresh Kumar
2015-10-28 8:17 ` Mark Brown
2015-10-29 23:38 ` Stephen Boyd
2015-10-22 16:30 ` Mark Brown
2015-09-11 12:01 ` [PATCH 02/16] PM / OPP: Add 'opp-microvolt-triplets' binding Viresh Kumar
2015-09-14 20:30 ` Rob Herring
2015-09-15 3:30 ` Viresh Kumar
2015-09-19 15:39 ` Mark Brown
2015-09-11 12:01 ` [PATCH 03/16] PM / OPP: Improve debug print messages with pr_fmt Viresh Kumar
2015-09-11 12:02 ` [PATCH 04/16] PM / OPP: Rename routines specific to old bindings with _v1 Viresh Kumar
2015-09-11 12:02 ` [PATCH 05/16] PM / OPP: Parse all power-supply related bindings together Viresh Kumar
2015-09-11 12:02 ` [PATCH 06/16] PM / OPP: Create separate structure for regulator/supplies Viresh Kumar
2015-09-11 12:02 ` [PATCH 07/16] PM / OPP: Add multiple regulators support Viresh Kumar
2015-09-11 12:02 ` [PATCH 08/16] PM / OPP: get/put regulators from OPP core Viresh Kumar
2015-09-11 12:02 ` Viresh Kumar [this message]
2015-09-11 12:02 ` [PATCH 10/16] PM / OPP: Introduce dev_pm_opp_get_max_volt_latency() Viresh Kumar
2015-09-11 12:02 ` [PATCH 11/16] PM / OPP: Introduce dev_pm_opp_get_max_transition_latency() Viresh Kumar
2015-09-11 12:02 ` [PATCH 12/16] PM / OPP: Parse clock and voltage tolerance for v1 bindings Viresh Kumar
2015-09-11 12:02 ` [PATCH 13/16] PM / OPP: Manage device clk as well Viresh Kumar
2015-09-11 12:02 ` [PATCH 14/16] PM / OPP: Add dev_pm_opp_set_regulator() to specify regulator Viresh Kumar
2015-09-11 12:02 ` [PATCH 15/16] PM / OPP: Add dev_pm_opp_set_rate() Viresh Kumar
2015-09-11 12:02 ` [PATCH 16/16] PM / OPP: don't print error message for deferred probing Viresh Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2cd568e33356b2f409d6af81aaad4e2ee418b905.1441972771.git.viresh.kumar@linaro.org \
--to=viresh.kumar@linaro.org \
--cc=b.zolnierkie@samsung.com \
--cc=dtor@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=lee.jones@linaro.org \
--cc=len.brown@intel.com \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nm@ti.com \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=rob.herring@linaro.org \
--cc=sboyd@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®