Add input voltage suppliers for PMIC MCP16502

Merge series from Andrei Simion <andrei.simion@microchip.com>:

In this series of patches, support for the *-supply property [1]  is added
(correlated with supply_name [2]) from the core regulator.
Link [1]: https://github.com/torvalds/linux/blob/master/drivers/regulator/core.c#L471
Link [2]: https://github.com/torvalds/linux/blob/master/drivers/regulator/core.c#L2064

I modified the mcp16502.c driver and the dts that use this PMIC.
We added these improvements to provide a complete description of the board power scheme.
This commit is contained in:
Mark Brown 2024-08-13 15:51:35 +01:00
commit b31274caf3
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 29 additions and 8 deletions

View File

@ -28,6 +28,21 @@ properties:
reg:
maxItems: 1
lvin-supply:
description: Input supply phandle for LDO1 and LDO2
pvin1-supply:
description: Input supply phandle for VDD_IO (BUCK1)
pvin2-supply:
description: Input supply phandle for VDD_DDR (BUCK2)
pvin3-supply:
description: Input supply phandle for VDD_CORE (BUCK3)
pvin4-supply:
description: Input supply phandle for VDD_OTHER (BUCK4)
regulators:
type: object
additionalProperties: false
@ -68,6 +83,11 @@ examples:
pmic@5b {
compatible = "microchip,mcp16502";
reg = <0x5b>;
lvin-supply = <&reg_5v>;
pvin1-supply = <&reg_5v>;
pvin2-supply = <&reg_5v>;
pvin3-supply = <&reg_5v>;
pvin4-supply = <&reg_5v>;
regulators {
VDD_IO {

View File

@ -107,9 +107,10 @@ static unsigned int mcp16502_of_map_mode(unsigned int mode)
return REGULATOR_MODE_INVALID;
}
#define MCP16502_REGULATOR(_name, _id, _ranges, _ops, _ramp_table) \
#define MCP16502_REGULATOR(_name, _id, _sn, _ranges, _ops, _ramp_table) \
[_id] = { \
.name = _name, \
.supply_name = #_sn, \
.regulators_node = "regulators", \
.id = _id, \
.ops = &(_ops), \
@ -467,18 +468,18 @@ static const struct linear_range b234_ranges[] = {
};
static const struct regulator_desc mcp16502_desc[] = {
/* MCP16502_REGULATOR(_name, _id, ranges, regulator_ops, ramp_table) */
MCP16502_REGULATOR("VDD_IO", BUCK1, b1l12_ranges, mcp16502_buck_ops,
/* MCP16502_REGULATOR(_name, _id, _sn, _ranges, _ops, _ramp_table) */
MCP16502_REGULATOR("VDD_IO", BUCK1, pvin1, b1l12_ranges, mcp16502_buck_ops,
mcp16502_ramp_b1l12),
MCP16502_REGULATOR("VDD_DDR", BUCK2, b234_ranges, mcp16502_buck_ops,
MCP16502_REGULATOR("VDD_DDR", BUCK2, pvin2, b234_ranges, mcp16502_buck_ops,
mcp16502_ramp_b234),
MCP16502_REGULATOR("VDD_CORE", BUCK3, b234_ranges, mcp16502_buck_ops,
MCP16502_REGULATOR("VDD_CORE", BUCK3, pvin3, b234_ranges, mcp16502_buck_ops,
mcp16502_ramp_b234),
MCP16502_REGULATOR("VDD_OTHER", BUCK4, b234_ranges, mcp16502_buck_ops,
MCP16502_REGULATOR("VDD_OTHER", BUCK4, pvin4, b234_ranges, mcp16502_buck_ops,
mcp16502_ramp_b234),
MCP16502_REGULATOR("LDO1", LDO1, b1l12_ranges, mcp16502_ldo_ops,
MCP16502_REGULATOR("LDO1", LDO1, lvin, b1l12_ranges, mcp16502_ldo_ops,
mcp16502_ramp_b1l12),
MCP16502_REGULATOR("LDO2", LDO2, b1l12_ranges, mcp16502_ldo_ops,
MCP16502_REGULATOR("LDO2", LDO2, lvin, b1l12_ranges, mcp16502_ldo_ops,
mcp16502_ramp_b1l12)
};