[UPSTREAM - RFC] gta02_regulator_constraints.patch

Balaji Rao balaji at raobalaji.com
Wed Oct 8 16:10:05 CEST 2008


gta02_regulator_constraints.patch

Specify regulator constraints for gta02. For now, constraints for only
the current used devices are specified.
---

 arch/arm/mach-s3c2440/mach-gta02.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)


diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 0cd6f51..8e22a3f 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -47,6 +47,8 @@
 
 #include <linux/i2c.h>
 
+#include <linux/regulator/machine.h>
+
 #include <linux/pcf50633.h>
 #include <linux/lis302dl.h>
 
@@ -543,6 +545,29 @@ static struct platform_device gta01_pm_bt_dev = {
 	.name		= "neo1973-pm-bt",
 };
 
+/* Regulation constraints */
+
+static struct regulation_constraints hcldo_constraint = {
+	.min_uV = 2000000,
+	.max_uV = 3300000,
+	.valid_modes_mask = REGULATOR_MODE_NORMAL,
+	.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+};
+
+static struct regulation_constraints ldo4_constraint = {
+	.min_uV = 2500000,
+	.max_uV = 3300000,
+	.valid_modes_mask = REGULATOR_MODE_NORMAL,
+	.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+};
+
+static struct regulation_constraints ldo5_constraint = {
+	.min_uV = 2500000,
+	.max_uV = 3300000,
+	.valid_modes_mask = REGULATOR_MODE_NORMAL,
+	.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+};
+
 /* this is called when pc50633 is probed, unfortunately quite late in the
  * day since it is an I2C bus device.  Here we can belatedly define some
  * platform devices with the advantage that we can mark the pcf50633 as the
@@ -552,6 +577,14 @@ static struct platform_device gta01_pm_bt_dev = {
 
 static void gta02_pcf50633_attach_child_devices(struct device *parent_device)
 {
+	/*
+	 * Set regulation constraints here. Can be done only after all
+	 * regulators are registered.
+	 */
+	regulator_set_machine_constraints("hcldo", &hcldo_constraint);
+	regulator_set_machine_constraints("ldo4", &ldo4_constraint);
+	regulator_set_machine_constraints("ldo5", &ldo5_constraint);
+
 	gta01_pm_gps_dev.dev.parent = parent_device;
 	gta01_pm_bt_dev.dev.parent = parent_device;
 	platform_device_register(&gta01_pm_bt_dev);



More information about the openmoko-kernel mailing list