Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

+29 -8
+20
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml
··· 28 28 reg: 29 29 maxItems: 1 30 30 31 + lvin-supply: 32 + description: Input supply phandle for LDO1 and LDO2 33 + 34 + pvin1-supply: 35 + description: Input supply phandle for VDD_IO (BUCK1) 36 + 37 + pvin2-supply: 38 + description: Input supply phandle for VDD_DDR (BUCK2) 39 + 40 + pvin3-supply: 41 + description: Input supply phandle for VDD_CORE (BUCK3) 42 + 43 + pvin4-supply: 44 + description: Input supply phandle for VDD_OTHER (BUCK4) 45 + 31 46 regulators: 32 47 type: object 33 48 additionalProperties: false ··· 83 68 pmic@5b { 84 69 compatible = "microchip,mcp16502"; 85 70 reg = <0x5b>; 71 + lvin-supply = <&reg_5v>; 72 + pvin1-supply = <&reg_5v>; 73 + pvin2-supply = <&reg_5v>; 74 + pvin3-supply = <&reg_5v>; 75 + pvin4-supply = <&reg_5v>; 86 76 87 77 regulators { 88 78 VDD_IO {
+9 -8
drivers/regulator/mcp16502.c
··· 107 107 return REGULATOR_MODE_INVALID; 108 108 } 109 109 110 - #define MCP16502_REGULATOR(_name, _id, _ranges, _ops, _ramp_table) \ 110 + #define MCP16502_REGULATOR(_name, _id, _sn, _ranges, _ops, _ramp_table) \ 111 111 [_id] = { \ 112 112 .name = _name, \ 113 + .supply_name = #_sn, \ 113 114 .regulators_node = "regulators", \ 114 115 .id = _id, \ 115 116 .ops = &(_ops), \ ··· 468 467 }; 469 468 470 469 static const struct regulator_desc mcp16502_desc[] = { 471 - /* MCP16502_REGULATOR(_name, _id, ranges, regulator_ops, ramp_table) */ 472 - MCP16502_REGULATOR("VDD_IO", BUCK1, b1l12_ranges, mcp16502_buck_ops, 470 + /* MCP16502_REGULATOR(_name, _id, _sn, _ranges, _ops, _ramp_table) */ 471 + MCP16502_REGULATOR("VDD_IO", BUCK1, pvin1, b1l12_ranges, mcp16502_buck_ops, 473 472 mcp16502_ramp_b1l12), 474 - MCP16502_REGULATOR("VDD_DDR", BUCK2, b234_ranges, mcp16502_buck_ops, 473 + MCP16502_REGULATOR("VDD_DDR", BUCK2, pvin2, b234_ranges, mcp16502_buck_ops, 475 474 mcp16502_ramp_b234), 476 - MCP16502_REGULATOR("VDD_CORE", BUCK3, b234_ranges, mcp16502_buck_ops, 475 + MCP16502_REGULATOR("VDD_CORE", BUCK3, pvin3, b234_ranges, mcp16502_buck_ops, 477 476 mcp16502_ramp_b234), 478 - MCP16502_REGULATOR("VDD_OTHER", BUCK4, b234_ranges, mcp16502_buck_ops, 477 + MCP16502_REGULATOR("VDD_OTHER", BUCK4, pvin4, b234_ranges, mcp16502_buck_ops, 479 478 mcp16502_ramp_b234), 480 - MCP16502_REGULATOR("LDO1", LDO1, b1l12_ranges, mcp16502_ldo_ops, 479 + MCP16502_REGULATOR("LDO1", LDO1, lvin, b1l12_ranges, mcp16502_ldo_ops, 481 480 mcp16502_ramp_b1l12), 482 - MCP16502_REGULATOR("LDO2", LDO2, b1l12_ranges, mcp16502_ldo_ops, 481 + MCP16502_REGULATOR("LDO2", LDO2, lvin, b1l12_ranges, mcp16502_ldo_ops, 483 482 mcp16502_ramp_b1l12) 484 483 }; 485 484