Merge remote-tracking branch 'regulator/topic/apply' into regulator-next
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 19 Feb 2013 12:42:29 +0000 (12:42 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 19 Feb 2013 12:42:29 +0000 (12:42 +0000)
1  2 
drivers/regulator/core.c

diff --combined drivers/regulator/core.c
@@@ -1885,15 -1885,9 +1885,15 @@@ int regulator_can_change_voltage(struc
        struct regulator_dev    *rdev = regulator->rdev;
  
        if (rdev->constraints &&
 -          rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
 -          (rdev->desc->n_voltages - rdev->desc->linear_min_sel) > 1)
 -              return 1;
 +          (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
 +              if (rdev->desc->n_voltages - rdev->desc->linear_min_sel > 1)
 +                      return 1;
 +
 +              if (rdev->desc->continuous_voltage_range &&
 +                  rdev->constraints->min_uV && rdev->constraints->max_uV &&
 +                  rdev->constraints->min_uV != rdev->constraints->max_uV)
 +                      return 1;
 +      }
  
        return 0;
  }
@@@ -2080,10 -2074,20 +2080,20 @@@ EXPORT_SYMBOL_GPL(regulator_get_voltage
   */
  int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel)
  {
+       int ret;
        sel <<= ffs(rdev->desc->vsel_mask) - 1;
  
-       return regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
+       ret = regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
                                  rdev->desc->vsel_mask, sel);
+       if (ret)
+               return ret;
+       if (rdev->desc->apply_bit)
+               ret = regmap_update_bits(rdev->regmap, rdev->desc->apply_reg,
+                                        rdev->desc->apply_bit,
+                                        rdev->desc->apply_bit);
+       return ret;
  }
  EXPORT_SYMBOL_GPL(regulator_set_voltage_sel_regmap);
  
@@@ -3321,8 -3325,7 +3331,8 @@@ static void rdev_init_debugfs(struct re
   * @config: runtime configuration for regulator
   *
   * Called by regulator drivers to register a regulator.
 - * Returns 0 on success.
 + * Returns a valid pointer to struct regulator_dev on success
 + * or an ERR_PTR() on error.
   */
  struct regulator_dev *
  regulator_register(const struct regulator_desc *regulator_desc,