From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Linux-sh list <linux-sh@vger.kernel.org>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
Magnus Damm <magnus.damm@gmail.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: [RFC][PATCH 2/4] PM / shmobile: Remove the stay_on flag from SH7372's PM domains
Date: Fri, 09 Dec 2011 23:44:35 +0000 [thread overview]
Message-ID: <201112100044.35717.rjw@sisk.pl> (raw)
In-Reply-To: <201112100042.45168.rjw@sisk.pl>
From: Rafael J. Wysocki <rjw@sisk.pl>
SH7372 uses two independent mechanisms for ensuring that power
domains will never be turned off: the stay_on flag and the "always
on" domain governor. Moreover, the "always on" governor is only taken
into accout by runtime PM code paths, while the stay_on flag affects
all attempts to turn the given domain off. Thus setting the stay_on
flag causes the "always on" governor to be unnecessary, which is
quite confusing.
However, the stay_on flag is currently only set for the A3SP PM
domain and only if console_suspend_enabled, so it may be replaced
by checking console_suspend_enabled directly in the A3SP's
.suspend() routine. [This requires domain .suspend() to return
a result, but that is a minor modification.]
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/arm/mach-shmobile/include/mach/sh7372.h | 3 --
arch/arm/mach-shmobile/pm-sh7372.c | 36 ++++++++++++---------------
2 files changed, 18 insertions(+), 21 deletions(-)
Index: linux/arch/arm/mach-shmobile/include/mach/sh7372.h
=================================--- linux.orig/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ linux/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -480,11 +480,10 @@ struct platform_device;
struct sh7372_pm_domain {
struct generic_pm_domain genpd;
struct dev_power_governor *gov;
- void (*suspend)(void);
+ int (*suspend)(void);
void (*resume)(void);
unsigned int bit_shift;
bool no_debug;
- bool stay_on;
};
static inline struct sh7372_pm_domain *to_sh7372_pd(struct generic_pm_domain *d)
Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
+++ linux/arch/arm/mach-shmobile/pm-sh7372.c
@@ -82,11 +82,12 @@ static int pd_power_down(struct generic_
struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd);
unsigned int mask = 1 << sh7372_pd->bit_shift;
- if (sh7372_pd->suspend)
- sh7372_pd->suspend();
+ if (sh7372_pd->suspend) {
+ int ret = sh7372_pd->suspend();
- if (sh7372_pd->stay_on)
- return 0;
+ if (ret)
+ return ret;
+ }
if (__raw_readl(PSTR) & mask) {
unsigned int retry_count;
@@ -113,9 +114,6 @@ static int __pd_power_up(struct sh7372_p
unsigned int retry_count;
int ret = 0;
- if (sh7372_pd->stay_on)
- goto out;
-
if (__raw_readl(PSTR) & mask)
goto out;
@@ -148,10 +146,11 @@ static int pd_power_up(struct generic_pm
return __pd_power_up(to_sh7372_pd(genpd), true);
}
-static void sh7372_a4r_suspend(void)
+static int sh7372_a4r_suspend(void)
{
sh7372_intcs_suspend();
__raw_writel(0x300fffff, WUPRMSK); /* avoid wakeup */
+ return 0;
}
static bool pd_active_wakeup(struct device *dev)
@@ -243,7 +242,6 @@ struct sh7372_pm_domain sh7372_a4r = {
.gov = &pm_domain_always_on_gov,
.suspend = sh7372_a4r_suspend,
.resume = sh7372_intcs_resume,
- .stay_on = true,
};
struct sh7372_pm_domain sh7372_a3rv = {
@@ -256,21 +254,23 @@ struct sh7372_pm_domain sh7372_a3ri = {
.bit_shift = 8,
};
+static int sh7372_a3sp_suspend(void)
+{
+ /*
+ * Serial consoles make use of SCIF hardware located in A3SP,
+ * keep such power domain on if "no_console_suspend" is set.
+ */
+ return console_suspend_enabled ? -EBUSY : 0;
+}
+
struct sh7372_pm_domain sh7372_a3sp = {
.genpd.name = "A3SP",
.bit_shift = 11,
.gov = &pm_domain_always_on_gov,
.no_debug = true,
+ .suspend = sh7372_a3sp_suspend,
};
-static void sh7372_a3sp_init(void)
-{
- /* serial consoles make use of SCIF hardware located in A3SP,
- * keep such power domain on if "no_console_suspend" is set.
- */
- sh7372_a3sp.stay_on = !console_suspend_enabled;
-}
-
struct sh7372_pm_domain sh7372_a3sg = {
.genpd.name = "A3SG",
.bit_shift = 13,
@@ -514,8 +514,6 @@ void __init sh7372_pm_init(void)
/* do not convert A3SM, A3SP, A3SG, A4R power down into A4S */
__raw_writel(0, PDNSEL);
- sh7372_a3sp_init();
-
sh7372_suspend_init();
sh7372_cpuidle_init();
}
next prev parent reply other threads:[~2011-12-09 23:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-09 23:42 [RFC][PATCH 0/4] PM / shmobile: Use PM QoS latency constraints in touchscreen driver Rafael J. Wysocki
2011-12-09 23:43 ` [RFC][PATCH 1/4] PM / shmobile: Don't include SH7372's INTCS in syscore suspend/resume Rafael J. Wysocki
2011-12-09 23:44 ` Rafael J. Wysocki [this message]
2011-12-09 23:45 ` [RFC][PATCH 3/4] PM / QoS: Introduce dev_pm_qos_add_ancestor_request() Rafael J. Wysocki
2011-12-09 23:46 ` [RFC][PATCH 4/4] PM / input / touchscreen: Make st1232 use device PM QoS constraints Rafael J. Wysocki
2011-12-12 14:34 ` [RFC][PATCH 4/4] PM / input / touchscreen: Make st1232 use device Guennadi Liakhovetski
2011-12-16 0:10 ` [Update][PATCH 0/5] PM / shmobile: Use PM QoS latency constraints in touchscreen driver on SH7372 Rafael J. Wysocki
2011-12-16 0:11 ` [Update][PATCH 1/5] PM / shmobile: Don't include SH7372's INTCS in syscore suspend/resume Rafael J. Wysocki
2011-12-16 0:12 ` [Update][PATCH 2/5] PM / shmobile: Remove the stay_on flag from SH7372's PM domains Rafael J. Wysocki
2011-12-16 0:12 ` [Update][PATCH 3/5] PM / QoS: Introduce dev_pm_qos_add_ancestor_request() Rafael J. Wysocki
2011-12-16 0:13 ` [Update][PATCH 4/5] PM / input / touchscreen: Make st1232 use device PM QoS constraints Rafael J. Wysocki
2011-12-16 0:16 ` [Update][PATCH 5/5] PM / shmobile: Allow the A4R domain to be turned off at run time Rafael J. Wysocki
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=201112100044.35717.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=g.liakhovetski@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.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 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).