aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/axp20x-regulator.c
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2015-01-09 11:23:43 -0500
committerMark Brown <broonie@kernel.org>2015-01-09 12:12:58 -0500
commit880fe82dc555c514b5b4b14642f397afddd82860 (patch)
treefce194b3d9204033c74d0477ec6376d62d3fd976 /drivers/regulator/axp20x-regulator.c
parent97bf6af1f928216fd6c5a66e8a57bfa95a659672 (diff)
regulator: axp20x: Fill regulators_node and of_match descriptor fields
This patch fills the DT related fields in the regulator descriptors, which can then be used by the regulator core's simplified DT code. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/axp20x-regulator.c')
-rw-r--r--drivers/regulator/axp20x-regulator.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index f23d7e1f2ee7..441ae01123dd 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -32,11 +32,13 @@
32 32
33#define AXP20X_FREQ_DCDC_MASK 0x0f 33#define AXP20X_FREQ_DCDC_MASK 0x0f
34 34
35#define AXP20X_DESC_IO(_id, _supply, _min, _max, _step, _vreg, _vmask, _ereg, \ 35#define AXP20X_DESC_IO(_id, _match, _supply, _min, _max, _step, _vreg, _vmask, \
36 _emask, _enable_val, _disable_val) \ 36 _ereg, _emask, _enable_val, _disable_val) \
37 [AXP20X_##_id] = { \ 37 [AXP20X_##_id] = { \
38 .name = #_id, \ 38 .name = #_id, \
39 .supply_name = (_supply), \ 39 .supply_name = (_supply), \
40 .of_match = of_match_ptr(_match), \
41 .regulators_node = of_match_ptr("regulators"), \
40 .type = REGULATOR_VOLTAGE, \ 42 .type = REGULATOR_VOLTAGE, \
41 .id = AXP20X_##_id, \ 43 .id = AXP20X_##_id, \
42 .n_voltages = (((_max) - (_min)) / (_step) + 1), \ 44 .n_voltages = (((_max) - (_min)) / (_step) + 1), \
@@ -52,11 +54,13 @@
52 .ops = &axp20x_ops, \ 54 .ops = &axp20x_ops, \
53 } 55 }
54 56
55#define AXP20X_DESC(_id, _supply, _min, _max, _step, _vreg, _vmask, _ereg, \ 57#define AXP20X_DESC(_id, _match, _supply, _min, _max, _step, _vreg, _vmask, \
56 _emask) \ 58 _ereg, _emask) \
57 [AXP20X_##_id] = { \ 59 [AXP20X_##_id] = { \
58 .name = #_id, \ 60 .name = #_id, \
59 .supply_name = (_supply), \ 61 .supply_name = (_supply), \
62 .of_match = of_match_ptr(_match), \
63 .regulators_node = of_match_ptr("regulators"), \
60 .type = REGULATOR_VOLTAGE, \ 64 .type = REGULATOR_VOLTAGE, \
61 .id = AXP20X_##_id, \ 65 .id = AXP20X_##_id, \
62 .n_voltages = (((_max) - (_min)) / (_step) + 1), \ 66 .n_voltages = (((_max) - (_min)) / (_step) + 1), \
@@ -70,10 +74,12 @@
70 .ops = &axp20x_ops, \ 74 .ops = &axp20x_ops, \
71 } 75 }
72 76
73#define AXP20X_DESC_FIXED(_id, _supply, _volt) \ 77#define AXP20X_DESC_FIXED(_id, _match, _supply, _volt) \
74 [AXP20X_##_id] = { \ 78 [AXP20X_##_id] = { \
75 .name = #_id, \ 79 .name = #_id, \
76 .supply_name = (_supply), \ 80 .supply_name = (_supply), \
81 .of_match = of_match_ptr(_match), \
82 .regulators_node = of_match_ptr("regulators"), \
77 .type = REGULATOR_VOLTAGE, \ 83 .type = REGULATOR_VOLTAGE, \
78 .id = AXP20X_##_id, \ 84 .id = AXP20X_##_id, \
79 .n_voltages = 1, \ 85 .n_voltages = 1, \
@@ -82,10 +88,13 @@
82 .ops = &axp20x_ops_fixed \ 88 .ops = &axp20x_ops_fixed \
83 } 89 }
84 90
85#define AXP20X_DESC_TABLE(_id, _supply, _table, _vreg, _vmask, _ereg, _emask) \ 91#define AXP20X_DESC_TABLE(_id, _match, _supply, _table, _vreg, _vmask, _ereg, \
92 _emask) \
86 [AXP20X_##_id] = { \ 93 [AXP20X_##_id] = { \
87 .name = #_id, \ 94 .name = #_id, \
88 .supply_name = (_supply), \ 95 .supply_name = (_supply), \
96 .of_match = of_match_ptr(_match), \
97 .regulators_node = of_match_ptr("regulators"), \
89 .type = REGULATOR_VOLTAGE, \ 98 .type = REGULATOR_VOLTAGE, \
90 .id = AXP20X_##_id, \ 99 .id = AXP20X_##_id, \
91 .n_voltages = ARRAY_SIZE(_table), \ 100 .n_voltages = ARRAY_SIZE(_table), \
@@ -127,20 +136,20 @@ static struct regulator_ops axp20x_ops = {
127}; 136};
128 137
129static const struct regulator_desc axp20x_regulators[] = { 138static const struct regulator_desc axp20x_regulators[] = {
130 AXP20X_DESC(DCDC2, "vin2", 700, 2275, 25, AXP20X_DCDC2_V_OUT, 0x3f, 139 AXP20X_DESC(DCDC2, "dcdc2", "vin2", 700, 2275, 25, AXP20X_DCDC2_V_OUT,
131 AXP20X_PWR_OUT_CTRL, 0x10), 140 0x3f, AXP20X_PWR_OUT_CTRL, 0x10),
132 AXP20X_DESC(DCDC3, "vin3", 700, 3500, 25, AXP20X_DCDC3_V_OUT, 0x7f, 141 AXP20X_DESC(DCDC3, "dcdc3", "vin3", 700, 3500, 25, AXP20X_DCDC3_V_OUT,
133 AXP20X_PWR_OUT_CTRL, 0x02), 142 0x7f, AXP20X_PWR_OUT_CTRL, 0x02),
134 AXP20X_DESC_FIXED(LDO1, "acin", 1300), 143 AXP20X_DESC_FIXED(LDO1, "ldo1", "acin", 1300),
135 AXP20X_DESC(LDO2, "ldo24in", 1800, 3300, 100, AXP20X_LDO24_V_OUT, 0xf0, 144 AXP20X_DESC(LDO2, "ldo2", "ldo24in", 1800, 3300, 100,
136 AXP20X_PWR_OUT_CTRL, 0x04), 145 AXP20X_LDO24_V_OUT, 0xf0, AXP20X_PWR_OUT_CTRL, 0x04),
137 AXP20X_DESC(LDO3, "ldo3in", 700, 3500, 25, AXP20X_LDO3_V_OUT, 0x7f, 146 AXP20X_DESC(LDO3, "ldo3", "ldo3in", 700, 3500, 25, AXP20X_LDO3_V_OUT,
138 AXP20X_PWR_OUT_CTRL, 0x40), 147 0x7f, AXP20X_PWR_OUT_CTRL, 0x40),
139 AXP20X_DESC_TABLE(LDO4, "ldo24in", axp20x_ldo4_data, AXP20X_LDO24_V_OUT, 0x0f, 148 AXP20X_DESC_TABLE(LDO4, "ldo4", "ldo24in", axp20x_ldo4_data,
140 AXP20X_PWR_OUT_CTRL, 0x08), 149 AXP20X_LDO24_V_OUT, 0x0f, AXP20X_PWR_OUT_CTRL, 0x08),
141 AXP20X_DESC_IO(LDO5, "ldo5in", 1800, 3300, 100, AXP20X_LDO5_V_OUT, 0xf0, 150 AXP20X_DESC_IO(LDO5, "ldo5", "ldo5in", 1800, 3300, 100,
142 AXP20X_GPIO0_CTRL, 0x07, AXP20X_IO_ENABLED, 151 AXP20X_LDO5_V_OUT, 0xf0, AXP20X_GPIO0_CTRL, 0x07,
143 AXP20X_IO_DISABLED), 152 AXP20X_IO_ENABLED, AXP20X_IO_DISABLED),
144}; 153};
145 154
146#define AXP_MATCH(_name, _id) \ 155#define AXP_MATCH(_name, _id) \