msm: board-8974: Switch from stub to krait regulator for 8841 S5-S8

Remove stub-regulator devices and initialization for PMIC PM8841 FTSMPS
regulators S5-S8. Add a krait-regulator initialization call so that the
krait-regulator driver is used to control these regulators instead of
the stub-regulator driver.

Change-Id: I6f1ea43acf435c48f7f5224234d95af9502f15d2
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index ce19336..5e3a980 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -287,7 +287,7 @@
 obj-$(CONFIG_MACH_MPQ8064_DTV) += board-8064-all.o board-8064-regulator.o
 obj-$(CONFIG_ARCH_MSM9615) += board-9615.o devices-9615.o board-9615-regulator.o board-9615-gpiomux.o board-9615-storage.o board-9615-display.o
 obj-$(CONFIG_ARCH_MSM9615) += clock-local.o clock-9615.o acpuclock-9615.o clock-rpm.o clock-pll.o
-obj-$(CONFIG_ARCH_MSM8974) += board-8974.o board-dt.o board-8974-regulator.o board-8974-gpiomux.o
+obj-$(CONFIG_ARCH_MSM8974) += board-8974.o board-dt.o board-8974-gpiomux.o
 obj-$(CONFIG_ARCH_MSM8974) += acpuclock-8974.o
 obj-$(CONFIG_ARCH_MSM8974) += clock-local2.o clock-pll.o clock-8974.o clock-rpm.o clock-voter.o
 obj-$(CONFIG_ARCH_MSM8974) += gdsc.o
diff --git a/arch/arm/mach-msm/board-8974-regulator.c b/arch/arm/mach-msm/board-8974-regulator.c
deleted file mode 100644
index 1a41f09..0000000
--- a/arch/arm/mach-msm/board-8974-regulator.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 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
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/platform_device.h>
-#include <linux/regulator/stub-regulator.h>
-
-#define VREG_CONSUMERS(_name) \
-	static struct regulator_consumer_supply vreg_consumers_##_name[]
-
-/*
- * Consumer specific regulator names:
- *			 regulator name		consumer dev_name
- */
-VREG_CONSUMERS(K0) = {
-	REGULATOR_SUPPLY("krait0",		"f9000000.qcom,acpuclk"),
-};
-VREG_CONSUMERS(K1) = {
-	REGULATOR_SUPPLY("krait1",		"f9000000.qcom,acpuclk"),
-};
-VREG_CONSUMERS(K2) = {
-	REGULATOR_SUPPLY("krait2",		"f9000000.qcom,acpuclk"),
-};
-VREG_CONSUMERS(K3) = {
-	REGULATOR_SUPPLY("krait3",		"f9000000.qcom,acpuclk"),
-};
-
-#define PM8X41_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
-			 _always_on, _supply_regulator, _hpm_min, _system_uA)  \
-	struct stub_regulator_pdata vreg_dev_##_id##_pdata __devinitdata = { \
-		.init_data = { \
-			.constraints = { \
-				.valid_modes_mask	= _modes, \
-				.valid_ops_mask		= _ops, \
-				.min_uV			= _min_uV, \
-				.max_uV			= _max_uV, \
-				.input_uV		= _max_uV, \
-				.apply_uV		= 0,	\
-				.always_on		= _always_on, \
-				.name			= _name, \
-			}, \
-			.num_consumer_supplies	= \
-					ARRAY_SIZE(vreg_consumers_##_id), \
-			.consumer_supplies	= vreg_consumers_##_id, \
-			.supply_regulator	= _supply_regulator, \
-		}, \
-		.hpm_min_load		= _hpm_min, \
-		.system_uA		= _system_uA, \
-	}
-
-#define KRAIT_PWR(_id, _name, _always_on, _min_uV, _max_uV, \
-		_supply_regulator, _hpm_min, _system_uA) \
-	PM8X41_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
-		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
-		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
-		REGULATOR_CHANGE_DRMS, _always_on, \
-		_supply_regulator, _hpm_min, _system_uA)
-
-/*	 ID      name     a_on  min_uV   max_uV  supply  hpm_min sys_uA  */
-KRAIT_PWR(K0, "krait0", 0, 850000,  1100000, NULL,     100000, 0);
-KRAIT_PWR(K1, "krait1", 0, 850000,  1100000, NULL,     100000, 0);
-KRAIT_PWR(K2, "krait2", 0, 850000,  1100000, NULL,     100000, 0);
-KRAIT_PWR(K3, "krait3", 0, 850000,  1100000, NULL,     100000, 0);
-
-#define VREG_DEVICE(_name, _devid) \
-	static struct platform_device vreg_device_##_name __devinitdata = \
-	{ \
-		.name = STUB_REGULATOR_DRIVER_NAME, \
-		.id = _devid, \
-		.dev = { .platform_data = &vreg_dev_##_name##_pdata }, \
-	}
-
-VREG_DEVICE(K0, 0);
-VREG_DEVICE(K1, 1);
-VREG_DEVICE(K2, 2);
-VREG_DEVICE(K3, 3);
-
-struct platform_device *msm_8974_stub_regulator_devices[] __devinitdata = {
-	&vreg_device_K0,
-	&vreg_device_K1,
-	&vreg_device_K2,
-	&vreg_device_K3,
-};
-
-int msm_8974_stub_regulator_devices_len __devinitdata =
-			ARRAY_SIZE(msm_8974_stub_regulator_devices);
diff --git a/arch/arm/mach-msm/board-8974.c b/arch/arm/mach-msm/board-8974.c
index a44d67b..1049bcb 100644
--- a/arch/arm/mach-msm/board-8974.c
+++ b/arch/arm/mach-msm/board-8974.c
@@ -24,8 +24,8 @@
 #ifdef CONFIG_ANDROID_PMEM
 #include <linux/android_pmem.h>
 #endif
-#include <linux/regulator/stub-regulator.h>
 #include <linux/regulator/machine.h>
+#include <linux/regulator/krait-regulator.h>
 #include <asm/mach/map.h>
 #include <asm/hardware/gic.h>
 #include <mach/board.h>
@@ -412,8 +412,6 @@
 {
 	platform_device_register(&msm_device_smd_8974);
 	platform_device_register(&android_usb_device);
-	platform_add_devices(msm_8974_stub_regulator_devices,
-					msm_8974_stub_regulator_devices_len);
 }
 
 /*
@@ -430,7 +428,7 @@
 	msm_lpmrs_module_init();
 	rpm_regulator_smd_driver_init();
 	msm_spm_device_init();
-	regulator_stub_init();
+	krait_power_init();
 	if (machine_is_msm8974_rumi())
 		msm_clock_init(&msm8974_rumi_clock_init_data);
 	else