linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] Add input voltage suppliers for PMIC MCP16502 regulators
@ 2024-08-02  8:44 Andrei Simion
  2024-08-02  8:44 ` [PATCH 1/6] regulator: mcp16502: Add supplier for regulators Andrei Simion
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Andrei Simion @ 2024-08-02  8:44 UTC (permalink / raw)
  To: broonie, lgirdwood, claudiu.beznea, nicolas.ferre, krzk+dt,
	conor+dt, robh, alexandre.belloni
  Cc: linux-arm-kernel, linux-kernel, devicetree, Andrei Simion

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.

Snippet (as an example) from /sys/kernel/debug/regulator/regulator_summary
(for at91-sama7g5ek):
# cat regulator_summary
 regulator                      use open bypass  opmode voltage current     min     max
---------------------------------------------------------------------------------------
 regulator-dummy                  1    0      0 unknown     0mV     0mA     0mV     0mV
 5V_MAIN                          6    6      0 unknown  5000mV     0mA  5000mV  5000mV
    VDD_IO                        5    4      0  normal  3300mV     0mA  3300mV  3300mV
       e1208000.mmc-vqmmc         1                                 0mA     0mV     0mV
       e1208000.mmc-vmmc          1                                 0mA  3300mV  3400mV
       e1204000.mmc-vmmc          1                                 0mA  3300mV  3400mV
       VDDOUT25                   3    2      0 unknown  2500mV     0mA  2500mV  2500mV
          e1000000.adc-vref       1                                 0mA     0mV     0mV
          e1000000.adc-vddana     1                                 0mA     0mV     0mV
    VDD_DDR                       1    0      0  normal  1350mV     0mA  1350mV  1350mV
    VDD_CORE                      1    0      0  normal  1150mV     0mA  1150mV  1150mV
    VDD_OTHER                     2    1      0  normal  1050mV     0mA  1050mV  1250mV
       cpu0-cpu                   1                                 0mA  1050mV  1225mV
    LDO1                          2    1      0 unknown  1800mV     0mA  1800mV  1800mV
       e1204000.mmc-vqmmc         1                                 0mA     0mV     0mV
    LDO2

-------------------------------------------------------------------------------------------
Andrei Simion (6):
  regulator: mcp16502: Add supplier for regulators
  ARM: dts: microchip: at91-sama7g5ek: Add reg_5v to supply PMIC nodes
  ARM: dts: microchip: at91-sama7g54_curiosity: Add reg_5v to supply
    PMIC nodes
  ARM: dts: microchip: at91-sama5d2_icp: Add reg_5v to supply PMIC nodes
  ARM: dts: microchip: at91-sama5d27_wlsom1: Add reg_5v to supply PMIC
    nodes
  ARM: dts: microchip: sama5d29_curiosity: Add reg_5v to supply PMIC
    nodes

 .../dts/microchip/at91-sama5d27_wlsom1.dtsi     | 14 ++++++++++++++
 .../dts/microchip/at91-sama5d29_curiosity.dts   | 14 ++++++++++++++
 .../arm/boot/dts/microchip/at91-sama5d2_icp.dts | 14 ++++++++++++++
 .../dts/microchip/at91-sama7g54_curiosity.dts   | 14 ++++++++++++++
 arch/arm/boot/dts/microchip/at91-sama7g5ek.dts  | 14 ++++++++++++++
 drivers/regulator/mcp16502.c                    | 17 +++++++++--------
 6 files changed, 79 insertions(+), 8 deletions(-)


base-commit: f524a5e4dfb75b277c9a5ad819ca5f035f490f14
-- 
2.34.1



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/6] regulator: mcp16502: Add supplier for regulators
  2024-08-02  8:44 [PATCH 0/6] Add input voltage suppliers for PMIC MCP16502 regulators Andrei Simion
@ 2024-08-02  8:44 ` Andrei Simion
  2024-08-02 12:56   ` Mark Brown
  2024-08-02  8:44 ` [PATCH 2/6] ARM: dts: microchip: at91-sama7g5ek: Add reg_5v to supply PMIC nodes Andrei Simion
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Andrei Simion @ 2024-08-02  8:44 UTC (permalink / raw)
  To: broonie, lgirdwood, claudiu.beznea, nicolas.ferre, krzk+dt,
	conor+dt, robh, alexandre.belloni
  Cc: linux-arm-kernel, linux-kernel, devicetree, Andrei Simion,
	Mihai Sain

Based on the datasheet [1] (Block Diagram) PVIN[1-4] and LVIN
represent the input voltage supply for each BUCKs respective LDOs.
Update the driver to align with the datasheet [1].

[1]: https://ww1.microchip.com/downloads/en/DeviceDoc/MCP16502-High-Performance-PMIC-for-SAMA5DX-SAM9X6-MPUs-Data-Sheet-DS20006275A.pdf

Co-developed-by: Mihai Sain <mihai.sain@microchip.com>
Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
Signed-off-by: Andrei Simion <andrei.simion@microchip.com>
---
 drivers/regulator/mcp16502.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/regulator/mcp16502.c b/drivers/regulator/mcp16502.c
index 5de9d4fa5113..b34ae0bbba6f 100644
--- a/drivers/regulator/mcp16502.c
+++ b/drivers/regulator/mcp16502.c
@@ -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)
 };
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/6] ARM: dts: microchip: at91-sama7g5ek: Add reg_5v to supply PMIC nodes
  2024-08-02  8:44 [PATCH 0/6] Add input voltage suppliers for PMIC MCP16502 regulators Andrei Simion
  2024-08-02  8:44 ` [PATCH 1/6] regulator: mcp16502: Add supplier for regulators Andrei Simion
@ 2024-08-02  8:44 ` Andrei Simion
  2024-08-02  8:44 ` [PATCH 3/6] ARM: dts: microchip: at91-sama7g54_curiosity: " Andrei Simion
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Andrei Simion @ 2024-08-02  8:44 UTC (permalink / raw)
  To: broonie, lgirdwood, claudiu.beznea, nicolas.ferre, krzk+dt,
	conor+dt, robh, alexandre.belloni
  Cc: linux-arm-kernel, linux-kernel, devicetree, Andrei Simion,
	Mihai Sain

Align with the datasheet by adding regulator-5v which supplies
each node from the regulator using phandle to regulator-5v through
pvin[1-4]-supply and lvin-supply.

Co-developed-by: Mihai Sain <mihai.sain@microchip.com>
Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
Signed-off-by: Andrei Simion <andrei.simion@microchip.com>
---
 arch/arm/boot/dts/microchip/at91-sama7g5ek.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/microchip/at91-sama7g5ek.dts b/arch/arm/boot/dts/microchip/at91-sama7g5ek.dts
index 20b2497657ae..f0035b093b16 100644
--- a/arch/arm/boot/dts/microchip/at91-sama7g5ek.dts
+++ b/arch/arm/boot/dts/microchip/at91-sama7g5ek.dts
@@ -88,6 +88,14 @@ memory@60000000 {
 		reg = <0x60000000 0x20000000>;
 	};
 
+	reg_5v: regulator-5v {
+		compatible = "regulator-fixed";
+		regulator-name = "5V_MAIN";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
+	};
+
 	sound: sound {
 		compatible = "simple-audio-card";
 		simple-audio-card,name = "sama7g5ek audio";
@@ -244,6 +252,7 @@ mcp16502@5b {
 			regulators {
 				vdd_3v3: VDD_IO {
 					regulator-name = "VDD_IO";
+					pvin1-supply = <&reg_5v>;
 					regulator-min-microvolt = <3300000>;
 					regulator-max-microvolt = <3300000>;
 					regulator-initial-mode = <2>;
@@ -264,6 +273,7 @@ regulator-state-mem {
 
 				vddioddr: VDD_DDR {
 					regulator-name = "VDD_DDR";
+					pvin2-supply = <&reg_5v>;
 					regulator-min-microvolt = <1350000>;
 					regulator-max-microvolt = <1350000>;
 					regulator-initial-mode = <2>;
@@ -285,6 +295,7 @@ regulator-state-mem {
 
 				vddcore: VDD_CORE {
 					regulator-name = "VDD_CORE";
+					pvin3-supply = <&reg_5v>;
 					regulator-min-microvolt = <1150000>;
 					regulator-max-microvolt = <1150000>;
 					regulator-initial-mode = <2>;
@@ -305,6 +316,7 @@ regulator-state-mem {
 
 				vddcpu: VDD_OTHER {
 					regulator-name = "VDD_OTHER";
+					pvin4-supply = <&reg_5v>;
 					regulator-min-microvolt = <1050000>;
 					regulator-max-microvolt = <1250000>;
 					regulator-initial-mode = <2>;
@@ -326,6 +338,7 @@ regulator-state-mem {
 
 				vldo1: LDO1 {
 					regulator-name = "LDO1";
+					lvin-supply = <&reg_5v>;
 					regulator-min-microvolt = <1800000>;
 					regulator-max-microvolt = <1800000>;
 					regulator-always-on;
@@ -342,6 +355,7 @@ regulator-state-mem {
 
 				vldo2: LDO2 {
 					regulator-name = "LDO2";
+					lvin-supply = <&reg_5v>;
 					regulator-min-microvolt = <1200000>;
 					regulator-max-microvolt = <3700000>;
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/6] ARM: dts: microchip: at91-sama7g54_curiosity: Add reg_5v to supply PMIC nodes
  2024-08-02  8:44 [PATCH 0/6] Add input voltage suppliers for PMIC MCP16502 regulators Andrei Simion
  2024-08-02  8:44 ` [PATCH 1/6] regulator: mcp16502: Add supplier for regulators Andrei Simion
  2024-08-02  8:44 ` [PATCH 2/6] ARM: dts: microchip: at91-sama7g5ek: Add reg_5v to supply PMIC nodes Andrei Simion
@ 2024-08-02  8:44 ` Andrei Simion
  2024-08-02  8:44 ` [PATCH 4/6] ARM: dts: microchip: at91-sama5d2_icp: " Andrei Simion
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Andrei Simion @ 2024-08-02  8:44 UTC (permalink / raw)
  To: broonie, lgirdwood, claudiu.beznea, nicolas.ferre, krzk+dt,
	conor+dt, robh, alexandre.belloni
  Cc: linux-arm-kernel, linux-kernel, devicetree, Andrei Simion,
	Mihai Sain

Align with the datasheet by adding regulator-5v which supplies
each node from the regulator using phandle to regulator-5v through
pvin[1-4]-supply and lvin-supply.

Co-developed-by: Mihai Sain <mihai.sain@microchip.com>
Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
Signed-off-by: Andrei Simion <andrei.simion@microchip.com>
---
 .../boot/dts/microchip/at91-sama7g54_curiosity.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/microchip/at91-sama7g54_curiosity.dts b/arch/arm/boot/dts/microchip/at91-sama7g54_curiosity.dts
index 009d2c832421..b1bdfc67aa6e 100644
--- a/arch/arm/boot/dts/microchip/at91-sama7g54_curiosity.dts
+++ b/arch/arm/boot/dts/microchip/at91-sama7g54_curiosity.dts
@@ -72,6 +72,14 @@ memory@60000000 {
 		device_type = "memory";
 		reg = <0x60000000 0x10000000>; /* 256 MiB DDR3L-1066 16-bit */
 	};
+
+	reg_5v: regulator-5v {
+		compatible = "regulator-fixed";
+		regulator-name = "5V_MAIN";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
+	};
 };
 
 &adc {
@@ -193,6 +201,7 @@ pmic@5b {
 			regulators {
 				vdd_3v3: VDD_IO {
 					regulator-name = "VDD_IO";
+					pvin1-supply = <&reg_5v>;
 					regulator-min-microvolt = <3300000>;
 					regulator-max-microvolt = <3300000>;
 					regulator-initial-mode = <2>;
@@ -213,6 +222,7 @@ regulator-state-mem {
 
 				vddioddr: VDD_DDR {
 					regulator-name = "VDD_DDR";
+					pvin2-supply = <&reg_5v>;
 					regulator-min-microvolt = <1350000>;
 					regulator-max-microvolt = <1350000>;
 					regulator-initial-mode = <2>;
@@ -234,6 +244,7 @@ regulator-state-mem {
 
 				vddcore: VDD_CORE {
 					regulator-name = "VDD_CORE";
+					pvin3-supply = <&reg_5v>;
 					regulator-min-microvolt = <1150000>;
 					regulator-max-microvolt = <1150000>;
 					regulator-initial-mode = <2>;
@@ -254,6 +265,7 @@ regulator-state-mem {
 
 				vddcpu: VDD_OTHER {
 					regulator-name = "VDD_OTHER";
+					pvin4-supply = <&reg_5v>;
 					regulator-min-microvolt = <1050000>;
 					regulator-max-microvolt = <1250000>;
 					regulator-initial-mode = <2>;
@@ -275,6 +287,7 @@ regulator-state-mem {
 
 				vldo1: LDO1 {
 					regulator-name = "LDO1";
+					lvin-supply = <&reg_5v>;
 					regulator-min-microvolt = <1800000>;
 					regulator-max-microvolt = <1800000>;
 					regulator-always-on;
@@ -291,6 +304,7 @@ regulator-state-mem {
 
 				vldo2: LDO2 {
 					regulator-name = "LDO2";
+					lvin-supply = <&reg_5v>;
 					regulator-min-microvolt = <3300000>;
 					regulator-max-microvolt = <3300000>;
 					regulator-always-on;
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/6] ARM: dts: microchip: at91-sama5d2_icp: Add reg_5v to supply PMIC nodes
  2024-08-02  8:44 [PATCH 0/6] Add input voltage suppliers for PMIC MCP16502 regulators Andrei Simion
                   ` (2 preceding siblings ...)
  2024-08-02  8:44 ` [PATCH 3/6] ARM: dts: microchip: at91-sama7g54_curiosity: " Andrei Simion
@ 2024-08-02  8:44 ` Andrei Simion
  2024-08-02  8:44 ` [PATCH 5/6] ARM: dts: microchip: at91-sama5d27_wlsom1: " Andrei Simion
  2024-08-02  8:44 ` [PATCH 6/6] ARM: dts: microchip: sama5d29_curiosity: " Andrei Simion
  5 siblings, 0 replies; 10+ messages in thread
From: Andrei Simion @ 2024-08-02  8:44 UTC (permalink / raw)
  To: broonie, lgirdwood, claudiu.beznea, nicolas.ferre, krzk+dt,
	conor+dt, robh, alexandre.belloni
  Cc: linux-arm-kernel, linux-kernel, devicetree, Andrei Simion,
	Mihai Sain

Align with the datasheet by adding regulator-5v which supplies
each node from the regulator using phandle to regulator-5v through
pvin[1-4]-supply and lvin-supply.

Co-developed-by: Mihai Sain <mihai.sain@microchip.com>
Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
Signed-off-by: Andrei Simion <andrei.simion@microchip.com>
---
 arch/arm/boot/dts/microchip/at91-sama5d2_icp.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/microchip/at91-sama5d2_icp.dts b/arch/arm/boot/dts/microchip/at91-sama5d2_icp.dts
index 999adeca6f33..20ef12a321fb 100644
--- a/arch/arm/boot/dts/microchip/at91-sama5d2_icp.dts
+++ b/arch/arm/boot/dts/microchip/at91-sama5d2_icp.dts
@@ -78,6 +78,14 @@ led-blue {
 			linux,default-trigger = "heartbeat";
 		};
 	};
+
+	reg_5v: regulator-5v {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_MAIN_5V";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
+	};
 };
 
 &adc {
@@ -196,6 +204,7 @@ mcp16502@5b {
 			regulators {
 				vdd_io_reg: VDD_IO {
 					regulator-name = "VDD_IO";
+					pvin1-supply = <&reg_5v>;
 					regulator-min-microvolt = <3300000>;
 					regulator-max-microvolt = <3300000>;
 					regulator-initial-mode = <2>;
@@ -215,6 +224,7 @@ regulator-state-mem {
 
 				VDD_DDR {
 					regulator-name = "VDD_DDR";
+					pvin2-supply = <&reg_5v>;
 					regulator-min-microvolt = <1350000>;
 					regulator-max-microvolt = <1350000>;
 					regulator-initial-mode = <2>;
@@ -234,6 +244,7 @@ regulator-state-mem {
 
 				VDD_CORE {
 					regulator-name = "VDD_CORE";
+					pvin3-supply = <&reg_5v>;
 					regulator-min-microvolt = <1250000>;
 					regulator-max-microvolt = <1250000>;
 					regulator-initial-mode = <2>;
@@ -253,6 +264,7 @@ regulator-state-mem {
 
 				VDD_OTHER {
 					regulator-name = "VDD_OTHER";
+					pvin4-supply = <&reg_5v>;
 					regulator-min-microvolt = <600000>;
 					regulator-max-microvolt = <1850000>;
 					regulator-initial-mode = <2>;
@@ -271,6 +283,7 @@ regulator-state-mem {
 
 				LDO1 {
 					regulator-name = "LDO1";
+					lvin-supply = <&reg_5v>;
 					regulator-min-microvolt = <2500000>;
 					regulator-max-microvolt = <2500000>;
 					regulator-always-on;
@@ -286,6 +299,7 @@ regulator-state-mem {
 
 				LDO2 {
 					regulator-name = "LDO2";
+					lvin-supply = <&reg_5v>;
 					regulator-min-microvolt = <3300000>;
 					regulator-max-microvolt = <3300000>;
 					regulator-always-on;
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/6] ARM: dts: microchip: at91-sama5d27_wlsom1: Add reg_5v to supply PMIC nodes
  2024-08-02  8:44 [PATCH 0/6] Add input voltage suppliers for PMIC MCP16502 regulators Andrei Simion
                   ` (3 preceding siblings ...)
  2024-08-02  8:44 ` [PATCH 4/6] ARM: dts: microchip: at91-sama5d2_icp: " Andrei Simion
@ 2024-08-02  8:44 ` Andrei Simion
  2024-08-02  8:44 ` [PATCH 6/6] ARM: dts: microchip: sama5d29_curiosity: " Andrei Simion
  5 siblings, 0 replies; 10+ messages in thread
From: Andrei Simion @ 2024-08-02  8:44 UTC (permalink / raw)
  To: broonie, lgirdwood, claudiu.beznea, nicolas.ferre, krzk+dt,
	conor+dt, robh, alexandre.belloni
  Cc: linux-arm-kernel, linux-kernel, devicetree, Andrei Simion,
	Mihai Sain

Align with the datasheet by adding regulator-5v which supplies
each node from the regulator using phandle to regulator-5v through
pvin[1-4]-supply and lvin-supply.

Co-developed-by: Mihai Sain <mihai.sain@microchip.com>
Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
Signed-off-by: Andrei Simion <andrei.simion@microchip.com>
---
 .../boot/dts/microchip/at91-sama5d27_wlsom1.dtsi   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1.dtsi b/arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1.dtsi
index 4617805c7748..21c6e7e645fa 100644
--- a/arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1.dtsi
+++ b/arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1.dtsi
@@ -31,6 +31,14 @@ main_xtal {
 		};
 	};
 
+	reg_5v: regulator-5v {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_MAIN";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
+	};
+
 	wifi_pwrseq: wifi_pwrseq {
 		compatible = "mmc-pwrseq-wilc1000";
 		reset-gpios = <&pioA PIN_PA27 GPIO_ACTIVE_HIGH>;
@@ -76,6 +84,7 @@ mcp16502@5b {
 		regulators {
 			vdd_3v3: VDD_IO {
 				regulator-name = "VDD_IO";
+				pvin1-supply = <&reg_5v>;
 				regulator-min-microvolt = <3300000>;
 				regulator-max-microvolt = <3300000>;
 				regulator-initial-mode = <2>;
@@ -95,6 +104,7 @@ regulator-state-mem {
 
 			vddio_ddr: VDD_DDR {
 				regulator-name = "VDD_DDR";
+				pvin2-supply = <&reg_5v>;
 				regulator-min-microvolt = <1200000>;
 				regulator-max-microvolt = <1200000>;
 				regulator-initial-mode = <2>;
@@ -118,6 +128,7 @@ regulator-state-mem {
 
 			vdd_core: VDD_CORE {
 				regulator-name = "VDD_CORE";
+				pvin3-supply = <&reg_5v>;
 				regulator-min-microvolt = <1250000>;
 				regulator-max-microvolt = <1250000>;
 				regulator-initial-mode = <2>;
@@ -137,6 +148,7 @@ regulator-state-mem {
 
 			vdd_ddr: VDD_OTHER {
 				regulator-name = "VDD_OTHER";
+				pvin4-supply = <&reg_5v>;
 				regulator-min-microvolt = <1800000>;
 				regulator-max-microvolt = <1800000>;
 				regulator-initial-mode = <2>;
@@ -160,6 +172,7 @@ regulator-state-mem {
 
 			LDO1 {
 				regulator-name = "LDO1";
+				lvin-supply = <&reg_5v>;
 				regulator-min-microvolt = <3300000>;
 				regulator-max-microvolt = <3300000>;
 				regulator-always-on;
@@ -175,6 +188,7 @@ regulator-state-mem {
 
 			LDO2 {
 				regulator-name = "LDO2";
+				lvin-supply = <&reg_5v>;
 				regulator-min-microvolt = <1800000>;
 				regulator-max-microvolt = <3300000>;
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/6] ARM: dts: microchip: sama5d29_curiosity: Add reg_5v to supply PMIC nodes
  2024-08-02  8:44 [PATCH 0/6] Add input voltage suppliers for PMIC MCP16502 regulators Andrei Simion
                   ` (4 preceding siblings ...)
  2024-08-02  8:44 ` [PATCH 5/6] ARM: dts: microchip: at91-sama5d27_wlsom1: " Andrei Simion
@ 2024-08-02  8:44 ` Andrei Simion
  5 siblings, 0 replies; 10+ messages in thread
From: Andrei Simion @ 2024-08-02  8:44 UTC (permalink / raw)
  To: broonie, lgirdwood, claudiu.beznea, nicolas.ferre, krzk+dt,
	conor+dt, robh, alexandre.belloni
  Cc: linux-arm-kernel, linux-kernel, devicetree, Andrei Simion,
	Mihai Sain

Align with the datasheet by adding regulator-5v which supplies
each node from the regulator using phandle to regulator-5v through
pvin[1-4]-supply and lvin-supply.

Co-developed-by: Mihai Sain <mihai.sain@microchip.com>
Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
Signed-off-by: Andrei Simion <andrei.simion@microchip.com>
---
 .../boot/dts/microchip/at91-sama5d29_curiosity.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/microchip/at91-sama5d29_curiosity.dts b/arch/arm/boot/dts/microchip/at91-sama5d29_curiosity.dts
index 6b02b7bcfd49..a9d409ad7726 100644
--- a/arch/arm/boot/dts/microchip/at91-sama5d29_curiosity.dts
+++ b/arch/arm/boot/dts/microchip/at91-sama5d29_curiosity.dts
@@ -84,6 +84,14 @@ memory@20000000 {
 		device_type = "memory";
 		reg = <0x20000000 0x20000000>;
 	};
+
+	reg_5v: regulator-5v {
+		compatible = "regulator-fixed";
+		regulator-name = "5V_MAIN";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
+	};
 };
 
 &adc {
@@ -150,6 +158,7 @@ mcp16502@5b {
 		regulators {
 			vdd_3v3: VDD_IO {
 				regulator-name = "VDD_IO";
+				pvin1-supply = <&reg_5v>;
 				regulator-min-microvolt = <3300000>;
 				regulator-max-microvolt = <3300000>;
 				regulator-initial-mode = <2>;
@@ -169,6 +178,7 @@ regulator-state-mem {
 
 			vddio_ddr: VDD_DDR {
 				regulator-name = "VDD_DDR";
+				pvin2-supply = <&reg_5v>;
 				regulator-min-microvolt = <1200000>;
 				regulator-max-microvolt = <1200000>;
 				regulator-initial-mode = <2>;
@@ -192,6 +202,7 @@ regulator-state-mem {
 
 			vdd_core: VDD_CORE {
 				regulator-name = "VDD_CORE";
+				pvin3-supply = <&reg_5v>;
 				regulator-min-microvolt = <1250000>;
 				regulator-max-microvolt = <1250000>;
 				regulator-initial-mode = <2>;
@@ -211,6 +222,7 @@ regulator-state-mem {
 
 			vdd_ddr: VDD_OTHER {
 				regulator-name = "VDD_OTHER";
+				pvin4-supply = <&reg_5v>;
 				regulator-min-microvolt = <1800000>;
 				regulator-max-microvolt = <1800000>;
 				regulator-initial-mode = <2>;
@@ -234,6 +246,7 @@ regulator-state-mem {
 
 			LDO1 {
 				regulator-name = "LDO1";
+				lvin-supply = <&reg_5v>;
 				regulator-min-microvolt = <2500000>;
 				regulator-max-microvolt = <2500000>;
 				regulator-always-on;
@@ -249,6 +262,7 @@ regulator-state-mem {
 
 			LDO2 {
 				regulator-name = "LDO2";
+				lvin-supply = <&reg_5v>;
 				regulator-min-microvolt = <3300000>;
 				regulator-max-microvolt = <3300000>;
 				regulator-always-on;
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/6] regulator: mcp16502: Add supplier for regulators
  2024-08-02  8:44 ` [PATCH 1/6] regulator: mcp16502: Add supplier for regulators Andrei Simion
@ 2024-08-02 12:56   ` Mark Brown
  2024-08-02 14:25     ` Andrei.Simion
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2024-08-02 12:56 UTC (permalink / raw)
  To: Andrei Simion
  Cc: robh, conor+dt, alexandre.belloni, devicetree, linux-kernel,
	lgirdwood, Mihai Sain, claudiu.beznea, krzk+dt, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

On Fri, Aug 02, 2024 at 11:44:28AM +0300, Andrei Simion wrote:
> Based on the datasheet [1] (Block Diagram) PVIN[1-4] and LVIN
> represent the input voltage supply for each BUCKs respective LDOs.
> Update the driver to align with the datasheet [1].
> 
> [1]: https://ww1.microchip.com/downloads/en/DeviceDoc/MCP16502-High-Performance-PMIC-for-SAMA5DX-SAM9X6-MPUs-Data-Sheet-DS20006275A.pdf

I'd expect to see a matching update to the bindings.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/6] regulator: mcp16502: Add supplier for regulators
  2024-08-02 12:56   ` Mark Brown
@ 2024-08-02 14:25     ` Andrei.Simion
  2024-08-02 17:58       ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Andrei.Simion @ 2024-08-02 14:25 UTC (permalink / raw)
  To: broonie
  Cc: robh, conor+dt, alexandre.belloni, devicetree, linux-kernel,
	lgirdwood, Mihai.Sain, claudiu.beznea, krzk+dt, linux-arm-kernel

> On Fri, Aug 02, 2024 at 11:44:28AM +0300, Andrei Simion wrote:
>> Based on the datasheet [1] (Block Diagram) PVIN[1-4] and LVIN
>> represent the input voltage supply for each BUCKs respective LDOs.
>> Update the driver to align with the datasheet [1].
>>
>> [1]: https://ww1.microchip.com/downloads/en/DeviceDoc/MCP16502-High-Performance-PMIC-for-SAMA5DX-SAM9X6-MPUs-Data-Sheet-DS20006275A.pdf
> I'd expect to see a matching update to the bindings.

In regulator.yaml exists .*-supply [1] which practically allows every
char sequence before -supply. In the binding microchip,mcp16502.yaml [2]
each node under the regulators includes all the rules/documentation
from regulator.yaml , so I supposed that it is unnecessary to add
in the binding of those new property.

What is your opinion? Let me know any thoughts.

[1] https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/regulator/regulator.yaml#L244
[2] https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/regulator/microchip%2Cmcp16502.yaml#L39

Best Regards, 
Andrei Simion



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/6] regulator: mcp16502: Add supplier for regulators
  2024-08-02 14:25     ` Andrei.Simion
@ 2024-08-02 17:58       ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2024-08-02 17:58 UTC (permalink / raw)
  To: Andrei.Simion
  Cc: robh, conor+dt, alexandre.belloni, devicetree, linux-kernel,
	lgirdwood, Mihai.Sain, claudiu.beznea, krzk+dt, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

On Fri, Aug 02, 2024 at 02:25:15PM +0000, Andrei.Simion@microchip.com wrote:

> In regulator.yaml exists .*-supply [1] which practically allows every
> char sequence before -supply. In the binding microchip,mcp16502.yaml [2]
> each node under the regulators includes all the rules/documentation
> from regulator.yaml , so I supposed that it is unnecessary to add
> in the binding of those new property.

> What is your opinion? Let me know any thoughts.

The specific names for a given device are supposed to be specified,
there's a bunch of existing bindings that appear to do that.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-08-02 17:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-02  8:44 [PATCH 0/6] Add input voltage suppliers for PMIC MCP16502 regulators Andrei Simion
2024-08-02  8:44 ` [PATCH 1/6] regulator: mcp16502: Add supplier for regulators Andrei Simion
2024-08-02 12:56   ` Mark Brown
2024-08-02 14:25     ` Andrei.Simion
2024-08-02 17:58       ` Mark Brown
2024-08-02  8:44 ` [PATCH 2/6] ARM: dts: microchip: at91-sama7g5ek: Add reg_5v to supply PMIC nodes Andrei Simion
2024-08-02  8:44 ` [PATCH 3/6] ARM: dts: microchip: at91-sama7g54_curiosity: " Andrei Simion
2024-08-02  8:44 ` [PATCH 4/6] ARM: dts: microchip: at91-sama5d2_icp: " Andrei Simion
2024-08-02  8:44 ` [PATCH 5/6] ARM: dts: microchip: at91-sama5d27_wlsom1: " Andrei Simion
2024-08-02  8:44 ` [PATCH 6/6] ARM: dts: microchip: sama5d29_curiosity: " Andrei Simion

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).