Merge branches 'x86-fixes-for-linus', 'sched-fixes-for-linus', 'timers-fixes-for...
[pandora-kernel.git] / drivers / regulator / ab3100.c
index ed6feaf..b1d7794 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/platform_device.h>
 #include <linux/regulator/driver.h>
 #include <linux/mfd/abx500.h>
+#include <linux/mfd/core.h>
 
 /* LDO registers and some handy masking definitions for AB3100 */
 #define AB3100_LDO_A           0x40
@@ -205,29 +206,6 @@ static int ab3100_enable_regulator(struct regulator_dev *reg)
                return err;
        }
 
-       /* Per-regulator power on delay from spec */
-       switch (abreg->regreg) {
-       case AB3100_LDO_A: /* Fallthrough */
-       case AB3100_LDO_C: /* Fallthrough */
-       case AB3100_LDO_D: /* Fallthrough */
-       case AB3100_LDO_E: /* Fallthrough */
-       case AB3100_LDO_H: /* Fallthrough */
-       case AB3100_LDO_K:
-               udelay(200);
-               break;
-       case AB3100_LDO_F:
-               udelay(600);
-               break;
-       case AB3100_LDO_G:
-               udelay(400);
-               break;
-       case AB3100_BUCK:
-               mdelay(1);
-               break;
-       default:
-               break;
-       }
-
        return 0;
 }
 
@@ -449,11 +427,37 @@ static int ab3100_get_voltage_regulator_external(struct regulator_dev *reg)
        return abreg->plfdata->external_voltage;
 }
 
+static int ab3100_enable_time_regulator(struct regulator_dev *reg)
+{
+       struct ab3100_regulator *abreg = reg->reg_data;
+
+       /* Per-regulator power on delay from spec */
+       switch (abreg->regreg) {
+       case AB3100_LDO_A: /* Fallthrough */
+       case AB3100_LDO_C: /* Fallthrough */
+       case AB3100_LDO_D: /* Fallthrough */
+       case AB3100_LDO_E: /* Fallthrough */
+       case AB3100_LDO_H: /* Fallthrough */
+       case AB3100_LDO_K:
+               return 200;
+       case AB3100_LDO_F:
+               return 600;
+       case AB3100_LDO_G:
+               return 400;
+       case AB3100_BUCK:
+               return 1000;
+       default:
+               break;
+       }
+       return 0;
+}
+
 static struct regulator_ops regulator_ops_fixed = {
        .enable      = ab3100_enable_regulator,
        .disable     = ab3100_disable_regulator,
        .is_enabled  = ab3100_is_enabled_regulator,
        .get_voltage = ab3100_get_voltage_regulator,
+       .enable_time = ab3100_enable_time_regulator,
 };
 
 static struct regulator_ops regulator_ops_variable = {
@@ -463,6 +467,7 @@ static struct regulator_ops regulator_ops_variable = {
        .get_voltage = ab3100_get_voltage_regulator,
        .set_voltage = ab3100_set_voltage_regulator,
        .list_voltage = ab3100_list_voltage_regulator,
+       .enable_time = ab3100_enable_time_regulator,
 };
 
 static struct regulator_ops regulator_ops_variable_sleepable = {
@@ -473,6 +478,7 @@ static struct regulator_ops regulator_ops_variable_sleepable = {
        .set_voltage = ab3100_set_voltage_regulator,
        .set_suspend_voltage = ab3100_set_suspend_voltage_regulator,
        .list_voltage = ab3100_list_voltage_regulator,
+       .enable_time = ab3100_enable_time_regulator,
 };
 
 /*
@@ -576,7 +582,7 @@ ab3100_regulator_desc[AB3100_NUM_REGULATORS] = {
 
 static int __devinit ab3100_regulators_probe(struct platform_device *pdev)
 {
-       struct ab3100_platform_data *plfdata = pdev->dev.platform_data;
+       struct ab3100_platform_data *plfdata = mfd_get_data(pdev);
        int err = 0;
        u8 data;
        int i;