regulator: ab8500: Another push to synchronise recent AB8500 developments
[firefly-linux-kernel-4.4.55.git] / drivers / regulator / ab8500.c
index 09014f38a9481f8afb630ce8a5c5fdb513100380..c7784c4bff4f3d24b953035a984eb16bab000c75 100644 (file)
  * @dev: device pointer
  * @desc: regulator description
  * @regulator_dev: regulator device
+ * @is_enabled: status of regulator (on/off)
+ * @load_lp_uA: maximum load in idle (low power) mode
  * @update_bank: bank to control on/off
  * @update_reg: register to control on/off
- * @update_mask: mask to enable/disable regulator
- * @update_val_enable: bits to enable the regulator in normal (high power) mode
+ * @update_mask: mask to enable/disable and set mode of regulator
+ * @update_val: bits holding the regulator current mode
+ * @update_val_idle: bits to enable the regulator in idle (low power) mode
+ * @update_val_normal: bits to enable the regulator in normal (high power) mode
  * @voltage_bank: bank to control regulator voltage
  * @voltage_reg: register to control regulator voltage
  * @voltage_mask: mask to control regulator voltage
@@ -44,10 +48,14 @@ struct ab8500_regulator_info {
        struct device           *dev;
        struct regulator_desc   desc;
        struct regulator_dev    *regulator;
+       bool is_enabled;
+       int load_lp_uA;
        u8 update_bank;
        u8 update_reg;
        u8 update_mask;
-       u8 update_val_enable;
+       u8 update_val;
+       u8 update_val_idle;
+       u8 update_val_normal;
        u8 voltage_bank;
        u8 voltage_reg;
        u8 voltage_mask;
@@ -108,15 +116,17 @@ static int ab8500_regulator_enable(struct regulator_dev *rdev)
 
        ret = abx500_mask_and_set_register_interruptible(info->dev,
                info->update_bank, info->update_reg,
-               info->update_mask, info->update_val_enable);
+               info->update_mask, info->update_val);
        if (ret < 0)
                dev_err(rdev_get_dev(rdev),
                        "couldn't set enable bits for regulator\n");
 
+       info->is_enabled = true;
+
        dev_vdbg(rdev_get_dev(rdev),
                "%s-enable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
                info->desc.name, info->update_bank, info->update_reg,
-               info->update_mask, info->update_val_enable);
+               info->update_mask, info->update_val);
 
        return ret;
 }
@@ -138,6 +148,8 @@ static int ab8500_regulator_disable(struct regulator_dev *rdev)
                dev_err(rdev_get_dev(rdev),
                        "couldn't set disable bits for regulator\n");
 
+       info->is_enabled = false;
+
        dev_vdbg(rdev_get_dev(rdev),
                "%s-disable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
                info->desc.name, info->update_bank, info->update_reg,
@@ -146,6 +158,88 @@ static int ab8500_regulator_disable(struct regulator_dev *rdev)
        return ret;
 }
 
+static unsigned int ab8500_regulator_get_optimum_mode(
+               struct regulator_dev *rdev, int input_uV,
+               int output_uV, int load_uA)
+{
+       unsigned int mode;
+
+       struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
+
+       if (info == NULL) {
+               dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
+               return -EINVAL;
+       }
+
+       if (load_uA <= info->load_lp_uA)
+               mode = REGULATOR_MODE_IDLE;
+       else
+               mode = REGULATOR_MODE_NORMAL;
+
+       return mode;
+}
+
+static int ab8500_regulator_set_mode(struct regulator_dev *rdev,
+                                    unsigned int mode)
+{
+       int ret = 0;
+
+       struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
+
+       if (info == NULL) {
+               dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
+               return -EINVAL;
+       }
+
+       switch (mode) {
+       case REGULATOR_MODE_NORMAL:
+               info->update_val = info->update_val_normal;
+               break;
+       case REGULATOR_MODE_IDLE:
+               info->update_val = info->update_val_idle;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       if (info->is_enabled) {
+               ret = abx500_mask_and_set_register_interruptible(info->dev,
+                       info->update_bank, info->update_reg,
+                       info->update_mask, info->update_val);
+               if (ret < 0)
+                       dev_err(rdev_get_dev(rdev),
+                               "couldn't set regulator mode\n");
+
+               dev_vdbg(rdev_get_dev(rdev),
+                       "%s-set_mode (bank, reg, mask, value): "
+                       "0x%x, 0x%x, 0x%x, 0x%x\n",
+                       info->desc.name, info->update_bank, info->update_reg,
+                       info->update_mask, info->update_val);
+       }
+
+       return ret;
+}
+
+static unsigned int ab8500_regulator_get_mode(struct regulator_dev *rdev)
+{
+       struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
+       int ret;
+
+       if (info == NULL) {
+               dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
+               return -EINVAL;
+       }
+
+       if (info->update_val == info->update_val_normal)
+               ret = REGULATOR_MODE_NORMAL;
+       else if (info->update_val == info->update_val_idle)
+               ret = REGULATOR_MODE_IDLE;
+       else
+               ret = -EINVAL;
+
+       return ret;
+}
+
 static int ab8500_regulator_is_enabled(struct regulator_dev *rdev)
 {
        int ret;
@@ -172,9 +266,11 @@ static int ab8500_regulator_is_enabled(struct regulator_dev *rdev)
                info->update_mask, regval);
 
        if (regval & info->update_mask)
-               return true;
+               info->is_enabled = true;
        else
-               return false;
+               info->is_enabled = false;
+
+       return info->is_enabled;
 }
 
 static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev)
@@ -246,21 +342,37 @@ static int ab8500_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
        return info->delay;
 }
 
-static struct regulator_ops ab8500_regulator_ops = {
-       .enable         = ab8500_regulator_enable,
-       .disable        = ab8500_regulator_disable,
-       .is_enabled     = ab8500_regulator_is_enabled,
-       .get_voltage_sel = ab8500_regulator_get_voltage_sel,
-       .set_voltage_sel = ab8500_regulator_set_voltage_sel,
-       .list_voltage   = regulator_list_voltage_table,
-       .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel,
+static struct regulator_ops ab8500_regulator_volt_mode_ops = {
+       .enable                 = ab8500_regulator_enable,
+       .disable                = ab8500_regulator_disable,
+       .is_enabled             = ab8500_regulator_is_enabled,
+       .get_optimum_mode       = ab8500_regulator_get_optimum_mode,
+       .set_mode               = ab8500_regulator_set_mode,
+       .get_mode               = ab8500_regulator_get_mode,
+       .get_voltage_sel        = ab8500_regulator_get_voltage_sel,
+       .set_voltage_sel        = ab8500_regulator_set_voltage_sel,
+       .list_voltage           = regulator_list_voltage_table,
+       .set_voltage_time_sel   = ab8500_regulator_set_voltage_time_sel,
 };
 
-static struct regulator_ops ab8500_regulator_fixed_ops = {
-       .enable         = ab8500_regulator_enable,
-       .disable        = ab8500_regulator_disable,
-       .is_enabled     = ab8500_regulator_is_enabled,
-       .list_voltage   = regulator_list_voltage_linear,
+static struct regulator_ops ab8500_regulator_mode_ops = {
+       .enable                 = ab8500_regulator_enable,
+       .disable                = ab8500_regulator_disable,
+       .is_enabled             = ab8500_regulator_is_enabled,
+       .get_optimum_mode       = ab8500_regulator_get_optimum_mode,
+       .set_mode               = ab8500_regulator_set_mode,
+       .get_mode               = ab8500_regulator_get_mode,
+       .get_voltage_sel        = ab8500_regulator_get_voltage_sel,
+       .list_voltage           = regulator_list_voltage_table,
+       .set_voltage_time_sel   = ab8500_regulator_set_voltage_time_sel,
+};
+
+static struct regulator_ops ab8500_regulator_ops = {
+       .enable                 = ab8500_regulator_enable,
+       .disable                = ab8500_regulator_disable,
+       .is_enabled             = ab8500_regulator_is_enabled,
+       .get_voltage_sel        = ab8500_regulator_get_voltage_sel,
+       .list_voltage           = regulator_list_voltage_table,
 };
 
 static struct ab8500_regulator_info
@@ -274,17 +386,20 @@ static struct ab8500_regulator_info
        [AB8500_LDO_AUX1] = {
                .desc = {
                        .name           = "LDO-AUX1",
-                       .ops            = &ab8500_regulator_ops,
+                       .ops            = &ab8500_regulator_volt_mode_ops,
                        .type           = REGULATOR_VOLTAGE,
                        .id             = AB8500_LDO_AUX1,
                        .owner          = THIS_MODULE,
                        .n_voltages     = ARRAY_SIZE(ldo_vauxn_voltages),
                        .volt_table     = ldo_vauxn_voltages,
                },
+               .load_lp_uA             = 5000,
                .update_bank            = 0x04,
                .update_reg             = 0x09,
                .update_mask            = 0x03,
-               .update_val_enable      = 0x01,
+               .update_val             = 0x01,
+               .update_val_idle        = 0x03,
+               .update_val_normal      = 0x01,
                .voltage_bank           = 0x04,
                .voltage_reg            = 0x1f,
                .voltage_mask           = 0x0f,
@@ -292,17 +407,20 @@ static struct ab8500_regulator_info
        [AB8500_LDO_AUX2] = {
                .desc = {
                        .name           = "LDO-AUX2",
-                       .ops            = &ab8500_regulator_ops,
+                       .ops            = &ab8500_regulator_volt_mode_ops,
                        .type           = REGULATOR_VOLTAGE,
                        .id             = AB8500_LDO_AUX2,
                        .owner          = THIS_MODULE,
                        .n_voltages     = ARRAY_SIZE(ldo_vauxn_voltages),
                        .volt_table     = ldo_vauxn_voltages,
                },
+               .load_lp_uA             = 5000,
                .update_bank            = 0x04,
                .update_reg             = 0x09,
                .update_mask            = 0x0c,
-               .update_val_enable      = 0x04,
+               .update_val             = 0x04,
+               .update_val_idle        = 0x0c,
+               .update_val_normal      = 0x04,
                .voltage_bank           = 0x04,
                .voltage_reg            = 0x20,
                .voltage_mask           = 0x0f,
@@ -310,17 +428,20 @@ static struct ab8500_regulator_info
        [AB8500_LDO_AUX3] = {
                .desc = {
                        .name           = "LDO-AUX3",
-                       .ops            = &ab8500_regulator_ops,
+                       .ops            = &ab8500_regulator_volt_mode_ops,
                        .type           = REGULATOR_VOLTAGE,
                        .id             = AB8500_LDO_AUX3,
                        .owner          = THIS_MODULE,
                        .n_voltages     = ARRAY_SIZE(ldo_vaux3_voltages),
                        .volt_table     = ldo_vaux3_voltages,
                },
+               .load_lp_uA             = 5000,
                .update_bank            = 0x04,
                .update_reg             = 0x0a,
                .update_mask            = 0x03,
-               .update_val_enable      = 0x01,
+               .update_val             = 0x01,
+               .update_val_idle        = 0x03,
+               .update_val_normal      = 0x01,
                .voltage_bank           = 0x04,
                .voltage_reg            = 0x21,
                .voltage_mask           = 0x07,
@@ -328,17 +449,20 @@ static struct ab8500_regulator_info
        [AB8500_LDO_INTCORE] = {
                .desc = {
                        .name           = "LDO-INTCORE",
-                       .ops            = &ab8500_regulator_ops,
+                       .ops            = &ab8500_regulator_volt_mode_ops,
                        .type           = REGULATOR_VOLTAGE,
                        .id             = AB8500_LDO_INTCORE,
                        .owner          = THIS_MODULE,
                        .n_voltages     = ARRAY_SIZE(ldo_vintcore_voltages),
                        .volt_table     = ldo_vintcore_voltages,
                },
+               .load_lp_uA             = 5000,
                .update_bank            = 0x03,
                .update_reg             = 0x80,
                .update_mask            = 0x44,
-               .update_val_enable      = 0x04,
+               .update_val             = 0x04,
+               .update_val_idle        = 0x44,
+               .update_val_normal      = 0x04,
                .voltage_bank           = 0x03,
                .voltage_reg            = 0x80,
                .voltage_mask           = 0x38,
@@ -353,7 +477,7 @@ static struct ab8500_regulator_info
        [AB8500_LDO_TVOUT] = {
                .desc = {
                        .name           = "LDO-TVOUT",
-                       .ops            = &ab8500_regulator_fixed_ops,
+                       .ops            = &ab8500_regulator_mode_ops,
                        .type           = REGULATOR_VOLTAGE,
                        .id             = AB8500_LDO_TVOUT,
                        .owner          = THIS_MODULE,
@@ -362,10 +486,13 @@ static struct ab8500_regulator_info
                        .enable_time    = 10000,
                },
                .delay                  = 10000,
+               .load_lp_uA             = 1000,
                .update_bank            = 0x03,
                .update_reg             = 0x80,
                .update_mask            = 0x82,
-               .update_val_enable      = 0x02,
+               .update_val             = 0x02,
+               .update_val_idle        = 0x82,
+               .update_val_normal      = 0x02,
        },
        [AB8500_LDO_USB] = {
                .desc = {
@@ -380,12 +507,15 @@ static struct ab8500_regulator_info
                .update_bank            = 0x03,
                .update_reg             = 0x82,
                .update_mask            = 0x03,
-               .update_val_enable      = 0x01,
        },
+
+       /*
+        * Regulators with fixed voltage and normal mode
+        */
        [AB8500_LDO_AUDIO] = {
                .desc = {
                        .name           = "LDO-AUDIO",
-                       .ops            = &ab8500_regulator_fixed_ops,
+                       .ops            = &ab8500_regulator_ops,
                        .type           = REGULATOR_VOLTAGE,
                        .id             = AB8500_LDO_AUDIO,
                        .owner          = THIS_MODULE,
@@ -395,12 +525,12 @@ static struct ab8500_regulator_info
                .update_bank            = 0x03,
                .update_reg             = 0x83,
                .update_mask            = 0x02,
-               .update_val_enable      = 0x02,
+               .update_val             = 0x02,
        },
        [AB8500_LDO_ANAMIC1] = {
                .desc = {
                        .name           = "LDO-ANAMIC1",
-                       .ops            = &ab8500_regulator_fixed_ops,
+                       .ops            = &ab8500_regulator_ops,
                        .type           = REGULATOR_VOLTAGE,
                        .id             = AB8500_LDO_ANAMIC1,
                        .owner          = THIS_MODULE,
@@ -410,12 +540,12 @@ static struct ab8500_regulator_info
                .update_bank            = 0x03,
                .update_reg             = 0x83,
                .update_mask            = 0x08,
-               .update_val_enable      = 0x08,
+               .update_val             = 0x08,
        },
        [AB8500_LDO_ANAMIC2] = {
                .desc = {
                        .name           = "LDO-ANAMIC2",
-                       .ops            = &ab8500_regulator_fixed_ops,
+                       .ops            = &ab8500_regulator_ops,
                        .type           = REGULATOR_VOLTAGE,
                        .id             = AB8500_LDO_ANAMIC2,
                        .owner          = THIS_MODULE,
@@ -425,12 +555,12 @@ static struct ab8500_regulator_info
                .update_bank            = 0x03,
                .update_reg             = 0x83,
                .update_mask            = 0x10,
-               .update_val_enable      = 0x10,
+               .update_val             = 0x10,
        },
        [AB8500_LDO_DMIC] = {
                .desc = {
                        .name           = "LDO-DMIC",
-                       .ops            = &ab8500_regulator_fixed_ops,
+                       .ops            = &ab8500_regulator_ops,
                        .type           = REGULATOR_VOLTAGE,
                        .id             = AB8500_LDO_DMIC,
                        .owner          = THIS_MODULE,
@@ -440,22 +570,29 @@ static struct ab8500_regulator_info
                .update_bank            = 0x03,
                .update_reg             = 0x83,
                .update_mask            = 0x04,
-               .update_val_enable      = 0x04,
+               .update_val             = 0x04,
        },
+
+       /*
+        * Regulators with fixed voltage and normal/idle modes
+        */
        [AB8500_LDO_ANA] = {
                .desc = {
                        .name           = "LDO-ANA",
-                       .ops            = &ab8500_regulator_fixed_ops,
+                       .ops            = &ab8500_regulator_mode_ops,
                        .type           = REGULATOR_VOLTAGE,
                        .id             = AB8500_LDO_ANA,
                        .owner          = THIS_MODULE,
                        .n_voltages     = 1,
                        .min_uV         = 1200000,
                },
+               .load_lp_uA             = 1000,
                .update_bank            = 0x04,
                .update_reg             = 0x06,
                .update_mask            = 0x0c,
-               .update_val_enable      = 0x04,
+               .update_val             = 0x04,
+               .update_val_idle        = 0x0c,
+               .update_val_normal      = 0x04,
        },
 
 
@@ -476,11 +613,19 @@ struct ab8500_reg_init {
 
 static struct ab8500_reg_init ab8500_reg_init[] = {
        /*
+        * 0x03, VarmRequestCtrl
+        * 0x0c, VapeRequestCtrl
+        * 0x30, Vsmps1RequestCtrl
+        * 0xc0, Vsmps2RequestCtrl
+        */
+       REG_INIT(AB8500_REGUREQUESTCTRL1,       0x03, 0x03, 0xff),
+       /*
+        * 0x03, Vsmps3RequestCtrl
+        * 0x0c, VpllRequestCtrl
         * 0x30, VanaRequestCtrl
-        * 0x0C, VpllRequestCtrl
         * 0xc0, VextSupply1RequestCtrl
         */
-       REG_INIT(AB8500_REGUREQUESTCTRL2,       0x03, 0x04, 0xfc),
+       REG_INIT(AB8500_REGUREQUESTCTRL2,       0x03, 0x04, 0xff),
        /*
         * 0x03, VextSupply2RequestCtrl
         * 0x0c, VextSupply3RequestCtrl
@@ -494,57 +639,82 @@ static struct ab8500_reg_init ab8500_reg_init[] = {
         */
        REG_INIT(AB8500_REGUREQUESTCTRL4,       0x03, 0x06, 0x07),
        /*
+        * 0x01, Vsmps1SysClkReq1HPValid
+        * 0x02, Vsmps2SysClkReq1HPValid
+        * 0x04, Vsmps3SysClkReq1HPValid
         * 0x08, VanaSysClkReq1HPValid
+        * 0x10, VpllSysClkReq1HPValid
         * 0x20, Vaux1SysClkReq1HPValid
         * 0x40, Vaux2SysClkReq1HPValid
         * 0x80, Vaux3SysClkReq1HPValid
         */
-       REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xe8),
+       REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff),
        /*
+        * 0x01, VapeSysClkReq1HPValid
+        * 0x02, VarmSysClkReq1HPValid
+        * 0x04, VbbSysClkReq1HPValid
+        * 0x08, VmodSysClkReq1HPValid
         * 0x10, VextSupply1SysClkReq1HPValid
         * 0x20, VextSupply2SysClkReq1HPValid
         * 0x40, VextSupply3SysClkReq1HPValid
         */
-       REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x70),
+       REG_INIT(AB8500_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x7f),
        /*
+        * 0x01, Vsmps1HwHPReq1Valid
+        * 0x02, Vsmps2HwHPReq1Valid
+        * 0x04, Vsmps3HwHPReq1Valid
         * 0x08, VanaHwHPReq1Valid
+        * 0x10, VpllHwHPReq1Valid
         * 0x20, Vaux1HwHPReq1Valid
         * 0x40, Vaux2HwHPReq1Valid
         * 0x80, Vaux3HwHPReq1Valid
         */
-       REG_INIT(AB8500_REGUHWHPREQ1VALID1,     0x03, 0x09, 0xe8),
+       REG_INIT(AB8500_REGUHWHPREQ1VALID1,     0x03, 0x09, 0xff),
        /*
         * 0x01, VextSupply1HwHPReq1Valid
         * 0x02, VextSupply2HwHPReq1Valid
         * 0x04, VextSupply3HwHPReq1Valid
+        * 0x08, VmodHwHPReq1Valid
         */
-       REG_INIT(AB8500_REGUHWHPREQ1VALID2,     0x03, 0x0a, 0x07),
+       REG_INIT(AB8500_REGUHWHPREQ1VALID2,     0x03, 0x0a, 0x0f),
        /*
+        * 0x01, Vsmps1HwHPReq2Valid
+        * 0x02, Vsmps2HwHPReq2Valid
+        * 0x03, Vsmps3HwHPReq2Valid
         * 0x08, VanaHwHPReq2Valid
+        * 0x10, VpllHwHPReq2Valid
         * 0x20, Vaux1HwHPReq2Valid
         * 0x40, Vaux2HwHPReq2Valid
         * 0x80, Vaux3HwHPReq2Valid
         */
-       REG_INIT(AB8500_REGUHWHPREQ2VALID1,     0x03, 0x0b, 0xe8),
+       REG_INIT(AB8500_REGUHWHPREQ2VALID1,     0x03, 0x0b, 0xff),
        /*
         * 0x01, VextSupply1HwHPReq2Valid
         * 0x02, VextSupply2HwHPReq2Valid
         * 0x04, VextSupply3HwHPReq2Valid
+        * 0x08, VmodHwHPReq2Valid
         */
-       REG_INIT(AB8500_REGUHWHPREQ2VALID2,     0x03, 0x0c, 0x07),
+       REG_INIT(AB8500_REGUHWHPREQ2VALID2,     0x03, 0x0c, 0x0f),
        /*
+        * 0x01, VapeSwHPReqValid
+        * 0x02, VarmSwHPReqValid
+        * 0x04, Vsmps1SwHPReqValid
+        * 0x08, Vsmps2SwHPReqValid
+        * 0x10, Vsmps3SwHPReqValid
         * 0x20, VanaSwHPReqValid
+        * 0x40, VpllSwHPReqValid
         * 0x80, Vaux1SwHPReqValid
         */
-       REG_INIT(AB8500_REGUSWHPREQVALID1,      0x03, 0x0d, 0xa0),
+       REG_INIT(AB8500_REGUSWHPREQVALID1,      0x03, 0x0d, 0xff),
        /*
         * 0x01, Vaux2SwHPReqValid
         * 0x02, Vaux3SwHPReqValid
         * 0x04, VextSupply1SwHPReqValid
         * 0x08, VextSupply2SwHPReqValid
         * 0x10, VextSupply3SwHPReqValid
+        * 0x20, VmodSwHPReqValid
         */
-       REG_INIT(AB8500_REGUSWHPREQVALID2,      0x03, 0x0e, 0x1f),
+       REG_INIT(AB8500_REGUSWHPREQVALID2,      0x03, 0x0e, 0x3f),
        /*
         * 0x02, SysClkReq2Valid1
         * ...
@@ -578,8 +748,22 @@ static struct ab8500_reg_init ab8500_reg_init[] = {
         */
        REG_INIT(AB8500_REGUCTRL1VAMIC,         0x03, 0x84, 0x03),
        /*
-        * 0x0c, VanaRegu
+        * 0x03, Vsmps1Regu
+        * 0x0c, Vsmps1SelCtrl
+        * 0x10, Vsmps1AutoMode
+        * 0x20, Vsmps1PWMMode
+        */
+       REG_INIT(AB8500_VSMPS1REGU,             0x04, 0x03, 0x3f),
+       /*
+        * 0x03, Vsmps2Regu
+        * 0x0c, Vsmps2SelCtrl
+        * 0x10, Vsmps2AutoMode
+        * 0x20, Vsmps2PWMMode
+        */
+       REG_INIT(AB8500_VSMPS2REGU,             0x04, 0x04, 0x3f),
+       /*
         * 0x03, VpllRegu
+        * 0x0c, VanaRegu
         */
        REG_INIT(AB8500_VPLLVANAREGU,           0x04, 0x06, 0x0f),
        /*
@@ -601,9 +785,10 @@ static struct ab8500_reg_init ab8500_reg_init[] = {
         */
        REG_INIT(AB8500_VAUX12REGU,             0x04, 0x09, 0x0f),
        /*
+        * 0x0c, Vrf1Regu
         * 0x03, Vaux3Regu
         */
-       REG_INIT(AB8500_VRF1VAUX3REGU,          0x04, 0x0a, 0x03),
+       REG_INIT(AB8500_VRF1VAUX3REGU,          0x04, 0x0a, 0x0f),
        /*
         * 0x3f, Vsmps1Sel1
         */
@@ -618,13 +803,16 @@ static struct ab8500_reg_init ab8500_reg_init[] = {
        REG_INIT(AB8500_VAUX2SEL,               0x04, 0x20, 0x0f),
        /*
         * 0x07, Vaux3Sel
+        * 0x30, Vrf1Sel
         */
-       REG_INIT(AB8500_VRF1VAUX3SEL,           0x04, 0x21, 0x07),
+       REG_INIT(AB8500_VRF1VAUX3SEL,           0x04, 0x21, 0x37),
        /*
         * 0x01, VextSupply12LP
         */
        REG_INIT(AB8500_REGUCTRL2SPARE,         0x04, 0x22, 0x01),
        /*
+        * 0x01, VpllDisch
+        * 0x02, Vrf1Disch
         * 0x04, Vaux1Disch
         * 0x08, Vaux2Disch
         * 0x10, Vaux3Disch
@@ -632,32 +820,31 @@ static struct ab8500_reg_init ab8500_reg_init[] = {
         * 0x40, VTVoutDisch
         * 0x80, VaudioDisch
         */
-       REG_INIT(AB8500_REGUCTRLDISCH,          0x04, 0x43, 0xfc),
+       REG_INIT(AB8500_REGUCTRLDISCH,          0x04, 0x43, 0xff),
        /*
+        * 0x01, VsimDisch
         * 0x02, VanaDisch
         * 0x04, VdmicPullDownEna
+        * 0x08, VpllPullDownEna
         * 0x10, VdmicDisch
         */
-       REG_INIT(AB8500_REGUCTRLDISCH2,         0x04, 0x44, 0x16),
+       REG_INIT(AB8500_REGUCTRLDISCH2,         0x04, 0x44, 0x1f),
 };
 
-static int
-ab8500_regulator_init_registers(struct platform_device *pdev, int id, int value)
+static int ab8500_regulator_init_registers(struct platform_device *pdev,
+                                          int id, int mask, int value)
 {
        int err;
 
-       if (value & ~ab8500_reg_init[id].mask) {
-               dev_err(&pdev->dev,
-                       "Configuration error: value outside mask.\n");
-               return -EINVAL;
-       }
+       BUG_ON(value & ~mask);
+       BUG_ON(mask & ~ab8500_reg_init[id].mask);
 
+       /* initialize register */
        err = abx500_mask_and_set_register_interruptible(
                &pdev->dev,
                ab8500_reg_init[id].bank,
                ab8500_reg_init[id].addr,
-               ab8500_reg_init[id].mask,
-               value);
+               mask, value);
        if (err < 0) {
                dev_err(&pdev->dev,
                        "Failed to initialize 0x%02x, 0x%02x.\n",
@@ -665,13 +852,11 @@ ab8500_regulator_init_registers(struct platform_device *pdev, int id, int value)
                        ab8500_reg_init[id].addr);
                return err;
        }
-
        dev_vdbg(&pdev->dev,
-               "init: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
-               ab8500_reg_init[id].bank,
-               ab8500_reg_init[id].addr,
-               ab8500_reg_init[id].mask,
-               value);
+                "  init: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
+                ab8500_reg_init[id].bank,
+                ab8500_reg_init[id].addr,
+                mask, value);
 
        return 0;
 }
@@ -790,19 +975,16 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
 
        /* initialize registers */
        for (i = 0; i < pdata->num_regulator_reg_init; i++) {
-               int id, value;
+               int id, mask, value;
 
                id = pdata->regulator_reg_init[i].id;
+               mask = pdata->regulator_reg_init[i].mask;
                value = pdata->regulator_reg_init[i].value;
 
                /* check for configuration errors */
-               if (id >= AB8500_NUM_REGULATOR_REGISTERS) {
-                       dev_err(&pdev->dev,
-                               "Configuration error: id outside range.\n");
-                       return -EINVAL;
-               }
+               BUG_ON(id >= AB8500_NUM_REGULATOR_REGISTERS);
 
-               err = ab8500_regulator_init_registers(pdev, id, value);
+               err = ab8500_regulator_init_registers(pdev, id, mask, value);
                if (err < 0)
                        return err;
        }