msm: acpuclock: Convert acpuclock drivers into platform drivers

This allows the acpuclock drivers to initialize in a manner consistent
with other platform drivers used on MSM chipsets.

For targets without specific probe order dependencies involving
acpuclock, platform_device_register() is called during init_machine()
in the target's board file. platform_driver_probe() is then called
in a 'device' initcall. This is the case for:
  acpuclock-8x60, acpuclock-8960, acpuclock-9615, acpuclock-fsm9xxx

For the other targets, platform_driver_register() is called in a
postcore initcall and the driver probes as a result of calling
platform_device_register() during init_machine(). This is required
for the following drivers:
  acpuclock-7627, acpuclock-7x30, acpuclock-8x50

Specifically, these three drivers are used on targets where the CPUs
may be running from disableable clock sources that are shared with
other peripheral clocks. We must make sure that acpuclock has a
chance to assert a vote for the clock source that the CPU is currently
running from before other drivers using that same source have a chance
to disable it.

Change-Id: Ieec39722ebd757ab90057fd10ccc9a8786f0c8cb
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/arch/arm/mach-msm/acpuclock-fsm9xxx.c b/arch/arm/mach-msm/acpuclock-fsm9xxx.c
index 3cdc58d..af1c0eb 100644
--- a/arch/arm/mach-msm/acpuclock-fsm9xxx.c
+++ b/arch/arm/mach-msm/acpuclock-fsm9xxx.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -11,8 +11,10 @@
  *
  */
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/platform_device.h>
 #include <mach/board.h>
 
 #include "acpuclock.h"
@@ -40,13 +42,22 @@
 	.get_rate = acpuclk_9xxx_get_rate,
 };
 
-static int __init acpuclk_9xxx_init(struct acpuclk_soc_data *soc_data)
+static int __init acpuclk_9xxx_probe(struct platform_device *pdev)
 {
 	acpuclk_register(&acpuclk_9xxx_data);
 	pr_info("ACPU running at %lu KHz\n", acpuclk_get_rate(0));
 	return 0;
 }
 
-struct acpuclk_soc_data acpuclk_9xxx_soc_data __initdata = {
-	.init = acpuclk_9xxx_init,
+static struct platform_driver acpuclk_9xxx_driver = {
+	.driver = {
+		.name = "acpuclk-9xxx",
+		.owner = THIS_MODULE,
+	},
 };
+
+static int __init acpuclk_9xxx_init(void)
+{
+	return platform_driver_probe(&acpuclk_9xxx_driver, acpuclk_9xxx_probe);
+}
+device_initcall(acpuclk_9xxx_init);