From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Tony Lindgren <tony@atomide.com>, Dave Gerlach <d-gerlach@ti.com>,
Suman Anna <s-anna@ti.com>, Sasha Levin <sashal@kernel.org>,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 5.12 076/102] ARM: OMAP2+: Block suspend for am3 and am4 if PM is not configured
Date: Wed, 14 Jul 2021 15:40:09 -0400 [thread overview]
Message-ID: <20210714194036.53141-76-sashal@kernel.org> (raw)
In-Reply-To: <20210714194036.53141-1-sashal@kernel.org>
From: Tony Lindgren <tony@atomide.com>
[ Upstream commit 093a474ce10d8ea3db3ef2922aca5a38f34bab1b ]
If the PM related modules are not loaded and PM firmware not configured,
the system suspend fails to resume. Let's fix this by adding initial
platform_suspend_ops to block suspend and warn about missing modules.
When pm33xx and wkup_m3_ipc have been loaded and m3 coprocessor booted
with it's firmware, pm33xx sets up working platform_suspend_ops. Note
that we need to configure at least PM_SUSPEND_STANDBY to have
suspend_set_ops().
Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm/mach-omap2/pm33xx-core.c | 40 +++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/arch/arm/mach-omap2/pm33xx-core.c b/arch/arm/mach-omap2/pm33xx-core.c
index 56f2c0bcae5a..bf0d25fd2cea 100644
--- a/arch/arm/mach-omap2/pm33xx-core.c
+++ b/arch/arm/mach-omap2/pm33xx-core.c
@@ -8,6 +8,7 @@
#include <linux/cpuidle.h>
#include <linux/platform_data/pm33xx.h>
+#include <linux/suspend.h>
#include <asm/cpuidle.h>
#include <asm/smp_scu.h>
#include <asm/suspend.h>
@@ -324,6 +325,44 @@ static struct am33xx_pm_platform_data *am33xx_pm_get_pdata(void)
return NULL;
}
+#ifdef CONFIG_SUSPEND
+/*
+ * Block system suspend initially. Later on pm33xx sets up it's own
+ * platform_suspend_ops after probe. That depends also on loaded
+ * wkup_m3_ipc and booted am335x-pm-firmware.elf.
+ */
+static int amx3_suspend_block(suspend_state_t state)
+{
+ pr_warn("PM not initialized for pm33xx, wkup_m3_ipc, or am335x-pm-firmware.elf\n");
+
+ return -EINVAL;
+}
+
+static int amx3_pm_valid(suspend_state_t state)
+{
+ switch (state) {
+ case PM_SUSPEND_STANDBY:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+static const struct platform_suspend_ops amx3_blocked_pm_ops = {
+ .begin = amx3_suspend_block,
+ .valid = amx3_pm_valid,
+};
+
+static void __init amx3_block_suspend(void)
+{
+ suspend_set_ops(&amx3_blocked_pm_ops);
+}
+#else
+static inline void amx3_block_suspend(void)
+{
+}
+#endif /* CONFIG_SUSPEND */
+
int __init amx3_common_pm_init(void)
{
struct am33xx_pm_platform_data *pdata;
@@ -337,6 +376,7 @@ int __init amx3_common_pm_init(void)
devinfo.size_data = sizeof(*pdata);
devinfo.id = -1;
platform_device_register_full(&devinfo);
+ amx3_block_suspend();
return 0;
}
--
2.30.2
prev parent reply other threads:[~2021-07-14 19:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210714194036.53141-1-sashal@kernel.org>
2021-07-14 19:39 ` [PATCH AUTOSEL 5.12 040/102] ARM: dts: am335x: align GPIO hog names with dt-schema Sasha Levin
2021-07-14 19:39 ` [PATCH AUTOSEL 5.12 041/102] ARM: dts: am437x: align gpio " Sasha Levin
2021-07-14 19:39 ` [PATCH AUTOSEL 5.12 042/102] ARM: dts: omap3: " Sasha Levin
2021-07-14 19:39 ` [PATCH AUTOSEL 5.12 043/102] ARM: dts: omap5-board-common: " Sasha Levin
2021-07-14 19:39 ` [PATCH AUTOSEL 5.12 044/102] ARM: dts: dra7x-evm: Align GPIO " Sasha Levin
2021-07-14 19:39 ` [PATCH AUTOSEL 5.12 045/102] ARM: dts: am57xx-cl-som-am57x: fix ti,no-reset-on-init flag for gpios Sasha Levin
2021-07-14 19:39 ` [PATCH AUTOSEL 5.12 046/102] ARM: dts: am437x-gp-evm: " Sasha Levin
2021-07-14 19:39 ` [PATCH AUTOSEL 5.12 047/102] ARM: dts: am335x: " Sasha Levin
2021-07-14 19:39 ` [PATCH AUTOSEL 5.12 048/102] ARM: dts: OMAP2+: Replace underscores in sub-mailbox node names Sasha Levin
2021-07-14 19:40 ` Sasha Levin [this message]
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=20210714194036.53141-76-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=d-gerlach@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=s-anna@ti.com \
--cc=stable@vger.kernel.org \
--cc=tony@atomide.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).