Skip to content

Commit ffa6f08

Browse files
tmlindgregkh
authored andcommitted
ARM: OMAP2+: Block suspend for am3 and am4 if PM is not configured
[ Upstream commit 093a474 ] 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>
1 parent f40a7c9 commit ffa6f08

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

‎arch/arm/mach-omap2/pm33xx-core.c‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <linux/cpuidle.h>
1010
#include <linux/platform_data/pm33xx.h>
11+
#include <linux/suspend.h>
1112
#include <asm/cpuidle.h>
1213
#include <asm/smp_scu.h>
1314
#include <asm/suspend.h>
@@ -324,6 +325,44 @@ static struct am33xx_pm_platform_data *am33xx_pm_get_pdata(void)
324325
return NULL;
325326
}
326327

328+
#ifdef CONFIG_SUSPEND
329+
/*
330+
* Block system suspend initially. Later on pm33xx sets up it's own
331+
* platform_suspend_ops after probe. That depends also on loaded
332+
* wkup_m3_ipc and booted am335x-pm-firmware.elf.
333+
*/
334+
static int amx3_suspend_block(suspend_state_t state)
335+
{
336+
pr_warn("PM not initialized for pm33xx, wkup_m3_ipc, or am335x-pm-firmware.elf\n");
337+
338+
return -EINVAL;
339+
}
340+
341+
static int amx3_pm_valid(suspend_state_t state)
342+
{
343+
switch (state) {
344+
case PM_SUSPEND_STANDBY:
345+
return 1;
346+
default:
347+
return 0;
348+
}
349+
}
350+
351+
static const struct platform_suspend_ops amx3_blocked_pm_ops = {
352+
.begin = amx3_suspend_block,
353+
.valid = amx3_pm_valid,
354+
};
355+
356+
static void __init amx3_block_suspend(void)
357+
{
358+
suspend_set_ops(&amx3_blocked_pm_ops);
359+
}
360+
#else
361+
static inline void amx3_block_suspend(void)
362+
{
363+
}
364+
#endif /* CONFIG_SUSPEND */
365+
327366
int __init amx3_common_pm_init(void)
328367
{
329368
struct am33xx_pm_platform_data *pdata;
@@ -337,6 +376,7 @@ int __init amx3_common_pm_init(void)
337376
devinfo.size_data = sizeof(*pdata);
338377
devinfo.id = -1;
339378
platform_device_register_full(&devinfo);
379+
amx3_block_suspend();
340380

341381
return 0;
342382
}

0 commit comments

Comments
 (0)