Skip to content

Commit

Permalink
cpufreq: exynos: Convert exynos-cpufreq to platform driver
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Sachin Kamat <sachin.kamat@linaro.org>
Tested-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Lukasz Majewski authored and Rafael J. Wysocki committed Jan 6, 2014
1 parent d391669 commit d568b6f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions arch/arm/mach-exynos/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-exynos/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-exynos/mach-exynos4-dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-exynos/mach-exynos5-dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
13 changes: 11 additions & 2 deletions drivers/cpufreq/exynos-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -281,4 +282,12 @@ static int __init exynos_cpufreq_init(void)
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);

0 comments on commit d568b6f

Please sign in to comment.