linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: linux-arm-kernel@lists.infradead.org
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	linux-pm@vger.kernel.org, Shawn Guo <shawnguo@kernel.org>,
	kernel@pengutronix.de, Heiner Kallweit <hkallweit1@gmail.com>,
	Sascha Hauer <s.hauer@pengutronix.de>
Subject: [PATCH 5/5] cpufreq: imx6q: pu regulator is not optional
Date: Wed, 28 Oct 2015 08:59:14 +0100	[thread overview]
Message-ID: <1446019154-16384-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1446019154-16384-1-git-send-email-s.hauer@pengutronix.de>

Some SoC types have a PU regulator and others don't. On the SoCs which
have a PU regulator it's not optional, so regulator_get_optional is
not appropriate here.

Use the IMX6_CPUFREQ_NEED_PU_REG introduced with the last patch to
check whether we need a PU regulator and if we do, request it using
regulator_get() rather than regulator_get_optional.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/cpufreq/imx6q-cpufreq.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index f3729f9..605897b 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -92,7 +92,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
 
 	/* scaling up?  scale voltage before frequency */
 	if (new_freq > old_freq) {
-		if (!IS_ERR(pu_reg)) {
+		if (pu_reg) {
 			ret = regulator_set_voltage_tol(pu_reg, imx6_soc_volt[index], 0);
 			if (ret) {
 				dev_err(cpu_dev, "failed to scale vddpu up: %d\n", ret);
@@ -169,7 +169,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
 			dev_warn(cpu_dev, "failed to scale vddsoc down: %d\n", ret);
 			ret = 0;
 		}
-		if (!IS_ERR(pu_reg)) {
+		if (pu_reg) {
 			ret = regulator_set_voltage_tol(pu_reg, imx6_soc_volt[index], 0);
 			if (ret) {
 				dev_warn(cpu_dev, "failed to scale vddpu down: %d\n", ret);
@@ -237,7 +237,11 @@ static int imx6q_cpufreq_get_resources(void)
 	if (IS_ERR(arm_reg))
 		return PTR_ERR(arm_reg);
 
-	pu_reg = regulator_get_optional(cpu_dev, "pu");
+	if (imx6_cpufreq_flags & IMX6_CPUFREQ_NEED_PU_REG) {
+		pu_reg = regulator_get(cpu_dev, "pu");
+		if (IS_ERR(pu_reg))
+			return -EPROBE_DEFER;
+	}
 
 	soc_reg = regulator_get(cpu_dev, "soc");
 	if (IS_ERR(soc_reg))
@@ -404,7 +408,7 @@ soc_opp_out:
 	ret = regulator_set_voltage_time(soc_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]);
 	if (ret > 0)
 		transition_latency += ret * 1000;
-	if (!IS_ERR(pu_reg)) {
+	if (pu_reg) {
 		ret = regulator_set_voltage_time(pu_reg, imx6_soc_volt[0], imx6_soc_volt[num - 1]);
 		if (ret > 0)
 			transition_latency += ret * 1000;
-- 
2.6.1


  parent reply	other threads:[~2015-10-28  7:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-28  7:59 [PATCH v2] cpufreq: i.MX6: -EPROBE_DEFER fixes Sascha Hauer
2015-10-28  7:59 ` [PATCH 1/5] cpufreq: imx6q: Fix goto wrong error label Sascha Hauer
2015-10-28  7:59 ` [PATCH 2/5] cpufreq: imx6q: Fix wrong device in devm_kzalloc Sascha Hauer
2015-10-28  8:49   ` Lucas Stach
2015-10-28  7:59 ` [PATCH 3/5] cpufreq: imx6q: Fix regulator/clock error handling Sascha Hauer
2015-10-28  8:51   ` Lucas Stach
2015-10-28  7:59 ` [PATCH 4/5] cpufreq: imx6q: Use id_table to distinguish between SoCs Sascha Hauer
2015-10-28  9:00   ` Lucas Stach
2015-12-14  1:30   ` Shawn Guo
2015-10-28  7:59 ` Sascha Hauer [this message]
2015-12-11 17:23 ` [PATCH v2] cpufreq: i.MX6: -EPROBE_DEFER fixes Lucas Stach

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=1446019154-16384-6-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=hkallweit1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=shawnguo@kernel.org \
    --cc=viresh.kumar@linaro.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;
as well as URLs for NNTP newsgroup(s).