Merge branch 'topic/min' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 11 Dec 2012 12:44:17 +0000 (21:44 +0900)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 11 Dec 2012 12:44:17 +0000 (21:44 +0900)
1  2 
drivers/regulator/core.c

diff --combined drivers/regulator/core.c
index 59e08633372a074380e337af4fd7bce0e7b1d72c,02a249b024b343fd7fa9dadf8a13c36b04c89f27..1c8ff8ce5c57b471bfe4aca908b88ac80038637e
@@@ -1866,28 -1866,6 +1866,28 @@@ int regulator_is_enabled(struct regulat
  }
  EXPORT_SYMBOL_GPL(regulator_is_enabled);
  
 +/**
 + * regulator_can_change_voltage - check if regulator can change voltage
 + * @regulator: regulator source
 + *
 + * Returns positive if the regulator driver backing the source/client
 + * can change its voltage, false otherwise. Usefull for detecting fixed
 + * or dummy regulators and disabling voltage change logic in the client
 + * driver.
 + */
 +int regulator_can_change_voltage(struct regulator *regulator)
 +{
 +      struct regulator_dev    *rdev = regulator->rdev;
 +
 +      if (rdev->constraints &&
 +          rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
 +          rdev->desc->n_voltages > 1)
 +              return 1;
 +
 +      return 0;
 +}
 +EXPORT_SYMBOL_GPL(regulator_can_change_voltage);
 +
  /**
   * regulator_count_voltages - count regulator_list_voltage() selectors
   * @regulator: regulator source
@@@ -1919,6 -1897,10 +1919,10 @@@ int regulator_list_voltage_linear(struc
  {
        if (selector >= rdev->desc->n_voltages)
                return -EINVAL;
+       if (selector < rdev->desc->linear_min_sel)
+               return 0;
+       selector -= rdev->desc->linear_min_sel;
  
        return rdev->desc->min_uV + (rdev->desc->uV_step * selector);
  }
@@@ -2142,6 -2124,8 +2146,8 @@@ int regulator_map_voltage_linear(struc
        if (ret < 0)
                return ret;
  
+       ret += rdev->desc->linear_min_sel;
        /* Map back into a voltage to verify we're still in bounds */
        voltage = rdev->desc->ops->list_voltage(rdev, ret);
        if (voltage < min_uV || voltage > max_uV)