regulator: da9052: Add ramp speed information for the DVC regulators
authorPhilipp Zabel <p.zabel@pengutronix.de>
Thu, 6 Feb 2014 14:35:21 +0000 (15:35 +0100)
committerMark Brown <broonie@linaro.org>
Wed, 19 Feb 2014 13:04:38 +0000 (22:04 +0900)
Some LDOs and DCDCs have a fixed ramp speed of 6.25 mV/µs. This patch adds
the set_voltage_time_sel function to let consumers know about this.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/regulator/da9052-regulator.c

index 889c7c9b9f15533805f1e21fc648f1defff9e0c9..fdb6ea8ae7e64dc73a7cb2cc4f16a8b43c533b72 100644 (file)
@@ -240,6 +240,31 @@ static int da9052_regulator_set_voltage_sel(struct regulator_dev *rdev,
        return ret;
 }
 
+static int da9052_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
+                                                unsigned int old_sel,
+                                                unsigned int new_sel)
+{
+       struct da9052_regulator *regulator = rdev_get_drvdata(rdev);
+       struct da9052_regulator_info *info = regulator->info;
+       int id = rdev_get_id(rdev);
+       int ret = 0;
+
+       /* The DVC controlled LDOs and DCDCs ramp with 6.25mV/µs after enabling
+        * the activate bit.
+        */
+       switch (id) {
+       case DA9052_ID_BUCK1:
+       case DA9052_ID_BUCK2:
+       case DA9052_ID_BUCK3:
+       case DA9052_ID_LDO2:
+       case DA9052_ID_LDO3:
+               ret = (new_sel - old_sel) * info->step_uV / 6250;
+               break;
+       }
+
+       return ret;
+}
+
 static struct regulator_ops da9052_dcdc_ops = {
        .get_current_limit = da9052_dcdc_get_current_limit,
        .set_current_limit = da9052_dcdc_set_current_limit,
@@ -248,6 +273,7 @@ static struct regulator_ops da9052_dcdc_ops = {
        .map_voltage = da9052_map_voltage,
        .get_voltage_sel = regulator_get_voltage_sel_regmap,
        .set_voltage_sel = da9052_regulator_set_voltage_sel,
+       .set_voltage_time_sel = da9052_regulator_set_voltage_time_sel,
        .is_enabled = regulator_is_enabled_regmap,
        .enable = regulator_enable_regmap,
        .disable = regulator_disable_regmap,
@@ -258,6 +284,7 @@ static struct regulator_ops da9052_ldo_ops = {
        .map_voltage = da9052_map_voltage,
        .get_voltage_sel = regulator_get_voltage_sel_regmap,
        .set_voltage_sel = da9052_regulator_set_voltage_sel,
+       .set_voltage_time_sel = da9052_regulator_set_voltage_time_sel,
        .is_enabled = regulator_is_enabled_regmap,
        .enable = regulator_enable_regmap,
        .disable = regulator_disable_regmap,
This page took 0.030154 seconds and 5 git commands to generate.