]> git.karo-electronics.de Git - linux-beck.git/commitdiff
regulator: Remove max_uV from struct regulator_linear_range
authorAxel Lin <axel.lin@ingics.com>
Fri, 11 Oct 2013 01:30:24 +0000 (09:30 +0800)
committerMark Brown <broonie@linaro.org>
Fri, 11 Oct 2013 11:49:12 +0000 (12:49 +0100)
linear ranges means each range has linear voltage settings.
So we can calculate max_uV for each linear range in regulator core rather than
set the max_uV field in drivers.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/regulator/88pm800.c
drivers/regulator/as3711-regulator.c
drivers/regulator/as3722-regulator.c
drivers/regulator/da903x.c
drivers/regulator/helpers.c
drivers/regulator/tps65217-regulator.c
drivers/regulator/tps65912-regulator.c
drivers/regulator/wm831x-ldo.c
drivers/regulator/wm8350-regulator.c
drivers/regulator/wm8400-regulator.c
include/linux/regulator/driver.h

index 3459f60dcfd1c7dfc67aa641edd49f697ffb8b94..22ba4c4280eeef4c7a7d8702bacaca431b16dd30 100644 (file)
@@ -141,18 +141,16 @@ 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 },
+       { .min_uV = 600000, .min_sel = 0, .max_sel = 0x4f, .uV_step = 12500 },
+       { .min_uV = 1600000, .min_sel = 0x50, .max_sel = 0x54,
+         .uV_step = 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 },
+       { .min_uV = 600000, .min_sel = 0, .max_sel = 0x4f, .uV_step = 12500 },
+       { .min_uV = 1600000, .min_sel = 0x50, .max_sel = 0x72,
+         .uV_step = 50000 },
 };
 
 static const unsigned int ldo1_volt_table[] = {
index 8406cd745da29e6a60a76624d1199516d7d46121..d0a97e5ea431999272b73aec723079a913be33d5 100644 (file)
@@ -117,26 +117,23 @@ 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 },
+       { .min_uV = 612500, .min_sel = 0x1, .max_sel = 0x40, .uV_step = 12500 },
+       { .min_uV = 1425000, .min_sel = 0x41, .max_sel = 0x70,
+         .uV_step = 25000 },
+       { .min_uV = 2650000, .min_sel = 0x71, .max_sel = 0x7f,
+         .uV_step = 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 },
+       { .min_uV = 1200000, .min_sel = 0, .max_sel = 0xf, .uV_step = 50000 },
+       { .min_uV = 1800000, .min_sel = 0x10, .max_sel = 0x1f,
+         .uV_step = 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 },
+       { .min_uV = 900000, .min_sel = 0, .max_sel = 0x10, .uV_step = 50000 },
+       { .min_uV = 1750000, .min_sel = 0x20, .max_sel = 0x3f,
+         .uV_step = 50000 },
 };
 
 #define AS3711_REG(_id, _en_reg, _en_bit, _vmask, _vshift, _min_uV, _max_uV, _sfx)     \
index d7b71a9c41f1b0e96596d5c53a8327de4c9e7100..240ae6d2ee2aa856e7c4f4c78ae59abdbd0b13e6 100644 (file)
@@ -441,7 +441,6 @@ static struct regulator_ops as3722_ldo3_extcntrl_ops = {
                .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[] = {
index f06854cf8cf50739866386538668f4eb5acbc34a..90d55e0664478cf962be3b7b9f4b144f31deabf0 100644 (file)
@@ -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 },
+       { .min_uV = 1700000, .min_sel =  0, .max_sel = 7, .uV_step =  50000 },
+       { .min_uV = 2700000, .min_sel =  8, .max_sel = 15, .uV_step =  50000 },
 };
 
 static struct regulator_ops da903x_regulator_ldo_ops = {
index 6e30df14714bf15b944740c371d751413421ed3c..e221a271ba56601d12f5fc3d14a09db967a7d292 100644 (file)
@@ -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)
index 90861d68a0b002ee3f83b6529feed9884770ca9a..484866f4368181c5dca03ae1f416a15b25ebd927 100644 (file)
@@ -52,25 +52,17 @@ static const unsigned int LDO1_VSEL_table[] = {
 };
 
 static const struct regulator_linear_range tps65217_uv1_ranges[] = {
-       { .min_uV = 900000, .max_uV = 1500000, .min_sel =  0, .max_sel = 24,
-         .uV_step = 25000 },
-       { .min_uV = 1550000, .max_uV = 1800000, .min_sel = 25, .max_sel = 30,
-         .uV_step = 50000 },
-       { .min_uV = 1850000, .max_uV = 2900000, .min_sel = 31, .max_sel = 52,
-         .uV_step = 50000 },
-       { .min_uV = 3000000, .max_uV = 3200000, .min_sel = 53, .max_sel = 55,
-         .uV_step = 100000 },
-       { .min_uV = 3300000, .max_uV = 3300000, .min_sel = 56, .max_sel = 62,
-         .uV_step = 0 },
+       { .min_uV = 900000, .min_sel =  0, .max_sel = 24, .uV_step = 25000 },
+       { .min_uV = 1550000, .min_sel = 25, .max_sel = 30, .uV_step = 50000 },
+       { .min_uV = 1850000, .min_sel = 31, .max_sel = 52, .uV_step = 50000 },
+       { .min_uV = 3000000, .min_sel = 53, .max_sel = 55, .uV_step = 100000 },
+       { .min_uV = 3300000, .min_sel = 56, .max_sel = 62, .uV_step = 0 },
 };
 
 static const struct regulator_linear_range tps65217_uv2_ranges[] = {
-       { .min_uV = 1500000, .max_uV = 1900000, .min_sel =  0, .max_sel = 8,
-         .uV_step = 50000 },
-       { .min_uV = 2000000, .max_uV = 2400000, .min_sel = 9, .max_sel = 13,
-         .uV_step = 100000 },
-       { .min_uV = 2450000, .max_uV = 3300000, .min_sel = 14, .max_sel = 31,
-         .uV_step = 50000 },
+       { .min_uV = 1500000, .min_sel =  0, .max_sel = 8, .uV_step = 50000 },
+       { .min_uV = 2000000, .min_sel = 9, .max_sel = 13, .uV_step = 100000 },
+       { .min_uV = 2450000, .min_sel = 14, .max_sel = 31, .uV_step = 50000 },
 };
 
 static int tps65217_pmic_enable(struct regulator_dev *dev)
index 281e52ac64ba0e3caf66c0322bd23ac91455a8a4..9fc87d8c9ce5227ea59e1521575dc2eea9bc804f 100644 (file)
@@ -119,12 +119,9 @@ struct tps65912_reg {
 };
 
 static const struct regulator_linear_range tps65912_ldo_ranges[] = {
-       { .min_uV = 800000, .max_uV = 1600000, .min_sel =  0, .max_sel = 32,
-         .uV_step = 25000 },
-       { .min_uV = 1650000, .max_uV = 3000000, .min_sel = 33, .max_sel = 60,
-         .uV_step = 50000 },
-       { .min_uV = 3100000, .max_uV = 3300000, .min_sel = 61, .max_sel = 63,
-         .uV_step = 100000 },
+       { .min_uV = 800000, .min_sel =  0, .max_sel = 32, .uV_step = 25000 },
+       { .min_uV = 1650000, .min_sel = 33, .max_sel = 60, .uV_step = 50000 },
+       { .min_uV = 3100000, .min_sel = 61, .max_sel = 63, .uV_step = 100000 },
 };
 
 static int tps65912_get_range(struct tps65912_reg *pmic, int id)
index 2205fbc2c37b4cf9b917bafa5d1f583f7e767b49..a95814027b24ccd5e74f2ab954739bce5ae9e1c0 100644 (file)
@@ -63,10 +63,8 @@ static irqreturn_t wm831x_ldo_uv_irq(int irq, void *data)
  */
 
 static const struct regulator_linear_range wm831x_gp_ldo_ranges[] = {
-       { .min_uV =  900000, .max_uV = 1600000, .min_sel =  0, .max_sel = 14,
-         .uV_step =  50000 },
-       { .min_uV = 1700000, .max_uV = 3300000, .min_sel = 15, .max_sel = 31,
-         .uV_step = 100000 },
+       { .min_uV =  900000, .min_sel =  0, .max_sel = 14, .uV_step =  50000 },
+       { .min_uV = 1700000, .min_sel = 15, .max_sel = 31, .uV_step = 100000 },
 };
 
 static int wm831x_gp_ldo_set_suspend_voltage(struct regulator_dev *rdev,
@@ -332,10 +330,8 @@ static struct platform_driver wm831x_gp_ldo_driver = {
  */
 
 static const struct regulator_linear_range wm831x_aldo_ranges[] = {
-       { .min_uV = 1000000, .max_uV = 1600000, .min_sel =  0, .max_sel = 12,
-         .uV_step =  50000 },
-       { .min_uV = 1700000, .max_uV = 3500000, .min_sel = 13, .max_sel = 31,
-         .uV_step = 100000 },
+       { .min_uV = 1000000, .min_sel =  0, .max_sel = 12, .uV_step =  50000 },
+       { .min_uV = 1700000, .min_sel = 13, .max_sel = 31, .uV_step = 100000 },
 };
 
 static int wm831x_aldo_set_suspend_voltage(struct regulator_dev *rdev,
index 61ca9292a42944229f9f52bc6f5b8943b6414b22..de9de26d0bfcad7c2ee5790197619563a5d73696 100644 (file)
@@ -543,10 +543,8 @@ static int wm8350_dcdc_set_suspend_mode(struct regulator_dev *rdev,
 }
 
 static const struct regulator_linear_range wm8350_ldo_ranges[] = {
-       { .min_uV =  900000, .max_uV = 1650000, .min_sel =  0, .max_sel = 15,
-         .uV_step =  50000 },
-       { .min_uV = 1800000, .max_uV = 3300000, .min_sel = 16, .max_sel = 31,
-         .uV_step = 100000 },
+       { .min_uV =  900000, .min_sel =  0, .max_sel = 15, .uV_step =  50000 },
+       { .min_uV = 1800000, .min_sel = 16, .max_sel = 31, .uV_step = 100000 },
 };
 
 static int wm8350_ldo_set_suspend_voltage(struct regulator_dev *rdev, int uV)
index 58f51bec13f25d2f47a488ca53fc1099bb683762..3352b2090ed5373c4e04e2f8fb7c210b679e05ab 100644 (file)
 #include <linux/mfd/wm8400-private.h>
 
 static const struct regulator_linear_range wm8400_ldo_ranges[] = {
-       { .min_uV =  900000, .max_uV = 1600000, .min_sel = 0, .max_sel = 14,
-         .uV_step =  50000 },
-       { .min_uV = 1700000, .max_uV = 3300000, .min_sel = 15, .max_sel = 31,
-         .uV_step = 100000 },
+       { .min_uV =  900000, .min_sel = 0, .max_sel = 14, .uV_step =  50000 },
+       { .min_uV = 1700000, .min_sel = 15, .max_sel = 31, .uV_step = 100000 },
 };
 
 static struct regulator_ops wm8400_ldo_ops = {
index 9bdad43ad228a5501c2dc8b0e6cc77a6da8c7b30..997ff5c4d880e3956c8a914436d8585791e5f8a2 100644 (file)
@@ -46,14 +46,12 @@ enum regulator_status {
  * regulator_list_linear_range().
  *
  * @min_uV:  Lowest voltage in range
- * @max_uV:  Highest voltage in range
  * @min_sel: Lowest selector for range
  * @max_sel: Highest selector for range
  * @uV_step: Step size
  */
 struct regulator_linear_range {
        unsigned int min_uV;
-       unsigned int max_uV;
        unsigned int min_sel;
        unsigned int max_sel;
        unsigned int uV_step;