aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-10-10 21:32:18 -0400
committerMark Brown <broonie@linaro.org>2013-10-11 07:49:16 -0400
commit8828bae464b129abed95b748263f1ab53bdc5755 (patch)
tree505148f6e9ed7a89a238cc8f1b3042e459f7c703 /drivers/regulator
parente277e656804c85a0729d4fd8cdd3c8ab3e6b3b86 (diff)
regulator: Add REGULATOR_LINEAR_RANGE macro
Add REGULATOR_LINEAR_RANGE macro and convert regulator drivers to use it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/88pm800.c10
-rw-r--r--drivers/regulator/as3711-regulator.c18
-rw-r--r--drivers/regulator/as3722-regulator.c18
-rw-r--r--drivers/regulator/da903x.c4
-rw-r--r--drivers/regulator/tps65217-regulator.c16
-rw-r--r--drivers/regulator/tps65912-regulator.c6
-rw-r--r--drivers/regulator/wm831x-ldo.c8
-rw-r--r--drivers/regulator/wm8350-regulator.c4
-rw-r--r--drivers/regulator/wm8400-regulator.c4
9 files changed, 37 insertions, 51 deletions
diff --git a/drivers/regulator/88pm800.c b/drivers/regulator/88pm800.c
index 22ba4c4280ee..d333f7eac106 100644
--- a/drivers/regulator/88pm800.c
+++ b/drivers/regulator/88pm800.c
@@ -141,16 +141,14 @@ struct pm800_regulators {
141 141
142/* Ranges are sorted in ascending order. */ 142/* Ranges are sorted in ascending order. */
143static const struct regulator_linear_range buck1_volt_range[] = { 143static const struct regulator_linear_range buck1_volt_range[] = {
144 { .min_uV = 600000, .min_sel = 0, .max_sel = 0x4f, .uV_step = 12500 }, 144 REGULATOR_LINEAR_RANGE(600000, 0, 0x4f, 12500),
145 { .min_uV = 1600000, .min_sel = 0x50, .max_sel = 0x54, 145 REGULATOR_LINEAR_RANGE(1600000, 0x50, 0x54, 50000),
146 .uV_step = 50000 },
147}; 146};
148 147
149/* BUCK 2~5 have same ranges. */ 148/* BUCK 2~5 have same ranges. */
150static const struct regulator_linear_range buck2_5_volt_range[] = { 149static const struct regulator_linear_range buck2_5_volt_range[] = {
151 { .min_uV = 600000, .min_sel = 0, .max_sel = 0x4f, .uV_step = 12500 }, 150 REGULATOR_LINEAR_RANGE(600000, 0, 0x4f, 12500),
152 { .min_uV = 1600000, .min_sel = 0x50, .max_sel = 0x72, 151 REGULATOR_LINEAR_RANGE(1600000, 0x50, 0x72, 50000),
153 .uV_step = 50000 },
154}; 152};
155 153
156static const unsigned int ldo1_volt_table[] = { 154static const unsigned int ldo1_volt_table[] = {
diff --git a/drivers/regulator/as3711-regulator.c b/drivers/regulator/as3711-regulator.c
index d0a97e5ea431..f8524f988bdc 100644
--- a/drivers/regulator/as3711-regulator.c
+++ b/drivers/regulator/as3711-regulator.c
@@ -117,23 +117,19 @@ static struct regulator_ops as3711_dldo_ops = {
117}; 117};
118 118
119static const struct regulator_linear_range as3711_sd_ranges[] = { 119static const struct regulator_linear_range as3711_sd_ranges[] = {
120 { .min_uV = 612500, .min_sel = 0x1, .max_sel = 0x40, .uV_step = 12500 }, 120 REGULATOR_LINEAR_RANGE(612500, 0x1, 0x40, 12500),
121 { .min_uV = 1425000, .min_sel = 0x41, .max_sel = 0x70, 121 REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000),
122 .uV_step = 25000 }, 122 REGULATOR_LINEAR_RANGE(2650000, 0x71, 0x7f, 50000),
123 { .min_uV = 2650000, .min_sel = 0x71, .max_sel = 0x7f,
124 .uV_step = 50000 },
125}; 123};
126 124
127static const struct regulator_linear_range as3711_aldo_ranges[] = { 125static const struct regulator_linear_range as3711_aldo_ranges[] = {
128 { .min_uV = 1200000, .min_sel = 0, .max_sel = 0xf, .uV_step = 50000 }, 126 REGULATOR_LINEAR_RANGE(1200000, 0, 0xf, 50000),
129 { .min_uV = 1800000, .min_sel = 0x10, .max_sel = 0x1f, 127 REGULATOR_LINEAR_RANGE(1800000, 0x10, 0x1f, 100000),
130 .uV_step = 100000 },
131}; 128};
132 129
133static const struct regulator_linear_range as3711_dldo_ranges[] = { 130static const struct regulator_linear_range as3711_dldo_ranges[] = {
134 { .min_uV = 900000, .min_sel = 0, .max_sel = 0x10, .uV_step = 50000 }, 131 REGULATOR_LINEAR_RANGE(900000, 0, 0x10, 50000),
135 { .min_uV = 1750000, .min_sel = 0x20, .max_sel = 0x3f, 132 REGULATOR_LINEAR_RANGE(1750000, 0x20, 0x3f, 50000),
136 .uV_step = 50000 },
137}; 133};
138 134
139#define AS3711_REG(_id, _en_reg, _en_bit, _vmask, _vshift, _min_uV, _max_uV, _sfx) \ 135#define AS3711_REG(_id, _en_reg, _en_bit, _vmask, _vshift, _min_uV, _max_uV, _sfx) \
diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c
index 240ae6d2ee2a..5917fe3dc983 100644
--- a/drivers/regulator/as3722-regulator.c
+++ b/drivers/regulator/as3722-regulator.c
@@ -435,17 +435,9 @@ static struct regulator_ops as3722_ldo3_extcntrl_ops = {
435 .get_current_limit = as3722_ldo3_get_current_limit, 435 .get_current_limit = as3722_ldo3_get_current_limit,
436}; 436};
437 437
438#define regulator_lin_range(_min_sel, _max_sel, _min_uV, _step_uV) \
439 { \
440 .min_sel = _min_sel, \
441 .max_sel = _max_sel, \
442 .uV_step = _step_uV, \
443 .min_uV = _min_uV, \
444 }
445
446static const struct regulator_linear_range as3722_ldo_ranges[] = { 438static const struct regulator_linear_range as3722_ldo_ranges[] = {
447 regulator_lin_range(0x01, 0x24, 825000, 25000), 439 REGULATOR_LINEAR_RANGE(825000, 0x01, 0x24, 25000),
448 regulator_lin_range(0x40, 0x7F, 1725000, 25000), 440 REGULATOR_LINEAR_RANGE(1725000, 0x40, 0x7F, 25000),
449}; 441};
450 442
451static struct regulator_ops as3722_ldo_ops = { 443static struct regulator_ops as3722_ldo_ops = {
@@ -604,9 +596,9 @@ static int as3722_sd016_set_current_limit(struct regulator_dev *rdev,
604} 596}
605 597
606static const struct regulator_linear_range as3722_sd2345_ranges[] = { 598static const struct regulator_linear_range as3722_sd2345_ranges[] = {
607 regulator_lin_range(0x01, 0x40, 612500, 12500), 599 REGULATOR_LINEAR_RANGE(612500, 0x01, 0x40, 12500),
608 regulator_lin_range(0x41, 0x70, 1425000, 25000), 600 REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000),
609 regulator_lin_range(0x71, 0x7F, 2650000, 50000), 601 REGULATOR_LINEAR_RANGE(2650000, 0x71, 0x7F, 50000),
610}; 602};
611 603
612static struct regulator_ops as3722_sd016_ops = { 604static struct regulator_ops as3722_sd016_ops = {
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index 90d55e066447..6d1b799ad86b 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -253,8 +253,8 @@ static int da9034_set_dvc_voltage_sel(struct regulator_dev *rdev,
253} 253}
254 254
255static const struct regulator_linear_range da9034_ldo12_ranges[] = { 255static const struct regulator_linear_range da9034_ldo12_ranges[] = {
256 { .min_uV = 1700000, .min_sel = 0, .max_sel = 7, .uV_step = 50000 }, 256 REGULATOR_LINEAR_RANGE(1700000, 0, 7, 50000),
257 { .min_uV = 2700000, .min_sel = 8, .max_sel = 15, .uV_step = 50000 }, 257 REGULATOR_LINEAR_RANGE(2700000, 8, 15, 50000),
258}; 258};
259 259
260static struct regulator_ops da903x_regulator_ldo_ops = { 260static struct regulator_ops da903x_regulator_ldo_ops = {
diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c
index 484866f43681..bbc7277fa097 100644
--- a/drivers/regulator/tps65217-regulator.c
+++ b/drivers/regulator/tps65217-regulator.c
@@ -52,17 +52,17 @@ static const unsigned int LDO1_VSEL_table[] = {
52}; 52};
53 53
54static const struct regulator_linear_range tps65217_uv1_ranges[] = { 54static const struct regulator_linear_range tps65217_uv1_ranges[] = {
55 { .min_uV = 900000, .min_sel = 0, .max_sel = 24, .uV_step = 25000 }, 55 REGULATOR_LINEAR_RANGE(900000, 0, 24, 25000),
56 { .min_uV = 1550000, .min_sel = 25, .max_sel = 30, .uV_step = 50000 }, 56 REGULATOR_LINEAR_RANGE(1550000, 25, 30, 50000),
57 { .min_uV = 1850000, .min_sel = 31, .max_sel = 52, .uV_step = 50000 }, 57 REGULATOR_LINEAR_RANGE(1850000, 31, 52, 50000),
58 { .min_uV = 3000000, .min_sel = 53, .max_sel = 55, .uV_step = 100000 }, 58 REGULATOR_LINEAR_RANGE(3000000, 53, 55, 100000),
59 { .min_uV = 3300000, .min_sel = 56, .max_sel = 62, .uV_step = 0 }, 59 REGULATOR_LINEAR_RANGE(3300000, 56, 62, 0),
60}; 60};
61 61
62static const struct regulator_linear_range tps65217_uv2_ranges[] = { 62static const struct regulator_linear_range tps65217_uv2_ranges[] = {
63 { .min_uV = 1500000, .min_sel = 0, .max_sel = 8, .uV_step = 50000 }, 63 REGULATOR_LINEAR_RANGE(1500000, 0, 8, 50000),
64 { .min_uV = 2000000, .min_sel = 9, .max_sel = 13, .uV_step = 100000 }, 64 REGULATOR_LINEAR_RANGE(2000000, 9, 13, 100000),
65 { .min_uV = 2450000, .min_sel = 14, .max_sel = 31, .uV_step = 50000 }, 65 REGULATOR_LINEAR_RANGE(2450000, 14, 31, 50000),
66}; 66};
67 67
68static int tps65217_pmic_enable(struct regulator_dev *dev) 68static int tps65217_pmic_enable(struct regulator_dev *dev)
diff --git a/drivers/regulator/tps65912-regulator.c b/drivers/regulator/tps65912-regulator.c
index 9fc87d8c9ce5..697eab8e74d8 100644
--- a/drivers/regulator/tps65912-regulator.c
+++ b/drivers/regulator/tps65912-regulator.c
@@ -119,9 +119,9 @@ struct tps65912_reg {
119}; 119};
120 120
121static const struct regulator_linear_range tps65912_ldo_ranges[] = { 121static const struct regulator_linear_range tps65912_ldo_ranges[] = {
122 { .min_uV = 800000, .min_sel = 0, .max_sel = 32, .uV_step = 25000 }, 122 REGULATOR_LINEAR_RANGE(800000, 0, 32, 25000),
123 { .min_uV = 1650000, .min_sel = 33, .max_sel = 60, .uV_step = 50000 }, 123 REGULATOR_LINEAR_RANGE(1650000, 33, 60, 50000),
124 { .min_uV = 3100000, .min_sel = 61, .max_sel = 63, .uV_step = 100000 }, 124 REGULATOR_LINEAR_RANGE(3100000, 61, 63, 100000),
125}; 125};
126 126
127static int tps65912_get_range(struct tps65912_reg *pmic, int id) 127static int tps65912_get_range(struct tps65912_reg *pmic, int id)
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c
index a95814027b24..9111b651c353 100644
--- a/drivers/regulator/wm831x-ldo.c
+++ b/drivers/regulator/wm831x-ldo.c
@@ -63,8 +63,8 @@ static irqreturn_t wm831x_ldo_uv_irq(int irq, void *data)
63 */ 63 */
64 64
65static const struct regulator_linear_range wm831x_gp_ldo_ranges[] = { 65static const struct regulator_linear_range wm831x_gp_ldo_ranges[] = {
66 { .min_uV = 900000, .min_sel = 0, .max_sel = 14, .uV_step = 50000 }, 66 REGULATOR_LINEAR_RANGE(900000, 0, 14, 50000),
67 { .min_uV = 1700000, .min_sel = 15, .max_sel = 31, .uV_step = 100000 }, 67 REGULATOR_LINEAR_RANGE(1700000, 15, 31, 100000),
68}; 68};
69 69
70static int wm831x_gp_ldo_set_suspend_voltage(struct regulator_dev *rdev, 70static int wm831x_gp_ldo_set_suspend_voltage(struct regulator_dev *rdev,
@@ -330,8 +330,8 @@ static struct platform_driver wm831x_gp_ldo_driver = {
330 */ 330 */
331 331
332static const struct regulator_linear_range wm831x_aldo_ranges[] = { 332static const struct regulator_linear_range wm831x_aldo_ranges[] = {
333 { .min_uV = 1000000, .min_sel = 0, .max_sel = 12, .uV_step = 50000 }, 333 REGULATOR_LINEAR_RANGE(1000000, 0, 12, 50000),
334 { .min_uV = 1700000, .min_sel = 13, .max_sel = 31, .uV_step = 100000 }, 334 REGULATOR_LINEAR_RANGE(1700000, 13, 31, 100000),
335}; 335};
336 336
337static int wm831x_aldo_set_suspend_voltage(struct regulator_dev *rdev, 337static int wm831x_aldo_set_suspend_voltage(struct regulator_dev *rdev,
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
index de9de26d0bfc..3827539f3ad7 100644
--- a/drivers/regulator/wm8350-regulator.c
+++ b/drivers/regulator/wm8350-regulator.c
@@ -543,8 +543,8 @@ static int wm8350_dcdc_set_suspend_mode(struct regulator_dev *rdev,
543} 543}
544 544
545static const struct regulator_linear_range wm8350_ldo_ranges[] = { 545static const struct regulator_linear_range wm8350_ldo_ranges[] = {
546 { .min_uV = 900000, .min_sel = 0, .max_sel = 15, .uV_step = 50000 }, 546 REGULATOR_LINEAR_RANGE(900000, 0, 15, 50000),
547 { .min_uV = 1800000, .min_sel = 16, .max_sel = 31, .uV_step = 100000 }, 547 REGULATOR_LINEAR_RANGE(1800000, 16, 31, 100000),
548}; 548};
549 549
550static int wm8350_ldo_set_suspend_voltage(struct regulator_dev *rdev, int uV) 550static int wm8350_ldo_set_suspend_voltage(struct regulator_dev *rdev, int uV)
diff --git a/drivers/regulator/wm8400-regulator.c b/drivers/regulator/wm8400-regulator.c
index 3352b2090ed5..8eedba2953f9 100644
--- a/drivers/regulator/wm8400-regulator.c
+++ b/drivers/regulator/wm8400-regulator.c
@@ -20,8 +20,8 @@
20#include <linux/mfd/wm8400-private.h> 20#include <linux/mfd/wm8400-private.h>
21 21
22static const struct regulator_linear_range wm8400_ldo_ranges[] = { 22static const struct regulator_linear_range wm8400_ldo_ranges[] = {
23 { .min_uV = 900000, .min_sel = 0, .max_sel = 14, .uV_step = 50000 }, 23 REGULATOR_LINEAR_RANGE(900000, 0, 14, 50000),
24 { .min_uV = 1700000, .min_sel = 15, .max_sel = 31, .uV_step = 100000 }, 24 REGULATOR_LINEAR_RANGE(1700000, 15, 31, 100000),
25}; 25};
26 26
27static struct regulator_ops wm8400_ldo_ops = { 27static struct regulator_ops wm8400_ldo_ops = {