return max8660_write(max8660, MAX8660_OVER1, mask, 0);
}
-static int max8660_dcdc_list(struct regulator_dev *rdev, unsigned selector)
-{
- if (selector > MAX8660_DCDC_MAX_SEL)
- return -EINVAL;
- return MAX8660_DCDC_MIN_UV + selector * MAX8660_DCDC_STEP;
-}
-
static int max8660_dcdc_get(struct regulator_dev *rdev)
{
struct max8660 *max8660 = rdev_get_drvdata(rdev);
selector = DIV_ROUND_UP(min_uV - MAX8660_DCDC_MIN_UV,
MAX8660_DCDC_STEP);
- ret = max8660_dcdc_list(rdev, selector);
+ ret = regulator_list_voltage_linear(rdev, selector);
if (ret < 0 || ret > max_uV)
return -EINVAL;
static struct regulator_ops max8660_dcdc_ops = {
.is_enabled = max8660_dcdc_is_enabled,
- .list_voltage = max8660_dcdc_list,
+ .list_voltage = regulator_list_voltage_linear,
.set_voltage = max8660_dcdc_set,
.get_voltage = max8660_dcdc_get,
};
* LDO5 functions
*/
-static int max8660_ldo5_list(struct regulator_dev *rdev, unsigned selector)
-{
- if (selector > MAX8660_LDO5_MAX_SEL)
- return -EINVAL;
- return MAX8660_LDO5_MIN_UV + selector * MAX8660_LDO5_STEP;
-}
-
static int max8660_ldo5_get(struct regulator_dev *rdev)
{
struct max8660 *max8660 = rdev_get_drvdata(rdev);
selector = DIV_ROUND_UP(min_uV - MAX8660_LDO5_MIN_UV,
MAX8660_LDO5_STEP);
- ret = max8660_ldo5_list(rdev, selector);
+ ret = regulator_list_voltage_linear(rdev, selector);
if (ret < 0 || ret > max_uV)
return -EINVAL;
}
static struct regulator_ops max8660_ldo5_ops = {
- .list_voltage = max8660_ldo5_list,
+ .list_voltage = regulator_list_voltage_linear,
.set_voltage = max8660_ldo5_set,
.get_voltage = max8660_ldo5_get,
};
return max8660_write(max8660, MAX8660_OVER2, mask, 0);
}
-static int max8660_ldo67_list(struct regulator_dev *rdev, unsigned selector)
-{
- if (selector > MAX8660_LDO67_MAX_SEL)
- return -EINVAL;
- return MAX8660_LDO67_MIN_UV + selector * MAX8660_LDO67_STEP;
-}
-
static int max8660_ldo67_get(struct regulator_dev *rdev)
{
struct max8660 *max8660 = rdev_get_drvdata(rdev);
selector = DIV_ROUND_UP(min_uV - MAX8660_LDO67_MIN_UV,
MAX8660_LDO67_STEP);
- ret = max8660_ldo67_list(rdev, selector);
+ ret = regulator_list_voltage_linear(rdev, selector);
if (ret < 0 || ret > max_uV)
return -EINVAL;
.is_enabled = max8660_ldo67_is_enabled,
.enable = max8660_ldo67_enable,
.disable = max8660_ldo67_disable,
- .list_voltage = max8660_ldo67_list,
+ .list_voltage = regulator_list_voltage_linear,
.get_voltage = max8660_ldo67_get,
.set_voltage = max8660_ldo67_set,
};
.type = REGULATOR_VOLTAGE,
.n_voltages = MAX8660_DCDC_MAX_SEL + 1,
.owner = THIS_MODULE,
+ .min_uV = MAX8660_DCDC_MIN_UV,
+ .uV_step = MAX8660_DCDC_STEP,
},
{
.name = "V4(DCDC)",
.type = REGULATOR_VOLTAGE,
.n_voltages = MAX8660_DCDC_MAX_SEL + 1,
.owner = THIS_MODULE,
+ .min_uV = MAX8660_DCDC_MIN_UV,
+ .uV_step = MAX8660_DCDC_STEP,
},
{
.name = "V5(LDO)",
.type = REGULATOR_VOLTAGE,
.n_voltages = MAX8660_LDO5_MAX_SEL + 1,
.owner = THIS_MODULE,
+ .min_uV = MAX8660_LDO5_MIN_UV,
+ .uV_step = MAX8660_LDO5_STEP,
},
{
.name = "V6(LDO)",
.type = REGULATOR_VOLTAGE,
.n_voltages = MAX8660_LDO67_MAX_SEL + 1,
.owner = THIS_MODULE,
+ .min_uV = MAX8660_LDO67_MIN_UV,
+ .uV_step = MAX8660_LDO67_STEP,
},
{
.name = "V7(LDO)",
.type = REGULATOR_VOLTAGE,
.n_voltages = MAX8660_LDO67_MAX_SEL + 1,
.owner = THIS_MODULE,
+ .min_uV = MAX8660_LDO67_MIN_UV,
+ .uV_step = MAX8660_LDO67_STEP,
},
};