Skip to content

Commit

Permalink
regulator: axp20x: Fill regulators_node and of_match descriptor fields
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
wens authored and broonie committed Jan 9, 2015
1 parent 97bf6af commit 880fe82
Showing 1 changed file with 29 additions and 20 deletions.
49 changes: 29 additions & 20 deletions drivers/regulator/axp20x-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@

#define AXP20X_FREQ_DCDC_MASK 0x0f

#define AXP20X_DESC_IO(_id, _supply, _min, _max, _step, _vreg, _vmask, _ereg, \
_emask, _enable_val, _disable_val) \
#define AXP20X_DESC_IO(_id, _match, _supply, _min, _max, _step, _vreg, _vmask, \
_ereg, _emask, _enable_val, _disable_val) \
[AXP20X_##_id] = { \
.name = #_id, \
.supply_name = (_supply), \
.of_match = of_match_ptr(_match), \
.regulators_node = of_match_ptr("regulators"), \
.type = REGULATOR_VOLTAGE, \
.id = AXP20X_##_id, \
.n_voltages = (((_max) - (_min)) / (_step) + 1), \
Expand All @@ -52,11 +54,13 @@
.ops = &axp20x_ops, \
}

#define AXP20X_DESC(_id, _supply, _min, _max, _step, _vreg, _vmask, _ereg, \
_emask) \
#define AXP20X_DESC(_id, _match, _supply, _min, _max, _step, _vreg, _vmask, \
_ereg, _emask) \
[AXP20X_##_id] = { \
.name = #_id, \
.supply_name = (_supply), \
.of_match = of_match_ptr(_match), \
.regulators_node = of_match_ptr("regulators"), \
.type = REGULATOR_VOLTAGE, \
.id = AXP20X_##_id, \
.n_voltages = (((_max) - (_min)) / (_step) + 1), \
Expand All @@ -70,10 +74,12 @@
.ops = &axp20x_ops, \
}

#define AXP20X_DESC_FIXED(_id, _supply, _volt) \
#define AXP20X_DESC_FIXED(_id, _match, _supply, _volt) \
[AXP20X_##_id] = { \
.name = #_id, \
.supply_name = (_supply), \
.of_match = of_match_ptr(_match), \
.regulators_node = of_match_ptr("regulators"), \
.type = REGULATOR_VOLTAGE, \
.id = AXP20X_##_id, \
.n_voltages = 1, \
Expand All @@ -82,10 +88,13 @@
.ops = &axp20x_ops_fixed \
}

#define AXP20X_DESC_TABLE(_id, _supply, _table, _vreg, _vmask, _ereg, _emask) \
#define AXP20X_DESC_TABLE(_id, _match, _supply, _table, _vreg, _vmask, _ereg, \
_emask) \
[AXP20X_##_id] = { \
.name = #_id, \
.supply_name = (_supply), \
.of_match = of_match_ptr(_match), \
.regulators_node = of_match_ptr("regulators"), \
.type = REGULATOR_VOLTAGE, \
.id = AXP20X_##_id, \
.n_voltages = ARRAY_SIZE(_table), \
Expand Down Expand Up @@ -127,20 +136,20 @@ static struct regulator_ops axp20x_ops = {
};

static const struct regulator_desc axp20x_regulators[] = {
AXP20X_DESC(DCDC2, "vin2", 700, 2275, 25, AXP20X_DCDC2_V_OUT, 0x3f,
AXP20X_PWR_OUT_CTRL, 0x10),
AXP20X_DESC(DCDC3, "vin3", 700, 3500, 25, AXP20X_DCDC3_V_OUT, 0x7f,
AXP20X_PWR_OUT_CTRL, 0x02),
AXP20X_DESC_FIXED(LDO1, "acin", 1300),
AXP20X_DESC(LDO2, "ldo24in", 1800, 3300, 100, AXP20X_LDO24_V_OUT, 0xf0,
AXP20X_PWR_OUT_CTRL, 0x04),
AXP20X_DESC(LDO3, "ldo3in", 700, 3500, 25, AXP20X_LDO3_V_OUT, 0x7f,
AXP20X_PWR_OUT_CTRL, 0x40),
AXP20X_DESC_TABLE(LDO4, "ldo24in", axp20x_ldo4_data, AXP20X_LDO24_V_OUT, 0x0f,
AXP20X_PWR_OUT_CTRL, 0x08),
AXP20X_DESC_IO(LDO5, "ldo5in", 1800, 3300, 100, AXP20X_LDO5_V_OUT, 0xf0,
AXP20X_GPIO0_CTRL, 0x07, AXP20X_IO_ENABLED,
AXP20X_IO_DISABLED),
AXP20X_DESC(DCDC2, "dcdc2", "vin2", 700, 2275, 25, AXP20X_DCDC2_V_OUT,
0x3f, AXP20X_PWR_OUT_CTRL, 0x10),
AXP20X_DESC(DCDC3, "dcdc3", "vin3", 700, 3500, 25, AXP20X_DCDC3_V_OUT,
0x7f, AXP20X_PWR_OUT_CTRL, 0x02),
AXP20X_DESC_FIXED(LDO1, "ldo1", "acin", 1300),
AXP20X_DESC(LDO2, "ldo2", "ldo24in", 1800, 3300, 100,
AXP20X_LDO24_V_OUT, 0xf0, AXP20X_PWR_OUT_CTRL, 0x04),
AXP20X_DESC(LDO3, "ldo3", "ldo3in", 700, 3500, 25, AXP20X_LDO3_V_OUT,
0x7f, AXP20X_PWR_OUT_CTRL, 0x40),
AXP20X_DESC_TABLE(LDO4, "ldo4", "ldo24in", axp20x_ldo4_data,
AXP20X_LDO24_V_OUT, 0x0f, AXP20X_PWR_OUT_CTRL, 0x08),
AXP20X_DESC_IO(LDO5, "ldo5", "ldo5in", 1800, 3300, 100,
AXP20X_LDO5_V_OUT, 0xf0, AXP20X_GPIO0_CTRL, 0x07,
AXP20X_IO_ENABLED, AXP20X_IO_DISABLED),
};

#define AXP_MATCH(_name, _id) \
Expand Down

0 comments on commit 880fe82

Please sign in to comment.