[PATCH v2 5/5] ARM: OMAP2+: Create dummy platform_device for pm33xx

From: Dave Gerlach
Date: Fri May 19 2017 - 16:06:33 EST


Add amx3_common_pm_init to create a dummy platform_device for
pm33xx so that our pm33xx module can probe and am335x and am437x
platforms to enable basic suspend to mem and standby support.

Signed-off-by: Dave Gerlach <d-gerlach@xxxxxx>
---
arch/arm/mach-omap2/common.h | 7 +++++++
arch/arm/mach-omap2/io.c | 2 ++
arch/arm/mach-omap2/pm33xx-core.c | 12 ++++++++++++
3 files changed, 21 insertions(+)

diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 3089d3bfa19b..cd7724d040f8 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -77,6 +77,13 @@ static inline int omap4_pm_init_early(void)
}
#endif

+#if defined(CONFIG_PM) && (defined(CONFIG_SOC_AM33XX) || \
+ defined(CONFIG_SOC_AM43XX))
+void amx3_common_pm_init(void);
+#else
+static inline void amx3_common_pm_init(void) { }
+#endif
+
extern void omap2_init_common_infrastructure(void);

extern void omap_init_time(void);
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 5aafb8449c40..1bbbf19c93ea 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -652,6 +652,7 @@ void __init am33xx_init_early(void)
void __init am33xx_init_late(void)
{
omap_common_late_init();
+ amx3_common_pm_init();
}
#endif

@@ -676,6 +677,7 @@ void __init am43xx_init_late(void)
{
omap_common_late_init();
omap2_clk_enable_autoidle_all();
+ amx3_common_pm_init();
}
#endif

diff --git a/arch/arm/mach-omap2/pm33xx-core.c b/arch/arm/mach-omap2/pm33xx-core.c
index c84ffc4de2e9..b5d90841c27a 100644
--- a/arch/arm/mach-omap2/pm33xx-core.c
+++ b/arch/arm/mach-omap2/pm33xx-core.c
@@ -179,3 +179,15 @@ struct am33xx_pm_platform_data *am33xx_pm_get_pdata(void)
else
return NULL;
}
+
+void __init amx3_common_pm_init(void)
+{
+ struct platform_device_info devinfo = { };
+ struct am33xx_pm_platform_data *pdata;
+
+ pdata = am33xx_pm_get_pdata();
+ devinfo.name = "pm33xx";
+ devinfo.data = pdata;
+ devinfo.size_data = sizeof(*pdata);
+ platform_device_register_full(&devinfo);
+}
--
2.13.0