All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leonard Crestez <leonard.crestez@nxp.com>
To: Lucas Stach <l.stach@pengutronix.de>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Sascha Hauer <kernel@pengutronix.de>,
	Shawn Guo <shawnguo@kernel.org>
Cc: Leonard Crestez <leonard.crestez@nxp.com>,
	Mark Brown <broonie@kernel.org>, Robin Gong <yibin.gong@nxp.com>,
	Anson Huang <Anson.Huang@nxp.com>,
	Irina Tirdea <irina.tirdea@nxp.com>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	Octavian Purdila <octavian.purdila@nxp.com>,
	Liam Girdwood <lgirdwood@gmail.com>, <linux-pm@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH v2 2/4] cpufreq: imx6q: Set max suspend_freq to avoid changes during suspend
Date: Tue, 4 Apr 2017 20:04:12 +0300	[thread overview]
Message-ID: <5f61b819733127ddc7d41e82bf703a355c845b49.1491324640.git.leonard.crestez@nxp.com> (raw)
In-Reply-To: <cover.1491324640.git.leonard.crestez@nxp.com>

If the cpufreq driver tries to modify voltage/freq during suspend/resume
it might need to control an external PMIC via I2C or SPI but those
devices might be already suspended. This issue is likely to happen
whenever the LDOs have their vin-supply set.

To avoid this scenario we just increase cpufreq to the maximum before
suspend.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 drivers/cpufreq/imx6q-cpufreq.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index be90ee3..786122e 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -161,8 +161,13 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
 
 static int imx6q_cpufreq_init(struct cpufreq_policy *policy)
 {
+	int ret;
+
 	policy->clk = arm_clk;
-	return cpufreq_generic_init(policy, freq_table, transition_latency);
+	ret = cpufreq_generic_init(policy, freq_table, transition_latency);
+	policy->suspend_freq = policy->max;
+
+	return ret;
 }
 
 static struct cpufreq_driver imx6q_cpufreq_driver = {
@@ -173,6 +178,7 @@ static struct cpufreq_driver imx6q_cpufreq_driver = {
 	.init = imx6q_cpufreq_init,
 	.name = "imx6q-cpufreq",
 	.attr = cpufreq_generic_attr,
+	.suspend = cpufreq_generic_suspend,
 };
 
 static int imx6q_cpufreq_probe(struct platform_device *pdev)
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: Leonard Crestez <leonard.crestez@nxp.com>
To: Lucas Stach <l.stach@pengutronix.de>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Sascha Hauer <kernel@pengutronix.de>,
	Shawn Guo <shawnguo@kernel.org>
Cc: Leonard Crestez <leonard.crestez@nxp.com>,
	Anson Huang <Anson.Huang@nxp.com>,
	Irina Tirdea <irina.tirdea@nxp.com>,
	linux-pm@vger.kernel.org, Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org>,
	Octavian Purdila <octavian.purdila@nxp.com>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	Robin Gong <yibin.gong@nxp.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/4] cpufreq: imx6q: Set max suspend_freq to avoid changes during suspend
Date: Tue, 4 Apr 2017 20:04:12 +0300	[thread overview]
Message-ID: <5f61b819733127ddc7d41e82bf703a355c845b49.1491324640.git.leonard.crestez@nxp.com> (raw)
In-Reply-To: <cover.1491324640.git.leonard.crestez@nxp.com>

If the cpufreq driver tries to modify voltage/freq during suspend/resume
it might need to control an external PMIC via I2C or SPI but those
devices might be already suspended. This issue is likely to happen
whenever the LDOs have their vin-supply set.

To avoid this scenario we just increase cpufreq to the maximum before
suspend.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 drivers/cpufreq/imx6q-cpufreq.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index be90ee3..786122e 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -161,8 +161,13 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
 
 static int imx6q_cpufreq_init(struct cpufreq_policy *policy)
 {
+	int ret;
+
 	policy->clk = arm_clk;
-	return cpufreq_generic_init(policy, freq_table, transition_latency);
+	ret = cpufreq_generic_init(policy, freq_table, transition_latency);
+	policy->suspend_freq = policy->max;
+
+	return ret;
 }
 
 static struct cpufreq_driver imx6q_cpufreq_driver = {
@@ -173,6 +178,7 @@ static struct cpufreq_driver imx6q_cpufreq_driver = {
 	.init = imx6q_cpufreq_init,
 	.name = "imx6q-cpufreq",
 	.attr = cpufreq_generic_attr,
+	.suspend = cpufreq_generic_suspend,
 };
 
 static int imx6q_cpufreq_probe(struct platform_device *pdev)
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: leonard.crestez@nxp.com (Leonard Crestez)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/4] cpufreq: imx6q: Set max suspend_freq to avoid changes during suspend
Date: Tue, 4 Apr 2017 20:04:12 +0300	[thread overview]
Message-ID: <5f61b819733127ddc7d41e82bf703a355c845b49.1491324640.git.leonard.crestez@nxp.com> (raw)
In-Reply-To: <cover.1491324640.git.leonard.crestez@nxp.com>

If the cpufreq driver tries to modify voltage/freq during suspend/resume
it might need to control an external PMIC via I2C or SPI but those
devices might be already suspended. This issue is likely to happen
whenever the LDOs have their vin-supply set.

To avoid this scenario we just increase cpufreq to the maximum before
suspend.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 drivers/cpufreq/imx6q-cpufreq.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index be90ee3..786122e 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -161,8 +161,13 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
 
 static int imx6q_cpufreq_init(struct cpufreq_policy *policy)
 {
+	int ret;
+
 	policy->clk = arm_clk;
-	return cpufreq_generic_init(policy, freq_table, transition_latency);
+	ret = cpufreq_generic_init(policy, freq_table, transition_latency);
+	policy->suspend_freq = policy->max;
+
+	return ret;
 }
 
 static struct cpufreq_driver imx6q_cpufreq_driver = {
@@ -173,6 +178,7 @@ static struct cpufreq_driver imx6q_cpufreq_driver = {
 	.init = imx6q_cpufreq_init,
 	.name = "imx6q-cpufreq",
 	.attr = cpufreq_generic_attr,
+	.suspend = cpufreq_generic_suspend,
 };
 
 static int imx6q_cpufreq_probe(struct platform_device *pdev)
-- 
2.7.4

  parent reply	other threads:[~2017-04-04 17:05 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 17:04 [PATCH v2 0/4] ARM: imx: Set LDO regulator supply Leonard Crestez
2017-04-04 17:04 ` Leonard Crestez
2017-04-04 17:04 ` Leonard Crestez
2017-04-04 17:04 ` [PATCH v2 1/4] cpufreq: imx6q: Fix handling EPROBE_DEFER from regulator Leonard Crestez
2017-04-04 17:04   ` Leonard Crestez
2017-04-04 17:04   ` Leonard Crestez
2017-04-04 17:04 ` Leonard Crestez [this message]
2017-04-04 17:04   ` [PATCH v2 2/4] cpufreq: imx6q: Set max suspend_freq to avoid changes during suspend Leonard Crestez
2017-04-04 17:04   ` Leonard Crestez
2017-04-05  8:03   ` Lucas Stach
2017-04-05  8:03     ` Lucas Stach
2017-04-11  6:37   ` Viresh Kumar
2017-04-11  6:37     ` Viresh Kumar
2017-04-11  8:16     ` Leonard Crestez
2017-04-11  8:16       ` Leonard Crestez
2017-04-11  8:16       ` Leonard Crestez
2017-04-11  9:27   ` Viresh Kumar
2017-04-11  9:27     ` Viresh Kumar
2017-04-04 17:04 ` [PATCH v2 3/4] ARM: dts: imx6qdl-sabresd: Set LDO regulator supply Leonard Crestez
2017-04-04 17:04   ` Leonard Crestez
2017-04-04 17:04   ` Leonard Crestez
2017-04-07 12:20   ` Shawn Guo
2017-04-07 12:20     ` Shawn Guo
2017-04-04 17:04 ` [PATCH v2 4/4] ARM: dts: imx6qp-sabresd: Set reg_arm " Leonard Crestez
2017-04-04 17:04   ` Leonard Crestez
2017-04-04 17:04   ` Leonard Crestez
2017-04-07 12:21   ` Shawn Guo
2017-04-07 12:21     ` Shawn Guo
2017-04-19  9:28 ` [PATCH v2 0/4] ARM: imx: Set LDO " Leonard Crestez
2017-04-19  9:28   ` Leonard Crestez
2017-04-19  9:28   ` Leonard Crestez

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=5f61b819733127ddc7d41e82bf703a355c845b49.1491324640.git.leonard.crestez@nxp.com \
    --to=leonard.crestez@nxp.com \
    --cc=Anson.Huang@nxp.com \
    --cc=broonie@kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=irina.tirdea@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=octavian.purdila@nxp.com \
    --cc=rjw@rjwysocki.net \
    --cc=shawnguo@kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=yibin.gong@nxp.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.