Loading drivers/regulator/88pm800.c +4 −8 Original line number Diff line number Diff line Loading @@ -141,18 +141,14 @@ struct pm800_regulators { /* Ranges are sorted in ascending order. */ static const struct regulator_linear_range buck1_volt_range[] = { { .min_uV = 600000, .max_uV = 1587500, .min_sel = 0, .max_sel = 0x4f, .uV_step = 12500 }, { .min_uV = 1600000, .max_uV = 1800000, .min_sel = 0x50, .max_sel = 0x54, .uV_step = 50000 }, REGULATOR_LINEAR_RANGE(600000, 0, 0x4f, 12500), REGULATOR_LINEAR_RANGE(1600000, 0x50, 0x54, 50000), }; /* BUCK 2~5 have same ranges. */ static const struct regulator_linear_range buck2_5_volt_range[] = { { .min_uV = 600000, .max_uV = 1587500, .min_sel = 0, .max_sel = 0x4f, .uV_step = 12500 }, { .min_uV = 1600000, .max_uV = 3300000, .min_sel = 0x50, .max_sel = 0x72, .uV_step = 50000 }, REGULATOR_LINEAR_RANGE(600000, 0, 0x4f, 12500), REGULATOR_LINEAR_RANGE(1600000, 0x50, 0x72, 50000), }; static const unsigned int ldo1_volt_table[] = { Loading drivers/regulator/as3711-regulator.c +7 −14 Original line number Diff line number Diff line Loading @@ -117,26 +117,19 @@ static struct regulator_ops as3711_dldo_ops = { }; static const struct regulator_linear_range as3711_sd_ranges[] = { { .min_uV = 612500, .max_uV = 1400000, .min_sel = 0x1, .max_sel = 0x40, .uV_step = 12500 }, { .min_uV = 1425000, .max_uV = 2600000, .min_sel = 0x41, .max_sel = 0x70, .uV_step = 25000 }, { .min_uV = 2650000, .max_uV = 3350000, .min_sel = 0x71, .max_sel = 0x7f, .uV_step = 50000 }, REGULATOR_LINEAR_RANGE(612500, 0x1, 0x40, 12500), REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000), REGULATOR_LINEAR_RANGE(2650000, 0x71, 0x7f, 50000), }; static const struct regulator_linear_range as3711_aldo_ranges[] = { { .min_uV = 1200000, .max_uV = 1950000, .min_sel = 0, .max_sel = 0xf, .uV_step = 50000 }, { .min_uV = 1800000, .max_uV = 3300000, .min_sel = 0x10, .max_sel = 0x1f, .uV_step = 100000 }, REGULATOR_LINEAR_RANGE(1200000, 0, 0xf, 50000), REGULATOR_LINEAR_RANGE(1800000, 0x10, 0x1f, 100000), }; static const struct regulator_linear_range as3711_dldo_ranges[] = { { .min_uV = 900000, .max_uV = 1700000, .min_sel = 0, .max_sel = 0x10, .uV_step = 50000 }, { .min_uV = 1750000, .max_uV = 3300000, .min_sel = 0x20, .max_sel = 0x3f, .uV_step = 50000 }, REGULATOR_LINEAR_RANGE(900000, 0, 0x10, 50000), REGULATOR_LINEAR_RANGE(1750000, 0x20, 0x3f, 50000), }; #define AS3711_REG(_id, _en_reg, _en_bit, _vmask, _vshift, _min_uV, _max_uV, _sfx) \ Loading drivers/regulator/as3722-regulator.c +5 −14 Original line number Diff line number Diff line Loading @@ -435,18 +435,9 @@ static struct regulator_ops as3722_ldo3_extcntrl_ops = { .get_current_limit = as3722_ldo3_get_current_limit, }; #define regulator_lin_range(_min_sel, _max_sel, _min_uV, _step_uV) \ { \ .min_sel = _min_sel, \ .max_sel = _max_sel, \ .uV_step = _step_uV, \ .min_uV = _min_uV, \ .max_uV = _min_uV + (_max_sel - _min_sel) * _step_uV, \ } static const struct regulator_linear_range as3722_ldo_ranges[] = { regulator_lin_range(0x01, 0x24, 825000, 25000), regulator_lin_range(0x40, 0x7F, 1725000, 25000), REGULATOR_LINEAR_RANGE(825000, 0x01, 0x24, 25000), REGULATOR_LINEAR_RANGE(1725000, 0x40, 0x7F, 25000), }; static struct regulator_ops as3722_ldo_ops = { Loading Loading @@ -605,9 +596,9 @@ static int as3722_sd016_set_current_limit(struct regulator_dev *rdev, } static const struct regulator_linear_range as3722_sd2345_ranges[] = { regulator_lin_range(0x01, 0x40, 612500, 12500), regulator_lin_range(0x41, 0x70, 1425000, 25000), regulator_lin_range(0x71, 0x7F, 2650000, 50000), REGULATOR_LINEAR_RANGE(612500, 0x01, 0x40, 12500), REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000), REGULATOR_LINEAR_RANGE(2650000, 0x71, 0x7F, 50000), }; static struct regulator_ops as3722_sd016_ops = { Loading drivers/regulator/da903x.c +2 −4 Original line number Diff line number Diff line Loading @@ -253,10 +253,8 @@ static int da9034_set_dvc_voltage_sel(struct regulator_dev *rdev, } static const struct regulator_linear_range da9034_ldo12_ranges[] = { { .min_uV = 1700000, .max_uV = 2050000, .min_sel = 0, .max_sel = 7, .uV_step = 50000 }, { .min_uV = 2700000, .max_uV = 3050000, .min_sel = 8, .max_sel = 15, .uV_step = 50000 }, REGULATOR_LINEAR_RANGE(1700000, 0, 7, 50000), REGULATOR_LINEAR_RANGE(2700000, 8, 15, 50000), }; static struct regulator_ops da903x_regulator_ldo_ops = { Loading drivers/regulator/helpers.c +5 −1 Original line number Diff line number Diff line Loading @@ -284,9 +284,13 @@ int regulator_map_voltage_linear_range(struct regulator_dev *rdev, } for (i = 0; i < rdev->desc->n_linear_ranges; i++) { int linear_max_uV; range = &rdev->desc->linear_ranges[i]; linear_max_uV = range->min_uV + (range->max_sel - range->min_sel) * range->uV_step; if (!(min_uV <= range->max_uV && max_uV >= range->min_uV)) if (!(min_uV <= linear_max_uV && max_uV >= range->min_uV)) continue; if (min_uV <= range->min_uV) Loading Loading
drivers/regulator/88pm800.c +4 −8 Original line number Diff line number Diff line Loading @@ -141,18 +141,14 @@ struct pm800_regulators { /* Ranges are sorted in ascending order. */ static const struct regulator_linear_range buck1_volt_range[] = { { .min_uV = 600000, .max_uV = 1587500, .min_sel = 0, .max_sel = 0x4f, .uV_step = 12500 }, { .min_uV = 1600000, .max_uV = 1800000, .min_sel = 0x50, .max_sel = 0x54, .uV_step = 50000 }, REGULATOR_LINEAR_RANGE(600000, 0, 0x4f, 12500), REGULATOR_LINEAR_RANGE(1600000, 0x50, 0x54, 50000), }; /* BUCK 2~5 have same ranges. */ static const struct regulator_linear_range buck2_5_volt_range[] = { { .min_uV = 600000, .max_uV = 1587500, .min_sel = 0, .max_sel = 0x4f, .uV_step = 12500 }, { .min_uV = 1600000, .max_uV = 3300000, .min_sel = 0x50, .max_sel = 0x72, .uV_step = 50000 }, REGULATOR_LINEAR_RANGE(600000, 0, 0x4f, 12500), REGULATOR_LINEAR_RANGE(1600000, 0x50, 0x72, 50000), }; static const unsigned int ldo1_volt_table[] = { Loading
drivers/regulator/as3711-regulator.c +7 −14 Original line number Diff line number Diff line Loading @@ -117,26 +117,19 @@ static struct regulator_ops as3711_dldo_ops = { }; static const struct regulator_linear_range as3711_sd_ranges[] = { { .min_uV = 612500, .max_uV = 1400000, .min_sel = 0x1, .max_sel = 0x40, .uV_step = 12500 }, { .min_uV = 1425000, .max_uV = 2600000, .min_sel = 0x41, .max_sel = 0x70, .uV_step = 25000 }, { .min_uV = 2650000, .max_uV = 3350000, .min_sel = 0x71, .max_sel = 0x7f, .uV_step = 50000 }, REGULATOR_LINEAR_RANGE(612500, 0x1, 0x40, 12500), REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000), REGULATOR_LINEAR_RANGE(2650000, 0x71, 0x7f, 50000), }; static const struct regulator_linear_range as3711_aldo_ranges[] = { { .min_uV = 1200000, .max_uV = 1950000, .min_sel = 0, .max_sel = 0xf, .uV_step = 50000 }, { .min_uV = 1800000, .max_uV = 3300000, .min_sel = 0x10, .max_sel = 0x1f, .uV_step = 100000 }, REGULATOR_LINEAR_RANGE(1200000, 0, 0xf, 50000), REGULATOR_LINEAR_RANGE(1800000, 0x10, 0x1f, 100000), }; static const struct regulator_linear_range as3711_dldo_ranges[] = { { .min_uV = 900000, .max_uV = 1700000, .min_sel = 0, .max_sel = 0x10, .uV_step = 50000 }, { .min_uV = 1750000, .max_uV = 3300000, .min_sel = 0x20, .max_sel = 0x3f, .uV_step = 50000 }, REGULATOR_LINEAR_RANGE(900000, 0, 0x10, 50000), REGULATOR_LINEAR_RANGE(1750000, 0x20, 0x3f, 50000), }; #define AS3711_REG(_id, _en_reg, _en_bit, _vmask, _vshift, _min_uV, _max_uV, _sfx) \ Loading
drivers/regulator/as3722-regulator.c +5 −14 Original line number Diff line number Diff line Loading @@ -435,18 +435,9 @@ static struct regulator_ops as3722_ldo3_extcntrl_ops = { .get_current_limit = as3722_ldo3_get_current_limit, }; #define regulator_lin_range(_min_sel, _max_sel, _min_uV, _step_uV) \ { \ .min_sel = _min_sel, \ .max_sel = _max_sel, \ .uV_step = _step_uV, \ .min_uV = _min_uV, \ .max_uV = _min_uV + (_max_sel - _min_sel) * _step_uV, \ } static const struct regulator_linear_range as3722_ldo_ranges[] = { regulator_lin_range(0x01, 0x24, 825000, 25000), regulator_lin_range(0x40, 0x7F, 1725000, 25000), REGULATOR_LINEAR_RANGE(825000, 0x01, 0x24, 25000), REGULATOR_LINEAR_RANGE(1725000, 0x40, 0x7F, 25000), }; static struct regulator_ops as3722_ldo_ops = { Loading Loading @@ -605,9 +596,9 @@ static int as3722_sd016_set_current_limit(struct regulator_dev *rdev, } static const struct regulator_linear_range as3722_sd2345_ranges[] = { regulator_lin_range(0x01, 0x40, 612500, 12500), regulator_lin_range(0x41, 0x70, 1425000, 25000), regulator_lin_range(0x71, 0x7F, 2650000, 50000), REGULATOR_LINEAR_RANGE(612500, 0x01, 0x40, 12500), REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000), REGULATOR_LINEAR_RANGE(2650000, 0x71, 0x7F, 50000), }; static struct regulator_ops as3722_sd016_ops = { Loading
drivers/regulator/da903x.c +2 −4 Original line number Diff line number Diff line Loading @@ -253,10 +253,8 @@ static int da9034_set_dvc_voltage_sel(struct regulator_dev *rdev, } static const struct regulator_linear_range da9034_ldo12_ranges[] = { { .min_uV = 1700000, .max_uV = 2050000, .min_sel = 0, .max_sel = 7, .uV_step = 50000 }, { .min_uV = 2700000, .max_uV = 3050000, .min_sel = 8, .max_sel = 15, .uV_step = 50000 }, REGULATOR_LINEAR_RANGE(1700000, 0, 7, 50000), REGULATOR_LINEAR_RANGE(2700000, 8, 15, 50000), }; static struct regulator_ops da903x_regulator_ldo_ops = { Loading
drivers/regulator/helpers.c +5 −1 Original line number Diff line number Diff line Loading @@ -284,9 +284,13 @@ int regulator_map_voltage_linear_range(struct regulator_dev *rdev, } for (i = 0; i < rdev->desc->n_linear_ranges; i++) { int linear_max_uV; range = &rdev->desc->linear_ranges[i]; linear_max_uV = range->min_uV + (range->max_sel - range->min_sel) * range->uV_step; if (!(min_uV <= range->max_uV && max_uV >= range->min_uV)) if (!(min_uV <= linear_max_uV && max_uV >= range->min_uV)) continue; if (min_uV <= range->min_uV) Loading