msm: board-8930: Use saw-regulator driver to control Krait supplies

Switch control of the Krait supply regulators, PMIC 8038 S5 and
S6, from the pm8xxx-regulator driver to the saw-regulator driver.
This ensures that core voltages return to proper values after
power collapse.

Change-Id: Icef28301a8f0a6fd2447c0d62c75d5ce4f7bcfcb
Signed-off-by: David Collins <collinsd@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-8930-regulator.c b/arch/arm/mach-msm/board-8930-regulator.c
index ff4c808..729b6ac 100644
--- a/arch/arm/mach-msm/board-8930-regulator.c
+++ b/arch/arm/mach-msm/board-8930-regulator.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2011-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
@@ -114,9 +114,11 @@
 };
 VREG_CONSUMERS(S5) = {
 	REGULATOR_SUPPLY("8038_s5",		NULL),
+	REGULATOR_SUPPLY("krait0",		NULL),
 };
 VREG_CONSUMERS(S6) = {
 	REGULATOR_SUPPLY("8038_s6",		NULL),
+	REGULATOR_SUPPLY("krait1",		NULL),
 };
 VREG_CONSUMERS(LVS1) = {
 	REGULATOR_SUPPLY("8038_lvs1",		NULL),
@@ -243,6 +245,18 @@
 		.gpio		= _gpio, \
 	}
 
+#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
+	{ \
+		.constraints = { \
+			.name		= _name, \
+			.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE, \
+			.min_uV		= _min_uV, \
+			.max_uV		= _max_uV, \
+		}, \
+		.num_consumer_supplies	= ARRAY_SIZE(vreg_consumers_##_id), \
+		.consumer_supplies	= vreg_consumers_##_id, \
+	}
+
 /* GPIO regulator constraints */
 struct gpio_regulator_platform_data
 msm8930_gpio_regulator_pdata[] __devinitdata = {
@@ -251,6 +265,13 @@
 	GPIO_VREG(EXT_OTG_SW, "ext_otg_sw", "ext_otg_sw_en", 97, "ext_5v"),
 };
 
+/* SAW regulator constraints */
+struct regulator_init_data msm8930_saw_regulator_core0_pdata =
+	/*	      ID  vreg_name	       min_uV   max_uV */
+	SAW_VREG_INIT(S5, "8038_s5",	       850000, 1300000);
+struct regulator_init_data msm8930_saw_regulator_core1_pdata =
+	SAW_VREG_INIT(S6, "8038_s6",	       850000, 1300000);
+
 /* PM8038 regulator constraints */
 struct pm8xxx_regulator_platform_data
 msm8930_pm8038_regulator_pdata[] __devinitdata = {
@@ -266,9 +287,6 @@
 	PM8XXX_SMPS(S4, "8038_s4", 1, 1,  2200000, 2200000, 500, NULL, 100000,
 		29),
 
-	PM8XXX_FTSMPS(S5, "8038_s5", 0, 1, 950000, 1150000, 500, NULL, 0, 30),
-	PM8XXX_FTSMPS(S6, "8038_s6", 0, 1, 950000, 1150000, 500, NULL, 0, 31),
-
 	PM8XXX_NLDO1200(L1, "8038_l1",  0, 1, 1300000, 1300000, 200, "8038_s2",
 		0, 1),
 	PM8XXX_LDO(L2,  "8038_l2",  0, 1, 1200000, 1200000, 200, "8038_s2", 0,
diff --git a/arch/arm/mach-msm/board-8930.c b/arch/arm/mach-msm/board-8930.c
index c2592ae..fa548aa 100644
--- a/arch/arm/mach-msm/board-8930.c
+++ b/arch/arm/mach-msm/board-8930.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2011-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
@@ -1415,14 +1415,7 @@
 	.name	= "saw-regulator",
 	.id	= 0,
 	.dev	= {
-	/*
-	 * TODO: When physical 8930/PM8038 hardware becomes
-	 * available, replace msm_saw_regulator_pdata_s5
-	 * with 8930 saw regulator object.
-	 */
-#ifndef MSM8930_PHASE_2
-		.platform_data = &msm_saw_regulator_pdata_s5,
-#endif
+		.platform_data = &msm8930_saw_regulator_core0_pdata,
 	},
 };
 
@@ -1430,14 +1423,7 @@
 	.name	= "saw-regulator",
 	.id	= 1,
 	.dev	= {
-	/*
-	 * TODO: When physical 8930/PM8038 hardware becomes
-	 * available, replace msm_saw_regulator_pdata_s5
-	 * with 8930 saw regulator object.
-	 */
-#if     !defined(MSM8930_PHASE_2)
-		.platform_data = &msm_saw_regulator_pdata_s6,
-#endif
+		.platform_data = &msm8930_saw_regulator_core1_pdata,
 	},
 };
 
diff --git a/arch/arm/mach-msm/board-8930.h b/arch/arm/mach-msm/board-8930.h
index d6d3b49..8e20903 100644
--- a/arch/arm/mach-msm/board-8930.h
+++ b/arch/arm/mach-msm/board-8930.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2011-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
@@ -46,9 +46,6 @@
  * declarations.
  */
 #ifndef MSM8930_PHASE_2
-extern struct regulator_init_data msm_saw_regulator_pdata_s5;
-extern struct regulator_init_data msm_saw_regulator_pdata_s6;
-
 extern struct pm8xxx_regulator_platform_data
 	msm_pm8921_regulator_pdata[] __devinitdata;
 
@@ -64,6 +61,9 @@
 #define GPIO_VREG_ID_EXT_3P3V		2
 #endif
 
+extern struct regulator_init_data msm8930_saw_regulator_core0_pdata;
+extern struct regulator_init_data msm8930_saw_regulator_core1_pdata;
+
 extern struct pm8xxx_regulator_platform_data
 	msm8930_pm8038_regulator_pdata[] __devinitdata;