]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/regulator/core.c
Merge tag 'for-v3.8' of git://git.infradead.org/users/cbou/linux-pstore
[karo-tx-linux.git] / drivers / regulator / core.c
index 35c149bb2ad36a662f2eb8e13b6c2dab44b8b584..0f65b246cc0c8d24c559cdeafd340232d1c55e0c 100644 (file)
@@ -1886,7 +1886,7 @@ int regulator_can_change_voltage(struct regulator *regulator)
 
        if (rdev->constraints &&
            rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
-           rdev->desc->n_voltages > 1)
+           (rdev->desc->n_voltages - rdev->desc->linear_min_sel) > 1)
                return 1;
 
        return 0;
@@ -1924,6 +1924,10 @@ int regulator_list_voltage_linear(struct regulator_dev *rdev,
 {
        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);
 }
@@ -2152,6 +2156,8 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev,
        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)