diff mbox

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

Message ID 20170519200438.9502-6-d-gerlach@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dave Gerlach May 19, 2017, 8:04 p.m. UTC
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@ti.com>
---
 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(+)

Comments

Johan Hovold July 3, 2017, 4:58 p.m. UTC | #1
On Fri, May 19, 2017 at 03:04:38PM -0500, Dave Gerlach wrote:
> 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@ti.com>
> ---

> +void __init amx3_common_pm_init(void)
> +{
> +	struct platform_device_info devinfo = { };

You should make sure devinfo is zeroed, and also set .id to -1. 

> +	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);
> +}

Johan
Dave Gerlach July 6, 2017, 7:08 p.m. UTC | #2
On 07/03/2017 11:58 AM, Johan Hovold wrote:
> On Fri, May 19, 2017 at 03:04:38PM -0500, Dave Gerlach wrote:
>> 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@ti.com>
>> ---
> 
>> +void __init amx3_common_pm_init(void)
>> +{
>> +	struct platform_device_info devinfo = { };
> 
> You should make sure devinfo is zeroed, and also set .id to -1. 

Thanks for the comment, will look into updating this for next version.

Regards,
Dave

> 
>> +	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);
>> +}
> 
> Johan
>
diff mbox

Patch

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);
+}