regulator: s2mps11: Convert ramp rate to uV/us and set default ramp rate
authorYadwinder Singh Brar <yadi.brar@samsung.com>
Mon, 24 Jun 2013 11:20:55 +0000 (16:50 +0530)
committerMark Brown <broonie@linaro.org>
Wed, 3 Jul 2013 17:51:40 +0000 (18:51 +0100)
This patch makes driver to use uV/us as units of ramp_delay. It makes driver
in compliance with regulator framework and make ramp rate precise.

This patch also sets default ramp rate in regulator descriptor which can be
used in case if case ramp rate is not set in regulator constraints.

Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/regulator/s2mps11.c
include/linux/mfd/samsung/s2mps11.h

index c9f16e17920fc2005e9a165fd28a343073c83c14..2f62564ca9362e06ae8e5479864af5c48f12342e 100644 (file)
@@ -42,7 +42,7 @@ static int get_ramp_delay(int ramp_delay)
 {
        unsigned char cnt = 0;
 
-       ramp_delay /= 6;
+       ramp_delay /= 6250;
 
        while (true) {
                ramp_delay = ramp_delay >> 1;
@@ -113,6 +113,7 @@ static struct regulator_ops s2mps11_buck_ops = {
        .min_uV         = S2MPS11_BUCK_MIN1,                    \
        .uV_step        = S2MPS11_BUCK_STEP1,                   \
        .n_voltages     = S2MPS11_BUCK_N_VOLTAGES,              \
+       .ramp_delay     = S2MPS11_RAMP_DELAY,                   \
        .vsel_reg       = S2MPS11_REG_B1CTRL2 + (num - 1) * 2,  \
        .vsel_mask      = S2MPS11_BUCK_VSEL_MASK,               \
        .enable_reg     = S2MPS11_REG_B1CTRL1 + (num - 1) * 2,  \
@@ -128,6 +129,7 @@ static struct regulator_ops s2mps11_buck_ops = {
        .min_uV         = S2MPS11_BUCK_MIN1,                    \
        .uV_step        = S2MPS11_BUCK_STEP1,                   \
        .n_voltages     = S2MPS11_BUCK_N_VOLTAGES,              \
+       .ramp_delay     = S2MPS11_RAMP_DELAY,                   \
        .vsel_reg       = S2MPS11_REG_B5CTRL2,                  \
        .vsel_mask      = S2MPS11_BUCK_VSEL_MASK,               \
        .enable_reg     = S2MPS11_REG_B5CTRL1,                  \
@@ -143,6 +145,7 @@ static struct regulator_ops s2mps11_buck_ops = {
        .min_uV         = S2MPS11_BUCK_MIN1,                    \
        .uV_step        = S2MPS11_BUCK_STEP1,                   \
        .n_voltages     = S2MPS11_BUCK_N_VOLTAGES,              \
+       .ramp_delay     = S2MPS11_RAMP_DELAY,                   \
        .vsel_reg       = S2MPS11_REG_B6CTRL2 + (num - 6) * 2,  \
        .vsel_mask      = S2MPS11_BUCK_VSEL_MASK,               \
        .enable_reg     = S2MPS11_REG_B6CTRL1 + (num - 6) * 2,  \
@@ -158,6 +161,7 @@ static struct regulator_ops s2mps11_buck_ops = {
        .min_uV         = S2MPS11_BUCK_MIN3,                    \
        .uV_step        = S2MPS11_BUCK_STEP3,                   \
        .n_voltages     = S2MPS11_BUCK_N_VOLTAGES,              \
+       .ramp_delay     = S2MPS11_RAMP_DELAY,                   \
        .vsel_reg       = S2MPS11_REG_B9CTRL2,                  \
        .vsel_mask      = S2MPS11_BUCK_VSEL_MASK,               \
        .enable_reg     = S2MPS11_REG_B9CTRL1,                  \
@@ -173,6 +177,7 @@ static struct regulator_ops s2mps11_buck_ops = {
        .min_uV         = S2MPS11_BUCK_MIN2,                    \
        .uV_step        = S2MPS11_BUCK_STEP2,                   \
        .n_voltages     = S2MPS11_BUCK_N_VOLTAGES,              \
+       .ramp_delay     = S2MPS11_RAMP_DELAY,                   \
        .vsel_reg       = S2MPS11_REG_B10CTRL2,                 \
        .vsel_mask      = S2MPS11_BUCK_VSEL_MASK,               \
        .enable_reg     = S2MPS11_REG_B10CTRL1,                 \
index ad2252f239d75bbe05a5c78f85c2a463ed1ffa52..4e94dc65f987f2b9185ac18b4be67c3ffbb53f58 100644 (file)
@@ -189,6 +189,7 @@ enum s2mps11_regulators {
 #define S2MPS11_ENABLE_SHIFT   0x06
 #define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1)
 #define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)
+#define S2MPS11_RAMP_DELAY     25000           /* uV/us */
 
 #define S2MPS11_PMIC_EN_SHIFT  6
 #define S2MPS11_REGULATOR_MAX (S2MPS11_REG_MAX - 3)