The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2] cpufreq: exynos: Convert exynos-cpufreq to platform driver
       [not found] <1381939238-30398-1-git-send-email-t.figa@samsung.com>
@ 2013-11-28 11:35 ` Lukasz Majewski
  2013-11-28 11:40   ` Sachin Kamat
  2013-11-28 12:42 ` [PATCH v3] " Lukasz Majewski
  1 sibling, 1 reply; 6+ messages in thread
From: Lukasz Majewski @ 2013-11-28 11:35 UTC (permalink / raw)
  To: Viresh Kumar, Rafael J. Wysocki
  Cc: cpufreq@vger.kernel.org, Linux PM list, Sachin Kamat, Jingoo Han,
	Lukasz Majewski, Lukasz Majewski, linux-kernel,
	Bartlomiej Zolnierkiewicz, Tomasz Figa, Kyungmin Park

To make the driver multiplatform-friendly, unconditional initialization
in an initcall is replaced with a platform driver probed only if
respective platform device is registered.

Tested at: Exynos4210 (TRATS) and Exynos4412 (TRATS2)

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

---
Changes for v2:
- Proper definition of exynos_cpufreq_init() function to squash warnings

 arch/arm/mach-exynos/common.c          |    5 +++++
 arch/arm/mach-exynos/common.h          |    1 +
 arch/arm/mach-exynos/mach-exynos4-dt.c |    1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |    1 +
 drivers/cpufreq/exynos-cpufreq.c       |   13 +++++++++++--
 5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 61d2906..1510436 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -303,6 +303,11 @@ void __init exynos_cpuidle_init(void)
 	platform_device_register(&exynos_cpuidle);
 }
 
+void __init exynos_cpufreq_init(void)
+{
+	platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
+}
+
 void __init exynos_init_late(void)
 {
 	if (of_machine_is_compatible("samsung,exynos5440"))
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index ff9b6a9..3f03334 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -22,6 +22,7 @@ void exynos_init_io(void);
 void exynos4_restart(enum reboot_mode mode, const char *cmd);
 void exynos5_restart(enum reboot_mode mode, const char *cmd);
 void exynos_cpuidle_init(void);
+void exynos_cpufreq_init(void);
 void exynos_init_late(void);
 
 void exynos_firmware_init(void);
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c
index 4603e6b..d3e54b7 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -22,6 +22,7 @@
 static void __init exynos4_dt_machine_init(void)
 {
 	exynos_cpuidle_init();
+	exynos_cpufreq_init();
 
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 1fe075a..602c5d7 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -44,6 +44,7 @@ static void __init exynos5_dt_machine_init(void)
 	}
 
 	exynos_cpuidle_init();
+	exynos_cpufreq_init();
 
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index f3c2287..e238c46 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -17,6 +17,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/cpufreq.h>
 #include <linux/suspend.h>
+#include <linux/platform_device.h>
 
 #include <plat/cpu.h>
 
@@ -232,7 +233,7 @@ static struct cpufreq_driver exynos_driver = {
 #endif
 };
 
-static int __init exynos_cpufreq_init(void)
+static int exynos_cpufreq_init(struct platform_device *pdev)
 {
 	int ret = -EINVAL;
 
@@ -281,4 +282,12 @@ err_vdd_arm:
 	kfree(exynos_info);
 	return -EINVAL;
 }
-late_initcall(exynos_cpufreq_init);
+
+static struct platform_driver exynos_cpufreq_platdrv = {
+	.driver = {
+		.name	= "exynos-cpufreq",
+		.owner	= THIS_MODULE,
+	},
+	.probe = exynos_cpufreq_init,
+};
+module_platform_driver(exynos_cpufreq_platdrv);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] cpufreq: exynos: Convert exynos-cpufreq to platform driver
  2013-11-28 11:35 ` [PATCH v2] cpufreq: exynos: Convert exynos-cpufreq to platform driver Lukasz Majewski
@ 2013-11-28 11:40   ` Sachin Kamat
  0 siblings, 0 replies; 6+ messages in thread
From: Sachin Kamat @ 2013-11-28 11:40 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Viresh Kumar, Rafael J. Wysocki, cpufreq@vger.kernel.org,
	Linux PM list, Jingoo Han, Lukasz Majewski, linux-kernel,
	Bartlomiej Zolnierkiewicz, Tomasz Figa, Kyungmin Park

Hi Lukasz,

On 28 November 2013 17:05, Lukasz Majewski <l.majewski@samsung.com> wrote:
> To make the driver multiplatform-friendly, unconditional initialization
> in an initcall is replaced with a platform driver probed only if
> respective platform device is registered.
>
> Tested at: Exynos4210 (TRATS) and Exynos4412 (TRATS2)
>
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>
> ---
> Changes for v2:
> - Proper definition of exynos_cpufreq_init() function to squash warnings

Looks good. Just one minor nit which I forgot to mention earlier.

[snip]

>
> -static int __init exynos_cpufreq_init(void)
> +static int exynos_cpufreq_init(struct platform_device *pdev)

How about renaming this function to exynos_cpufreq_probe?

-- 
With warm regards,
Sachin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3] cpufreq: exynos: Convert exynos-cpufreq to platform driver
       [not found] <1381939238-30398-1-git-send-email-t.figa@samsung.com>
  2013-11-28 11:35 ` [PATCH v2] cpufreq: exynos: Convert exynos-cpufreq to platform driver Lukasz Majewski
@ 2013-11-28 12:42 ` Lukasz Majewski
  2013-11-29  5:45   ` Sachin Kamat
  2013-12-16  9:13   ` Viresh Kumar
  1 sibling, 2 replies; 6+ messages in thread
From: Lukasz Majewski @ 2013-11-28 12:42 UTC (permalink / raw)
  To: Viresh Kumar, Rafael J. Wysocki
  Cc: cpufreq@vger.kernel.org, Linux PM list, Sachin Kamat, Jingoo Han,
	Lukasz Majewski, Lukasz Majewski, linux-kernel,
	Bartlomiej Zolnierkiewicz, Tomasz Figa, Kyungmin Park

To make the driver multiplatform-friendly, unconditional initialization
in an initcall is replaced with a platform driver probed only if
respective platform device is registered.

Tested at: Exynos4210 (TRATS) and Exynos4412 (TRATS2)

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

---
Changes for v3:
- Rename exynos_cpufreq_init() to exynos_cpufreq_probe()

Changes for v2:
- Proper definition of exynos_cpufreq_init() function to squash warnings

 arch/arm/mach-exynos/common.c          |    5 +++++
 arch/arm/mach-exynos/common.h          |    1 +
 arch/arm/mach-exynos/mach-exynos4-dt.c |    1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |    1 +
 drivers/cpufreq/exynos-cpufreq.c       |   13 +++++++++++--
 5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 61d2906..1510436 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -303,6 +303,11 @@ void __init exynos_cpuidle_init(void)
 	platform_device_register(&exynos_cpuidle);
 }
 
+void __init exynos_cpufreq_init(void)
+{
+	platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
+}
+
 void __init exynos_init_late(void)
 {
 	if (of_machine_is_compatible("samsung,exynos5440"))
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index ff9b6a9..3f03334 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -22,6 +22,7 @@ void exynos_init_io(void);
 void exynos4_restart(enum reboot_mode mode, const char *cmd);
 void exynos5_restart(enum reboot_mode mode, const char *cmd);
 void exynos_cpuidle_init(void);
+void exynos_cpufreq_init(void);
 void exynos_init_late(void);
 
 void exynos_firmware_init(void);
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c
index 4603e6b..d3e54b7 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -22,6 +22,7 @@
 static void __init exynos4_dt_machine_init(void)
 {
 	exynos_cpuidle_init();
+	exynos_cpufreq_init();
 
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 1fe075a..602c5d7 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -44,6 +44,7 @@ static void __init exynos5_dt_machine_init(void)
 	}
 
 	exynos_cpuidle_init();
+	exynos_cpufreq_init();
 
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index f3c2287..81b863c 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -17,6 +17,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/cpufreq.h>
 #include <linux/suspend.h>
+#include <linux/platform_device.h>
 
 #include <plat/cpu.h>
 
@@ -232,7 +233,7 @@ static struct cpufreq_driver exynos_driver = {
 #endif
 };
 
-static int __init exynos_cpufreq_init(void)
+static int exynos_cpufreq_probe(struct platform_device *pdev)
 {
 	int ret = -EINVAL;
 
@@ -281,4 +282,12 @@ err_vdd_arm:
 	kfree(exynos_info);
 	return -EINVAL;
 }
-late_initcall(exynos_cpufreq_init);
+
+static struct platform_driver exynos_cpufreq_platdrv = {
+	.driver = {
+		.name	= "exynos-cpufreq",
+		.owner	= THIS_MODULE,
+	},
+	.probe = exynos_cpufreq_probe,
+};
+module_platform_driver(exynos_cpufreq_platdrv);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] cpufreq: exynos: Convert exynos-cpufreq to platform driver
  2013-11-28 12:42 ` [PATCH v3] " Lukasz Majewski
@ 2013-11-29  5:45   ` Sachin Kamat
  2013-12-09  8:28     ` Lukasz Majewski
  2013-12-16  9:13   ` Viresh Kumar
  1 sibling, 1 reply; 6+ messages in thread
From: Sachin Kamat @ 2013-11-29  5:45 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Viresh Kumar, Rafael J. Wysocki, cpufreq@vger.kernel.org,
	Linux PM list, Lukasz Majewski, linux-kernel

On 28 November 2013 18:12, Lukasz Majewski <l.majewski@samsung.com> wrote:
> To make the driver multiplatform-friendly, unconditional initialization
> in an initcall is replaced with a platform driver probed only if
> respective platform device is registered.
>
> Tested at: Exynos4210 (TRATS) and Exynos4412 (TRATS2)
>
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

Looks good to me.
Reviewed-by: Sachin Kamat <sachin.kamat@linaro.org>

Tested on Exynos5250 board.
Tested-by: Sachin Kamat <sachin.kamat@linaro.org>

Btw, Lukasz, can you please review my patch [1] which is similar to your
changes done for 4210/4412.

[1] http://www.spinics.net/lists/linux-samsung-soc/msg24397.html

-- 
With warm regards,
Sachin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] cpufreq: exynos: Convert exynos-cpufreq to platform driver
  2013-11-29  5:45   ` Sachin Kamat
@ 2013-12-09  8:28     ` Lukasz Majewski
  0 siblings, 0 replies; 6+ messages in thread
From: Lukasz Majewski @ 2013-12-09  8:28 UTC (permalink / raw)
  To: Viresh Kumar, Rafael J. Wysocki
  Cc: Sachin Kamat, cpufreq@vger.kernel.org, Linux PM list,
	Lukasz Majewski, linux-kernel

Hi Rafael, Vires,

> On 28 November 2013 18:12, Lukasz Majewski <l.majewski@samsung.com>
> wrote:
> > To make the driver multiplatform-friendly, unconditional
> > initialization in an initcall is replaced with a platform driver
> > probed only if respective platform device is registered.
> >
> > Tested at: Exynos4210 (TRATS) and Exynos4412 (TRATS2)
> >
> > Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> > Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> 
> Looks good to me.
> Reviewed-by: Sachin Kamat <sachin.kamat@linaro.org>
> 
> Tested on Exynos5250 board.
> Tested-by: Sachin Kamat <sachin.kamat@linaro.org>
> 
> Btw, Lukasz, can you please review my patch [1] which is similar to
> your changes done for 4210/4412.
> 
> [1] http://www.spinics.net/lists/linux-samsung-soc/msg24397.html
> 

Any comments on this patch? Is it suitable for pulling?


-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] cpufreq: exynos: Convert exynos-cpufreq to platform driver
  2013-11-28 12:42 ` [PATCH v3] " Lukasz Majewski
  2013-11-29  5:45   ` Sachin Kamat
@ 2013-12-16  9:13   ` Viresh Kumar
  1 sibling, 0 replies; 6+ messages in thread
From: Viresh Kumar @ 2013-12-16  9:13 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Rafael J. Wysocki, cpufreq@vger.kernel.org, Linux PM list,
	Sachin Kamat, Jingoo Han, Lukasz Majewski, linux-kernel,
	Bartlomiej Zolnierkiewicz, Tomasz Figa, Kyungmin Park

On 28 November 2013 18:12, Lukasz Majewski <l.majewski@samsung.com> wrote:
> To make the driver multiplatform-friendly, unconditional initialization
> in an initcall is replaced with a platform driver probed only if
> respective platform device is registered.
>
> Tested at: Exynos4210 (TRATS) and Exynos4412 (TRATS2)
>
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>
> ---
> Changes for v3:
> - Rename exynos_cpufreq_init() to exynos_cpufreq_probe()
>
> Changes for v2:
> - Proper definition of exynos_cpufreq_init() function to squash warnings
>
>  arch/arm/mach-exynos/common.c          |    5 +++++
>  arch/arm/mach-exynos/common.h          |    1 +
>  arch/arm/mach-exynos/mach-exynos4-dt.c |    1 +
>  arch/arm/mach-exynos/mach-exynos5-dt.c |    1 +
>  drivers/cpufreq/exynos-cpufreq.c       |   13 +++++++++++--
>  5 files changed, 19 insertions(+), 2 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-12-16  9:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1381939238-30398-1-git-send-email-t.figa@samsung.com>
2013-11-28 11:35 ` [PATCH v2] cpufreq: exynos: Convert exynos-cpufreq to platform driver Lukasz Majewski
2013-11-28 11:40   ` Sachin Kamat
2013-11-28 12:42 ` [PATCH v3] " Lukasz Majewski
2013-11-29  5:45   ` Sachin Kamat
2013-12-09  8:28     ` Lukasz Majewski
2013-12-16  9:13   ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox