All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/11] regulator: mt6366: Split out of MT6358 and cleanup
@ 2023-08-22  8:45 ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

Hi everyone,

This is v2 of my MT6366 PMIC split-out-of-MT6358 cleanup series. The two
PMICs are mostly identical, except for the regulator bits. The MT6366 is
missing the VCAM* (camera related) LDOs, but in their place has a few
other ones. This thus requires a separate compatible to handle the
differences.

Changes since v1:
- Switched to using MT6358 compatible as fallback compatible
  Differences are detected through chip ID register
- MT6366 regulator binding merged with MT6358 one instead of having two
  separate ones
- Added patches
  - regulator: dt-bindings: mt6358: Convert to DT schema     
  - regulator: dt-bindings: mt6358: Add regulator supplies   
  - regulator: mt6358: Add supply names for MT6358 regulators
  - arm64: dts: mediatek: mt8183-kukui: Add PMIC regulator supplies
  These bring MT6358 regulators to the same completeness level as MT6366
- Dropped patch "mfd: mt6397: Split MediaTek MT6366 PMIC out of MT6358"
- Dropped patch "soc: mediatek: pwrap: add support for MT6366 PMIC"

This depends on my previous "regulator: mt6358: Remove bogus regulators
and improvements" series [1]. The series is still in flight, but I think
posting this earlier would help get reviews underway.

Patch 1 add a compatible string for the MT6366 PMIC, with a fallback to
the MT6358 one.

Patch 2 adds new register definitions for the MT6366-specific
regulators.

These two should go through the MFD tree and put on an immutable
branch for the regulator tree to consume patch 2.

Patch 3 converts the existing MT6358 regulator DT binding to DT schema.

Patch 4 adds regulator supply properties to the MT6358 regulator
binding.

Patch 5 adds MT6366 regulators to the MT6358 regulator binding. This was
previously done by Zhiyong Tao [2] from MediaTek as a separate binding
file. I cleaned up the patch based on previous review comments, simplified
the regulator names, and added regulator supplies. Bogus regulators were
also dropped, like what was done for the MT6358 [1]. In v2 this was
merged with the MT6358 binding, now converted to DT schema.

Patch 6 adds support for the regulator supplies to the MT6358 regulator
driver.

Patch 7 simplifies the MT6366 regulator names to match the new names
specified in the binding.

Patch 8 makes the MT6366 VCN18 LDO regulator configurable. This is one
of the differences between the MT6358 and MT6366.

Patch 9 adds regulators that were missing from the originally proposed
binding and driver.

Patch 10 adds regulator supply names to the MT6366 regulators

Patch 11 adds regulator supplies to MT8183 Kukui boards.

As mentioned, patches 1 and 2 should go through the mfd tree on an
immutable branch. patches 3 through 10 should go through the regulator
tree, on top of the aforementioned immutable branch. Patch 11 should go
through the MediaTek tree.

[1] https://lore.kernel.org/linux-arm-kernel/20230721082903.2038975-1-wenst@chromium.org/
[2] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/

Chen-Yu Tsai (10):
  dt-bindings: mfd: mt6397: Split out compatible for MediaTek MT6366
    PMIC
  mfd: mt6358: Add registers for MT6366 specific regulators
  regulator: dt-bindings: mt6358: Convert to DT schema
  regulator: dt-bindings: mt6358: Add regulator supplies
  regulator: mt6358: Add supply names for MT6358 regulators
  regulator: mt6358: fix and drop type prefix in MT6366 regulator node
    names
  regulator: mt6358: Make MT6366 vcn18 LDO configurable
  regulator: mt6358: Add missing regulators for MT6366
  regulator: mt6358: Add supply names for MT6366 regulators
  arm64: dts: mediatek: mt8183-kukui: Add PMIC regulator supplies

Zhiyong Tao (1):
  regulator: dt-bindings: mediatek: Add MT6366 PMIC

 .../devicetree/bindings/mfd/mt6397.txt        |   4 +-
 .../regulator/mediatek,mt6358-regulator.yaml  | 249 +++++++++++++
 .../bindings/regulator/mt6358-regulator.txt   | 350 ------------------
 .../arm64/boot/dts/mediatek/mt8183-kukui.dtsi |  28 ++
 drivers/regulator/mt6358-regulator.c          | 237 +++++++-----
 include/linux/mfd/mt6358/registers.h          |  17 +
 include/linux/regulator/mt6358-regulator.h    |   3 +
 7 files changed, 436 insertions(+), 452 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
 delete mode 100644 Documentation/devicetree/bindings/regulator/mt6358-regulator.txt

-- 
2.42.0.rc1.204.g551eb34607-goog


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

* [PATCH v2 00/11] regulator: mt6366: Split out of MT6358 and cleanup
@ 2023-08-22  8:45 ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

Hi everyone,

This is v2 of my MT6366 PMIC split-out-of-MT6358 cleanup series. The two
PMICs are mostly identical, except for the regulator bits. The MT6366 is
missing the VCAM* (camera related) LDOs, but in their place has a few
other ones. This thus requires a separate compatible to handle the
differences.

Changes since v1:
- Switched to using MT6358 compatible as fallback compatible
  Differences are detected through chip ID register
- MT6366 regulator binding merged with MT6358 one instead of having two
  separate ones
- Added patches
  - regulator: dt-bindings: mt6358: Convert to DT schema     
  - regulator: dt-bindings: mt6358: Add regulator supplies   
  - regulator: mt6358: Add supply names for MT6358 regulators
  - arm64: dts: mediatek: mt8183-kukui: Add PMIC regulator supplies
  These bring MT6358 regulators to the same completeness level as MT6366
- Dropped patch "mfd: mt6397: Split MediaTek MT6366 PMIC out of MT6358"
- Dropped patch "soc: mediatek: pwrap: add support for MT6366 PMIC"

This depends on my previous "regulator: mt6358: Remove bogus regulators
and improvements" series [1]. The series is still in flight, but I think
posting this earlier would help get reviews underway.

Patch 1 add a compatible string for the MT6366 PMIC, with a fallback to
the MT6358 one.

Patch 2 adds new register definitions for the MT6366-specific
regulators.

These two should go through the MFD tree and put on an immutable
branch for the regulator tree to consume patch 2.

Patch 3 converts the existing MT6358 regulator DT binding to DT schema.

Patch 4 adds regulator supply properties to the MT6358 regulator
binding.

Patch 5 adds MT6366 regulators to the MT6358 regulator binding. This was
previously done by Zhiyong Tao [2] from MediaTek as a separate binding
file. I cleaned up the patch based on previous review comments, simplified
the regulator names, and added regulator supplies. Bogus regulators were
also dropped, like what was done for the MT6358 [1]. In v2 this was
merged with the MT6358 binding, now converted to DT schema.

Patch 6 adds support for the regulator supplies to the MT6358 regulator
driver.

Patch 7 simplifies the MT6366 regulator names to match the new names
specified in the binding.

Patch 8 makes the MT6366 VCN18 LDO regulator configurable. This is one
of the differences between the MT6358 and MT6366.

Patch 9 adds regulators that were missing from the originally proposed
binding and driver.

Patch 10 adds regulator supply names to the MT6366 regulators

Patch 11 adds regulator supplies to MT8183 Kukui boards.

As mentioned, patches 1 and 2 should go through the mfd tree on an
immutable branch. patches 3 through 10 should go through the regulator
tree, on top of the aforementioned immutable branch. Patch 11 should go
through the MediaTek tree.

[1] https://lore.kernel.org/linux-arm-kernel/20230721082903.2038975-1-wenst@chromium.org/
[2] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/

Chen-Yu Tsai (10):
  dt-bindings: mfd: mt6397: Split out compatible for MediaTek MT6366
    PMIC
  mfd: mt6358: Add registers for MT6366 specific regulators
  regulator: dt-bindings: mt6358: Convert to DT schema
  regulator: dt-bindings: mt6358: Add regulator supplies
  regulator: mt6358: Add supply names for MT6358 regulators
  regulator: mt6358: fix and drop type prefix in MT6366 regulator node
    names
  regulator: mt6358: Make MT6366 vcn18 LDO configurable
  regulator: mt6358: Add missing regulators for MT6366
  regulator: mt6358: Add supply names for MT6366 regulators
  arm64: dts: mediatek: mt8183-kukui: Add PMIC regulator supplies

Zhiyong Tao (1):
  regulator: dt-bindings: mediatek: Add MT6366 PMIC

 .../devicetree/bindings/mfd/mt6397.txt        |   4 +-
 .../regulator/mediatek,mt6358-regulator.yaml  | 249 +++++++++++++
 .../bindings/regulator/mt6358-regulator.txt   | 350 ------------------
 .../arm64/boot/dts/mediatek/mt8183-kukui.dtsi |  28 ++
 drivers/regulator/mt6358-regulator.c          | 237 +++++++-----
 include/linux/mfd/mt6358/registers.h          |  17 +
 include/linux/regulator/mt6358-regulator.h    |   3 +
 7 files changed, 436 insertions(+), 452 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
 delete mode 100644 Documentation/devicetree/bindings/regulator/mt6358-regulator.txt

-- 
2.42.0.rc1.204.g551eb34607-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 01/11] dt-bindings: mfd: mt6397: Split out compatible for MediaTek MT6366 PMIC
  2023-08-22  8:45 ` Chen-Yu Tsai
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The MT6366 PMIC is mostly, but not fully, compatible with MT6358. It has
a different set of regulators. Specifically, it lacks the camera related
VCAM* LDOs and VLDO28, but has additional VM18, VMDDR, and VSRAM_CORE LDOs.

The PMICs contain a chip ID register that can be used to detect which
exact model is preset, so it is possible to share a common base
compatible string.

Add a separate compatible for the MT6366 PMIC, with a fallback to the
MT6358 PMIC.

Fixes: 49be16305587 ("dt-bindings: mfd: Add compatible for the MediaTek MT6366 PMIC")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
Dropped Conor's Reviewed-by tag as this patch is now completely different.

 Documentation/devicetree/bindings/mfd/mt6397.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt
index 294693a8906c..10540aa7afa1 100644
--- a/Documentation/devicetree/bindings/mfd/mt6397.txt
+++ b/Documentation/devicetree/bindings/mfd/mt6397.txt
@@ -22,8 +22,9 @@ compatible:
 	"mediatek,mt6323" for PMIC MT6323
 	"mediatek,mt6331" for PMIC MT6331 and MT6332
 	"mediatek,mt6357" for PMIC MT6357
-	"mediatek,mt6358" for PMIC MT6358 and MT6366
+	"mediatek,mt6358" for PMIC MT6358
 	"mediatek,mt6359" for PMIC MT6359
+	"mediatek,mt6366", "mediatek,mt6358" for PMIC MT6366
 	"mediatek,mt6397" for PMIC MT6397
 
 Optional subnodes:
@@ -40,6 +41,7 @@ Optional subnodes:
 		- compatible: "mediatek,mt6323-regulator"
 	see ../regulator/mt6323-regulator.txt
 		- compatible: "mediatek,mt6358-regulator"
+		- compatible: "mediatek,mt6366-regulator", "mediatek-mt6358-regulator"
 	see ../regulator/mt6358-regulator.txt
 		- compatible: "mediatek,mt6397-regulator"
 	see ../regulator/mt6397-regulator.txt
-- 
2.42.0.rc1.204.g551eb34607-goog


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

* [PATCH v2 01/11] dt-bindings: mfd: mt6397: Split out compatible for MediaTek MT6366 PMIC
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The MT6366 PMIC is mostly, but not fully, compatible with MT6358. It has
a different set of regulators. Specifically, it lacks the camera related
VCAM* LDOs and VLDO28, but has additional VM18, VMDDR, and VSRAM_CORE LDOs.

The PMICs contain a chip ID register that can be used to detect which
exact model is preset, so it is possible to share a common base
compatible string.

Add a separate compatible for the MT6366 PMIC, with a fallback to the
MT6358 PMIC.

Fixes: 49be16305587 ("dt-bindings: mfd: Add compatible for the MediaTek MT6366 PMIC")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
Dropped Conor's Reviewed-by tag as this patch is now completely different.

 Documentation/devicetree/bindings/mfd/mt6397.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt
index 294693a8906c..10540aa7afa1 100644
--- a/Documentation/devicetree/bindings/mfd/mt6397.txt
+++ b/Documentation/devicetree/bindings/mfd/mt6397.txt
@@ -22,8 +22,9 @@ compatible:
 	"mediatek,mt6323" for PMIC MT6323
 	"mediatek,mt6331" for PMIC MT6331 and MT6332
 	"mediatek,mt6357" for PMIC MT6357
-	"mediatek,mt6358" for PMIC MT6358 and MT6366
+	"mediatek,mt6358" for PMIC MT6358
 	"mediatek,mt6359" for PMIC MT6359
+	"mediatek,mt6366", "mediatek,mt6358" for PMIC MT6366
 	"mediatek,mt6397" for PMIC MT6397
 
 Optional subnodes:
@@ -40,6 +41,7 @@ Optional subnodes:
 		- compatible: "mediatek,mt6323-regulator"
 	see ../regulator/mt6323-regulator.txt
 		- compatible: "mediatek,mt6358-regulator"
+		- compatible: "mediatek,mt6366-regulator", "mediatek-mt6358-regulator"
 	see ../regulator/mt6358-regulator.txt
 		- compatible: "mediatek,mt6397-regulator"
 	see ../regulator/mt6397-regulator.txt
-- 
2.42.0.rc1.204.g551eb34607-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 02/11] mfd: mt6358: Add registers for MT6366 specific regulators
  2023-08-22  8:45 ` Chen-Yu Tsai
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The MT6366 PMIC, compared to the MT6358, does away with the VCAM*
regulators. Two regulators VM18 and VMDDR reuse their register space.
There's also a VSRAM type regulator VSRAM_CORE thats' split between
the VCAM* register space and other parts.

Add register address macros for these MT6366 specific regulators.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 include/linux/mfd/mt6358/registers.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h
index 5ea2590be710..d83e87298ac4 100644
--- a/include/linux/mfd/mt6358/registers.h
+++ b/include/linux/mfd/mt6358/registers.h
@@ -294,4 +294,21 @@
 #define MT6358_AUD_TOP_INT_CON0               0x2228
 #define MT6358_AUD_TOP_INT_STATUS0            0x2234
 
+/*
+ * MT6366 has no VCAM*, but has other regulators in its place. The names
+ * keep the MT6358 prefix for ease of use in the regulator driver.
+ */
+#define MT6358_LDO_VSRAM_CON5                 0x1bf8
+#define MT6358_LDO_VM18_CON0                  MT6358_LDO_VCAMA1_CON0
+#define MT6358_LDO_VM18_CON1                  MT6358_LDO_VCAMA1_CON1
+#define MT6358_LDO_VM18_CON2                  MT6358_LDO_VCAMA1_CON2
+#define MT6358_LDO_VMDDR_CON0                 MT6358_LDO_VCAMA2_CON0
+#define MT6358_LDO_VMDDR_CON1                 MT6358_LDO_VCAMA2_CON1
+#define MT6358_LDO_VMDDR_CON2                 MT6358_LDO_VCAMA2_CON2
+#define MT6358_LDO_VSRAM_CORE_CON0            MT6358_LDO_VCAMD_CON0
+#define MT6358_LDO_VSRAM_CORE_DBG0            0x1cb6
+#define MT6358_LDO_VSRAM_CORE_DBG1            0x1cb8
+#define MT6358_VM18_ANA_CON0                  MT6358_VCAMA1_ANA_CON0
+#define MT6358_VMDDR_ANA_CON0                 MT6358_VCAMD_ANA_CON0
+
 #endif /* __MFD_MT6358_REGISTERS_H__ */
-- 
2.42.0.rc1.204.g551eb34607-goog


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

* [PATCH v2 02/11] mfd: mt6358: Add registers for MT6366 specific regulators
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The MT6366 PMIC, compared to the MT6358, does away with the VCAM*
regulators. Two regulators VM18 and VMDDR reuse their register space.
There's also a VSRAM type regulator VSRAM_CORE thats' split between
the VCAM* register space and other parts.

Add register address macros for these MT6366 specific regulators.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 include/linux/mfd/mt6358/registers.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h
index 5ea2590be710..d83e87298ac4 100644
--- a/include/linux/mfd/mt6358/registers.h
+++ b/include/linux/mfd/mt6358/registers.h
@@ -294,4 +294,21 @@
 #define MT6358_AUD_TOP_INT_CON0               0x2228
 #define MT6358_AUD_TOP_INT_STATUS0            0x2234
 
+/*
+ * MT6366 has no VCAM*, but has other regulators in its place. The names
+ * keep the MT6358 prefix for ease of use in the regulator driver.
+ */
+#define MT6358_LDO_VSRAM_CON5                 0x1bf8
+#define MT6358_LDO_VM18_CON0                  MT6358_LDO_VCAMA1_CON0
+#define MT6358_LDO_VM18_CON1                  MT6358_LDO_VCAMA1_CON1
+#define MT6358_LDO_VM18_CON2                  MT6358_LDO_VCAMA1_CON2
+#define MT6358_LDO_VMDDR_CON0                 MT6358_LDO_VCAMA2_CON0
+#define MT6358_LDO_VMDDR_CON1                 MT6358_LDO_VCAMA2_CON1
+#define MT6358_LDO_VMDDR_CON2                 MT6358_LDO_VCAMA2_CON2
+#define MT6358_LDO_VSRAM_CORE_CON0            MT6358_LDO_VCAMD_CON0
+#define MT6358_LDO_VSRAM_CORE_DBG0            0x1cb6
+#define MT6358_LDO_VSRAM_CORE_DBG1            0x1cb8
+#define MT6358_VM18_ANA_CON0                  MT6358_VCAMA1_ANA_CON0
+#define MT6358_VMDDR_ANA_CON0                 MT6358_VCAMD_ANA_CON0
+
 #endif /* __MFD_MT6358_REGISTERS_H__ */
-- 
2.42.0.rc1.204.g551eb34607-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 03/11] regulator: dt-bindings: mt6358: Convert to DT schema
  2023-08-22  8:45 ` Chen-Yu Tsai
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

Convert this from the old style text based binding to the new DT schema
style. This will make adding the MT6366 portion easier.

The examples have been trimmed down considerably, and the remaining
entries now match what is seen in actual device trees.

The original submitter seems to have left MediaTek, so instead the
submitter and maintainer for the MT6366 binding is listed.

Cc: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 .../regulator/mediatek,mt6358-regulator.yaml  | 105 ++++++
 .../bindings/regulator/mt6358-regulator.txt   | 350 ------------------
 2 files changed, 105 insertions(+), 350 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
 delete mode 100644 Documentation/devicetree/bindings/regulator/mt6358-regulator.txt

diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
new file mode 100644
index 000000000000..4d7924c5cc7d
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
@@ -0,0 +1,105 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/mediatek,mt6358-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT6358 Regulator
+
+maintainers:
+  - Zhiyong Tao <zhiyong.tao@mediatek.com>
+
+description: |
+  Regulator node of the PMIC. This node should under the PMIC's device node.
+  All voltage regulators provided by the PMIC are described as sub-nodes of
+  this node.
+
+properties:
+  compatible:
+    const: mediatek,mt6358-regulator
+
+patternProperties:
+  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
+    description: Buck regulators
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_v(a|rf)12":
+    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_v((aux|cn|io|rf)18|camio)":
+    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_vxo22":
+    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_v(aud|bif|cn|fe|io)28":
+    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_vusb":
+    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_vsram_(gpu|others|proc1[12])$":
+    description: LDOs with variable output
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
+    description: LDOs with variable output and 0~100/10mV tuning
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/regulator/mediatek,mt6397-regulator.h>
+
+    regulator {
+        compatible = "mediatek,mt6358-regulator";
+
+        buck_vgpu {
+            regulator-name = "vgpu";
+            regulator-min-microvolt = <625000>;
+            regulator-max-microvolt = <900000>;
+            regulator-ramp-delay = <6250>;
+            regulator-enable-ramp-delay = <200>;
+            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO
+                                       MT6397_BUCK_MODE_FORCE_PWM>;
+            regulator-coupled-with = <&mt6358_vsram_gpu_reg>;
+            regulator-coupled-max-spread = <100000>;
+        };
+
+        ldo_vsram_gpu {
+            regulator-name = "vsram_gpu";
+            regulator-min-microvolt = <850000>;
+            regulator-max-microvolt = <1000000>;
+            regulator-ramp-delay = <6250>;
+            regulator-enable-ramp-delay = <240>;
+            regulator-coupled-with = <&mt6358_vgpu_reg>;
+            regulator-coupled-max-spread = <100000>;
+        };
+    };
+
+...
diff --git a/Documentation/devicetree/bindings/regulator/mt6358-regulator.txt b/Documentation/devicetree/bindings/regulator/mt6358-regulator.txt
deleted file mode 100644
index b6384306db5c..000000000000
--- a/Documentation/devicetree/bindings/regulator/mt6358-regulator.txt
+++ /dev/null
@@ -1,350 +0,0 @@
-MediaTek MT6358 Regulator
-
-All voltage regulators provided by the MT6358 PMIC are described as the
-subnodes of the MT6358 regulators node. Each regulator is named according
-to its regulator type, buck_<name> and ldo_<name>. The definition for each
-of these nodes is defined using the standard binding for regulators at
-Documentation/devicetree/bindings/regulator/regulator.txt.
-
-The valid names for regulators are::
-BUCK:
-  buck_vdram1, buck_vcore, buck_vpa, buck_vproc11, buck_vproc12, buck_vgpu,
-  buck_vs2, buck_vmodem, buck_vs1
-LDO:
-  ldo_vdram2, ldo_vsim1, ldo_vibr, ldo_vrf12, ldo_vio18, ldo_vusb, ldo_vcamio,
-  ldo_vcamd, ldo_vcn18, ldo_vfe28, ldo_vsram_proc11, ldo_vcn28, ldo_vsram_others,
-  ldo_vsram_gpu, ldo_vxo22, ldo_vefuse, ldo_vaux18, ldo_vmch, ldo_vbif28,
-  ldo_vsram_proc12, ldo_vcama1, ldo_vemc, ldo_vio28, ldo_va12, ldo_vrf18,
-  ldo_vcn33, ldo_vcama2, ldo_vmc, ldo_vldo28, ldo_vaud28, ldo_vsim2
-
-Example:
-
-	pmic {
-		compatible = "mediatek,mt6358";
-
-		mt6358regulator: mt6358regulator {
-			compatible = "mediatek,mt6358-regulator";
-
-			mt6358_vdram1_reg: buck_vdram1 {
-				regulator-compatible = "buck_vdram1";
-				regulator-name = "vdram1";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <2087500>;
-				regulator-ramp-delay = <12500>;
-				regulator-enable-ramp-delay = <0>;
-				regulator-always-on;
-			};
-
-			mt6358_vcore_reg: buck_vcore {
-				regulator-name = "vcore";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <200>;
-				regulator-always-on;
-			};
-
-			mt6358_vpa_reg: buck_vpa {
-				regulator-name = "vpa";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <3650000>;
-				regulator-ramp-delay = <50000>;
-				regulator-enable-ramp-delay = <250>;
-			};
-
-			mt6358_vproc11_reg: buck_vproc11 {
-				regulator-name = "vproc11";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <200>;
-				regulator-always-on;
-			};
-
-			mt6358_vproc12_reg: buck_vproc12 {
-				regulator-name = "vproc12";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <200>;
-				regulator-always-on;
-			};
-
-			mt6358_vgpu_reg: buck_vgpu {
-				regulator-name = "vgpu";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <200>;
-			};
-
-			mt6358_vs2_reg: buck_vs2 {
-				regulator-name = "vs2";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <2087500>;
-				regulator-ramp-delay = <12500>;
-				regulator-enable-ramp-delay = <0>;
-				regulator-always-on;
-			};
-
-			mt6358_vmodem_reg: buck_vmodem {
-				regulator-name = "vmodem";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <900>;
-				regulator-always-on;
-			};
-
-			mt6358_vs1_reg: buck_vs1 {
-				regulator-name = "vs1";
-				regulator-min-microvolt = <1000000>;
-				regulator-max-microvolt = <2587500>;
-				regulator-ramp-delay = <12500>;
-				regulator-enable-ramp-delay = <0>;
-				regulator-always-on;
-			};
-
-			mt6358_vdram2_reg: ldo_vdram2 {
-				regulator-name = "vdram2";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <3300>;
-			};
-
-			mt6358_vsim1_reg: ldo_vsim1 {
-				regulator-name = "vsim1";
-				regulator-min-microvolt = <1700000>;
-				regulator-max-microvolt = <3100000>;
-				regulator-enable-ramp-delay = <540>;
-			};
-
-			mt6358_vibr_reg: ldo_vibr {
-				regulator-name = "vibr";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-enable-ramp-delay = <60>;
-			};
-
-			mt6358_vrf12_reg: ldo_vrf12 {
-				compatible = "regulator-fixed";
-				regulator-name = "vrf12";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <1200000>;
-				regulator-enable-ramp-delay = <120>;
-			};
-
-			mt6358_vio18_reg: ldo_vio18 {
-				compatible = "regulator-fixed";
-				regulator-name = "vio18";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <2700>;
-				regulator-always-on;
-			};
-
-			mt6358_vusb_reg: ldo_vusb {
-				regulator-name = "vusb";
-				regulator-min-microvolt = <3000000>;
-				regulator-max-microvolt = <3100000>;
-				regulator-enable-ramp-delay = <270>;
-				regulator-always-on;
-			};
-
-			mt6358_vcamio_reg: ldo_vcamio {
-				compatible = "regulator-fixed";
-				regulator-name = "vcamio";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vcamd_reg: ldo_vcamd {
-				regulator-name = "vcamd";
-				regulator-min-microvolt = <900000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vcn18_reg: ldo_vcn18 {
-				compatible = "regulator-fixed";
-				regulator-name = "vcn18";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vfe28_reg: ldo_vfe28 {
-				compatible = "regulator-fixed";
-				regulator-name = "vfe28";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vsram_proc11_reg: ldo_vsram_proc11 {
-				regulator-name = "vsram_proc11";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <240>;
-				regulator-always-on;
-			};
-
-			mt6358_vcn28_reg: ldo_vcn28 {
-				compatible = "regulator-fixed";
-				regulator-name = "vcn28";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vsram_others_reg: ldo_vsram_others {
-				regulator-name = "vsram_others";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <240>;
-				regulator-always-on;
-			};
-
-			mt6358_vsram_gpu_reg: ldo_vsram_gpu {
-				regulator-name = "vsram_gpu";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <240>;
-			};
-
-			mt6358_vxo22_reg: ldo_vxo22 {
-				compatible = "regulator-fixed";
-				regulator-name = "vxo22";
-				regulator-min-microvolt = <2200000>;
-				regulator-max-microvolt = <2200000>;
-				regulator-enable-ramp-delay = <120>;
-				regulator-always-on;
-			};
-
-			mt6358_vefuse_reg: ldo_vefuse {
-				regulator-name = "vefuse";
-				regulator-min-microvolt = <1700000>;
-				regulator-max-microvolt = <1900000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vaux18_reg: ldo_vaux18 {
-				compatible = "regulator-fixed";
-				regulator-name = "vaux18";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vmch_reg: ldo_vmch {
-				regulator-name = "vmch";
-				regulator-min-microvolt = <2900000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-enable-ramp-delay = <60>;
-			};
-
-			mt6358_vbif28_reg: ldo_vbif28 {
-				compatible = "regulator-fixed";
-				regulator-name = "vbif28";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vsram_proc12_reg: ldo_vsram_proc12 {
-				regulator-name = "vsram_proc12";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <240>;
-				regulator-always-on;
-			};
-
-			mt6358_vcama1_reg: ldo_vcama1 {
-				regulator-name = "vcama1";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <3000000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vemc_reg: ldo_vemc {
-				regulator-name = "vemc";
-				regulator-min-microvolt = <2900000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-enable-ramp-delay = <60>;
-				regulator-always-on;
-			};
-
-			mt6358_vio28_reg: ldo_vio28 {
-				compatible = "regulator-fixed";
-				regulator-name = "vio28";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_va12_reg: ldo_va12 {
-				compatible = "regulator-fixed";
-				regulator-name = "va12";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <1200000>;
-				regulator-enable-ramp-delay = <270>;
-				regulator-always-on;
-			};
-
-			mt6358_vrf18_reg: ldo_vrf18 {
-				compatible = "regulator-fixed";
-				regulator-name = "vrf18";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <120>;
-			};
-
-			mt6358_vcn33_reg: ldo_vcn33 {
-				regulator-name = "vcn33";
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <3500000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vcama2_reg: ldo_vcama2 {
-				regulator-name = "vcama2";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <3000000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vmc_reg: ldo_vmc {
-				regulator-name = "vmc";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-enable-ramp-delay = <60>;
-			};
-
-			mt6358_vldo28_reg: ldo_vldo28 {
-				regulator-name = "vldo28";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <3000000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vaud28_reg: ldo_vaud28 {
-				compatible = "regulator-fixed";
-				regulator-name = "vaud28";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vsim2_reg: ldo_vsim2 {
-				regulator-name = "vsim2";
-				regulator-min-microvolt = <1700000>;
-				regulator-max-microvolt = <3100000>;
-				regulator-enable-ramp-delay = <540>;
-			};
-		};
-	};
-- 
2.42.0.rc1.204.g551eb34607-goog


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

* [PATCH v2 03/11] regulator: dt-bindings: mt6358: Convert to DT schema
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

Convert this from the old style text based binding to the new DT schema
style. This will make adding the MT6366 portion easier.

The examples have been trimmed down considerably, and the remaining
entries now match what is seen in actual device trees.

The original submitter seems to have left MediaTek, so instead the
submitter and maintainer for the MT6366 binding is listed.

Cc: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 .../regulator/mediatek,mt6358-regulator.yaml  | 105 ++++++
 .../bindings/regulator/mt6358-regulator.txt   | 350 ------------------
 2 files changed, 105 insertions(+), 350 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
 delete mode 100644 Documentation/devicetree/bindings/regulator/mt6358-regulator.txt

diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
new file mode 100644
index 000000000000..4d7924c5cc7d
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
@@ -0,0 +1,105 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/mediatek,mt6358-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT6358 Regulator
+
+maintainers:
+  - Zhiyong Tao <zhiyong.tao@mediatek.com>
+
+description: |
+  Regulator node of the PMIC. This node should under the PMIC's device node.
+  All voltage regulators provided by the PMIC are described as sub-nodes of
+  this node.
+
+properties:
+  compatible:
+    const: mediatek,mt6358-regulator
+
+patternProperties:
+  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
+    description: Buck regulators
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_v(a|rf)12":
+    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_v((aux|cn|io|rf)18|camio)":
+    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_vxo22":
+    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_v(aud|bif|cn|fe|io)28":
+    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_vusb":
+    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_vsram_(gpu|others|proc1[12])$":
+    description: LDOs with variable output
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
+    description: LDOs with variable output and 0~100/10mV tuning
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/regulator/mediatek,mt6397-regulator.h>
+
+    regulator {
+        compatible = "mediatek,mt6358-regulator";
+
+        buck_vgpu {
+            regulator-name = "vgpu";
+            regulator-min-microvolt = <625000>;
+            regulator-max-microvolt = <900000>;
+            regulator-ramp-delay = <6250>;
+            regulator-enable-ramp-delay = <200>;
+            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO
+                                       MT6397_BUCK_MODE_FORCE_PWM>;
+            regulator-coupled-with = <&mt6358_vsram_gpu_reg>;
+            regulator-coupled-max-spread = <100000>;
+        };
+
+        ldo_vsram_gpu {
+            regulator-name = "vsram_gpu";
+            regulator-min-microvolt = <850000>;
+            regulator-max-microvolt = <1000000>;
+            regulator-ramp-delay = <6250>;
+            regulator-enable-ramp-delay = <240>;
+            regulator-coupled-with = <&mt6358_vgpu_reg>;
+            regulator-coupled-max-spread = <100000>;
+        };
+    };
+
+...
diff --git a/Documentation/devicetree/bindings/regulator/mt6358-regulator.txt b/Documentation/devicetree/bindings/regulator/mt6358-regulator.txt
deleted file mode 100644
index b6384306db5c..000000000000
--- a/Documentation/devicetree/bindings/regulator/mt6358-regulator.txt
+++ /dev/null
@@ -1,350 +0,0 @@
-MediaTek MT6358 Regulator
-
-All voltage regulators provided by the MT6358 PMIC are described as the
-subnodes of the MT6358 regulators node. Each regulator is named according
-to its regulator type, buck_<name> and ldo_<name>. The definition for each
-of these nodes is defined using the standard binding for regulators at
-Documentation/devicetree/bindings/regulator/regulator.txt.
-
-The valid names for regulators are::
-BUCK:
-  buck_vdram1, buck_vcore, buck_vpa, buck_vproc11, buck_vproc12, buck_vgpu,
-  buck_vs2, buck_vmodem, buck_vs1
-LDO:
-  ldo_vdram2, ldo_vsim1, ldo_vibr, ldo_vrf12, ldo_vio18, ldo_vusb, ldo_vcamio,
-  ldo_vcamd, ldo_vcn18, ldo_vfe28, ldo_vsram_proc11, ldo_vcn28, ldo_vsram_others,
-  ldo_vsram_gpu, ldo_vxo22, ldo_vefuse, ldo_vaux18, ldo_vmch, ldo_vbif28,
-  ldo_vsram_proc12, ldo_vcama1, ldo_vemc, ldo_vio28, ldo_va12, ldo_vrf18,
-  ldo_vcn33, ldo_vcama2, ldo_vmc, ldo_vldo28, ldo_vaud28, ldo_vsim2
-
-Example:
-
-	pmic {
-		compatible = "mediatek,mt6358";
-
-		mt6358regulator: mt6358regulator {
-			compatible = "mediatek,mt6358-regulator";
-
-			mt6358_vdram1_reg: buck_vdram1 {
-				regulator-compatible = "buck_vdram1";
-				regulator-name = "vdram1";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <2087500>;
-				regulator-ramp-delay = <12500>;
-				regulator-enable-ramp-delay = <0>;
-				regulator-always-on;
-			};
-
-			mt6358_vcore_reg: buck_vcore {
-				regulator-name = "vcore";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <200>;
-				regulator-always-on;
-			};
-
-			mt6358_vpa_reg: buck_vpa {
-				regulator-name = "vpa";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <3650000>;
-				regulator-ramp-delay = <50000>;
-				regulator-enable-ramp-delay = <250>;
-			};
-
-			mt6358_vproc11_reg: buck_vproc11 {
-				regulator-name = "vproc11";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <200>;
-				regulator-always-on;
-			};
-
-			mt6358_vproc12_reg: buck_vproc12 {
-				regulator-name = "vproc12";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <200>;
-				regulator-always-on;
-			};
-
-			mt6358_vgpu_reg: buck_vgpu {
-				regulator-name = "vgpu";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <200>;
-			};
-
-			mt6358_vs2_reg: buck_vs2 {
-				regulator-name = "vs2";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <2087500>;
-				regulator-ramp-delay = <12500>;
-				regulator-enable-ramp-delay = <0>;
-				regulator-always-on;
-			};
-
-			mt6358_vmodem_reg: buck_vmodem {
-				regulator-name = "vmodem";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <900>;
-				regulator-always-on;
-			};
-
-			mt6358_vs1_reg: buck_vs1 {
-				regulator-name = "vs1";
-				regulator-min-microvolt = <1000000>;
-				regulator-max-microvolt = <2587500>;
-				regulator-ramp-delay = <12500>;
-				regulator-enable-ramp-delay = <0>;
-				regulator-always-on;
-			};
-
-			mt6358_vdram2_reg: ldo_vdram2 {
-				regulator-name = "vdram2";
-				regulator-min-microvolt = <600000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <3300>;
-			};
-
-			mt6358_vsim1_reg: ldo_vsim1 {
-				regulator-name = "vsim1";
-				regulator-min-microvolt = <1700000>;
-				regulator-max-microvolt = <3100000>;
-				regulator-enable-ramp-delay = <540>;
-			};
-
-			mt6358_vibr_reg: ldo_vibr {
-				regulator-name = "vibr";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-enable-ramp-delay = <60>;
-			};
-
-			mt6358_vrf12_reg: ldo_vrf12 {
-				compatible = "regulator-fixed";
-				regulator-name = "vrf12";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <1200000>;
-				regulator-enable-ramp-delay = <120>;
-			};
-
-			mt6358_vio18_reg: ldo_vio18 {
-				compatible = "regulator-fixed";
-				regulator-name = "vio18";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <2700>;
-				regulator-always-on;
-			};
-
-			mt6358_vusb_reg: ldo_vusb {
-				regulator-name = "vusb";
-				regulator-min-microvolt = <3000000>;
-				regulator-max-microvolt = <3100000>;
-				regulator-enable-ramp-delay = <270>;
-				regulator-always-on;
-			};
-
-			mt6358_vcamio_reg: ldo_vcamio {
-				compatible = "regulator-fixed";
-				regulator-name = "vcamio";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vcamd_reg: ldo_vcamd {
-				regulator-name = "vcamd";
-				regulator-min-microvolt = <900000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vcn18_reg: ldo_vcn18 {
-				compatible = "regulator-fixed";
-				regulator-name = "vcn18";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vfe28_reg: ldo_vfe28 {
-				compatible = "regulator-fixed";
-				regulator-name = "vfe28";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vsram_proc11_reg: ldo_vsram_proc11 {
-				regulator-name = "vsram_proc11";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <240>;
-				regulator-always-on;
-			};
-
-			mt6358_vcn28_reg: ldo_vcn28 {
-				compatible = "regulator-fixed";
-				regulator-name = "vcn28";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vsram_others_reg: ldo_vsram_others {
-				regulator-name = "vsram_others";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <240>;
-				regulator-always-on;
-			};
-
-			mt6358_vsram_gpu_reg: ldo_vsram_gpu {
-				regulator-name = "vsram_gpu";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <240>;
-			};
-
-			mt6358_vxo22_reg: ldo_vxo22 {
-				compatible = "regulator-fixed";
-				regulator-name = "vxo22";
-				regulator-min-microvolt = <2200000>;
-				regulator-max-microvolt = <2200000>;
-				regulator-enable-ramp-delay = <120>;
-				regulator-always-on;
-			};
-
-			mt6358_vefuse_reg: ldo_vefuse {
-				regulator-name = "vefuse";
-				regulator-min-microvolt = <1700000>;
-				regulator-max-microvolt = <1900000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vaux18_reg: ldo_vaux18 {
-				compatible = "regulator-fixed";
-				regulator-name = "vaux18";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vmch_reg: ldo_vmch {
-				regulator-name = "vmch";
-				regulator-min-microvolt = <2900000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-enable-ramp-delay = <60>;
-			};
-
-			mt6358_vbif28_reg: ldo_vbif28 {
-				compatible = "regulator-fixed";
-				regulator-name = "vbif28";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vsram_proc12_reg: ldo_vsram_proc12 {
-				regulator-name = "vsram_proc12";
-				regulator-min-microvolt = <500000>;
-				regulator-max-microvolt = <1293750>;
-				regulator-ramp-delay = <6250>;
-				regulator-enable-ramp-delay = <240>;
-				regulator-always-on;
-			};
-
-			mt6358_vcama1_reg: ldo_vcama1 {
-				regulator-name = "vcama1";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <3000000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vemc_reg: ldo_vemc {
-				regulator-name = "vemc";
-				regulator-min-microvolt = <2900000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-enable-ramp-delay = <60>;
-				regulator-always-on;
-			};
-
-			mt6358_vio28_reg: ldo_vio28 {
-				compatible = "regulator-fixed";
-				regulator-name = "vio28";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_va12_reg: ldo_va12 {
-				compatible = "regulator-fixed";
-				regulator-name = "va12";
-				regulator-min-microvolt = <1200000>;
-				regulator-max-microvolt = <1200000>;
-				regulator-enable-ramp-delay = <270>;
-				regulator-always-on;
-			};
-
-			mt6358_vrf18_reg: ldo_vrf18 {
-				compatible = "regulator-fixed";
-				regulator-name = "vrf18";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <1800000>;
-				regulator-enable-ramp-delay = <120>;
-			};
-
-			mt6358_vcn33_reg: ldo_vcn33 {
-				regulator-name = "vcn33";
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <3500000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vcama2_reg: ldo_vcama2 {
-				regulator-name = "vcama2";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <3000000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vmc_reg: ldo_vmc {
-				regulator-name = "vmc";
-				regulator-min-microvolt = <1800000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-enable-ramp-delay = <60>;
-			};
-
-			mt6358_vldo28_reg: ldo_vldo28 {
-				regulator-name = "vldo28";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <3000000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vaud28_reg: ldo_vaud28 {
-				compatible = "regulator-fixed";
-				regulator-name = "vaud28";
-				regulator-min-microvolt = <2800000>;
-				regulator-max-microvolt = <2800000>;
-				regulator-enable-ramp-delay = <270>;
-			};
-
-			mt6358_vsim2_reg: ldo_vsim2 {
-				regulator-name = "vsim2";
-				regulator-min-microvolt = <1700000>;
-				regulator-max-microvolt = <3100000>;
-				regulator-enable-ramp-delay = <540>;
-			};
-		};
-	};
-- 
2.42.0.rc1.204.g551eb34607-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 04/11] regulator: dt-bindings: mt6358: Add regulator supplies
  2023-08-22  8:45 ` Chen-Yu Tsai
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The MT6358 PMIC has various regulator power supply pins that should be
supplied from external power sources or routed from one of its outputs.

Add these regulator supplies to the binding. The names are the actual
names from the datasheet, with hyphens replacing underscores.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 .../regulator/mediatek,mt6358-regulator.yaml  | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
index 4d7924c5cc7d..82328fe17680 100644
--- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
@@ -18,6 +18,41 @@ properties:
   compatible:
     const: mediatek,mt6358-regulator
 
+  vsys-ldo1-supply:
+    description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
+  vsys-ldo2-supply:
+    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
+  vsys-ldo3-supply:
+    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
+  vsys-vcore-supply:
+    description: Supply for buck regulator vcore
+  vsys-vdram1-supply:
+    description: Supply for buck regulator vdram1
+  vsys-vgpu-supply:
+    description: Supply for buck regulator vgpu
+  vsys-vmodem-supply:
+    description: Supply for buck regulator vmodem
+  vsys-vpa-supply:
+    description: Supply for buck regulator vpa
+  vsys-vproc11-supply:
+    description: Supply for buck regulator vproc11
+  vsys-vproc12-supply:
+    description: Supply for buck regulator vproc12
+  vsys-vs1-supply:
+    description: Supply for buck regulator vs1
+  vsys-vs2-supply:
+    description: Supply for buck regulator vs2
+  vs1-ldo1-supply:
+    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
+  vs2-ldo1-supply:
+    description: Supply for LDOs vdram2
+  vs2-ldo2-supply:
+    description: Supply for LDOs vrf12, va12
+  vs2-ldo3-supply:
+    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
+  vs2-ldo4-supply:
+    description: Supply for LDO vcamd
+
 patternProperties:
   "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
     description: Buck regulators
-- 
2.42.0.rc1.204.g551eb34607-goog


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

* [PATCH v2 04/11] regulator: dt-bindings: mt6358: Add regulator supplies
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The MT6358 PMIC has various regulator power supply pins that should be
supplied from external power sources or routed from one of its outputs.

Add these regulator supplies to the binding. The names are the actual
names from the datasheet, with hyphens replacing underscores.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 .../regulator/mediatek,mt6358-regulator.yaml  | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
index 4d7924c5cc7d..82328fe17680 100644
--- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
@@ -18,6 +18,41 @@ properties:
   compatible:
     const: mediatek,mt6358-regulator
 
+  vsys-ldo1-supply:
+    description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
+  vsys-ldo2-supply:
+    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
+  vsys-ldo3-supply:
+    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
+  vsys-vcore-supply:
+    description: Supply for buck regulator vcore
+  vsys-vdram1-supply:
+    description: Supply for buck regulator vdram1
+  vsys-vgpu-supply:
+    description: Supply for buck regulator vgpu
+  vsys-vmodem-supply:
+    description: Supply for buck regulator vmodem
+  vsys-vpa-supply:
+    description: Supply for buck regulator vpa
+  vsys-vproc11-supply:
+    description: Supply for buck regulator vproc11
+  vsys-vproc12-supply:
+    description: Supply for buck regulator vproc12
+  vsys-vs1-supply:
+    description: Supply for buck regulator vs1
+  vsys-vs2-supply:
+    description: Supply for buck regulator vs2
+  vs1-ldo1-supply:
+    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
+  vs2-ldo1-supply:
+    description: Supply for LDOs vdram2
+  vs2-ldo2-supply:
+    description: Supply for LDOs vrf12, va12
+  vs2-ldo3-supply:
+    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
+  vs2-ldo4-supply:
+    description: Supply for LDO vcamd
+
 patternProperties:
   "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
     description: Buck regulators
-- 
2.42.0.rc1.204.g551eb34607-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
  2023-08-22  8:45 ` Chen-Yu Tsai
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, Chen-Yu Tsai

From: Zhiyong Tao <zhiyong.tao@mediatek.com>

The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
29 LDO regulators, not counting ones that feed internally and basically
have no controls. The regulators are named after their intended usage
for the SoC and system design, thus not named generically as ldoX or
dcdcX, but as vcn33 or vgpu.

Add a binding document describing all the regulators and their supplies.

Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
[wens@chromium.org: major rework and added commit message]
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
Changes since v1:
- Replaced underscores in supply names to hyphens
- Merged with MT6358 regulator binding
- Added MT6358 fallback compatible to MT6366 regulator

Changes since Zhiyong's last version (v4) [1]:
- simplified regulator names
- added descriptions to regulators
- removed bogus regulators (*_sshub)
- merged vcn33-wifi and vcn33-bt as vcn33
- added missing regulators (vm18, vmddr, vsram-core)
- cut down examples to a handful of cases and made them complete
- expanded commit message a lot

[1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
 .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
 1 file changed, 168 insertions(+), 59 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
index 82328fe17680..b350181f33ff 100644
--- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
@@ -16,14 +16,18 @@ description: |
 
 properties:
   compatible:
-    const: mediatek,mt6358-regulator
+    oneOf:
+      - const: mediatek,mt6358-regulator
+      - items:
+          - const: mediatek,mt6366-regulator
+          - const: mediatek,mt6358-regulator
 
   vsys-ldo1-supply:
     description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
   vsys-ldo2-supply:
-    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
+    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
   vsys-ldo3-supply:
-    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
+    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
   vsys-vcore-supply:
     description: Supply for buck regulator vcore
   vsys-vdram1-supply:
@@ -43,75 +47,138 @@ properties:
   vsys-vs2-supply:
     description: Supply for buck regulator vs2
   vs1-ldo1-supply:
-    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
+    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
   vs2-ldo1-supply:
-    description: Supply for LDOs vdram2
+    description: Supply for LDOs vdram2, vmddr (MT6366 only)
   vs2-ldo2-supply:
     description: Supply for LDOs vrf12, va12
   vs2-ldo3-supply:
-    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
-  vs2-ldo4-supply:
-    description: Supply for LDO vcamd
-
-patternProperties:
-  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
-    description: Buck regulators
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_v(a|rf)12":
-    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_v((aux|cn|io|rf)18|camio)":
-    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_vxo22":
-    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_v(aud|bif|cn|fe|io)28":
-    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_vusb":
-    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_vsram_(gpu|others|proc1[12])$":
-    description: LDOs with variable output
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
-    description: LDOs with variable output and 0~100/10mV tuning
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
+    description: Supply for LDOs vsram-core (MT6366 only), vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
 
 required:
   - compatible
 
-additionalProperties: false
+unevaluatedProperties: false
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          const: mediatek,mt6358-regulator
+    then:
+      properties:
+        vs2-ldo4-supply:
+          description: Supply for LDO vcamd
+
+      patternProperties:
+        "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
+          description: Buck regulators
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_v(a|rf)12":
+          description: LDOs with fixed 1.2V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_v((aux|cn|io|rf)18|camio)":
+          description: LDOs with fixed 1.8V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_vxo22":
+          description: LDOs with fixed 2.2V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_v(aud|bif|cn|fe|io)28":
+          description: LDOs with fixed 2.8V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_vusb":
+          description: LDOs with fixed 3.0V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_vsram_(gpu|others|proc1[12])$":
+          description: LDOs with variable output
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
+          description: LDOs with variable output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: mediatek,mt6366-regulator
+    then:
+      patternProperties:
+        "^v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
+          description: Buck regulators
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^v(a|rf)12":
+          description: LDOs with fixed 1.2V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^v(aux|io|rf)18":
+          description: LDOs with fixed 1.8V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^vxo22":
+          description: LDOs with fixed 2.2V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^v(aud|bif|cn|fe|io)28":
+          description: LDOs with fixed 2.8V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^vusb":
+          description: LDOs with fixed 3.0V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^vsram-(core|gpu|others|proc1[12])$":
+          description: LDOs with variable output
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^v(cn18|cn33|dram2|efuse|emc|ibr|m18|mc|mch|mddr|sim[12])$":
+          description: LDOs with variable output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
 
 examples:
   - |
     #include <dt-bindings/regulator/mediatek,mt6397-regulator.h>
 
-    regulator {
+    mt6358-regulator {
         compatible = "mediatek,mt6358-regulator";
 
         buck_vgpu {
@@ -137,4 +204,46 @@ examples:
         };
     };
 
+    mt6366-regulator {
+        compatible = "mediatek,mt6366-regulator", "mediatek,mt6358-regulator";
+
+        vdram1 {
+            regulator-name = "pp1125_emi_vdd2";
+            regulator-min-microvolt = <1125000>;
+            regulator-max-microvolt = <1125000>;
+            regulator-ramp-delay = <12500>;
+            regulator-enable-ramp-delay = <0>;
+            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO
+                                       MT6397_BUCK_MODE_FORCE_PWM>;
+            regulator-always-on;
+        };
+
+        vproc11 {
+            regulator-name = "ppvar_dvdd_proc_bc_mt6366";
+            regulator-min-microvolt = <600000>;
+            regulator-max-microvolt = <1200000>;
+            regulator-ramp-delay = <6250>;
+            regulator-enable-ramp-delay = <200>;
+            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO
+                                       MT6397_BUCK_MODE_FORCE_PWM>;
+            regulator-always-on;
+        };
+
+        vmddr {
+            regulator-name = "pm0750_emi_vmddr";
+            regulator-min-microvolt = <700000>;
+            regulator-max-microvolt = <750000>;
+            regulator-enable-ramp-delay = <325>;
+            regulator-always-on;
+        };
+
+        vsram-proc11 {
+            regulator-name = "pp0900_dvdd_sram_bc";
+            regulator-min-microvolt = <850000>;
+            regulator-max-microvolt = <1120000>;
+            regulator-ramp-delay = <6250>;
+            regulator-enable-ramp-delay = <240>;
+            regulator-always-on;
+        };
+    };
 ...
-- 
2.42.0.rc1.204.g551eb34607-goog


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

* [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, Chen-Yu Tsai

From: Zhiyong Tao <zhiyong.tao@mediatek.com>

The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
29 LDO regulators, not counting ones that feed internally and basically
have no controls. The regulators are named after their intended usage
for the SoC and system design, thus not named generically as ldoX or
dcdcX, but as vcn33 or vgpu.

Add a binding document describing all the regulators and their supplies.

Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
[wens@chromium.org: major rework and added commit message]
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
Changes since v1:
- Replaced underscores in supply names to hyphens
- Merged with MT6358 regulator binding
- Added MT6358 fallback compatible to MT6366 regulator

Changes since Zhiyong's last version (v4) [1]:
- simplified regulator names
- added descriptions to regulators
- removed bogus regulators (*_sshub)
- merged vcn33-wifi and vcn33-bt as vcn33
- added missing regulators (vm18, vmddr, vsram-core)
- cut down examples to a handful of cases and made them complete
- expanded commit message a lot

[1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
 .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
 1 file changed, 168 insertions(+), 59 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
index 82328fe17680..b350181f33ff 100644
--- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
@@ -16,14 +16,18 @@ description: |
 
 properties:
   compatible:
-    const: mediatek,mt6358-regulator
+    oneOf:
+      - const: mediatek,mt6358-regulator
+      - items:
+          - const: mediatek,mt6366-regulator
+          - const: mediatek,mt6358-regulator
 
   vsys-ldo1-supply:
     description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
   vsys-ldo2-supply:
-    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
+    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
   vsys-ldo3-supply:
-    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
+    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
   vsys-vcore-supply:
     description: Supply for buck regulator vcore
   vsys-vdram1-supply:
@@ -43,75 +47,138 @@ properties:
   vsys-vs2-supply:
     description: Supply for buck regulator vs2
   vs1-ldo1-supply:
-    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
+    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
   vs2-ldo1-supply:
-    description: Supply for LDOs vdram2
+    description: Supply for LDOs vdram2, vmddr (MT6366 only)
   vs2-ldo2-supply:
     description: Supply for LDOs vrf12, va12
   vs2-ldo3-supply:
-    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
-  vs2-ldo4-supply:
-    description: Supply for LDO vcamd
-
-patternProperties:
-  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
-    description: Buck regulators
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_v(a|rf)12":
-    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_v((aux|cn|io|rf)18|camio)":
-    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_vxo22":
-    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_v(aud|bif|cn|fe|io)28":
-    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_vusb":
-    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_vsram_(gpu|others|proc1[12])$":
-    description: LDOs with variable output
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
-
-  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
-    description: LDOs with variable output and 0~100/10mV tuning
-    type: object
-    $ref: regulator.yaml#
-    unevaluatedProperties: false
+    description: Supply for LDOs vsram-core (MT6366 only), vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
 
 required:
   - compatible
 
-additionalProperties: false
+unevaluatedProperties: false
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          const: mediatek,mt6358-regulator
+    then:
+      properties:
+        vs2-ldo4-supply:
+          description: Supply for LDO vcamd
+
+      patternProperties:
+        "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
+          description: Buck regulators
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_v(a|rf)12":
+          description: LDOs with fixed 1.2V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_v((aux|cn|io|rf)18|camio)":
+          description: LDOs with fixed 1.8V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_vxo22":
+          description: LDOs with fixed 2.2V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_v(aud|bif|cn|fe|io)28":
+          description: LDOs with fixed 2.8V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_vusb":
+          description: LDOs with fixed 3.0V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_vsram_(gpu|others|proc1[12])$":
+          description: LDOs with variable output
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
+          description: LDOs with variable output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: mediatek,mt6366-regulator
+    then:
+      patternProperties:
+        "^v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
+          description: Buck regulators
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^v(a|rf)12":
+          description: LDOs with fixed 1.2V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^v(aux|io|rf)18":
+          description: LDOs with fixed 1.8V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^vxo22":
+          description: LDOs with fixed 2.2V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^v(aud|bif|cn|fe|io)28":
+          description: LDOs with fixed 2.8V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^vusb":
+          description: LDOs with fixed 3.0V output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^vsram-(core|gpu|others|proc1[12])$":
+          description: LDOs with variable output
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
+
+        "^v(cn18|cn33|dram2|efuse|emc|ibr|m18|mc|mch|mddr|sim[12])$":
+          description: LDOs with variable output and 0~100/10mV tuning
+          type: object
+          $ref: regulator.yaml#
+          unevaluatedProperties: false
 
 examples:
   - |
     #include <dt-bindings/regulator/mediatek,mt6397-regulator.h>
 
-    regulator {
+    mt6358-regulator {
         compatible = "mediatek,mt6358-regulator";
 
         buck_vgpu {
@@ -137,4 +204,46 @@ examples:
         };
     };
 
+    mt6366-regulator {
+        compatible = "mediatek,mt6366-regulator", "mediatek,mt6358-regulator";
+
+        vdram1 {
+            regulator-name = "pp1125_emi_vdd2";
+            regulator-min-microvolt = <1125000>;
+            regulator-max-microvolt = <1125000>;
+            regulator-ramp-delay = <12500>;
+            regulator-enable-ramp-delay = <0>;
+            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO
+                                       MT6397_BUCK_MODE_FORCE_PWM>;
+            regulator-always-on;
+        };
+
+        vproc11 {
+            regulator-name = "ppvar_dvdd_proc_bc_mt6366";
+            regulator-min-microvolt = <600000>;
+            regulator-max-microvolt = <1200000>;
+            regulator-ramp-delay = <6250>;
+            regulator-enable-ramp-delay = <200>;
+            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO
+                                       MT6397_BUCK_MODE_FORCE_PWM>;
+            regulator-always-on;
+        };
+
+        vmddr {
+            regulator-name = "pm0750_emi_vmddr";
+            regulator-min-microvolt = <700000>;
+            regulator-max-microvolt = <750000>;
+            regulator-enable-ramp-delay = <325>;
+            regulator-always-on;
+        };
+
+        vsram-proc11 {
+            regulator-name = "pp0900_dvdd_sram_bc";
+            regulator-min-microvolt = <850000>;
+            regulator-max-microvolt = <1120000>;
+            regulator-ramp-delay = <6250>;
+            regulator-enable-ramp-delay = <240>;
+            regulator-always-on;
+        };
+    };
 ...
-- 
2.42.0.rc1.204.g551eb34607-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 06/11] regulator: mt6358: Add supply names for MT6358 regulators
  2023-08-22  8:45 ` Chen-Yu Tsai
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The DT bindings for MT6358 regulator now defines the supply names for the
PMIC.

Add support for them by adding .supply_name field settings for each
regulator.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 drivers/regulator/mt6358-regulator.c | 106 +++++++++++++--------------
 1 file changed, 51 insertions(+), 55 deletions(-)

diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c
index 3cb2e6768e25..db75f644966a 100644
--- a/drivers/regulator/mt6358-regulator.c
+++ b/drivers/regulator/mt6358-regulator.c
@@ -34,12 +34,13 @@ struct mt6358_regulator_info {
 
 #define to_regulator_info(x) container_of((x), struct mt6358_regulator_info, desc)
 
-#define MT6358_BUCK(match, vreg, min, max, step,		\
-	vosel_mask, _da_vsel_reg, _da_vsel_mask,	\
-	_modeset_reg, _modeset_shift)		\
+#define MT6358_BUCK(match, vreg, supply, min, max, step,	\
+		    vosel_mask, _da_vsel_reg, _da_vsel_mask,	\
+		    _modeset_reg, _modeset_shift)		\
 [MT6358_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_range_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -62,10 +63,11 @@ struct mt6358_regulator_info {
 	.modeset_mask = BIT(_modeset_shift),	\
 }
 
-#define MT6358_LDO(match, vreg, volt_ranges, enreg, enbit, vosel, vosel_mask) \
+#define MT6358_LDO(match, vreg, supply, volt_ranges, enreg, enbit, vosel, vosel_mask) \
 [MT6358_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_table_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -86,12 +88,12 @@ struct mt6358_regulator_info {
 	.qi = BIT(15),	\
 }
 
-#define MT6358_LDO1(match, vreg, min, max, step,	\
-	_da_vsel_reg, _da_vsel_mask,	\
-	vosel, vosel_mask)	\
+#define MT6358_LDO1(match, vreg, supply, min, max, step,	\
+		    _da_vsel_reg, _da_vsel_mask, vosel, vosel_mask)	\
 [MT6358_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_range_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -111,11 +113,11 @@ struct mt6358_regulator_info {
 	.qi = BIT(0),	\
 }
 
-#define MT6358_REG_FIXED(match, vreg,	\
-	enreg, enbit, volt)	\
+#define MT6358_REG_FIXED(match, vreg, supply, enreg, enbit, volt)	\
 [MT6358_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_fixed_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -458,79 +460,73 @@ static const struct regulator_ops mt6358_volt_fixed_ops = {
 
 /* The array is indexed by id(MT6358_ID_XXX) */
 static const struct mt6358_regulator_info mt6358_regulators[] = {
-	MT6358_BUCK("buck_vdram1", VDRAM1, 500000, 2087500, 12500,
+	MT6358_BUCK("buck_vdram1", VDRAM1, "vsys-vdram1", 500000, 2087500, 12500,
 		    0x7f, MT6358_BUCK_VDRAM1_DBG0, 0x7f, MT6358_VDRAM1_ANA_CON0, 8),
-	MT6358_BUCK("buck_vcore", VCORE, 500000, 1293750, 6250,
+	MT6358_BUCK("buck_vcore", VCORE, "vsys-vcore", 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VCORE_DBG0, 0x7f, MT6358_VCORE_VGPU_ANA_CON0, 1),
-	MT6358_BUCK("buck_vpa", VPA, 500000, 3650000, 50000,
+	MT6358_BUCK("buck_vpa", VPA, "vsys-vpa", 500000, 3650000, 50000,
 		    0x3f, MT6358_BUCK_VPA_DBG0, 0x3f, MT6358_VPA_ANA_CON0, 3),
-	MT6358_BUCK("buck_vproc11", VPROC11, 500000, 1293750, 6250,
+	MT6358_BUCK("buck_vproc11", VPROC11, "vsys-vproc11", 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VPROC11_DBG0, 0x7f, MT6358_VPROC_ANA_CON0, 1),
-	MT6358_BUCK("buck_vproc12", VPROC12, 500000, 1293750, 6250,
+	MT6358_BUCK("buck_vproc12", VPROC12, "vsys-vproc12", 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VPROC12_DBG0, 0x7f, MT6358_VPROC_ANA_CON0, 2),
-	MT6358_BUCK("buck_vgpu", VGPU, 500000, 1293750, 6250,
+	MT6358_BUCK("buck_vgpu", VGPU, "vsys-vgpu", 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VGPU_ELR0, 0x7f, MT6358_VCORE_VGPU_ANA_CON0, 2),
-	MT6358_BUCK("buck_vs2", VS2, 500000, 2087500, 12500,
+	MT6358_BUCK("buck_vs2", VS2, "vsys-vs2", 500000, 2087500, 12500,
 		    0x7f, MT6358_BUCK_VS2_DBG0, 0x7f, MT6358_VS2_ANA_CON0, 8),
-	MT6358_BUCK("buck_vmodem", VMODEM, 500000, 1293750, 6250,
+	MT6358_BUCK("buck_vmodem", VMODEM, "vsys-vmodem", 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VMODEM_DBG0, 0x7f, MT6358_VMODEM_ANA_CON0, 8),
-	MT6358_BUCK("buck_vs1", VS1, 1000000, 2587500, 12500,
+	MT6358_BUCK("buck_vs1", VS1, "vsys-vs1", 1000000, 2587500, 12500,
 		    0x7f, MT6358_BUCK_VS1_DBG0, 0x7f, MT6358_VS1_ANA_CON0, 8),
-	MT6358_REG_FIXED("ldo_vrf12", VRF12,
-			 MT6358_LDO_VRF12_CON0, 0, 1200000),
-	MT6358_REG_FIXED("ldo_vio18", VIO18,
-			 MT6358_LDO_VIO18_CON0, 0, 1800000),
-	MT6358_REG_FIXED("ldo_vcamio", VCAMIO,
-			 MT6358_LDO_VCAMIO_CON0, 0, 1800000),
-	MT6358_REG_FIXED("ldo_vcn18", VCN18, MT6358_LDO_VCN18_CON0, 0, 1800000),
-	MT6358_REG_FIXED("ldo_vfe28", VFE28, MT6358_LDO_VFE28_CON0, 0, 2800000),
-	MT6358_REG_FIXED("ldo_vcn28", VCN28, MT6358_LDO_VCN28_CON0, 0, 2800000),
-	MT6358_REG_FIXED("ldo_vxo22", VXO22, MT6358_LDO_VXO22_CON0, 0, 2200000),
-	MT6358_REG_FIXED("ldo_vaux18", VAUX18,
-			 MT6358_LDO_VAUX18_CON0, 0, 1800000),
-	MT6358_REG_FIXED("ldo_vbif28", VBIF28,
-			 MT6358_LDO_VBIF28_CON0, 0, 2800000),
-	MT6358_REG_FIXED("ldo_vio28", VIO28, MT6358_LDO_VIO28_CON0, 0, 2800000),
-	MT6358_REG_FIXED("ldo_va12", VA12, MT6358_LDO_VA12_CON0, 0, 1200000),
-	MT6358_REG_FIXED("ldo_vrf18", VRF18, MT6358_LDO_VRF18_CON0, 0, 1800000),
-	MT6358_REG_FIXED("ldo_vaud28", VAUD28,
-			 MT6358_LDO_VAUD28_CON0, 0, 2800000),
-	MT6358_LDO("ldo_vdram2", VDRAM2, vdram2,
+	MT6358_REG_FIXED("ldo_vrf12", VRF12, "vs2-ldo2", MT6358_LDO_VRF12_CON0, 0, 1200000),
+	MT6358_REG_FIXED("ldo_vio18", VIO18, "vs1-ldo1", MT6358_LDO_VIO18_CON0, 0, 1800000),
+	MT6358_REG_FIXED("ldo_vcamio", VCAMIO, "vs1-ldo1", MT6358_LDO_VCAMIO_CON0, 0, 1800000),
+	MT6358_REG_FIXED("ldo_vcn18", VCN18, "vs1-ldo1", MT6358_LDO_VCN18_CON0, 0, 1800000),
+	MT6358_REG_FIXED("ldo_vfe28", VFE28, "vsys-ldo1", MT6358_LDO_VFE28_CON0, 0, 2800000),
+	MT6358_REG_FIXED("ldo_vcn28", VCN28, "vsys-ldo1", MT6358_LDO_VCN28_CON0, 0, 2800000),
+	MT6358_REG_FIXED("ldo_vxo22", VXO22, "vsys-ldo1", MT6358_LDO_VXO22_CON0, 0, 2200000),
+	MT6358_REG_FIXED("ldo_vaux18", VAUX18, "vsys-ldo1", MT6358_LDO_VAUX18_CON0, 0, 1800000),
+	MT6358_REG_FIXED("ldo_vbif28", VBIF28, "vsys-ldo1", MT6358_LDO_VBIF28_CON0, 0, 2800000),
+	MT6358_REG_FIXED("ldo_vio28", VIO28, "vsys-ldo2", MT6358_LDO_VIO28_CON0, 0, 2800000),
+	MT6358_REG_FIXED("ldo_va12", VA12, "vs2-ldo2", MT6358_LDO_VA12_CON0, 0, 1200000),
+	MT6358_REG_FIXED("ldo_vrf18", VRF18, "vs1-ldo1", MT6358_LDO_VRF18_CON0, 0, 1800000),
+	MT6358_REG_FIXED("ldo_vaud28", VAUD28, "vsys-ldo1", MT6358_LDO_VAUD28_CON0, 0, 2800000),
+	MT6358_LDO("ldo_vdram2", VDRAM2, "vs2-ldo1", vdram2,
 		   MT6358_LDO_VDRAM2_CON0, 0, MT6358_LDO_VDRAM2_ELR0, 0xf),
-	MT6358_LDO("ldo_vsim1", VSIM1, vsim,
+	MT6358_LDO("ldo_vsim1", VSIM1, "vsys-ldo1", vsim,
 		   MT6358_LDO_VSIM1_CON0, 0, MT6358_VSIM1_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vibr", VIBR, vibr,
+	MT6358_LDO("ldo_vibr", VIBR, "vsys-ldo3", vibr,
 		   MT6358_LDO_VIBR_CON0, 0, MT6358_VIBR_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vusb", VUSB, vusb,
+	MT6358_LDO("ldo_vusb", VUSB, "vsys-ldo1", vusb,
 		   MT6358_LDO_VUSB_CON0_0, 0, MT6358_VUSB_ANA_CON0, 0x700),
-	MT6358_LDO("ldo_vcamd", VCAMD, vcamd,
+	MT6358_LDO("ldo_vcamd", VCAMD, "vs2-ldo4", vcamd,
 		   MT6358_LDO_VCAMD_CON0, 0, MT6358_VCAMD_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vefuse", VEFUSE, vefuse,
+	MT6358_LDO("ldo_vefuse", VEFUSE, "vs1-ldo1", vefuse,
 		   MT6358_LDO_VEFUSE_CON0, 0, MT6358_VEFUSE_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vmch", VMCH, vmch_vemc,
+	MT6358_LDO("ldo_vmch", VMCH, "vsys-ldo2", vmch_vemc,
 		   MT6358_LDO_VMCH_CON0, 0, MT6358_VMCH_ANA_CON0, 0x700),
-	MT6358_LDO("ldo_vcama1", VCAMA1, vcama,
+	MT6358_LDO("ldo_vcama1", VCAMA1, "vsys-ldo3", vcama,
 		   MT6358_LDO_VCAMA1_CON0, 0, MT6358_VCAMA1_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vemc", VEMC, vmch_vemc,
+	MT6358_LDO("ldo_vemc", VEMC, "vsys-ldo2", vmch_vemc,
 		   MT6358_LDO_VEMC_CON0, 0, MT6358_VEMC_ANA_CON0, 0x700),
-	MT6358_LDO("ldo_vcn33", VCN33, vcn33,
+	MT6358_LDO("ldo_vcn33", VCN33, "vsys-ldo3", vcn33,
 		   MT6358_LDO_VCN33_CON0_0, 0, MT6358_VCN33_ANA_CON0, 0x300),
-	MT6358_LDO("ldo_vcama2", VCAMA2, vcama,
+	MT6358_LDO("ldo_vcama2", VCAMA2, "vsys-ldo3", vcama,
 		   MT6358_LDO_VCAMA2_CON0, 0, MT6358_VCAMA2_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vmc", VMC, vmc,
+	MT6358_LDO("ldo_vmc", VMC, "vsys-ldo2", vmc,
 		   MT6358_LDO_VMC_CON0, 0, MT6358_VMC_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vldo28", VLDO28, vldo28,
+	MT6358_LDO("ldo_vldo28", VLDO28, "vsys-ldo2", vldo28,
 		   MT6358_LDO_VLDO28_CON0_0, 0,
 		   MT6358_VLDO28_ANA_CON0, 0x300),
-	MT6358_LDO("ldo_vsim2", VSIM2, vsim,
+	MT6358_LDO("ldo_vsim2", VSIM2, "vsys-ldo2", vsim,
 		   MT6358_LDO_VSIM2_CON0, 0, MT6358_VSIM2_ANA_CON0, 0xf00),
-	MT6358_LDO1("ldo_vsram_proc11", VSRAM_PROC11, 500000, 1293750, 6250,
+	MT6358_LDO1("ldo_vsram_proc11", VSRAM_PROC11, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC11_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON0, 0x7f),
-	MT6358_LDO1("ldo_vsram_others", VSRAM_OTHERS, 500000, 1293750, 6250,
+	MT6358_LDO1("ldo_vsram_others", VSRAM_OTHERS, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_OTHERS_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON2, 0x7f),
-	MT6358_LDO1("ldo_vsram_gpu", VSRAM_GPU, 500000, 1293750, 6250,
+	MT6358_LDO1("ldo_vsram_gpu", VSRAM_GPU, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_GPU_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON3, 0x7f),
-	MT6358_LDO1("ldo_vsram_proc12", VSRAM_PROC12, 500000, 1293750, 6250,
+	MT6358_LDO1("ldo_vsram_proc12", VSRAM_PROC12, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC12_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON1, 0x7f),
 };
 
-- 
2.42.0.rc1.204.g551eb34607-goog


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

* [PATCH v2 06/11] regulator: mt6358: Add supply names for MT6358 regulators
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The DT bindings for MT6358 regulator now defines the supply names for the
PMIC.

Add support for them by adding .supply_name field settings for each
regulator.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 drivers/regulator/mt6358-regulator.c | 106 +++++++++++++--------------
 1 file changed, 51 insertions(+), 55 deletions(-)

diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c
index 3cb2e6768e25..db75f644966a 100644
--- a/drivers/regulator/mt6358-regulator.c
+++ b/drivers/regulator/mt6358-regulator.c
@@ -34,12 +34,13 @@ struct mt6358_regulator_info {
 
 #define to_regulator_info(x) container_of((x), struct mt6358_regulator_info, desc)
 
-#define MT6358_BUCK(match, vreg, min, max, step,		\
-	vosel_mask, _da_vsel_reg, _da_vsel_mask,	\
-	_modeset_reg, _modeset_shift)		\
+#define MT6358_BUCK(match, vreg, supply, min, max, step,	\
+		    vosel_mask, _da_vsel_reg, _da_vsel_mask,	\
+		    _modeset_reg, _modeset_shift)		\
 [MT6358_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_range_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -62,10 +63,11 @@ struct mt6358_regulator_info {
 	.modeset_mask = BIT(_modeset_shift),	\
 }
 
-#define MT6358_LDO(match, vreg, volt_ranges, enreg, enbit, vosel, vosel_mask) \
+#define MT6358_LDO(match, vreg, supply, volt_ranges, enreg, enbit, vosel, vosel_mask) \
 [MT6358_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_table_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -86,12 +88,12 @@ struct mt6358_regulator_info {
 	.qi = BIT(15),	\
 }
 
-#define MT6358_LDO1(match, vreg, min, max, step,	\
-	_da_vsel_reg, _da_vsel_mask,	\
-	vosel, vosel_mask)	\
+#define MT6358_LDO1(match, vreg, supply, min, max, step,	\
+		    _da_vsel_reg, _da_vsel_mask, vosel, vosel_mask)	\
 [MT6358_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_range_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -111,11 +113,11 @@ struct mt6358_regulator_info {
 	.qi = BIT(0),	\
 }
 
-#define MT6358_REG_FIXED(match, vreg,	\
-	enreg, enbit, volt)	\
+#define MT6358_REG_FIXED(match, vreg, supply, enreg, enbit, volt)	\
 [MT6358_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_fixed_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -458,79 +460,73 @@ static const struct regulator_ops mt6358_volt_fixed_ops = {
 
 /* The array is indexed by id(MT6358_ID_XXX) */
 static const struct mt6358_regulator_info mt6358_regulators[] = {
-	MT6358_BUCK("buck_vdram1", VDRAM1, 500000, 2087500, 12500,
+	MT6358_BUCK("buck_vdram1", VDRAM1, "vsys-vdram1", 500000, 2087500, 12500,
 		    0x7f, MT6358_BUCK_VDRAM1_DBG0, 0x7f, MT6358_VDRAM1_ANA_CON0, 8),
-	MT6358_BUCK("buck_vcore", VCORE, 500000, 1293750, 6250,
+	MT6358_BUCK("buck_vcore", VCORE, "vsys-vcore", 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VCORE_DBG0, 0x7f, MT6358_VCORE_VGPU_ANA_CON0, 1),
-	MT6358_BUCK("buck_vpa", VPA, 500000, 3650000, 50000,
+	MT6358_BUCK("buck_vpa", VPA, "vsys-vpa", 500000, 3650000, 50000,
 		    0x3f, MT6358_BUCK_VPA_DBG0, 0x3f, MT6358_VPA_ANA_CON0, 3),
-	MT6358_BUCK("buck_vproc11", VPROC11, 500000, 1293750, 6250,
+	MT6358_BUCK("buck_vproc11", VPROC11, "vsys-vproc11", 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VPROC11_DBG0, 0x7f, MT6358_VPROC_ANA_CON0, 1),
-	MT6358_BUCK("buck_vproc12", VPROC12, 500000, 1293750, 6250,
+	MT6358_BUCK("buck_vproc12", VPROC12, "vsys-vproc12", 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VPROC12_DBG0, 0x7f, MT6358_VPROC_ANA_CON0, 2),
-	MT6358_BUCK("buck_vgpu", VGPU, 500000, 1293750, 6250,
+	MT6358_BUCK("buck_vgpu", VGPU, "vsys-vgpu", 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VGPU_ELR0, 0x7f, MT6358_VCORE_VGPU_ANA_CON0, 2),
-	MT6358_BUCK("buck_vs2", VS2, 500000, 2087500, 12500,
+	MT6358_BUCK("buck_vs2", VS2, "vsys-vs2", 500000, 2087500, 12500,
 		    0x7f, MT6358_BUCK_VS2_DBG0, 0x7f, MT6358_VS2_ANA_CON0, 8),
-	MT6358_BUCK("buck_vmodem", VMODEM, 500000, 1293750, 6250,
+	MT6358_BUCK("buck_vmodem", VMODEM, "vsys-vmodem", 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VMODEM_DBG0, 0x7f, MT6358_VMODEM_ANA_CON0, 8),
-	MT6358_BUCK("buck_vs1", VS1, 1000000, 2587500, 12500,
+	MT6358_BUCK("buck_vs1", VS1, "vsys-vs1", 1000000, 2587500, 12500,
 		    0x7f, MT6358_BUCK_VS1_DBG0, 0x7f, MT6358_VS1_ANA_CON0, 8),
-	MT6358_REG_FIXED("ldo_vrf12", VRF12,
-			 MT6358_LDO_VRF12_CON0, 0, 1200000),
-	MT6358_REG_FIXED("ldo_vio18", VIO18,
-			 MT6358_LDO_VIO18_CON0, 0, 1800000),
-	MT6358_REG_FIXED("ldo_vcamio", VCAMIO,
-			 MT6358_LDO_VCAMIO_CON0, 0, 1800000),
-	MT6358_REG_FIXED("ldo_vcn18", VCN18, MT6358_LDO_VCN18_CON0, 0, 1800000),
-	MT6358_REG_FIXED("ldo_vfe28", VFE28, MT6358_LDO_VFE28_CON0, 0, 2800000),
-	MT6358_REG_FIXED("ldo_vcn28", VCN28, MT6358_LDO_VCN28_CON0, 0, 2800000),
-	MT6358_REG_FIXED("ldo_vxo22", VXO22, MT6358_LDO_VXO22_CON0, 0, 2200000),
-	MT6358_REG_FIXED("ldo_vaux18", VAUX18,
-			 MT6358_LDO_VAUX18_CON0, 0, 1800000),
-	MT6358_REG_FIXED("ldo_vbif28", VBIF28,
-			 MT6358_LDO_VBIF28_CON0, 0, 2800000),
-	MT6358_REG_FIXED("ldo_vio28", VIO28, MT6358_LDO_VIO28_CON0, 0, 2800000),
-	MT6358_REG_FIXED("ldo_va12", VA12, MT6358_LDO_VA12_CON0, 0, 1200000),
-	MT6358_REG_FIXED("ldo_vrf18", VRF18, MT6358_LDO_VRF18_CON0, 0, 1800000),
-	MT6358_REG_FIXED("ldo_vaud28", VAUD28,
-			 MT6358_LDO_VAUD28_CON0, 0, 2800000),
-	MT6358_LDO("ldo_vdram2", VDRAM2, vdram2,
+	MT6358_REG_FIXED("ldo_vrf12", VRF12, "vs2-ldo2", MT6358_LDO_VRF12_CON0, 0, 1200000),
+	MT6358_REG_FIXED("ldo_vio18", VIO18, "vs1-ldo1", MT6358_LDO_VIO18_CON0, 0, 1800000),
+	MT6358_REG_FIXED("ldo_vcamio", VCAMIO, "vs1-ldo1", MT6358_LDO_VCAMIO_CON0, 0, 1800000),
+	MT6358_REG_FIXED("ldo_vcn18", VCN18, "vs1-ldo1", MT6358_LDO_VCN18_CON0, 0, 1800000),
+	MT6358_REG_FIXED("ldo_vfe28", VFE28, "vsys-ldo1", MT6358_LDO_VFE28_CON0, 0, 2800000),
+	MT6358_REG_FIXED("ldo_vcn28", VCN28, "vsys-ldo1", MT6358_LDO_VCN28_CON0, 0, 2800000),
+	MT6358_REG_FIXED("ldo_vxo22", VXO22, "vsys-ldo1", MT6358_LDO_VXO22_CON0, 0, 2200000),
+	MT6358_REG_FIXED("ldo_vaux18", VAUX18, "vsys-ldo1", MT6358_LDO_VAUX18_CON0, 0, 1800000),
+	MT6358_REG_FIXED("ldo_vbif28", VBIF28, "vsys-ldo1", MT6358_LDO_VBIF28_CON0, 0, 2800000),
+	MT6358_REG_FIXED("ldo_vio28", VIO28, "vsys-ldo2", MT6358_LDO_VIO28_CON0, 0, 2800000),
+	MT6358_REG_FIXED("ldo_va12", VA12, "vs2-ldo2", MT6358_LDO_VA12_CON0, 0, 1200000),
+	MT6358_REG_FIXED("ldo_vrf18", VRF18, "vs1-ldo1", MT6358_LDO_VRF18_CON0, 0, 1800000),
+	MT6358_REG_FIXED("ldo_vaud28", VAUD28, "vsys-ldo1", MT6358_LDO_VAUD28_CON0, 0, 2800000),
+	MT6358_LDO("ldo_vdram2", VDRAM2, "vs2-ldo1", vdram2,
 		   MT6358_LDO_VDRAM2_CON0, 0, MT6358_LDO_VDRAM2_ELR0, 0xf),
-	MT6358_LDO("ldo_vsim1", VSIM1, vsim,
+	MT6358_LDO("ldo_vsim1", VSIM1, "vsys-ldo1", vsim,
 		   MT6358_LDO_VSIM1_CON0, 0, MT6358_VSIM1_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vibr", VIBR, vibr,
+	MT6358_LDO("ldo_vibr", VIBR, "vsys-ldo3", vibr,
 		   MT6358_LDO_VIBR_CON0, 0, MT6358_VIBR_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vusb", VUSB, vusb,
+	MT6358_LDO("ldo_vusb", VUSB, "vsys-ldo1", vusb,
 		   MT6358_LDO_VUSB_CON0_0, 0, MT6358_VUSB_ANA_CON0, 0x700),
-	MT6358_LDO("ldo_vcamd", VCAMD, vcamd,
+	MT6358_LDO("ldo_vcamd", VCAMD, "vs2-ldo4", vcamd,
 		   MT6358_LDO_VCAMD_CON0, 0, MT6358_VCAMD_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vefuse", VEFUSE, vefuse,
+	MT6358_LDO("ldo_vefuse", VEFUSE, "vs1-ldo1", vefuse,
 		   MT6358_LDO_VEFUSE_CON0, 0, MT6358_VEFUSE_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vmch", VMCH, vmch_vemc,
+	MT6358_LDO("ldo_vmch", VMCH, "vsys-ldo2", vmch_vemc,
 		   MT6358_LDO_VMCH_CON0, 0, MT6358_VMCH_ANA_CON0, 0x700),
-	MT6358_LDO("ldo_vcama1", VCAMA1, vcama,
+	MT6358_LDO("ldo_vcama1", VCAMA1, "vsys-ldo3", vcama,
 		   MT6358_LDO_VCAMA1_CON0, 0, MT6358_VCAMA1_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vemc", VEMC, vmch_vemc,
+	MT6358_LDO("ldo_vemc", VEMC, "vsys-ldo2", vmch_vemc,
 		   MT6358_LDO_VEMC_CON0, 0, MT6358_VEMC_ANA_CON0, 0x700),
-	MT6358_LDO("ldo_vcn33", VCN33, vcn33,
+	MT6358_LDO("ldo_vcn33", VCN33, "vsys-ldo3", vcn33,
 		   MT6358_LDO_VCN33_CON0_0, 0, MT6358_VCN33_ANA_CON0, 0x300),
-	MT6358_LDO("ldo_vcama2", VCAMA2, vcama,
+	MT6358_LDO("ldo_vcama2", VCAMA2, "vsys-ldo3", vcama,
 		   MT6358_LDO_VCAMA2_CON0, 0, MT6358_VCAMA2_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vmc", VMC, vmc,
+	MT6358_LDO("ldo_vmc", VMC, "vsys-ldo2", vmc,
 		   MT6358_LDO_VMC_CON0, 0, MT6358_VMC_ANA_CON0, 0xf00),
-	MT6358_LDO("ldo_vldo28", VLDO28, vldo28,
+	MT6358_LDO("ldo_vldo28", VLDO28, "vsys-ldo2", vldo28,
 		   MT6358_LDO_VLDO28_CON0_0, 0,
 		   MT6358_VLDO28_ANA_CON0, 0x300),
-	MT6358_LDO("ldo_vsim2", VSIM2, vsim,
+	MT6358_LDO("ldo_vsim2", VSIM2, "vsys-ldo2", vsim,
 		   MT6358_LDO_VSIM2_CON0, 0, MT6358_VSIM2_ANA_CON0, 0xf00),
-	MT6358_LDO1("ldo_vsram_proc11", VSRAM_PROC11, 500000, 1293750, 6250,
+	MT6358_LDO1("ldo_vsram_proc11", VSRAM_PROC11, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC11_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON0, 0x7f),
-	MT6358_LDO1("ldo_vsram_others", VSRAM_OTHERS, 500000, 1293750, 6250,
+	MT6358_LDO1("ldo_vsram_others", VSRAM_OTHERS, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_OTHERS_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON2, 0x7f),
-	MT6358_LDO1("ldo_vsram_gpu", VSRAM_GPU, 500000, 1293750, 6250,
+	MT6358_LDO1("ldo_vsram_gpu", VSRAM_GPU, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_GPU_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON3, 0x7f),
-	MT6358_LDO1("ldo_vsram_proc12", VSRAM_PROC12, 500000, 1293750, 6250,
+	MT6358_LDO1("ldo_vsram_proc12", VSRAM_PROC12, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC12_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON1, 0x7f),
 };
 
-- 
2.42.0.rc1.204.g551eb34607-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 07/11] regulator: mt6358: fix and drop type prefix in MT6366 regulator node names
  2023-08-22  8:45 ` Chen-Yu Tsai
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The new MT6366 binding does away with the type prefix ("buck_", "ldo_")
in the regulator node names. This better matches the PMIC pin names.
Remaining underscores in names are also replaced with hyphens.

Drop the type prefixes and replace remaining underscores to match the
MT6366 binding.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/regulator/mt6358-regulator.c | 70 ++++++++++++++--------------
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c
index db75f644966a..bc7fe2ff189d 100644
--- a/drivers/regulator/mt6358-regulator.c
+++ b/drivers/regulator/mt6358-regulator.c
@@ -532,68 +532,68 @@ static const struct mt6358_regulator_info mt6358_regulators[] = {
 
 /* The array is indexed by id(MT6366_ID_XXX) */
 static const struct mt6358_regulator_info mt6366_regulators[] = {
-	MT6366_BUCK("buck_vdram1", VDRAM1, 500000, 2087500, 12500,
+	MT6366_BUCK("vdram1", VDRAM1, 500000, 2087500, 12500,
 		    0x7f, MT6358_BUCK_VDRAM1_DBG0, 0x7f, MT6358_VDRAM1_ANA_CON0, 8),
-	MT6366_BUCK("buck_vcore", VCORE, 500000, 1293750, 6250,
+	MT6366_BUCK("vcore", VCORE, 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VCORE_DBG0, 0x7f, MT6358_VCORE_VGPU_ANA_CON0, 1),
-	MT6366_BUCK("buck_vpa", VPA, 500000, 3650000, 50000,
+	MT6366_BUCK("vpa", VPA, 500000, 3650000, 50000,
 		    0x3f, MT6358_BUCK_VPA_DBG0, 0x3f, MT6358_VPA_ANA_CON0, 3),
-	MT6366_BUCK("buck_vproc11", VPROC11, 500000, 1293750, 6250,
+	MT6366_BUCK("vproc11", VPROC11, 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VPROC11_DBG0, 0x7f, MT6358_VPROC_ANA_CON0, 1),
-	MT6366_BUCK("buck_vproc12", VPROC12, 500000, 1293750, 6250,
+	MT6366_BUCK("vproc12", VPROC12, 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VPROC12_DBG0, 0x7f, MT6358_VPROC_ANA_CON0, 2),
-	MT6366_BUCK("buck_vgpu", VGPU, 500000, 1293750, 6250,
+	MT6366_BUCK("vgpu", VGPU, 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VGPU_ELR0, 0x7f, MT6358_VCORE_VGPU_ANA_CON0, 2),
-	MT6366_BUCK("buck_vs2", VS2, 500000, 2087500, 12500,
+	MT6366_BUCK("vs2", VS2, 500000, 2087500, 12500,
 		    0x7f, MT6358_BUCK_VS2_DBG0, 0x7f, MT6358_VS2_ANA_CON0, 8),
-	MT6366_BUCK("buck_vmodem", VMODEM, 500000, 1293750, 6250,
+	MT6366_BUCK("vmodem", VMODEM, 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VMODEM_DBG0, 0x7f, MT6358_VMODEM_ANA_CON0, 8),
-	MT6366_BUCK("buck_vs1", VS1, 1000000, 2587500, 12500,
+	MT6366_BUCK("vs1", VS1, 1000000, 2587500, 12500,
 		    0x7f, MT6358_BUCK_VS1_DBG0, 0x7f, MT6358_VS1_ANA_CON0, 8),
-	MT6366_REG_FIXED("ldo_vrf12", VRF12,
+	MT6366_REG_FIXED("vrf12", VRF12,
 			 MT6358_LDO_VRF12_CON0, 0, 1200000),
-	MT6366_REG_FIXED("ldo_vio18", VIO18,
+	MT6366_REG_FIXED("vio18", VIO18,
 			 MT6358_LDO_VIO18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("ldo_vcn18", VCN18, MT6358_LDO_VCN18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("ldo_vfe28", VFE28, MT6358_LDO_VFE28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("ldo_vcn28", VCN28, MT6358_LDO_VCN28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("ldo_vxo22", VXO22, MT6358_LDO_VXO22_CON0, 0, 2200000),
-	MT6366_REG_FIXED("ldo_vaux18", VAUX18,
+	MT6366_REG_FIXED("vcn18", VCN18, MT6358_LDO_VCN18_CON0, 0, 1800000),
+	MT6366_REG_FIXED("vfe28", VFE28, MT6358_LDO_VFE28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("vcn28", VCN28, MT6358_LDO_VCN28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("vxo22", VXO22, MT6358_LDO_VXO22_CON0, 0, 2200000),
+	MT6366_REG_FIXED("vaux18", VAUX18,
 			 MT6358_LDO_VAUX18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("ldo_vbif28", VBIF28,
+	MT6366_REG_FIXED("vbif28", VBIF28,
 			 MT6358_LDO_VBIF28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("ldo_vio28", VIO28, MT6358_LDO_VIO28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("ldo_va12", VA12, MT6358_LDO_VA12_CON0, 0, 1200000),
-	MT6366_REG_FIXED("ldo_vrf18", VRF18, MT6358_LDO_VRF18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("ldo_vaud28", VAUD28,
+	MT6366_REG_FIXED("vio28", VIO28, MT6358_LDO_VIO28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("va12", VA12, MT6358_LDO_VA12_CON0, 0, 1200000),
+	MT6366_REG_FIXED("vrf18", VRF18, MT6358_LDO_VRF18_CON0, 0, 1800000),
+	MT6366_REG_FIXED("vaud28", VAUD28,
 			 MT6358_LDO_VAUD28_CON0, 0, 2800000),
-	MT6366_LDO("ldo_vdram2", VDRAM2, vdram2,
+	MT6366_LDO("vdram2", VDRAM2, vdram2,
 		   MT6358_LDO_VDRAM2_CON0, 0, MT6358_LDO_VDRAM2_ELR0, 0x10),
-	MT6366_LDO("ldo_vsim1", VSIM1, vsim,
+	MT6366_LDO("vsim1", VSIM1, vsim,
 		   MT6358_LDO_VSIM1_CON0, 0, MT6358_VSIM1_ANA_CON0, 0xf00),
-	MT6366_LDO("ldo_vibr", VIBR, vibr,
+	MT6366_LDO("vibr", VIBR, vibr,
 		   MT6358_LDO_VIBR_CON0, 0, MT6358_VIBR_ANA_CON0, 0xf00),
-	MT6366_LDO("ldo_vusb", VUSB, vusb,
+	MT6366_LDO("vusb", VUSB, vusb,
 		   MT6358_LDO_VUSB_CON0_0, 0, MT6358_VUSB_ANA_CON0, 0x700),
-	MT6366_LDO("ldo_vefuse", VEFUSE, vefuse,
+	MT6366_LDO("vefuse", VEFUSE, vefuse,
 		   MT6358_LDO_VEFUSE_CON0, 0, MT6358_VEFUSE_ANA_CON0, 0xf00),
-	MT6366_LDO("ldo_vmch", VMCH, vmch_vemc,
+	MT6366_LDO("vmch", VMCH, vmch_vemc,
 		   MT6358_LDO_VMCH_CON0, 0, MT6358_VMCH_ANA_CON0, 0x700),
-	MT6366_LDO("ldo_vemc", VEMC, vmch_vemc,
+	MT6366_LDO("vemc", VEMC, vmch_vemc,
 		   MT6358_LDO_VEMC_CON0, 0, MT6358_VEMC_ANA_CON0, 0x700),
-	MT6366_LDO("ldo_vcn33", VCN33, vcn33,
+	MT6366_LDO("vcn33", VCN33, vcn33,
 		   MT6358_LDO_VCN33_CON0_0, 0, MT6358_VCN33_ANA_CON0, 0x300),
-	MT6366_LDO("ldo_vmc", VMC, vmc,
+	MT6366_LDO("vmc", VMC, vmc,
 		   MT6358_LDO_VMC_CON0, 0, MT6358_VMC_ANA_CON0, 0xf00),
-	MT6366_LDO("ldo_vsim2", VSIM2, vsim,
+	MT6366_LDO("vsim2", VSIM2, vsim,
 		   MT6358_LDO_VSIM2_CON0, 0, MT6358_VSIM2_ANA_CON0, 0xf00),
-	MT6366_LDO1("ldo_vsram_proc11", VSRAM_PROC11, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-proc11", VSRAM_PROC11, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC11_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON0, 0x7f),
-	MT6366_LDO1("ldo_vsram_others", VSRAM_OTHERS, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-others", VSRAM_OTHERS, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_OTHERS_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON2, 0x7f),
-	MT6366_LDO1("ldo_vsram_gpu", VSRAM_GPU, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-gpu", VSRAM_GPU, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_GPU_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON3, 0x7f),
-	MT6366_LDO1("ldo_vsram_proc12", VSRAM_PROC12, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-proc12", VSRAM_PROC12, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC12_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON1, 0x7f),
 };
 
-- 
2.42.0.rc1.204.g551eb34607-goog


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

* [PATCH v2 07/11] regulator: mt6358: fix and drop type prefix in MT6366 regulator node names
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The new MT6366 binding does away with the type prefix ("buck_", "ldo_")
in the regulator node names. This better matches the PMIC pin names.
Remaining underscores in names are also replaced with hyphens.

Drop the type prefixes and replace remaining underscores to match the
MT6366 binding.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/regulator/mt6358-regulator.c | 70 ++++++++++++++--------------
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c
index db75f644966a..bc7fe2ff189d 100644
--- a/drivers/regulator/mt6358-regulator.c
+++ b/drivers/regulator/mt6358-regulator.c
@@ -532,68 +532,68 @@ static const struct mt6358_regulator_info mt6358_regulators[] = {
 
 /* The array is indexed by id(MT6366_ID_XXX) */
 static const struct mt6358_regulator_info mt6366_regulators[] = {
-	MT6366_BUCK("buck_vdram1", VDRAM1, 500000, 2087500, 12500,
+	MT6366_BUCK("vdram1", VDRAM1, 500000, 2087500, 12500,
 		    0x7f, MT6358_BUCK_VDRAM1_DBG0, 0x7f, MT6358_VDRAM1_ANA_CON0, 8),
-	MT6366_BUCK("buck_vcore", VCORE, 500000, 1293750, 6250,
+	MT6366_BUCK("vcore", VCORE, 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VCORE_DBG0, 0x7f, MT6358_VCORE_VGPU_ANA_CON0, 1),
-	MT6366_BUCK("buck_vpa", VPA, 500000, 3650000, 50000,
+	MT6366_BUCK("vpa", VPA, 500000, 3650000, 50000,
 		    0x3f, MT6358_BUCK_VPA_DBG0, 0x3f, MT6358_VPA_ANA_CON0, 3),
-	MT6366_BUCK("buck_vproc11", VPROC11, 500000, 1293750, 6250,
+	MT6366_BUCK("vproc11", VPROC11, 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VPROC11_DBG0, 0x7f, MT6358_VPROC_ANA_CON0, 1),
-	MT6366_BUCK("buck_vproc12", VPROC12, 500000, 1293750, 6250,
+	MT6366_BUCK("vproc12", VPROC12, 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VPROC12_DBG0, 0x7f, MT6358_VPROC_ANA_CON0, 2),
-	MT6366_BUCK("buck_vgpu", VGPU, 500000, 1293750, 6250,
+	MT6366_BUCK("vgpu", VGPU, 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VGPU_ELR0, 0x7f, MT6358_VCORE_VGPU_ANA_CON0, 2),
-	MT6366_BUCK("buck_vs2", VS2, 500000, 2087500, 12500,
+	MT6366_BUCK("vs2", VS2, 500000, 2087500, 12500,
 		    0x7f, MT6358_BUCK_VS2_DBG0, 0x7f, MT6358_VS2_ANA_CON0, 8),
-	MT6366_BUCK("buck_vmodem", VMODEM, 500000, 1293750, 6250,
+	MT6366_BUCK("vmodem", VMODEM, 500000, 1293750, 6250,
 		    0x7f, MT6358_BUCK_VMODEM_DBG0, 0x7f, MT6358_VMODEM_ANA_CON0, 8),
-	MT6366_BUCK("buck_vs1", VS1, 1000000, 2587500, 12500,
+	MT6366_BUCK("vs1", VS1, 1000000, 2587500, 12500,
 		    0x7f, MT6358_BUCK_VS1_DBG0, 0x7f, MT6358_VS1_ANA_CON0, 8),
-	MT6366_REG_FIXED("ldo_vrf12", VRF12,
+	MT6366_REG_FIXED("vrf12", VRF12,
 			 MT6358_LDO_VRF12_CON0, 0, 1200000),
-	MT6366_REG_FIXED("ldo_vio18", VIO18,
+	MT6366_REG_FIXED("vio18", VIO18,
 			 MT6358_LDO_VIO18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("ldo_vcn18", VCN18, MT6358_LDO_VCN18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("ldo_vfe28", VFE28, MT6358_LDO_VFE28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("ldo_vcn28", VCN28, MT6358_LDO_VCN28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("ldo_vxo22", VXO22, MT6358_LDO_VXO22_CON0, 0, 2200000),
-	MT6366_REG_FIXED("ldo_vaux18", VAUX18,
+	MT6366_REG_FIXED("vcn18", VCN18, MT6358_LDO_VCN18_CON0, 0, 1800000),
+	MT6366_REG_FIXED("vfe28", VFE28, MT6358_LDO_VFE28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("vcn28", VCN28, MT6358_LDO_VCN28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("vxo22", VXO22, MT6358_LDO_VXO22_CON0, 0, 2200000),
+	MT6366_REG_FIXED("vaux18", VAUX18,
 			 MT6358_LDO_VAUX18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("ldo_vbif28", VBIF28,
+	MT6366_REG_FIXED("vbif28", VBIF28,
 			 MT6358_LDO_VBIF28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("ldo_vio28", VIO28, MT6358_LDO_VIO28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("ldo_va12", VA12, MT6358_LDO_VA12_CON0, 0, 1200000),
-	MT6366_REG_FIXED("ldo_vrf18", VRF18, MT6358_LDO_VRF18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("ldo_vaud28", VAUD28,
+	MT6366_REG_FIXED("vio28", VIO28, MT6358_LDO_VIO28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("va12", VA12, MT6358_LDO_VA12_CON0, 0, 1200000),
+	MT6366_REG_FIXED("vrf18", VRF18, MT6358_LDO_VRF18_CON0, 0, 1800000),
+	MT6366_REG_FIXED("vaud28", VAUD28,
 			 MT6358_LDO_VAUD28_CON0, 0, 2800000),
-	MT6366_LDO("ldo_vdram2", VDRAM2, vdram2,
+	MT6366_LDO("vdram2", VDRAM2, vdram2,
 		   MT6358_LDO_VDRAM2_CON0, 0, MT6358_LDO_VDRAM2_ELR0, 0x10),
-	MT6366_LDO("ldo_vsim1", VSIM1, vsim,
+	MT6366_LDO("vsim1", VSIM1, vsim,
 		   MT6358_LDO_VSIM1_CON0, 0, MT6358_VSIM1_ANA_CON0, 0xf00),
-	MT6366_LDO("ldo_vibr", VIBR, vibr,
+	MT6366_LDO("vibr", VIBR, vibr,
 		   MT6358_LDO_VIBR_CON0, 0, MT6358_VIBR_ANA_CON0, 0xf00),
-	MT6366_LDO("ldo_vusb", VUSB, vusb,
+	MT6366_LDO("vusb", VUSB, vusb,
 		   MT6358_LDO_VUSB_CON0_0, 0, MT6358_VUSB_ANA_CON0, 0x700),
-	MT6366_LDO("ldo_vefuse", VEFUSE, vefuse,
+	MT6366_LDO("vefuse", VEFUSE, vefuse,
 		   MT6358_LDO_VEFUSE_CON0, 0, MT6358_VEFUSE_ANA_CON0, 0xf00),
-	MT6366_LDO("ldo_vmch", VMCH, vmch_vemc,
+	MT6366_LDO("vmch", VMCH, vmch_vemc,
 		   MT6358_LDO_VMCH_CON0, 0, MT6358_VMCH_ANA_CON0, 0x700),
-	MT6366_LDO("ldo_vemc", VEMC, vmch_vemc,
+	MT6366_LDO("vemc", VEMC, vmch_vemc,
 		   MT6358_LDO_VEMC_CON0, 0, MT6358_VEMC_ANA_CON0, 0x700),
-	MT6366_LDO("ldo_vcn33", VCN33, vcn33,
+	MT6366_LDO("vcn33", VCN33, vcn33,
 		   MT6358_LDO_VCN33_CON0_0, 0, MT6358_VCN33_ANA_CON0, 0x300),
-	MT6366_LDO("ldo_vmc", VMC, vmc,
+	MT6366_LDO("vmc", VMC, vmc,
 		   MT6358_LDO_VMC_CON0, 0, MT6358_VMC_ANA_CON0, 0xf00),
-	MT6366_LDO("ldo_vsim2", VSIM2, vsim,
+	MT6366_LDO("vsim2", VSIM2, vsim,
 		   MT6358_LDO_VSIM2_CON0, 0, MT6358_VSIM2_ANA_CON0, 0xf00),
-	MT6366_LDO1("ldo_vsram_proc11", VSRAM_PROC11, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-proc11", VSRAM_PROC11, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC11_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON0, 0x7f),
-	MT6366_LDO1("ldo_vsram_others", VSRAM_OTHERS, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-others", VSRAM_OTHERS, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_OTHERS_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON2, 0x7f),
-	MT6366_LDO1("ldo_vsram_gpu", VSRAM_GPU, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-gpu", VSRAM_GPU, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_GPU_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON3, 0x7f),
-	MT6366_LDO1("ldo_vsram_proc12", VSRAM_PROC12, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-proc12", VSRAM_PROC12, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC12_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON1, 0x7f),
 };
 
-- 
2.42.0.rc1.204.g551eb34607-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 08/11] regulator: mt6358: Make MT6366 vcn18 LDO configurable
  2023-08-22  8:45 ` Chen-Yu Tsai
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The VCN18 regulator on the MT6366 (only) actually has a wide
configurable range of voltages, even though its name suggests a fixed
output voltage.

Convert it from a fixed LDO to a configurable LDO. Its range of settings
is the same as the VM18 regulator, which is missing and will be added in
a subsequent patch.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/regulator/mt6358-regulator.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c
index bc7fe2ff189d..587ee852c053 100644
--- a/drivers/regulator/mt6358-regulator.c
+++ b/drivers/regulator/mt6358-regulator.c
@@ -326,6 +326,27 @@ static const struct linear_range vldo28_ranges[] = {
 	REGULATOR_LINEAR_RANGE(3000000, 11, 21, 10000),
 };
 
+static const unsigned int mt6366_vcn18_vm18_selectors[] = {
+	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
+static const struct linear_range mt6366_vcn18_vm18_ranges[] = {
+	REGULATOR_LINEAR_RANGE(600000, 0, 10, 10000),
+	REGULATOR_LINEAR_RANGE(700000, 11, 21, 10000),
+	REGULATOR_LINEAR_RANGE(800000, 22, 32, 10000),
+	REGULATOR_LINEAR_RANGE(900000, 33, 43, 10000),
+	REGULATOR_LINEAR_RANGE(1000000, 44, 54, 10000),
+	REGULATOR_LINEAR_RANGE(1100000, 55, 65, 10000),
+	REGULATOR_LINEAR_RANGE(1200000, 66, 76, 10000),
+	REGULATOR_LINEAR_RANGE(1300000, 77, 87, 10000),
+	REGULATOR_LINEAR_RANGE(1400000, 88, 98, 10000),
+	REGULATOR_LINEAR_RANGE(1500000, 99, 109, 10000),
+	REGULATOR_LINEAR_RANGE(1600000, 110, 120, 10000),
+	REGULATOR_LINEAR_RANGE(1700000, 121, 131, 10000),
+	REGULATOR_LINEAR_RANGE(1800000, 132, 142, 10000),
+	REGULATOR_LINEAR_RANGE(1900000, 143, 153, 10000),
+	REGULATOR_LINEAR_RANGE(2000000, 154, 164, 10000),
+	REGULATOR_LINEAR_RANGE(2100000, 165, 175, 10000),
+};
+
 static unsigned int mt6358_map_mode(unsigned int mode)
 {
 	return mode == MT6358_BUCK_MODE_AUTO ?
@@ -554,7 +575,6 @@ static const struct mt6358_regulator_info mt6366_regulators[] = {
 			 MT6358_LDO_VRF12_CON0, 0, 1200000),
 	MT6366_REG_FIXED("vio18", VIO18,
 			 MT6358_LDO_VIO18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("vcn18", VCN18, MT6358_LDO_VCN18_CON0, 0, 1800000),
 	MT6366_REG_FIXED("vfe28", VFE28, MT6358_LDO_VFE28_CON0, 0, 2800000),
 	MT6366_REG_FIXED("vcn28", VCN28, MT6358_LDO_VCN28_CON0, 0, 2800000),
 	MT6366_REG_FIXED("vxo22", VXO22, MT6358_LDO_VXO22_CON0, 0, 2200000),
@@ -587,6 +607,8 @@ static const struct mt6358_regulator_info mt6366_regulators[] = {
 		   MT6358_LDO_VMC_CON0, 0, MT6358_VMC_ANA_CON0, 0xf00),
 	MT6366_LDO("vsim2", VSIM2, vsim,
 		   MT6358_LDO_VSIM2_CON0, 0, MT6358_VSIM2_ANA_CON0, 0xf00),
+	MT6366_LDO("vcn18", VCN18, mt6366_vcn18_vm18,
+		   MT6358_LDO_VCN18_CON0, 0, MT6358_VCN18_ANA_CON0, 0xf00),
 	MT6366_LDO1("vsram-proc11", VSRAM_PROC11, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC11_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON0, 0x7f),
 	MT6366_LDO1("vsram-others", VSRAM_OTHERS, 500000, 1293750, 6250,
-- 
2.42.0.rc1.204.g551eb34607-goog


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

* [PATCH v2 08/11] regulator: mt6358: Make MT6366 vcn18 LDO configurable
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The VCN18 regulator on the MT6366 (only) actually has a wide
configurable range of voltages, even though its name suggests a fixed
output voltage.

Convert it from a fixed LDO to a configurable LDO. Its range of settings
is the same as the VM18 regulator, which is missing and will be added in
a subsequent patch.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/regulator/mt6358-regulator.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c
index bc7fe2ff189d..587ee852c053 100644
--- a/drivers/regulator/mt6358-regulator.c
+++ b/drivers/regulator/mt6358-regulator.c
@@ -326,6 +326,27 @@ static const struct linear_range vldo28_ranges[] = {
 	REGULATOR_LINEAR_RANGE(3000000, 11, 21, 10000),
 };
 
+static const unsigned int mt6366_vcn18_vm18_selectors[] = {
+	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
+static const struct linear_range mt6366_vcn18_vm18_ranges[] = {
+	REGULATOR_LINEAR_RANGE(600000, 0, 10, 10000),
+	REGULATOR_LINEAR_RANGE(700000, 11, 21, 10000),
+	REGULATOR_LINEAR_RANGE(800000, 22, 32, 10000),
+	REGULATOR_LINEAR_RANGE(900000, 33, 43, 10000),
+	REGULATOR_LINEAR_RANGE(1000000, 44, 54, 10000),
+	REGULATOR_LINEAR_RANGE(1100000, 55, 65, 10000),
+	REGULATOR_LINEAR_RANGE(1200000, 66, 76, 10000),
+	REGULATOR_LINEAR_RANGE(1300000, 77, 87, 10000),
+	REGULATOR_LINEAR_RANGE(1400000, 88, 98, 10000),
+	REGULATOR_LINEAR_RANGE(1500000, 99, 109, 10000),
+	REGULATOR_LINEAR_RANGE(1600000, 110, 120, 10000),
+	REGULATOR_LINEAR_RANGE(1700000, 121, 131, 10000),
+	REGULATOR_LINEAR_RANGE(1800000, 132, 142, 10000),
+	REGULATOR_LINEAR_RANGE(1900000, 143, 153, 10000),
+	REGULATOR_LINEAR_RANGE(2000000, 154, 164, 10000),
+	REGULATOR_LINEAR_RANGE(2100000, 165, 175, 10000),
+};
+
 static unsigned int mt6358_map_mode(unsigned int mode)
 {
 	return mode == MT6358_BUCK_MODE_AUTO ?
@@ -554,7 +575,6 @@ static const struct mt6358_regulator_info mt6366_regulators[] = {
 			 MT6358_LDO_VRF12_CON0, 0, 1200000),
 	MT6366_REG_FIXED("vio18", VIO18,
 			 MT6358_LDO_VIO18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("vcn18", VCN18, MT6358_LDO_VCN18_CON0, 0, 1800000),
 	MT6366_REG_FIXED("vfe28", VFE28, MT6358_LDO_VFE28_CON0, 0, 2800000),
 	MT6366_REG_FIXED("vcn28", VCN28, MT6358_LDO_VCN28_CON0, 0, 2800000),
 	MT6366_REG_FIXED("vxo22", VXO22, MT6358_LDO_VXO22_CON0, 0, 2200000),
@@ -587,6 +607,8 @@ static const struct mt6358_regulator_info mt6366_regulators[] = {
 		   MT6358_LDO_VMC_CON0, 0, MT6358_VMC_ANA_CON0, 0xf00),
 	MT6366_LDO("vsim2", VSIM2, vsim,
 		   MT6358_LDO_VSIM2_CON0, 0, MT6358_VSIM2_ANA_CON0, 0xf00),
+	MT6366_LDO("vcn18", VCN18, mt6366_vcn18_vm18,
+		   MT6358_LDO_VCN18_CON0, 0, MT6358_VCN18_ANA_CON0, 0xf00),
 	MT6366_LDO1("vsram-proc11", VSRAM_PROC11, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC11_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON0, 0x7f),
 	MT6366_LDO1("vsram-others", VSRAM_OTHERS, 500000, 1293750, 6250,
-- 
2.42.0.rc1.204.g551eb34607-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 09/11] regulator: mt6358: Add missing regulators for MT6366
  2023-08-22  8:45 ` Chen-Yu Tsai
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

When support for the MT6366 PMIC regulators was added, it was assumed
that it had the same functionality as MT6358. In reality there are
differences. A few regulators have different ranges, or were renamed
and repurposed, or removed altogether.

Add the 3 regulators that were missing from the original submission.
These are added for completeness. VSRAM_CORE is not used in existing
projects. VM18 and VMDDR feed DRAM related consumers, and are not used
in-kernel.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/regulator/mt6358-regulator.c       | 20 ++++++++++++++++++++
 include/linux/regulator/mt6358-regulator.h |  3 +++
 2 files changed, 23 insertions(+)

diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c
index 587ee852c053..658c4dbf478f 100644
--- a/drivers/regulator/mt6358-regulator.c
+++ b/drivers/regulator/mt6358-regulator.c
@@ -326,6 +326,20 @@ static const struct linear_range vldo28_ranges[] = {
 	REGULATOR_LINEAR_RANGE(3000000, 11, 21, 10000),
 };
 
+static const unsigned int mt6366_vmddr_selectors[] = { 0, 1, 2, 3, 4, 5, 6, 7, 9, 12 };
+static const struct linear_range mt6366_vmddr_ranges[] = {
+	REGULATOR_LINEAR_RANGE(600000, 0, 10, 10000),
+	REGULATOR_LINEAR_RANGE(700000, 11, 21, 10000),
+	REGULATOR_LINEAR_RANGE(800000, 22, 32, 10000),
+	REGULATOR_LINEAR_RANGE(900000, 33, 43, 10000),
+	REGULATOR_LINEAR_RANGE(1000000, 44, 54, 10000),
+	REGULATOR_LINEAR_RANGE(1100000, 55, 65, 10000),
+	REGULATOR_LINEAR_RANGE(1200000, 66, 76, 10000),
+	REGULATOR_LINEAR_RANGE(1300000, 77, 87, 10000),
+	REGULATOR_LINEAR_RANGE(1500000, 88, 98, 10000),
+	REGULATOR_LINEAR_RANGE(1800000, 99, 109, 10000),
+};
+
 static const unsigned int mt6366_vcn18_vm18_selectors[] = {
 	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
 static const struct linear_range mt6366_vcn18_vm18_ranges[] = {
@@ -609,6 +623,10 @@ static const struct mt6358_regulator_info mt6366_regulators[] = {
 		   MT6358_LDO_VSIM2_CON0, 0, MT6358_VSIM2_ANA_CON0, 0xf00),
 	MT6366_LDO("vcn18", VCN18, mt6366_vcn18_vm18,
 		   MT6358_LDO_VCN18_CON0, 0, MT6358_VCN18_ANA_CON0, 0xf00),
+	MT6366_LDO("vm18", VM18, mt6366_vcn18_vm18,
+		   MT6358_LDO_VM18_CON0, 0, MT6358_VM18_ANA_CON0, 0xf00),
+	MT6366_LDO("vmddr", VMDDR, mt6366_vmddr,
+		   MT6358_LDO_VMDDR_CON0, 0, MT6358_VMDDR_ANA_CON0, 0xf00),
 	MT6366_LDO1("vsram-proc11", VSRAM_PROC11, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC11_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON0, 0x7f),
 	MT6366_LDO1("vsram-others", VSRAM_OTHERS, 500000, 1293750, 6250,
@@ -617,6 +635,8 @@ static const struct mt6358_regulator_info mt6366_regulators[] = {
 		    MT6358_LDO_VSRAM_GPU_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON3, 0x7f),
 	MT6366_LDO1("vsram-proc12", VSRAM_PROC12, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC12_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON1, 0x7f),
+	MT6366_LDO1("vsram-core", VSRAM_CORE, 500000, 1293750, 6250,
+		    MT6358_LDO_VSRAM_CORE_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON5, 0x7f),
 };
 
 static int mt6358_sync_vcn33_setting(struct device *dev)
diff --git a/include/linux/regulator/mt6358-regulator.h b/include/linux/regulator/mt6358-regulator.h
index c71a6a9fce7a..562386f9b80e 100644
--- a/include/linux/regulator/mt6358-regulator.h
+++ b/include/linux/regulator/mt6358-regulator.h
@@ -86,6 +86,9 @@ enum {
 	MT6366_ID_VMC,
 	MT6366_ID_VAUD28,
 	MT6366_ID_VSIM2,
+	MT6366_ID_VM18,
+	MT6366_ID_VMDDR,
+	MT6366_ID_VSRAM_CORE,
 	MT6366_ID_RG_MAX,
 };
 
-- 
2.42.0.rc1.204.g551eb34607-goog


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

* [PATCH v2 09/11] regulator: mt6358: Add missing regulators for MT6366
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

When support for the MT6366 PMIC regulators was added, it was assumed
that it had the same functionality as MT6358. In reality there are
differences. A few regulators have different ranges, or were renamed
and repurposed, or removed altogether.

Add the 3 regulators that were missing from the original submission.
These are added for completeness. VSRAM_CORE is not used in existing
projects. VM18 and VMDDR feed DRAM related consumers, and are not used
in-kernel.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/regulator/mt6358-regulator.c       | 20 ++++++++++++++++++++
 include/linux/regulator/mt6358-regulator.h |  3 +++
 2 files changed, 23 insertions(+)

diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c
index 587ee852c053..658c4dbf478f 100644
--- a/drivers/regulator/mt6358-regulator.c
+++ b/drivers/regulator/mt6358-regulator.c
@@ -326,6 +326,20 @@ static const struct linear_range vldo28_ranges[] = {
 	REGULATOR_LINEAR_RANGE(3000000, 11, 21, 10000),
 };
 
+static const unsigned int mt6366_vmddr_selectors[] = { 0, 1, 2, 3, 4, 5, 6, 7, 9, 12 };
+static const struct linear_range mt6366_vmddr_ranges[] = {
+	REGULATOR_LINEAR_RANGE(600000, 0, 10, 10000),
+	REGULATOR_LINEAR_RANGE(700000, 11, 21, 10000),
+	REGULATOR_LINEAR_RANGE(800000, 22, 32, 10000),
+	REGULATOR_LINEAR_RANGE(900000, 33, 43, 10000),
+	REGULATOR_LINEAR_RANGE(1000000, 44, 54, 10000),
+	REGULATOR_LINEAR_RANGE(1100000, 55, 65, 10000),
+	REGULATOR_LINEAR_RANGE(1200000, 66, 76, 10000),
+	REGULATOR_LINEAR_RANGE(1300000, 77, 87, 10000),
+	REGULATOR_LINEAR_RANGE(1500000, 88, 98, 10000),
+	REGULATOR_LINEAR_RANGE(1800000, 99, 109, 10000),
+};
+
 static const unsigned int mt6366_vcn18_vm18_selectors[] = {
 	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
 static const struct linear_range mt6366_vcn18_vm18_ranges[] = {
@@ -609,6 +623,10 @@ static const struct mt6358_regulator_info mt6366_regulators[] = {
 		   MT6358_LDO_VSIM2_CON0, 0, MT6358_VSIM2_ANA_CON0, 0xf00),
 	MT6366_LDO("vcn18", VCN18, mt6366_vcn18_vm18,
 		   MT6358_LDO_VCN18_CON0, 0, MT6358_VCN18_ANA_CON0, 0xf00),
+	MT6366_LDO("vm18", VM18, mt6366_vcn18_vm18,
+		   MT6358_LDO_VM18_CON0, 0, MT6358_VM18_ANA_CON0, 0xf00),
+	MT6366_LDO("vmddr", VMDDR, mt6366_vmddr,
+		   MT6358_LDO_VMDDR_CON0, 0, MT6358_VMDDR_ANA_CON0, 0xf00),
 	MT6366_LDO1("vsram-proc11", VSRAM_PROC11, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC11_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON0, 0x7f),
 	MT6366_LDO1("vsram-others", VSRAM_OTHERS, 500000, 1293750, 6250,
@@ -617,6 +635,8 @@ static const struct mt6358_regulator_info mt6366_regulators[] = {
 		    MT6358_LDO_VSRAM_GPU_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON3, 0x7f),
 	MT6366_LDO1("vsram-proc12", VSRAM_PROC12, 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC12_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON1, 0x7f),
+	MT6366_LDO1("vsram-core", VSRAM_CORE, 500000, 1293750, 6250,
+		    MT6358_LDO_VSRAM_CORE_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON5, 0x7f),
 };
 
 static int mt6358_sync_vcn33_setting(struct device *dev)
diff --git a/include/linux/regulator/mt6358-regulator.h b/include/linux/regulator/mt6358-regulator.h
index c71a6a9fce7a..562386f9b80e 100644
--- a/include/linux/regulator/mt6358-regulator.h
+++ b/include/linux/regulator/mt6358-regulator.h
@@ -86,6 +86,9 @@ enum {
 	MT6366_ID_VMC,
 	MT6366_ID_VAUD28,
 	MT6366_ID_VSIM2,
+	MT6366_ID_VM18,
+	MT6366_ID_VMDDR,
+	MT6366_ID_VSRAM_CORE,
 	MT6366_ID_RG_MAX,
 };
 
-- 
2.42.0.rc1.204.g551eb34607-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 10/11] regulator: mt6358: Add supply names for MT6366 regulators
  2023-08-22  8:45 ` Chen-Yu Tsai
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The DT bindings for MT6366 regulator defines the supply names for the
PMIC.

Add support for them by adding .supply_name field settings for each
regulator. The buck regulators each have their own supply whose name
can be derived from the regulator name. The LDOs have shared supplies.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
Changes since v1:
- Replaced underscores in supply names with hyphens
- Reflowed a couple macros for readability

 drivers/regulator/mt6358-regulator.c | 77 +++++++++++++---------------
 1 file changed, 37 insertions(+), 40 deletions(-)

diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c
index 658c4dbf478f..e6533fd62a82 100644
--- a/drivers/regulator/mt6358-regulator.c
+++ b/drivers/regulator/mt6358-regulator.c
@@ -141,6 +141,7 @@ struct mt6358_regulator_info {
 [MT6366_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = "vsys-" match,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_range_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -163,10 +164,11 @@ struct mt6358_regulator_info {
 	.modeset_mask = BIT(_modeset_shift),	\
 }
 
-#define MT6366_LDO(match, vreg, volt_ranges, enreg, enbit, vosel, vosel_mask) \
+#define MT6366_LDO(match, vreg, volt_ranges, supply, enreg, enbit, vosel, vosel_mask) \
 [MT6366_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_table_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -187,12 +189,12 @@ struct mt6358_regulator_info {
 	.qi = BIT(15),	\
 }
 
-#define MT6366_LDO1(match, vreg, min, max, step,	\
-	_da_vsel_reg, _da_vsel_mask,	\
-	vosel, vosel_mask)	\
+#define MT6366_LDO1(match, vreg, supply, min, max, step,	\
+		    _da_vsel_reg, _da_vsel_mask, vosel, vosel_mask)	\
 [MT6366_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_range_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -212,11 +214,11 @@ struct mt6358_regulator_info {
 	.qi = BIT(0),	\
 }
 
-#define MT6366_REG_FIXED(match, vreg,	\
-	enreg, enbit, volt)	\
+#define MT6366_REG_FIXED(match, vreg, supply, enreg, enbit, volt)	\
 [MT6366_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_fixed_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -585,57 +587,52 @@ static const struct mt6358_regulator_info mt6366_regulators[] = {
 		    0x7f, MT6358_BUCK_VMODEM_DBG0, 0x7f, MT6358_VMODEM_ANA_CON0, 8),
 	MT6366_BUCK("vs1", VS1, 1000000, 2587500, 12500,
 		    0x7f, MT6358_BUCK_VS1_DBG0, 0x7f, MT6358_VS1_ANA_CON0, 8),
-	MT6366_REG_FIXED("vrf12", VRF12,
-			 MT6358_LDO_VRF12_CON0, 0, 1200000),
-	MT6366_REG_FIXED("vio18", VIO18,
-			 MT6358_LDO_VIO18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("vfe28", VFE28, MT6358_LDO_VFE28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("vcn28", VCN28, MT6358_LDO_VCN28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("vxo22", VXO22, MT6358_LDO_VXO22_CON0, 0, 2200000),
-	MT6366_REG_FIXED("vaux18", VAUX18,
-			 MT6358_LDO_VAUX18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("vbif28", VBIF28,
-			 MT6358_LDO_VBIF28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("vio28", VIO28, MT6358_LDO_VIO28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("va12", VA12, MT6358_LDO_VA12_CON0, 0, 1200000),
-	MT6366_REG_FIXED("vrf18", VRF18, MT6358_LDO_VRF18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("vaud28", VAUD28,
-			 MT6358_LDO_VAUD28_CON0, 0, 2800000),
-	MT6366_LDO("vdram2", VDRAM2, vdram2,
+	MT6366_REG_FIXED("vrf12", VRF12, "vs2-ldo2", MT6358_LDO_VRF12_CON0, 0, 1200000),
+	MT6366_REG_FIXED("vio18", VIO18, "vs1-ldo1", MT6358_LDO_VIO18_CON0, 0, 1800000),
+	MT6366_REG_FIXED("vfe28", VFE28, "vsys-ldo1", MT6358_LDO_VFE28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("vcn28", VCN28, "vsys-ldo1", MT6358_LDO_VCN28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("vxo22", VXO22, "vsys-ldo1", MT6358_LDO_VXO22_CON0, 0, 2200000),
+	MT6366_REG_FIXED("vaux18", VAUX18, "vsys-ldo1", MT6358_LDO_VAUX18_CON0, 0, 1800000),
+	MT6366_REG_FIXED("vbif28", VBIF28, "vsys-ldo1", MT6358_LDO_VBIF28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("vio28", VIO28, "vsys-ldo2", MT6358_LDO_VIO28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("va12", VA12, "vs2-ldo2", MT6358_LDO_VA12_CON0, 0, 1200000),
+	MT6366_REG_FIXED("vrf18", VRF18, "vs1-ldo1", MT6358_LDO_VRF18_CON0, 0, 1800000),
+	MT6366_REG_FIXED("vaud28", VAUD28, "vsys-ldo1", MT6358_LDO_VAUD28_CON0, 0, 2800000),
+	MT6366_LDO("vdram2", VDRAM2, vdram2, "vs2-ldo1",
 		   MT6358_LDO_VDRAM2_CON0, 0, MT6358_LDO_VDRAM2_ELR0, 0x10),
-	MT6366_LDO("vsim1", VSIM1, vsim,
+	MT6366_LDO("vsim1", VSIM1, vsim, "vsys-ldo1",
 		   MT6358_LDO_VSIM1_CON0, 0, MT6358_VSIM1_ANA_CON0, 0xf00),
-	MT6366_LDO("vibr", VIBR, vibr,
+	MT6366_LDO("vibr", VIBR, vibr, "vsys-ldo3",
 		   MT6358_LDO_VIBR_CON0, 0, MT6358_VIBR_ANA_CON0, 0xf00),
-	MT6366_LDO("vusb", VUSB, vusb,
+	MT6366_LDO("vusb", VUSB, vusb, "vsys-ldo1",
 		   MT6358_LDO_VUSB_CON0_0, 0, MT6358_VUSB_ANA_CON0, 0x700),
-	MT6366_LDO("vefuse", VEFUSE, vefuse,
+	MT6366_LDO("vefuse", VEFUSE, vefuse, "vs1-ldo1",
 		   MT6358_LDO_VEFUSE_CON0, 0, MT6358_VEFUSE_ANA_CON0, 0xf00),
-	MT6366_LDO("vmch", VMCH, vmch_vemc,
+	MT6366_LDO("vmch", VMCH, vmch_vemc, "vsys-ldo2",
 		   MT6358_LDO_VMCH_CON0, 0, MT6358_VMCH_ANA_CON0, 0x700),
-	MT6366_LDO("vemc", VEMC, vmch_vemc,
+	MT6366_LDO("vemc", VEMC, vmch_vemc, "vsys-ldo3",
 		   MT6358_LDO_VEMC_CON0, 0, MT6358_VEMC_ANA_CON0, 0x700),
-	MT6366_LDO("vcn33", VCN33, vcn33,
+	MT6366_LDO("vcn33", VCN33, vcn33, "vsys-ldo3",
 		   MT6358_LDO_VCN33_CON0_0, 0, MT6358_VCN33_ANA_CON0, 0x300),
-	MT6366_LDO("vmc", VMC, vmc,
+	MT6366_LDO("vmc", VMC, vmc, "vsys-ldo2",
 		   MT6358_LDO_VMC_CON0, 0, MT6358_VMC_ANA_CON0, 0xf00),
-	MT6366_LDO("vsim2", VSIM2, vsim,
+	MT6366_LDO("vsim2", VSIM2, vsim, "vsys-ldo2",
 		   MT6358_LDO_VSIM2_CON0, 0, MT6358_VSIM2_ANA_CON0, 0xf00),
-	MT6366_LDO("vcn18", VCN18, mt6366_vcn18_vm18,
+	MT6366_LDO("vcn18", VCN18, mt6366_vcn18_vm18, "vs1-ldo1",
 		   MT6358_LDO_VCN18_CON0, 0, MT6358_VCN18_ANA_CON0, 0xf00),
-	MT6366_LDO("vm18", VM18, mt6366_vcn18_vm18,
+	MT6366_LDO("vm18", VM18, mt6366_vcn18_vm18, "vs1-ldo1",
 		   MT6358_LDO_VM18_CON0, 0, MT6358_VM18_ANA_CON0, 0xf00),
-	MT6366_LDO("vmddr", VMDDR, mt6366_vmddr,
+	MT6366_LDO("vmddr", VMDDR, mt6366_vmddr, "vs2-ldo1",
 		   MT6358_LDO_VMDDR_CON0, 0, MT6358_VMDDR_ANA_CON0, 0xf00),
-	MT6366_LDO1("vsram-proc11", VSRAM_PROC11, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-proc11", VSRAM_PROC11, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC11_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON0, 0x7f),
-	MT6366_LDO1("vsram-others", VSRAM_OTHERS, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-others", VSRAM_OTHERS, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_OTHERS_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON2, 0x7f),
-	MT6366_LDO1("vsram-gpu", VSRAM_GPU, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-gpu", VSRAM_GPU, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_GPU_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON3, 0x7f),
-	MT6366_LDO1("vsram-proc12", VSRAM_PROC12, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-proc12", VSRAM_PROC12, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC12_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON1, 0x7f),
-	MT6366_LDO1("vsram-core", VSRAM_CORE, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-core", VSRAM_CORE, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_CORE_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON5, 0x7f),
 };
 
-- 
2.42.0.rc1.204.g551eb34607-goog


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

* [PATCH v2 10/11] regulator: mt6358: Add supply names for MT6366 regulators
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The DT bindings for MT6366 regulator defines the supply names for the
PMIC.

Add support for them by adding .supply_name field settings for each
regulator. The buck regulators each have their own supply whose name
can be derived from the regulator name. The LDOs have shared supplies.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
Changes since v1:
- Replaced underscores in supply names with hyphens
- Reflowed a couple macros for readability

 drivers/regulator/mt6358-regulator.c | 77 +++++++++++++---------------
 1 file changed, 37 insertions(+), 40 deletions(-)

diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c
index 658c4dbf478f..e6533fd62a82 100644
--- a/drivers/regulator/mt6358-regulator.c
+++ b/drivers/regulator/mt6358-regulator.c
@@ -141,6 +141,7 @@ struct mt6358_regulator_info {
 [MT6366_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = "vsys-" match,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_range_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -163,10 +164,11 @@ struct mt6358_regulator_info {
 	.modeset_mask = BIT(_modeset_shift),	\
 }
 
-#define MT6366_LDO(match, vreg, volt_ranges, enreg, enbit, vosel, vosel_mask) \
+#define MT6366_LDO(match, vreg, volt_ranges, supply, enreg, enbit, vosel, vosel_mask) \
 [MT6366_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_table_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -187,12 +189,12 @@ struct mt6358_regulator_info {
 	.qi = BIT(15),	\
 }
 
-#define MT6366_LDO1(match, vreg, min, max, step,	\
-	_da_vsel_reg, _da_vsel_mask,	\
-	vosel, vosel_mask)	\
+#define MT6366_LDO1(match, vreg, supply, min, max, step,	\
+		    _da_vsel_reg, _da_vsel_mask, vosel, vosel_mask)	\
 [MT6366_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_range_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -212,11 +214,11 @@ struct mt6358_regulator_info {
 	.qi = BIT(0),	\
 }
 
-#define MT6366_REG_FIXED(match, vreg,	\
-	enreg, enbit, volt)	\
+#define MT6366_REG_FIXED(match, vreg, supply, enreg, enbit, volt)	\
 [MT6366_ID_##vreg] = {	\
 	.desc = {	\
 		.name = #vreg,	\
+		.supply_name = supply,		\
 		.of_match = of_match_ptr(match),	\
 		.ops = &mt6358_volt_fixed_ops,	\
 		.type = REGULATOR_VOLTAGE,	\
@@ -585,57 +587,52 @@ static const struct mt6358_regulator_info mt6366_regulators[] = {
 		    0x7f, MT6358_BUCK_VMODEM_DBG0, 0x7f, MT6358_VMODEM_ANA_CON0, 8),
 	MT6366_BUCK("vs1", VS1, 1000000, 2587500, 12500,
 		    0x7f, MT6358_BUCK_VS1_DBG0, 0x7f, MT6358_VS1_ANA_CON0, 8),
-	MT6366_REG_FIXED("vrf12", VRF12,
-			 MT6358_LDO_VRF12_CON0, 0, 1200000),
-	MT6366_REG_FIXED("vio18", VIO18,
-			 MT6358_LDO_VIO18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("vfe28", VFE28, MT6358_LDO_VFE28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("vcn28", VCN28, MT6358_LDO_VCN28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("vxo22", VXO22, MT6358_LDO_VXO22_CON0, 0, 2200000),
-	MT6366_REG_FIXED("vaux18", VAUX18,
-			 MT6358_LDO_VAUX18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("vbif28", VBIF28,
-			 MT6358_LDO_VBIF28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("vio28", VIO28, MT6358_LDO_VIO28_CON0, 0, 2800000),
-	MT6366_REG_FIXED("va12", VA12, MT6358_LDO_VA12_CON0, 0, 1200000),
-	MT6366_REG_FIXED("vrf18", VRF18, MT6358_LDO_VRF18_CON0, 0, 1800000),
-	MT6366_REG_FIXED("vaud28", VAUD28,
-			 MT6358_LDO_VAUD28_CON0, 0, 2800000),
-	MT6366_LDO("vdram2", VDRAM2, vdram2,
+	MT6366_REG_FIXED("vrf12", VRF12, "vs2-ldo2", MT6358_LDO_VRF12_CON0, 0, 1200000),
+	MT6366_REG_FIXED("vio18", VIO18, "vs1-ldo1", MT6358_LDO_VIO18_CON0, 0, 1800000),
+	MT6366_REG_FIXED("vfe28", VFE28, "vsys-ldo1", MT6358_LDO_VFE28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("vcn28", VCN28, "vsys-ldo1", MT6358_LDO_VCN28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("vxo22", VXO22, "vsys-ldo1", MT6358_LDO_VXO22_CON0, 0, 2200000),
+	MT6366_REG_FIXED("vaux18", VAUX18, "vsys-ldo1", MT6358_LDO_VAUX18_CON0, 0, 1800000),
+	MT6366_REG_FIXED("vbif28", VBIF28, "vsys-ldo1", MT6358_LDO_VBIF28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("vio28", VIO28, "vsys-ldo2", MT6358_LDO_VIO28_CON0, 0, 2800000),
+	MT6366_REG_FIXED("va12", VA12, "vs2-ldo2", MT6358_LDO_VA12_CON0, 0, 1200000),
+	MT6366_REG_FIXED("vrf18", VRF18, "vs1-ldo1", MT6358_LDO_VRF18_CON0, 0, 1800000),
+	MT6366_REG_FIXED("vaud28", VAUD28, "vsys-ldo1", MT6358_LDO_VAUD28_CON0, 0, 2800000),
+	MT6366_LDO("vdram2", VDRAM2, vdram2, "vs2-ldo1",
 		   MT6358_LDO_VDRAM2_CON0, 0, MT6358_LDO_VDRAM2_ELR0, 0x10),
-	MT6366_LDO("vsim1", VSIM1, vsim,
+	MT6366_LDO("vsim1", VSIM1, vsim, "vsys-ldo1",
 		   MT6358_LDO_VSIM1_CON0, 0, MT6358_VSIM1_ANA_CON0, 0xf00),
-	MT6366_LDO("vibr", VIBR, vibr,
+	MT6366_LDO("vibr", VIBR, vibr, "vsys-ldo3",
 		   MT6358_LDO_VIBR_CON0, 0, MT6358_VIBR_ANA_CON0, 0xf00),
-	MT6366_LDO("vusb", VUSB, vusb,
+	MT6366_LDO("vusb", VUSB, vusb, "vsys-ldo1",
 		   MT6358_LDO_VUSB_CON0_0, 0, MT6358_VUSB_ANA_CON0, 0x700),
-	MT6366_LDO("vefuse", VEFUSE, vefuse,
+	MT6366_LDO("vefuse", VEFUSE, vefuse, "vs1-ldo1",
 		   MT6358_LDO_VEFUSE_CON0, 0, MT6358_VEFUSE_ANA_CON0, 0xf00),
-	MT6366_LDO("vmch", VMCH, vmch_vemc,
+	MT6366_LDO("vmch", VMCH, vmch_vemc, "vsys-ldo2",
 		   MT6358_LDO_VMCH_CON0, 0, MT6358_VMCH_ANA_CON0, 0x700),
-	MT6366_LDO("vemc", VEMC, vmch_vemc,
+	MT6366_LDO("vemc", VEMC, vmch_vemc, "vsys-ldo3",
 		   MT6358_LDO_VEMC_CON0, 0, MT6358_VEMC_ANA_CON0, 0x700),
-	MT6366_LDO("vcn33", VCN33, vcn33,
+	MT6366_LDO("vcn33", VCN33, vcn33, "vsys-ldo3",
 		   MT6358_LDO_VCN33_CON0_0, 0, MT6358_VCN33_ANA_CON0, 0x300),
-	MT6366_LDO("vmc", VMC, vmc,
+	MT6366_LDO("vmc", VMC, vmc, "vsys-ldo2",
 		   MT6358_LDO_VMC_CON0, 0, MT6358_VMC_ANA_CON0, 0xf00),
-	MT6366_LDO("vsim2", VSIM2, vsim,
+	MT6366_LDO("vsim2", VSIM2, vsim, "vsys-ldo2",
 		   MT6358_LDO_VSIM2_CON0, 0, MT6358_VSIM2_ANA_CON0, 0xf00),
-	MT6366_LDO("vcn18", VCN18, mt6366_vcn18_vm18,
+	MT6366_LDO("vcn18", VCN18, mt6366_vcn18_vm18, "vs1-ldo1",
 		   MT6358_LDO_VCN18_CON0, 0, MT6358_VCN18_ANA_CON0, 0xf00),
-	MT6366_LDO("vm18", VM18, mt6366_vcn18_vm18,
+	MT6366_LDO("vm18", VM18, mt6366_vcn18_vm18, "vs1-ldo1",
 		   MT6358_LDO_VM18_CON0, 0, MT6358_VM18_ANA_CON0, 0xf00),
-	MT6366_LDO("vmddr", VMDDR, mt6366_vmddr,
+	MT6366_LDO("vmddr", VMDDR, mt6366_vmddr, "vs2-ldo1",
 		   MT6358_LDO_VMDDR_CON0, 0, MT6358_VMDDR_ANA_CON0, 0xf00),
-	MT6366_LDO1("vsram-proc11", VSRAM_PROC11, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-proc11", VSRAM_PROC11, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC11_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON0, 0x7f),
-	MT6366_LDO1("vsram-others", VSRAM_OTHERS, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-others", VSRAM_OTHERS, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_OTHERS_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON2, 0x7f),
-	MT6366_LDO1("vsram-gpu", VSRAM_GPU, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-gpu", VSRAM_GPU, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_GPU_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON3, 0x7f),
-	MT6366_LDO1("vsram-proc12", VSRAM_PROC12, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-proc12", VSRAM_PROC12, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_PROC12_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON1, 0x7f),
-	MT6366_LDO1("vsram-core", VSRAM_CORE, 500000, 1293750, 6250,
+	MT6366_LDO1("vsram-core", VSRAM_CORE, "vs2-ldo3", 500000, 1293750, 6250,
 		    MT6358_LDO_VSRAM_CORE_DBG0, 0x7f00, MT6358_LDO_VSRAM_CON5, 0x7f),
 };
 
-- 
2.42.0.rc1.204.g551eb34607-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 11/11] arm64: dts: mediatek: mt8183-kukui: Add PMIC regulator supplies
  2023-08-22  8:45 ` Chen-Yu Tsai
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The PMIC regulator node is missing regulator supplies. Now that the
binding supports them, add all the power rail supplies. Most of them
are fed from a system-wide semi-regulated power rail. A couple LDOs
are fed from the PMIC's own buck regulator outputs.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 .../arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 28 +++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
index 6ce16a265e05..d48c66cc8c18 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
@@ -103,6 +103,14 @@ pp3300_alw: regulator6 {
 		regulator-max-microvolt = <3300000>;
 	};
 
+	/* system wide semi-regulated power rail from charger */
+	reg_vsys: regulator-vsys {
+		compatible = "regulator-fixed";
+		regulator-name = "vsys";
+		regulator-always-on;
+		regulator-boot-on;
+	};
+
 	reserved_memory: reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -404,6 +412,26 @@ &mt6358codec {
 	Avdd-supply = <&mt6358_vaud28_reg>;
 };
 
+&mt6358regulator {
+	vsys-ldo1-supply = <&reg_vsys>;
+	vsys-ldo2-supply = <&reg_vsys>;
+	vsys-ldo3-supply = <&reg_vsys>;
+	vsys-vcore-supply = <&reg_vsys>;
+	vsys-vdram1-supply = <&reg_vsys>;
+	vsys-vgpu-supply = <&reg_vsys>;
+	vsys-vmodem-supply = <&reg_vsys>;
+	vsys-vpa-supply = <&reg_vsys>;
+	vsys-vproc11-supply = <&reg_vsys>;
+	vsys-vproc12-supply = <&reg_vsys>;
+	vsys-vs1-supply = <&reg_vsys>;
+	vsys-vs2-supply = <&reg_vsys>;
+	vs1-ldo1-supply = <&mt6358_vs1_reg>;
+	vs2-ldo1-supply = <&mt6358_vdram1_reg>;
+	vs2-ldo2-supply = <&mt6358_vs2_reg>;
+	vs2-ldo3-supply = <&mt6358_vs2_reg>;
+	vs2-ldo4-supply = <&mt6358_vs2_reg>;
+};
+
 &mt6358_vgpu_reg {
 	regulator-min-microvolt = <625000>;
 	regulator-max-microvolt = <900000>;
-- 
2.42.0.rc1.204.g551eb34607-goog


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

* [PATCH v2 11/11] arm64: dts: mediatek: mt8183-kukui: Add PMIC regulator supplies
@ 2023-08-22  8:45   ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-22  8:45 UTC (permalink / raw)
  To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown
  Cc: Chen-Yu Tsai, Zhiyong Tao, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek

The PMIC regulator node is missing regulator supplies. Now that the
binding supports them, add all the power rail supplies. Most of them
are fed from a system-wide semi-regulated power rail. A couple LDOs
are fed from the PMIC's own buck regulator outputs.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 .../arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 28 +++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
index 6ce16a265e05..d48c66cc8c18 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
@@ -103,6 +103,14 @@ pp3300_alw: regulator6 {
 		regulator-max-microvolt = <3300000>;
 	};
 
+	/* system wide semi-regulated power rail from charger */
+	reg_vsys: regulator-vsys {
+		compatible = "regulator-fixed";
+		regulator-name = "vsys";
+		regulator-always-on;
+		regulator-boot-on;
+	};
+
 	reserved_memory: reserved-memory {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -404,6 +412,26 @@ &mt6358codec {
 	Avdd-supply = <&mt6358_vaud28_reg>;
 };
 
+&mt6358regulator {
+	vsys-ldo1-supply = <&reg_vsys>;
+	vsys-ldo2-supply = <&reg_vsys>;
+	vsys-ldo3-supply = <&reg_vsys>;
+	vsys-vcore-supply = <&reg_vsys>;
+	vsys-vdram1-supply = <&reg_vsys>;
+	vsys-vgpu-supply = <&reg_vsys>;
+	vsys-vmodem-supply = <&reg_vsys>;
+	vsys-vpa-supply = <&reg_vsys>;
+	vsys-vproc11-supply = <&reg_vsys>;
+	vsys-vproc12-supply = <&reg_vsys>;
+	vsys-vs1-supply = <&reg_vsys>;
+	vsys-vs2-supply = <&reg_vsys>;
+	vs1-ldo1-supply = <&mt6358_vs1_reg>;
+	vs2-ldo1-supply = <&mt6358_vdram1_reg>;
+	vs2-ldo2-supply = <&mt6358_vs2_reg>;
+	vs2-ldo3-supply = <&mt6358_vs2_reg>;
+	vs2-ldo4-supply = <&mt6358_vs2_reg>;
+};
+
 &mt6358_vgpu_reg {
 	regulator-min-microvolt = <625000>;
 	regulator-max-microvolt = <900000>;
-- 
2.42.0.rc1.204.g551eb34607-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 01/11] dt-bindings: mfd: mt6397: Split out compatible for MediaTek MT6366 PMIC
  2023-08-22  8:45   ` Chen-Yu Tsai
@ 2023-08-22 19:35     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-22 19:35 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> The MT6366 PMIC is mostly, but not fully, compatible with MT6358. It has
> a different set of regulators. Specifically, it lacks the camera related
> VCAM* LDOs and VLDO28, but has additional VM18, VMDDR, and VSRAM_CORE LDOs.
> 
> The PMICs contain a chip ID register that can be used to detect which
> exact model is preset, so it is possible to share a common base
> compatible string.
> 
> Add a separate compatible for the MT6366 PMIC, with a fallback to the
> MT6358 PMIC.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [PATCH v2 01/11] dt-bindings: mfd: mt6397: Split out compatible for MediaTek MT6366 PMIC
@ 2023-08-22 19:35     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-22 19:35 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> The MT6366 PMIC is mostly, but not fully, compatible with MT6358. It has
> a different set of regulators. Specifically, it lacks the camera related
> VCAM* LDOs and VLDO28, but has additional VM18, VMDDR, and VSRAM_CORE LDOs.
> 
> The PMICs contain a chip ID register that can be used to detect which
> exact model is preset, so it is possible to share a common base
> compatible string.
> 
> Add a separate compatible for the MT6366 PMIC, with a fallback to the
> MT6358 PMIC.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 02/11] mfd: mt6358: Add registers for MT6366 specific regulators
  2023-08-22  8:45   ` Chen-Yu Tsai
@ 2023-08-22 19:37     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-22 19:37 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> The MT6366 PMIC, compared to the MT6358, does away with the VCAM*
> regulators. Two regulators VM18 and VMDDR reuse their register space.
> There's also a VSRAM type regulator VSRAM_CORE thats' split between
> the VCAM* register space and other parts.
> 
> Add register address macros for these MT6366 specific regulators.
> 
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
>  include/linux/mfd/mt6358/registers.h | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 

Adding few defines without any code using it barely fits one logical
change. It's just not a change, even if AMD tells you otherwise with
their autogenerated headers. I think this should be squashed with its user.

Best regards,
Krzysztof


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

* Re: [PATCH v2 02/11] mfd: mt6358: Add registers for MT6366 specific regulators
@ 2023-08-22 19:37     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-22 19:37 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> The MT6366 PMIC, compared to the MT6358, does away with the VCAM*
> regulators. Two regulators VM18 and VMDDR reuse their register space.
> There's also a VSRAM type regulator VSRAM_CORE thats' split between
> the VCAM* register space and other parts.
> 
> Add register address macros for these MT6366 specific regulators.
> 
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
>  include/linux/mfd/mt6358/registers.h | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 

Adding few defines without any code using it barely fits one logical
change. It's just not a change, even if AMD tells you otherwise with
their autogenerated headers. I think this should be squashed with its user.

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
  2023-08-22  8:45   ` Chen-Yu Tsai
@ 2023-08-22 19:39     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-22 19:39 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> From: Zhiyong Tao <zhiyong.tao@mediatek.com>
> 
> The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
> to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
> 29 LDO regulators, not counting ones that feed internally and basically
> have no controls. The regulators are named after their intended usage
> for the SoC and system design, thus not named generically as ldoX or
> dcdcX, but as vcn33 or vgpu.
> 
> Add a binding document describing all the regulators and their supplies.
> 
> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
> [wens@chromium.org: major rework and added commit message]
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> Changes since v1:
> - Replaced underscores in supply names to hyphens
> - Merged with MT6358 regulator binding
> - Added MT6358 fallback compatible to MT6366 regulator
> 
> Changes since Zhiyong's last version (v4) [1]:
> - simplified regulator names
> - added descriptions to regulators
> - removed bogus regulators (*_sshub)
> - merged vcn33-wifi and vcn33-bt as vcn33
> - added missing regulators (vm18, vmddr, vsram-core)
> - cut down examples to a handful of cases and made them complete
> - expanded commit message a lot
> 
> [1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
>  .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
>  1 file changed, 168 insertions(+), 59 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> index 82328fe17680..b350181f33ff 100644
> --- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> +++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> @@ -16,14 +16,18 @@ description: |
>  
>  properties:
>    compatible:
> -    const: mediatek,mt6358-regulator
> +    oneOf:
> +      - const: mediatek,mt6358-regulator
> +      - items:
> +          - const: mediatek,mt6366-regulator
> +          - const: mediatek,mt6358-regulator
>  
>    vsys-ldo1-supply:
>      description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
>    vsys-ldo2-supply:
> -    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
> +    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
>    vsys-ldo3-supply:
> -    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
> +    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
>    vsys-vcore-supply:
>      description: Supply for buck regulator vcore
>    vsys-vdram1-supply:
> @@ -43,75 +47,138 @@ properties:
>    vsys-vs2-supply:
>      description: Supply for buck regulator vs2
>    vs1-ldo1-supply:
> -    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
> +    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
>    vs2-ldo1-supply:
> -    description: Supply for LDOs vdram2
> +    description: Supply for LDOs vdram2, vmddr (MT6366 only)
>    vs2-ldo2-supply:
>      description: Supply for LDOs vrf12, va12
>    vs2-ldo3-supply:
> -    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
> -  vs2-ldo4-supply:
> -    description: Supply for LDO vcamd
> -
> -patternProperties:
> -  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
> -    description: Buck regulators
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_v(a|rf)12":
> -    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_v((aux|cn|io|rf)18|camio)":
> -    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_vxo22":
> -    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_v(aud|bif|cn|fe|io)28":
> -    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_vusb":
> -    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_vsram_(gpu|others|proc1[12])$":
> -    description: LDOs with variable output
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
> -    description: LDOs with variable output and 0~100/10mV tuning
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false

I don't understand. You just added it and it is already wrong? Please,
do not add code which is clearly incorrect.


Best regards,
Krzysztof


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

* Re: [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
@ 2023-08-22 19:39     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-22 19:39 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> From: Zhiyong Tao <zhiyong.tao@mediatek.com>
> 
> The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
> to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
> 29 LDO regulators, not counting ones that feed internally and basically
> have no controls. The regulators are named after their intended usage
> for the SoC and system design, thus not named generically as ldoX or
> dcdcX, but as vcn33 or vgpu.
> 
> Add a binding document describing all the regulators and their supplies.
> 
> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
> [wens@chromium.org: major rework and added commit message]
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> Changes since v1:
> - Replaced underscores in supply names to hyphens
> - Merged with MT6358 regulator binding
> - Added MT6358 fallback compatible to MT6366 regulator
> 
> Changes since Zhiyong's last version (v4) [1]:
> - simplified regulator names
> - added descriptions to regulators
> - removed bogus regulators (*_sshub)
> - merged vcn33-wifi and vcn33-bt as vcn33
> - added missing regulators (vm18, vmddr, vsram-core)
> - cut down examples to a handful of cases and made them complete
> - expanded commit message a lot
> 
> [1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
>  .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
>  1 file changed, 168 insertions(+), 59 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> index 82328fe17680..b350181f33ff 100644
> --- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> +++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> @@ -16,14 +16,18 @@ description: |
>  
>  properties:
>    compatible:
> -    const: mediatek,mt6358-regulator
> +    oneOf:
> +      - const: mediatek,mt6358-regulator
> +      - items:
> +          - const: mediatek,mt6366-regulator
> +          - const: mediatek,mt6358-regulator
>  
>    vsys-ldo1-supply:
>      description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
>    vsys-ldo2-supply:
> -    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
> +    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
>    vsys-ldo3-supply:
> -    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
> +    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
>    vsys-vcore-supply:
>      description: Supply for buck regulator vcore
>    vsys-vdram1-supply:
> @@ -43,75 +47,138 @@ properties:
>    vsys-vs2-supply:
>      description: Supply for buck regulator vs2
>    vs1-ldo1-supply:
> -    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
> +    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
>    vs2-ldo1-supply:
> -    description: Supply for LDOs vdram2
> +    description: Supply for LDOs vdram2, vmddr (MT6366 only)
>    vs2-ldo2-supply:
>      description: Supply for LDOs vrf12, va12
>    vs2-ldo3-supply:
> -    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
> -  vs2-ldo4-supply:
> -    description: Supply for LDO vcamd
> -
> -patternProperties:
> -  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
> -    description: Buck regulators
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_v(a|rf)12":
> -    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_v((aux|cn|io|rf)18|camio)":
> -    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_vxo22":
> -    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_v(aud|bif|cn|fe|io)28":
> -    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_vusb":
> -    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_vsram_(gpu|others|proc1[12])$":
> -    description: LDOs with variable output
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false
> -
> -  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
> -    description: LDOs with variable output and 0~100/10mV tuning
> -    type: object
> -    $ref: regulator.yaml#
> -    unevaluatedProperties: false

I don't understand. You just added it and it is already wrong? Please,
do not add code which is clearly incorrect.


Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
  2023-08-22 19:39     ` Krzysztof Kozlowski
@ 2023-08-22 19:40       ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-22 19:40 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

On 22/08/2023 21:39, Krzysztof Kozlowski wrote:
> On 22/08/2023 10:45, Chen-Yu Tsai wrote:
>> From: Zhiyong Tao <zhiyong.tao@mediatek.com>
>>
>> The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
>> to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
>> 29 LDO regulators, not counting ones that feed internally and basically
>> have no controls. The regulators are named after their intended usage
>> for the SoC and system design, thus not named generically as ldoX or
>> dcdcX, but as vcn33 or vgpu.
>>
>> Add a binding document describing all the regulators and their supplies.
>>
>> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
>> [wens@chromium.org: major rework and added commit message]
>> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
>> ---
>> Changes since v1:
>> - Replaced underscores in supply names to hyphens
>> - Merged with MT6358 regulator binding
>> - Added MT6358 fallback compatible to MT6366 regulator
>>
>> Changes since Zhiyong's last version (v4) [1]:
>> - simplified regulator names
>> - added descriptions to regulators
>> - removed bogus regulators (*_sshub)
>> - merged vcn33-wifi and vcn33-bt as vcn33
>> - added missing regulators (vm18, vmddr, vsram-core)
>> - cut down examples to a handful of cases and made them complete
>> - expanded commit message a lot
>>
>> [1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
>>  .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
>>  1 file changed, 168 insertions(+), 59 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>> index 82328fe17680..b350181f33ff 100644
>> --- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>> +++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>> @@ -16,14 +16,18 @@ description: |
>>  
>>  properties:
>>    compatible:
>> -    const: mediatek,mt6358-regulator
>> +    oneOf:
>> +      - const: mediatek,mt6358-regulator
>> +      - items:
>> +          - const: mediatek,mt6366-regulator
>> +          - const: mediatek,mt6358-regulator
>>  
>>    vsys-ldo1-supply:
>>      description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
>>    vsys-ldo2-supply:
>> -    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
>> +    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
>>    vsys-ldo3-supply:
>> -    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
>> +    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
>>    vsys-vcore-supply:
>>      description: Supply for buck regulator vcore
>>    vsys-vdram1-supply:
>> @@ -43,75 +47,138 @@ properties:
>>    vsys-vs2-supply:
>>      description: Supply for buck regulator vs2
>>    vs1-ldo1-supply:
>> -    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
>> +    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
>>    vs2-ldo1-supply:
>> -    description: Supply for LDOs vdram2
>> +    description: Supply for LDOs vdram2, vmddr (MT6366 only)
>>    vs2-ldo2-supply:
>>      description: Supply for LDOs vrf12, va12
>>    vs2-ldo3-supply:
>> -    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
>> -  vs2-ldo4-supply:
>> -    description: Supply for LDO vcamd
>> -
>> -patternProperties:
>> -  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
>> -    description: Buck regulators
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_v(a|rf)12":
>> -    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_v((aux|cn|io|rf)18|camio)":
>> -    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_vxo22":
>> -    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_v(aud|bif|cn|fe|io)28":
>> -    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_vusb":
>> -    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_vsram_(gpu|others|proc1[12])$":
>> -    description: LDOs with variable output
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
>> -    description: LDOs with variable output and 0~100/10mV tuning
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
> 
> I don't understand. You just added it and it is already wrong? Please,
> do not add code which is clearly incorrect.

Sent too early - anyway properties cannot be defined in allOf:. That's
not the place for them and there is no single reason for it. From which
regulator binding you got this example?

Best regards,
Krzysztof


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

* Re: [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
@ 2023-08-22 19:40       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-22 19:40 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

On 22/08/2023 21:39, Krzysztof Kozlowski wrote:
> On 22/08/2023 10:45, Chen-Yu Tsai wrote:
>> From: Zhiyong Tao <zhiyong.tao@mediatek.com>
>>
>> The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
>> to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
>> 29 LDO regulators, not counting ones that feed internally and basically
>> have no controls. The regulators are named after their intended usage
>> for the SoC and system design, thus not named generically as ldoX or
>> dcdcX, but as vcn33 or vgpu.
>>
>> Add a binding document describing all the regulators and their supplies.
>>
>> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
>> [wens@chromium.org: major rework and added commit message]
>> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
>> ---
>> Changes since v1:
>> - Replaced underscores in supply names to hyphens
>> - Merged with MT6358 regulator binding
>> - Added MT6358 fallback compatible to MT6366 regulator
>>
>> Changes since Zhiyong's last version (v4) [1]:
>> - simplified regulator names
>> - added descriptions to regulators
>> - removed bogus regulators (*_sshub)
>> - merged vcn33-wifi and vcn33-bt as vcn33
>> - added missing regulators (vm18, vmddr, vsram-core)
>> - cut down examples to a handful of cases and made them complete
>> - expanded commit message a lot
>>
>> [1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
>>  .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
>>  1 file changed, 168 insertions(+), 59 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>> index 82328fe17680..b350181f33ff 100644
>> --- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>> +++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>> @@ -16,14 +16,18 @@ description: |
>>  
>>  properties:
>>    compatible:
>> -    const: mediatek,mt6358-regulator
>> +    oneOf:
>> +      - const: mediatek,mt6358-regulator
>> +      - items:
>> +          - const: mediatek,mt6366-regulator
>> +          - const: mediatek,mt6358-regulator
>>  
>>    vsys-ldo1-supply:
>>      description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
>>    vsys-ldo2-supply:
>> -    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
>> +    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
>>    vsys-ldo3-supply:
>> -    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
>> +    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
>>    vsys-vcore-supply:
>>      description: Supply for buck regulator vcore
>>    vsys-vdram1-supply:
>> @@ -43,75 +47,138 @@ properties:
>>    vsys-vs2-supply:
>>      description: Supply for buck regulator vs2
>>    vs1-ldo1-supply:
>> -    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
>> +    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
>>    vs2-ldo1-supply:
>> -    description: Supply for LDOs vdram2
>> +    description: Supply for LDOs vdram2, vmddr (MT6366 only)
>>    vs2-ldo2-supply:
>>      description: Supply for LDOs vrf12, va12
>>    vs2-ldo3-supply:
>> -    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
>> -  vs2-ldo4-supply:
>> -    description: Supply for LDO vcamd
>> -
>> -patternProperties:
>> -  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
>> -    description: Buck regulators
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_v(a|rf)12":
>> -    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_v((aux|cn|io|rf)18|camio)":
>> -    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_vxo22":
>> -    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_v(aud|bif|cn|fe|io)28":
>> -    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_vusb":
>> -    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_vsram_(gpu|others|proc1[12])$":
>> -    description: LDOs with variable output
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
>> -
>> -  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
>> -    description: LDOs with variable output and 0~100/10mV tuning
>> -    type: object
>> -    $ref: regulator.yaml#
>> -    unevaluatedProperties: false
> 
> I don't understand. You just added it and it is already wrong? Please,
> do not add code which is clearly incorrect.

Sent too early - anyway properties cannot be defined in allOf:. That's
not the place for them and there is no single reason for it. From which
regulator binding you got this example?

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 03/11] regulator: dt-bindings: mt6358: Convert to DT schema
  2023-08-22  8:45   ` Chen-Yu Tsai
@ 2023-08-22 19:47     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-22 19:47 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> Convert this from the old style text based binding to the new DT schema
> style. This will make adding the MT6366 portion easier.
> 
> The examples have been trimmed down considerably, and the remaining
> entries now match what is seen in actual device trees.

...

> +---
> +$id: http://devicetree.org/schemas/regulator/mediatek,mt6358-regulator.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MediaTek MT6358 Regulator
> +
> +maintainers:
> +  - Zhiyong Tao <zhiyong.tao@mediatek.com>
> +
> +description: |

Do not need '|' unless you need to preserve formatting.

> +  Regulator node of the PMIC. This node should under the PMIC's device node.
> +  All voltage regulators provided by the PMIC are described as sub-nodes of
> +  this node.
> +
> +properties:
> +  compatible:
> +    const: mediatek,mt6358-regulator
> +
...


> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/regulator/mediatek,mt6397-regulator.h>

mt6397?

> +
> +    regulator {
> +        compatible = "mediatek,mt6358-regulator";
> +
> +        buck_vgpu {
> +            regulator-name = "vgpu";
> +            regulator-min-microvolt = <625000>;
> +            regulator-max-microvolt = <900000>;
> +            regulator-ramp-delay = <6250>;
> +            regulator-enable-ramp-delay = <200>;
> +            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO

mt6397?

Both cases look a bit confusing.

Best regards,
Krzysztof


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

* Re: [PATCH v2 03/11] regulator: dt-bindings: mt6358: Convert to DT schema
@ 2023-08-22 19:47     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-22 19:47 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> Convert this from the old style text based binding to the new DT schema
> style. This will make adding the MT6366 portion easier.
> 
> The examples have been trimmed down considerably, and the remaining
> entries now match what is seen in actual device trees.

...

> +---
> +$id: http://devicetree.org/schemas/regulator/mediatek,mt6358-regulator.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MediaTek MT6358 Regulator
> +
> +maintainers:
> +  - Zhiyong Tao <zhiyong.tao@mediatek.com>
> +
> +description: |

Do not need '|' unless you need to preserve formatting.

> +  Regulator node of the PMIC. This node should under the PMIC's device node.
> +  All voltage regulators provided by the PMIC are described as sub-nodes of
> +  this node.
> +
> +properties:
> +  compatible:
> +    const: mediatek,mt6358-regulator
> +
...


> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/regulator/mediatek,mt6397-regulator.h>

mt6397?

> +
> +    regulator {
> +        compatible = "mediatek,mt6358-regulator";
> +
> +        buck_vgpu {
> +            regulator-name = "vgpu";
> +            regulator-min-microvolt = <625000>;
> +            regulator-max-microvolt = <900000>;
> +            regulator-ramp-delay = <6250>;
> +            regulator-enable-ramp-delay = <200>;
> +            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO

mt6397?

Both cases look a bit confusing.

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 03/11] regulator: dt-bindings: mt6358: Convert to DT schema
  2023-08-22 19:47     ` Krzysztof Kozlowski
@ 2023-08-23  3:54       ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-23  3:54 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown,
	Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On Wed, Aug 23, 2023 at 3:47 AM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> > Convert this from the old style text based binding to the new DT schema
> > style. This will make adding the MT6366 portion easier.
> >
> > The examples have been trimmed down considerably, and the remaining
> > entries now match what is seen in actual device trees.
>
> ...
>
> > +---
> > +$id: http://devicetree.org/schemas/regulator/mediatek,mt6358-regulator.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: MediaTek MT6358 Regulator
> > +
> > +maintainers:
> > +  - Zhiyong Tao <zhiyong.tao@mediatek.com>
> > +
> > +description: |
>
> Do not need '|' unless you need to preserve formatting.

Ack.

> > +  Regulator node of the PMIC. This node should under the PMIC's device node.
> > +  All voltage regulators provided by the PMIC are described as sub-nodes of
> > +  this node.
> > +
> > +properties:
> > +  compatible:
> > +    const: mediatek,mt6358-regulator
> > +
> ...
>
>
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/regulator/mediatek,mt6397-regulator.h>
>
> mt6397?
>
> > +
> > +    regulator {
> > +        compatible = "mediatek,mt6358-regulator";
> > +
> > +        buck_vgpu {
> > +            regulator-name = "vgpu";
> > +            regulator-min-microvolt = <625000>;
> > +            regulator-max-microvolt = <900000>;
> > +            regulator-ramp-delay = <6250>;
> > +            regulator-enable-ramp-delay = <200>;
> > +            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO
>
> mt6397?
>
> Both cases look a bit confusing.

There's only two regulator binding header files, mt6397 and mt6360.
They seem to correspond to the two classes of PMICs that MediaTek has.
I believe the two header files and thus the macros are meant to be
shared?

MT6397 and co refer to their AP PMICs, i.e. PMICs that are companion
chips to the SoC and provide most of the power rails a system needs,
along with things like RTC, audio codecs, etc.. The MT6358 and MT6366
belong to this class.

MT6360 and possibly others refer to their charger PMICs, which integrate
a battery charger, USB type-C PD stuff, LED drivers, and a handful of
regulators.


ChenYu

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

* Re: [PATCH v2 03/11] regulator: dt-bindings: mt6358: Convert to DT schema
@ 2023-08-23  3:54       ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-23  3:54 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown,
	Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On Wed, Aug 23, 2023 at 3:47 AM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> > Convert this from the old style text based binding to the new DT schema
> > style. This will make adding the MT6366 portion easier.
> >
> > The examples have been trimmed down considerably, and the remaining
> > entries now match what is seen in actual device trees.
>
> ...
>
> > +---
> > +$id: http://devicetree.org/schemas/regulator/mediatek,mt6358-regulator.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: MediaTek MT6358 Regulator
> > +
> > +maintainers:
> > +  - Zhiyong Tao <zhiyong.tao@mediatek.com>
> > +
> > +description: |
>
> Do not need '|' unless you need to preserve formatting.

Ack.

> > +  Regulator node of the PMIC. This node should under the PMIC's device node.
> > +  All voltage regulators provided by the PMIC are described as sub-nodes of
> > +  this node.
> > +
> > +properties:
> > +  compatible:
> > +    const: mediatek,mt6358-regulator
> > +
> ...
>
>
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/regulator/mediatek,mt6397-regulator.h>
>
> mt6397?
>
> > +
> > +    regulator {
> > +        compatible = "mediatek,mt6358-regulator";
> > +
> > +        buck_vgpu {
> > +            regulator-name = "vgpu";
> > +            regulator-min-microvolt = <625000>;
> > +            regulator-max-microvolt = <900000>;
> > +            regulator-ramp-delay = <6250>;
> > +            regulator-enable-ramp-delay = <200>;
> > +            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO
>
> mt6397?
>
> Both cases look a bit confusing.

There's only two regulator binding header files, mt6397 and mt6360.
They seem to correspond to the two classes of PMICs that MediaTek has.
I believe the two header files and thus the macros are meant to be
shared?

MT6397 and co refer to their AP PMICs, i.e. PMICs that are companion
chips to the SoC and provide most of the power rails a system needs,
along with things like RTC, audio codecs, etc.. The MT6358 and MT6366
belong to this class.

MT6360 and possibly others refer to their charger PMICs, which integrate
a battery charger, USB type-C PD stuff, LED drivers, and a handful of
regulators.


ChenYu

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
  2023-08-22 19:40       ` Krzysztof Kozlowski
@ 2023-08-23  4:20         ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-23  4:20 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown,
	Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On Wed, Aug 23, 2023 at 3:40 AM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 22/08/2023 21:39, Krzysztof Kozlowski wrote:
> > On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> >> From: Zhiyong Tao <zhiyong.tao@mediatek.com>
> >>
> >> The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
> >> to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
> >> 29 LDO regulators, not counting ones that feed internally and basically
> >> have no controls. The regulators are named after their intended usage
> >> for the SoC and system design, thus not named generically as ldoX or
> >> dcdcX, but as vcn33 or vgpu.
> >>
> >> Add a binding document describing all the regulators and their supplies.
> >>
> >> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
> >> [wens@chromium.org: major rework and added commit message]
> >> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> >> ---
> >> Changes since v1:
> >> - Replaced underscores in supply names to hyphens
> >> - Merged with MT6358 regulator binding
> >> - Added MT6358 fallback compatible to MT6366 regulator
> >>
> >> Changes since Zhiyong's last version (v4) [1]:
> >> - simplified regulator names
> >> - added descriptions to regulators
> >> - removed bogus regulators (*_sshub)
> >> - merged vcn33-wifi and vcn33-bt as vcn33
> >> - added missing regulators (vm18, vmddr, vsram-core)
> >> - cut down examples to a handful of cases and made them complete
> >> - expanded commit message a lot
> >>
> >> [1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
> >>  .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
> >>  1 file changed, 168 insertions(+), 59 deletions(-)
> >>
> >> diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> >> index 82328fe17680..b350181f33ff 100644
> >> --- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> >> +++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> >> @@ -16,14 +16,18 @@ description: |
> >>
> >>  properties:
> >>    compatible:
> >> -    const: mediatek,mt6358-regulator
> >> +    oneOf:
> >> +      - const: mediatek,mt6358-regulator
> >> +      - items:
> >> +          - const: mediatek,mt6366-regulator
> >> +          - const: mediatek,mt6358-regulator
> >>
> >>    vsys-ldo1-supply:
> >>      description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
> >>    vsys-ldo2-supply:
> >> -    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
> >> +    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
> >>    vsys-ldo3-supply:
> >> -    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
> >> +    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
> >>    vsys-vcore-supply:
> >>      description: Supply for buck regulator vcore
> >>    vsys-vdram1-supply:
> >> @@ -43,75 +47,138 @@ properties:
> >>    vsys-vs2-supply:
> >>      description: Supply for buck regulator vs2
> >>    vs1-ldo1-supply:
> >> -    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
> >> +    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
> >>    vs2-ldo1-supply:
> >> -    description: Supply for LDOs vdram2
> >> +    description: Supply for LDOs vdram2, vmddr (MT6366 only)
> >>    vs2-ldo2-supply:
> >>      description: Supply for LDOs vrf12, va12
> >>    vs2-ldo3-supply:
> >> -    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
> >> -  vs2-ldo4-supply:
> >> -    description: Supply for LDO vcamd
> >> -
> >> -patternProperties:
> >> -  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
> >> -    description: Buck regulators
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_v(a|rf)12":
> >> -    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_v((aux|cn|io|rf)18|camio)":
> >> -    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_vxo22":
> >> -    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_v(aud|bif|cn|fe|io)28":
> >> -    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_vusb":
> >> -    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_vsram_(gpu|others|proc1[12])$":
> >> -    description: LDOs with variable output
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
> >> -    description: LDOs with variable output and 0~100/10mV tuning
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >
> > I don't understand. You just added it and it is already wrong? Please,
> > do not add code which is clearly incorrect.
>
> Sent too early - anyway properties cannot be defined in allOf:. That's
> not the place for them and there is no single reason for it. From which
> regulator binding you got this example?

None. It was simply a way I figured out when I was reading up on JSON
schema syntax. I wanted to split the definitions cleanly, since they
are very different. And with "unevaluatedProperties: false" in the base
schema it did seem to work, successfully evaluating existing device trees
and producing errors when extra properties were added, or if types didn't
match up.

Now that you mention it, I suppose the preferred way to write it is to
have all the properties in the base schema, then negate the ones that
don't belong in the allOf: section? It just seems really repetitive given
the child node names for the chip variants are completely different. OOTH
I guess it would produce better error messages.


ChenYu

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

* Re: [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
@ 2023-08-23  4:20         ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-23  4:20 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown,
	Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On Wed, Aug 23, 2023 at 3:40 AM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 22/08/2023 21:39, Krzysztof Kozlowski wrote:
> > On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> >> From: Zhiyong Tao <zhiyong.tao@mediatek.com>
> >>
> >> The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
> >> to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
> >> 29 LDO regulators, not counting ones that feed internally and basically
> >> have no controls. The regulators are named after their intended usage
> >> for the SoC and system design, thus not named generically as ldoX or
> >> dcdcX, but as vcn33 or vgpu.
> >>
> >> Add a binding document describing all the regulators and their supplies.
> >>
> >> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
> >> [wens@chromium.org: major rework and added commit message]
> >> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> >> ---
> >> Changes since v1:
> >> - Replaced underscores in supply names to hyphens
> >> - Merged with MT6358 regulator binding
> >> - Added MT6358 fallback compatible to MT6366 regulator
> >>
> >> Changes since Zhiyong's last version (v4) [1]:
> >> - simplified regulator names
> >> - added descriptions to regulators
> >> - removed bogus regulators (*_sshub)
> >> - merged vcn33-wifi and vcn33-bt as vcn33
> >> - added missing regulators (vm18, vmddr, vsram-core)
> >> - cut down examples to a handful of cases and made them complete
> >> - expanded commit message a lot
> >>
> >> [1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
> >>  .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
> >>  1 file changed, 168 insertions(+), 59 deletions(-)
> >>
> >> diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> >> index 82328fe17680..b350181f33ff 100644
> >> --- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> >> +++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> >> @@ -16,14 +16,18 @@ description: |
> >>
> >>  properties:
> >>    compatible:
> >> -    const: mediatek,mt6358-regulator
> >> +    oneOf:
> >> +      - const: mediatek,mt6358-regulator
> >> +      - items:
> >> +          - const: mediatek,mt6366-regulator
> >> +          - const: mediatek,mt6358-regulator
> >>
> >>    vsys-ldo1-supply:
> >>      description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
> >>    vsys-ldo2-supply:
> >> -    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
> >> +    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
> >>    vsys-ldo3-supply:
> >> -    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
> >> +    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
> >>    vsys-vcore-supply:
> >>      description: Supply for buck regulator vcore
> >>    vsys-vdram1-supply:
> >> @@ -43,75 +47,138 @@ properties:
> >>    vsys-vs2-supply:
> >>      description: Supply for buck regulator vs2
> >>    vs1-ldo1-supply:
> >> -    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
> >> +    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
> >>    vs2-ldo1-supply:
> >> -    description: Supply for LDOs vdram2
> >> +    description: Supply for LDOs vdram2, vmddr (MT6366 only)
> >>    vs2-ldo2-supply:
> >>      description: Supply for LDOs vrf12, va12
> >>    vs2-ldo3-supply:
> >> -    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
> >> -  vs2-ldo4-supply:
> >> -    description: Supply for LDO vcamd
> >> -
> >> -patternProperties:
> >> -  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
> >> -    description: Buck regulators
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_v(a|rf)12":
> >> -    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_v((aux|cn|io|rf)18|camio)":
> >> -    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_vxo22":
> >> -    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_v(aud|bif|cn|fe|io)28":
> >> -    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_vusb":
> >> -    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_vsram_(gpu|others|proc1[12])$":
> >> -    description: LDOs with variable output
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >> -
> >> -  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
> >> -    description: LDOs with variable output and 0~100/10mV tuning
> >> -    type: object
> >> -    $ref: regulator.yaml#
> >> -    unevaluatedProperties: false
> >
> > I don't understand. You just added it and it is already wrong? Please,
> > do not add code which is clearly incorrect.
>
> Sent too early - anyway properties cannot be defined in allOf:. That's
> not the place for them and there is no single reason for it. From which
> regulator binding you got this example?

None. It was simply a way I figured out when I was reading up on JSON
schema syntax. I wanted to split the definitions cleanly, since they
are very different. And with "unevaluatedProperties: false" in the base
schema it did seem to work, successfully evaluating existing device trees
and producing errors when extra properties were added, or if types didn't
match up.

Now that you mention it, I suppose the preferred way to write it is to
have all the properties in the base schema, then negate the ones that
don't belong in the allOf: section? It just seems really repetitive given
the child node names for the chip variants are completely different. OOTH
I guess it would produce better error messages.


ChenYu

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
  2023-08-23  4:20         ` Chen-Yu Tsai
@ 2023-08-23  5:45           ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-23  5:45 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown,
	Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On 23/08/2023 06:20, Chen-Yu Tsai wrote:
> On Wed, Aug 23, 2023 at 3:40 AM Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
>>
>> On 22/08/2023 21:39, Krzysztof Kozlowski wrote:
>>> On 22/08/2023 10:45, Chen-Yu Tsai wrote:
>>>> From: Zhiyong Tao <zhiyong.tao@mediatek.com>
>>>>
>>>> The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
>>>> to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
>>>> 29 LDO regulators, not counting ones that feed internally and basically
>>>> have no controls. The regulators are named after their intended usage
>>>> for the SoC and system design, thus not named generically as ldoX or
>>>> dcdcX, but as vcn33 or vgpu.
>>>>
>>>> Add a binding document describing all the regulators and their supplies.
>>>>
>>>> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
>>>> [wens@chromium.org: major rework and added commit message]
>>>> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
>>>> ---
>>>> Changes since v1:
>>>> - Replaced underscores in supply names to hyphens
>>>> - Merged with MT6358 regulator binding
>>>> - Added MT6358 fallback compatible to MT6366 regulator
>>>>
>>>> Changes since Zhiyong's last version (v4) [1]:
>>>> - simplified regulator names
>>>> - added descriptions to regulators
>>>> - removed bogus regulators (*_sshub)
>>>> - merged vcn33-wifi and vcn33-bt as vcn33
>>>> - added missing regulators (vm18, vmddr, vsram-core)
>>>> - cut down examples to a handful of cases and made them complete
>>>> - expanded commit message a lot
>>>>
>>>> [1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
>>>>  .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
>>>>  1 file changed, 168 insertions(+), 59 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>>>> index 82328fe17680..b350181f33ff 100644
>>>> --- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>>>> +++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>>>> @@ -16,14 +16,18 @@ description: |
>>>>
>>>>  properties:
>>>>    compatible:
>>>> -    const: mediatek,mt6358-regulator
>>>> +    oneOf:
>>>> +      - const: mediatek,mt6358-regulator
>>>> +      - items:
>>>> +          - const: mediatek,mt6366-regulator
>>>> +          - const: mediatek,mt6358-regulator
>>>>
>>>>    vsys-ldo1-supply:
>>>>      description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
>>>>    vsys-ldo2-supply:
>>>> -    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
>>>> +    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
>>>>    vsys-ldo3-supply:
>>>> -    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
>>>> +    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
>>>>    vsys-vcore-supply:
>>>>      description: Supply for buck regulator vcore
>>>>    vsys-vdram1-supply:
>>>> @@ -43,75 +47,138 @@ properties:
>>>>    vsys-vs2-supply:
>>>>      description: Supply for buck regulator vs2
>>>>    vs1-ldo1-supply:
>>>> -    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
>>>> +    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
>>>>    vs2-ldo1-supply:
>>>> -    description: Supply for LDOs vdram2
>>>> +    description: Supply for LDOs vdram2, vmddr (MT6366 only)
>>>>    vs2-ldo2-supply:
>>>>      description: Supply for LDOs vrf12, va12
>>>>    vs2-ldo3-supply:
>>>> -    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
>>>> -  vs2-ldo4-supply:
>>>> -    description: Supply for LDO vcamd
>>>> -
>>>> -patternProperties:
>>>> -  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
>>>> -    description: Buck regulators
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_v(a|rf)12":
>>>> -    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_v((aux|cn|io|rf)18|camio)":
>>>> -    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_vxo22":
>>>> -    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_v(aud|bif|cn|fe|io)28":
>>>> -    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_vusb":
>>>> -    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_vsram_(gpu|others|proc1[12])$":
>>>> -    description: LDOs with variable output
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
>>>> -    description: LDOs with variable output and 0~100/10mV tuning
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>
>>> I don't understand. You just added it and it is already wrong? Please,
>>> do not add code which is clearly incorrect.
>>
>> Sent too early - anyway properties cannot be defined in allOf:. That's
>> not the place for them and there is no single reason for it. From which
>> regulator binding you got this example?
> 
> None. It was simply a way I figured out when I was reading up on JSON
> schema syntax. I wanted to split the definitions cleanly, since they
> are very different. And with "unevaluatedProperties: false" in the base
> schema it did seem to work, successfully evaluating existing device trees
> and producing errors when extra properties were added, or if types didn't
> match up.

If they are very different, this should not have been one binding. There
is little benefit of that.

> 
> Now that you mention it, I suppose the preferred way to write it is to
> have all the properties in the base schema, then negate the ones that
> don't belong in the allOf: section? It just seems really repetitive given
> the child node names for the chip variants are completely different. OOTH
> I guess it would produce better error messages.


For regular cases yes, but not if devices differ so much.

Best regards,
Krzysztof


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

* Re: [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
@ 2023-08-23  5:45           ` Krzysztof Kozlowski
  0 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-23  5:45 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown,
	Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On 23/08/2023 06:20, Chen-Yu Tsai wrote:
> On Wed, Aug 23, 2023 at 3:40 AM Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
>>
>> On 22/08/2023 21:39, Krzysztof Kozlowski wrote:
>>> On 22/08/2023 10:45, Chen-Yu Tsai wrote:
>>>> From: Zhiyong Tao <zhiyong.tao@mediatek.com>
>>>>
>>>> The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
>>>> to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
>>>> 29 LDO regulators, not counting ones that feed internally and basically
>>>> have no controls. The regulators are named after their intended usage
>>>> for the SoC and system design, thus not named generically as ldoX or
>>>> dcdcX, but as vcn33 or vgpu.
>>>>
>>>> Add a binding document describing all the regulators and their supplies.
>>>>
>>>> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
>>>> [wens@chromium.org: major rework and added commit message]
>>>> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
>>>> ---
>>>> Changes since v1:
>>>> - Replaced underscores in supply names to hyphens
>>>> - Merged with MT6358 regulator binding
>>>> - Added MT6358 fallback compatible to MT6366 regulator
>>>>
>>>> Changes since Zhiyong's last version (v4) [1]:
>>>> - simplified regulator names
>>>> - added descriptions to regulators
>>>> - removed bogus regulators (*_sshub)
>>>> - merged vcn33-wifi and vcn33-bt as vcn33
>>>> - added missing regulators (vm18, vmddr, vsram-core)
>>>> - cut down examples to a handful of cases and made them complete
>>>> - expanded commit message a lot
>>>>
>>>> [1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
>>>>  .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
>>>>  1 file changed, 168 insertions(+), 59 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>>>> index 82328fe17680..b350181f33ff 100644
>>>> --- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>>>> +++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>>>> @@ -16,14 +16,18 @@ description: |
>>>>
>>>>  properties:
>>>>    compatible:
>>>> -    const: mediatek,mt6358-regulator
>>>> +    oneOf:
>>>> +      - const: mediatek,mt6358-regulator
>>>> +      - items:
>>>> +          - const: mediatek,mt6366-regulator
>>>> +          - const: mediatek,mt6358-regulator
>>>>
>>>>    vsys-ldo1-supply:
>>>>      description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
>>>>    vsys-ldo2-supply:
>>>> -    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
>>>> +    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
>>>>    vsys-ldo3-supply:
>>>> -    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
>>>> +    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
>>>>    vsys-vcore-supply:
>>>>      description: Supply for buck regulator vcore
>>>>    vsys-vdram1-supply:
>>>> @@ -43,75 +47,138 @@ properties:
>>>>    vsys-vs2-supply:
>>>>      description: Supply for buck regulator vs2
>>>>    vs1-ldo1-supply:
>>>> -    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
>>>> +    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
>>>>    vs2-ldo1-supply:
>>>> -    description: Supply for LDOs vdram2
>>>> +    description: Supply for LDOs vdram2, vmddr (MT6366 only)
>>>>    vs2-ldo2-supply:
>>>>      description: Supply for LDOs vrf12, va12
>>>>    vs2-ldo3-supply:
>>>> -    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
>>>> -  vs2-ldo4-supply:
>>>> -    description: Supply for LDO vcamd
>>>> -
>>>> -patternProperties:
>>>> -  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
>>>> -    description: Buck regulators
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_v(a|rf)12":
>>>> -    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_v((aux|cn|io|rf)18|camio)":
>>>> -    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_vxo22":
>>>> -    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_v(aud|bif|cn|fe|io)28":
>>>> -    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_vusb":
>>>> -    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_vsram_(gpu|others|proc1[12])$":
>>>> -    description: LDOs with variable output
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>> -
>>>> -  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
>>>> -    description: LDOs with variable output and 0~100/10mV tuning
>>>> -    type: object
>>>> -    $ref: regulator.yaml#
>>>> -    unevaluatedProperties: false
>>>
>>> I don't understand. You just added it and it is already wrong? Please,
>>> do not add code which is clearly incorrect.
>>
>> Sent too early - anyway properties cannot be defined in allOf:. That's
>> not the place for them and there is no single reason for it. From which
>> regulator binding you got this example?
> 
> None. It was simply a way I figured out when I was reading up on JSON
> schema syntax. I wanted to split the definitions cleanly, since they
> are very different. And with "unevaluatedProperties: false" in the base
> schema it did seem to work, successfully evaluating existing device trees
> and producing errors when extra properties were added, or if types didn't
> match up.

If they are very different, this should not have been one binding. There
is little benefit of that.

> 
> Now that you mention it, I suppose the preferred way to write it is to
> have all the properties in the base schema, then negate the ones that
> don't belong in the allOf: section? It just seems really repetitive given
> the child node names for the chip variants are completely different. OOTH
> I guess it would produce better error messages.


For regular cases yes, but not if devices differ so much.

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 03/11] regulator: dt-bindings: mt6358: Convert to DT schema
  2023-08-23  3:54       ` Chen-Yu Tsai
@ 2023-08-23  5:48         ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-23  5:48 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown,
	Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On 23/08/2023 05:54, Chen-Yu Tsai wrote:
>>> +
>>> +    regulator {
>>> +        compatible = "mediatek,mt6358-regulator";
>>> +
>>> +        buck_vgpu {
>>> +            regulator-name = "vgpu";
>>> +            regulator-min-microvolt = <625000>;
>>> +            regulator-max-microvolt = <900000>;
>>> +            regulator-ramp-delay = <6250>;
>>> +            regulator-enable-ramp-delay = <200>;
>>> +            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO
>>
>> mt6397?
>>
>> Both cases look a bit confusing.
> 
> There's only two regulator binding header files, mt6397 and mt6360.
> They seem to correspond to the two classes of PMICs that MediaTek has.
> I believe the two header files and thus the macros are meant to be
> shared?

Defines have specific model name, so they do not look like meant to be
shared. If all the values of the binding match, they can be shared, but
then this should be mentioned in the binding plus it should be used in
the driver. I don't see your driver patches add include of this header.

> 
> MT6397 and co refer to their AP PMICs, i.e. PMICs that are companion
> chips to the SoC and provide most of the power rails a system needs,
> along with things like RTC, audio codecs, etc.. The MT6358 and MT6366
> belong to this class.
> 
> MT6360 and possibly others refer to their charger PMICs, which integrate
> a battery charger, USB type-C PD stuff, LED drivers, and a handful of
> regulators.


Best regards,
Krzysztof


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

* Re: [PATCH v2 03/11] regulator: dt-bindings: mt6358: Convert to DT schema
@ 2023-08-23  5:48         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 54+ messages in thread
From: Krzysztof Kozlowski @ 2023-08-23  5:48 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown,
	Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On 23/08/2023 05:54, Chen-Yu Tsai wrote:
>>> +
>>> +    regulator {
>>> +        compatible = "mediatek,mt6358-regulator";
>>> +
>>> +        buck_vgpu {
>>> +            regulator-name = "vgpu";
>>> +            regulator-min-microvolt = <625000>;
>>> +            regulator-max-microvolt = <900000>;
>>> +            regulator-ramp-delay = <6250>;
>>> +            regulator-enable-ramp-delay = <200>;
>>> +            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO
>>
>> mt6397?
>>
>> Both cases look a bit confusing.
> 
> There's only two regulator binding header files, mt6397 and mt6360.
> They seem to correspond to the two classes of PMICs that MediaTek has.
> I believe the two header files and thus the macros are meant to be
> shared?

Defines have specific model name, so they do not look like meant to be
shared. If all the values of the binding match, they can be shared, but
then this should be mentioned in the binding plus it should be used in
the driver. I don't see your driver patches add include of this header.

> 
> MT6397 and co refer to their AP PMICs, i.e. PMICs that are companion
> chips to the SoC and provide most of the power rails a system needs,
> along with things like RTC, audio codecs, etc.. The MT6358 and MT6366
> belong to this class.
> 
> MT6360 and possibly others refer to their charger PMICs, which integrate
> a battery charger, USB type-C PD stuff, LED drivers, and a handful of
> regulators.


Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
  2023-08-23  5:45           ` Krzysztof Kozlowski
@ 2023-08-23  8:07             ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-23  8:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown,
	Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On Wed, Aug 23, 2023 at 1:45 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 23/08/2023 06:20, Chen-Yu Tsai wrote:
> > On Wed, Aug 23, 2023 at 3:40 AM Krzysztof Kozlowski
> > <krzysztof.kozlowski@linaro.org> wrote:
> >>
> >> On 22/08/2023 21:39, Krzysztof Kozlowski wrote:
> >>> On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> >>>> From: Zhiyong Tao <zhiyong.tao@mediatek.com>
> >>>>
> >>>> The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
> >>>> to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
> >>>> 29 LDO regulators, not counting ones that feed internally and basically
> >>>> have no controls. The regulators are named after their intended usage
> >>>> for the SoC and system design, thus not named generically as ldoX or
> >>>> dcdcX, but as vcn33 or vgpu.
> >>>>
> >>>> Add a binding document describing all the regulators and their supplies.
> >>>>
> >>>> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
> >>>> [wens@chromium.org: major rework and added commit message]
> >>>> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> >>>> ---
> >>>> Changes since v1:
> >>>> - Replaced underscores in supply names to hyphens
> >>>> - Merged with MT6358 regulator binding
> >>>> - Added MT6358 fallback compatible to MT6366 regulator
> >>>>
> >>>> Changes since Zhiyong's last version (v4) [1]:
> >>>> - simplified regulator names
> >>>> - added descriptions to regulators
> >>>> - removed bogus regulators (*_sshub)
> >>>> - merged vcn33-wifi and vcn33-bt as vcn33
> >>>> - added missing regulators (vm18, vmddr, vsram-core)
> >>>> - cut down examples to a handful of cases and made them complete
> >>>> - expanded commit message a lot
> >>>>
> >>>> [1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
> >>>>  .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
> >>>>  1 file changed, 168 insertions(+), 59 deletions(-)
> >>>>
> >>>> diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> >>>> index 82328fe17680..b350181f33ff 100644
> >>>> --- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> >>>> +++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> >>>> @@ -16,14 +16,18 @@ description: |
> >>>>
> >>>>  properties:
> >>>>    compatible:
> >>>> -    const: mediatek,mt6358-regulator
> >>>> +    oneOf:
> >>>> +      - const: mediatek,mt6358-regulator
> >>>> +      - items:
> >>>> +          - const: mediatek,mt6366-regulator
> >>>> +          - const: mediatek,mt6358-regulator
> >>>>
> >>>>    vsys-ldo1-supply:
> >>>>      description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
> >>>>    vsys-ldo2-supply:
> >>>> -    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
> >>>> +    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
> >>>>    vsys-ldo3-supply:
> >>>> -    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
> >>>> +    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
> >>>>    vsys-vcore-supply:
> >>>>      description: Supply for buck regulator vcore
> >>>>    vsys-vdram1-supply:
> >>>> @@ -43,75 +47,138 @@ properties:
> >>>>    vsys-vs2-supply:
> >>>>      description: Supply for buck regulator vs2
> >>>>    vs1-ldo1-supply:
> >>>> -    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
> >>>> +    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
> >>>>    vs2-ldo1-supply:
> >>>> -    description: Supply for LDOs vdram2
> >>>> +    description: Supply for LDOs vdram2, vmddr (MT6366 only)
> >>>>    vs2-ldo2-supply:
> >>>>      description: Supply for LDOs vrf12, va12
> >>>>    vs2-ldo3-supply:
> >>>> -    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
> >>>> -  vs2-ldo4-supply:
> >>>> -    description: Supply for LDO vcamd
> >>>> -
> >>>> -patternProperties:
> >>>> -  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
> >>>> -    description: Buck regulators
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_v(a|rf)12":
> >>>> -    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_v((aux|cn|io|rf)18|camio)":
> >>>> -    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_vxo22":
> >>>> -    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_v(aud|bif|cn|fe|io)28":
> >>>> -    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_vusb":
> >>>> -    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_vsram_(gpu|others|proc1[12])$":
> >>>> -    description: LDOs with variable output
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
> >>>> -    description: LDOs with variable output and 0~100/10mV tuning
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>
> >>> I don't understand. You just added it and it is already wrong? Please,
> >>> do not add code which is clearly incorrect.
> >>
> >> Sent too early - anyway properties cannot be defined in allOf:. That's
> >> not the place for them and there is no single reason for it. From which
> >> regulator binding you got this example?
> >
> > None. It was simply a way I figured out when I was reading up on JSON
> > schema syntax. I wanted to split the definitions cleanly, since they
> > are very different. And with "unevaluatedProperties: false" in the base
> > schema it did seem to work, successfully evaluating existing device trees
> > and producing errors when extra properties were added, or if types didn't
> > match up.
>
> If they are very different, this should not have been one binding. There
> is little benefit of that.

But how would one handle sharing a common fallback compatible if it were
split? In v1 they were separate bindings, but then Angelo argued that they
were in fact very similar and the variants can be detected through hardware
registers.

Note that the vastly different regulator names here are done for aesthetic
reasons. The MT6358 had names with underscores and IMHO unneeded prefixes.
These can't be changed due to existing device trees using them. (Or we
could break the ABI.) With the MT6366 I chose to simplify them to match
the exact names from the datasheet, except for the underscores.

ChenYu

> > Now that you mention it, I suppose the preferred way to write it is to
> > have all the properties in the base schema, then negate the ones that
> > don't belong in the allOf: section? It just seems really repetitive given
> > the child node names for the chip variants are completely different. OOTH
> > I guess it would produce better error messages.
>
>
> For regular cases yes, but not if devices differ so much.
>
> Best regards,
> Krzysztof
>

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

* Re: [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
@ 2023-08-23  8:07             ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-23  8:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown,
	Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On Wed, Aug 23, 2023 at 1:45 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 23/08/2023 06:20, Chen-Yu Tsai wrote:
> > On Wed, Aug 23, 2023 at 3:40 AM Krzysztof Kozlowski
> > <krzysztof.kozlowski@linaro.org> wrote:
> >>
> >> On 22/08/2023 21:39, Krzysztof Kozlowski wrote:
> >>> On 22/08/2023 10:45, Chen-Yu Tsai wrote:
> >>>> From: Zhiyong Tao <zhiyong.tao@mediatek.com>
> >>>>
> >>>> The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
> >>>> to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
> >>>> 29 LDO regulators, not counting ones that feed internally and basically
> >>>> have no controls. The regulators are named after their intended usage
> >>>> for the SoC and system design, thus not named generically as ldoX or
> >>>> dcdcX, but as vcn33 or vgpu.
> >>>>
> >>>> Add a binding document describing all the regulators and their supplies.
> >>>>
> >>>> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
> >>>> [wens@chromium.org: major rework and added commit message]
> >>>> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> >>>> ---
> >>>> Changes since v1:
> >>>> - Replaced underscores in supply names to hyphens
> >>>> - Merged with MT6358 regulator binding
> >>>> - Added MT6358 fallback compatible to MT6366 regulator
> >>>>
> >>>> Changes since Zhiyong's last version (v4) [1]:
> >>>> - simplified regulator names
> >>>> - added descriptions to regulators
> >>>> - removed bogus regulators (*_sshub)
> >>>> - merged vcn33-wifi and vcn33-bt as vcn33
> >>>> - added missing regulators (vm18, vmddr, vsram-core)
> >>>> - cut down examples to a handful of cases and made them complete
> >>>> - expanded commit message a lot
> >>>>
> >>>> [1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
> >>>>  .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
> >>>>  1 file changed, 168 insertions(+), 59 deletions(-)
> >>>>
> >>>> diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> >>>> index 82328fe17680..b350181f33ff 100644
> >>>> --- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> >>>> +++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> >>>> @@ -16,14 +16,18 @@ description: |
> >>>>
> >>>>  properties:
> >>>>    compatible:
> >>>> -    const: mediatek,mt6358-regulator
> >>>> +    oneOf:
> >>>> +      - const: mediatek,mt6358-regulator
> >>>> +      - items:
> >>>> +          - const: mediatek,mt6366-regulator
> >>>> +          - const: mediatek,mt6358-regulator
> >>>>
> >>>>    vsys-ldo1-supply:
> >>>>      description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
> >>>>    vsys-ldo2-supply:
> >>>> -    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
> >>>> +    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
> >>>>    vsys-ldo3-supply:
> >>>> -    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
> >>>> +    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
> >>>>    vsys-vcore-supply:
> >>>>      description: Supply for buck regulator vcore
> >>>>    vsys-vdram1-supply:
> >>>> @@ -43,75 +47,138 @@ properties:
> >>>>    vsys-vs2-supply:
> >>>>      description: Supply for buck regulator vs2
> >>>>    vs1-ldo1-supply:
> >>>> -    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
> >>>> +    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
> >>>>    vs2-ldo1-supply:
> >>>> -    description: Supply for LDOs vdram2
> >>>> +    description: Supply for LDOs vdram2, vmddr (MT6366 only)
> >>>>    vs2-ldo2-supply:
> >>>>      description: Supply for LDOs vrf12, va12
> >>>>    vs2-ldo3-supply:
> >>>> -    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
> >>>> -  vs2-ldo4-supply:
> >>>> -    description: Supply for LDO vcamd
> >>>> -
> >>>> -patternProperties:
> >>>> -  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
> >>>> -    description: Buck regulators
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_v(a|rf)12":
> >>>> -    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_v((aux|cn|io|rf)18|camio)":
> >>>> -    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_vxo22":
> >>>> -    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_v(aud|bif|cn|fe|io)28":
> >>>> -    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_vusb":
> >>>> -    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_vsram_(gpu|others|proc1[12])$":
> >>>> -    description: LDOs with variable output
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>> -
> >>>> -  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
> >>>> -    description: LDOs with variable output and 0~100/10mV tuning
> >>>> -    type: object
> >>>> -    $ref: regulator.yaml#
> >>>> -    unevaluatedProperties: false
> >>>
> >>> I don't understand. You just added it and it is already wrong? Please,
> >>> do not add code which is clearly incorrect.
> >>
> >> Sent too early - anyway properties cannot be defined in allOf:. That's
> >> not the place for them and there is no single reason for it. From which
> >> regulator binding you got this example?
> >
> > None. It was simply a way I figured out when I was reading up on JSON
> > schema syntax. I wanted to split the definitions cleanly, since they
> > are very different. And with "unevaluatedProperties: false" in the base
> > schema it did seem to work, successfully evaluating existing device trees
> > and producing errors when extra properties were added, or if types didn't
> > match up.
>
> If they are very different, this should not have been one binding. There
> is little benefit of that.

But how would one handle sharing a common fallback compatible if it were
split? In v1 they were separate bindings, but then Angelo argued that they
were in fact very similar and the variants can be detected through hardware
registers.

Note that the vastly different regulator names here are done for aesthetic
reasons. The MT6358 had names with underscores and IMHO unneeded prefixes.
These can't be changed due to existing device trees using them. (Or we
could break the ABI.) With the MT6366 I chose to simplify them to match
the exact names from the datasheet, except for the underscores.

ChenYu

> > Now that you mention it, I suppose the preferred way to write it is to
> > have all the properties in the base schema, then negate the ones that
> > don't belong in the allOf: section? It just seems really repetitive given
> > the child node names for the chip variants are completely different. OOTH
> > I guess it would produce better error messages.
>
>
> For regular cases yes, but not if devices differ so much.
>
> Best regards,
> Krzysztof
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 03/11] regulator: dt-bindings: mt6358: Convert to DT schema
  2023-08-23  5:48         ` Krzysztof Kozlowski
@ 2023-08-23  8:13           ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-23  8:13 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown,
	Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On Wed, Aug 23, 2023 at 1:48 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 23/08/2023 05:54, Chen-Yu Tsai wrote:
> >>> +
> >>> +    regulator {
> >>> +        compatible = "mediatek,mt6358-regulator";
> >>> +
> >>> +        buck_vgpu {
> >>> +            regulator-name = "vgpu";
> >>> +            regulator-min-microvolt = <625000>;
> >>> +            regulator-max-microvolt = <900000>;
> >>> +            regulator-ramp-delay = <6250>;
> >>> +            regulator-enable-ramp-delay = <200>;
> >>> +            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO
> >>
> >> mt6397?
> >>
> >> Both cases look a bit confusing.
> >
> > There's only two regulator binding header files, mt6397 and mt6360.
> > They seem to correspond to the two classes of PMICs that MediaTek has.
> > I believe the two header files and thus the macros are meant to be
> > shared?
>
> Defines have specific model name, so they do not look like meant to be
> shared. If all the values of the binding match, they can be shared, but
> then this should be mentioned in the binding plus it should be used in
> the driver. I don't see your driver patches add include of this header.

Indeed. AFAICT the original raw values 0 and 1 just map directly to the
register bitfield values. And those are common across the series of PMICs.
I'll look into cleaning it up.

ChenYu

> > MT6397 and co refer to their AP PMICs, i.e. PMICs that are companion
> > chips to the SoC and provide most of the power rails a system needs,
> > along with things like RTC, audio codecs, etc.. The MT6358 and MT6366
> > belong to this class.
> >
> > MT6360 and possibly others refer to their charger PMICs, which integrate
> > a battery charger, USB type-C PD stuff, LED drivers, and a handful of
> > regulators.
>
>
> Best regards,
> Krzysztof
>

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

* Re: [PATCH v2 03/11] regulator: dt-bindings: mt6358: Convert to DT schema
@ 2023-08-23  8:13           ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-08-23  8:13 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, AngeloGioacchino Del Regno, Mark Brown,
	Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On Wed, Aug 23, 2023 at 1:48 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 23/08/2023 05:54, Chen-Yu Tsai wrote:
> >>> +
> >>> +    regulator {
> >>> +        compatible = "mediatek,mt6358-regulator";
> >>> +
> >>> +        buck_vgpu {
> >>> +            regulator-name = "vgpu";
> >>> +            regulator-min-microvolt = <625000>;
> >>> +            regulator-max-microvolt = <900000>;
> >>> +            regulator-ramp-delay = <6250>;
> >>> +            regulator-enable-ramp-delay = <200>;
> >>> +            regulator-allowed-modes = <MT6397_BUCK_MODE_AUTO
> >>
> >> mt6397?
> >>
> >> Both cases look a bit confusing.
> >
> > There's only two regulator binding header files, mt6397 and mt6360.
> > They seem to correspond to the two classes of PMICs that MediaTek has.
> > I believe the two header files and thus the macros are meant to be
> > shared?
>
> Defines have specific model name, so they do not look like meant to be
> shared. If all the values of the binding match, they can be shared, but
> then this should be mentioned in the binding plus it should be used in
> the driver. I don't see your driver patches add include of this header.

Indeed. AFAICT the original raw values 0 and 1 just map directly to the
register bitfield values. And those are common across the series of PMICs.
I'll look into cleaning it up.

ChenYu

> > MT6397 and co refer to their AP PMICs, i.e. PMICs that are companion
> > chips to the SoC and provide most of the power rails a system needs,
> > along with things like RTC, audio codecs, etc.. The MT6358 and MT6366
> > belong to this class.
> >
> > MT6360 and possibly others refer to their charger PMICs, which integrate
> > a battery charger, USB type-C PD stuff, LED drivers, and a handful of
> > regulators.
>
>
> Best regards,
> Krzysztof
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
  2023-08-23  8:07             ` Chen-Yu Tsai
@ 2023-09-15  8:44               ` AngeloGioacchino Del Regno
  -1 siblings, 0 replies; 54+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-15  8:44 UTC (permalink / raw)
  To: Chen-Yu Tsai, Krzysztof Kozlowski
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, Mark Brown, Zhiyong Tao, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek

Il 23/08/23 10:07, Chen-Yu Tsai ha scritto:
> On Wed, Aug 23, 2023 at 1:45 PM Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
>>
>> On 23/08/2023 06:20, Chen-Yu Tsai wrote:
>>> On Wed, Aug 23, 2023 at 3:40 AM Krzysztof Kozlowski
>>> <krzysztof.kozlowski@linaro.org> wrote:
>>>>
>>>> On 22/08/2023 21:39, Krzysztof Kozlowski wrote:
>>>>> On 22/08/2023 10:45, Chen-Yu Tsai wrote:
>>>>>> From: Zhiyong Tao <zhiyong.tao@mediatek.com>
>>>>>>
>>>>>> The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
>>>>>> to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
>>>>>> 29 LDO regulators, not counting ones that feed internally and basically
>>>>>> have no controls. The regulators are named after their intended usage
>>>>>> for the SoC and system design, thus not named generically as ldoX or
>>>>>> dcdcX, but as vcn33 or vgpu.
>>>>>>
>>>>>> Add a binding document describing all the regulators and their supplies.
>>>>>>
>>>>>> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
>>>>>> [wens@chromium.org: major rework and added commit message]
>>>>>> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
>>>>>> ---
>>>>>> Changes since v1:
>>>>>> - Replaced underscores in supply names to hyphens
>>>>>> - Merged with MT6358 regulator binding
>>>>>> - Added MT6358 fallback compatible to MT6366 regulator
>>>>>>
>>>>>> Changes since Zhiyong's last version (v4) [1]:
>>>>>> - simplified regulator names
>>>>>> - added descriptions to regulators
>>>>>> - removed bogus regulators (*_sshub)
>>>>>> - merged vcn33-wifi and vcn33-bt as vcn33
>>>>>> - added missing regulators (vm18, vmddr, vsram-core)
>>>>>> - cut down examples to a handful of cases and made them complete
>>>>>> - expanded commit message a lot
>>>>>>
>>>>>> [1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
>>>>>>   .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
>>>>>>   1 file changed, 168 insertions(+), 59 deletions(-)
>>>>>>
>>>>>> diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>>>>>> index 82328fe17680..b350181f33ff 100644
>>>>>> --- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>>>>>> +++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>>>>>> @@ -16,14 +16,18 @@ description: |
>>>>>>
>>>>>>   properties:
>>>>>>     compatible:
>>>>>> -    const: mediatek,mt6358-regulator
>>>>>> +    oneOf:
>>>>>> +      - const: mediatek,mt6358-regulator
>>>>>> +      - items:
>>>>>> +          - const: mediatek,mt6366-regulator
>>>>>> +          - const: mediatek,mt6358-regulator
>>>>>>
>>>>>>     vsys-ldo1-supply:
>>>>>>       description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
>>>>>>     vsys-ldo2-supply:
>>>>>> -    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
>>>>>> +    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
>>>>>>     vsys-ldo3-supply:
>>>>>> -    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
>>>>>> +    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
>>>>>>     vsys-vcore-supply:
>>>>>>       description: Supply for buck regulator vcore
>>>>>>     vsys-vdram1-supply:
>>>>>> @@ -43,75 +47,138 @@ properties:
>>>>>>     vsys-vs2-supply:
>>>>>>       description: Supply for buck regulator vs2
>>>>>>     vs1-ldo1-supply:
>>>>>> -    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
>>>>>> +    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
>>>>>>     vs2-ldo1-supply:
>>>>>> -    description: Supply for LDOs vdram2
>>>>>> +    description: Supply for LDOs vdram2, vmddr (MT6366 only)
>>>>>>     vs2-ldo2-supply:
>>>>>>       description: Supply for LDOs vrf12, va12
>>>>>>     vs2-ldo3-supply:
>>>>>> -    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
>>>>>> -  vs2-ldo4-supply:
>>>>>> -    description: Supply for LDO vcamd
>>>>>> -
>>>>>> -patternProperties:
>>>>>> -  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
>>>>>> -    description: Buck regulators
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_v(a|rf)12":
>>>>>> -    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_v((aux|cn|io|rf)18|camio)":
>>>>>> -    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_vxo22":
>>>>>> -    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_v(aud|bif|cn|fe|io)28":
>>>>>> -    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_vusb":
>>>>>> -    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_vsram_(gpu|others|proc1[12])$":
>>>>>> -    description: LDOs with variable output
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
>>>>>> -    description: LDOs with variable output and 0~100/10mV tuning
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>
>>>>> I don't understand. You just added it and it is already wrong? Please,
>>>>> do not add code which is clearly incorrect.
>>>>
>>>> Sent too early - anyway properties cannot be defined in allOf:. That's
>>>> not the place for them and there is no single reason for it. From which
>>>> regulator binding you got this example?
>>>
>>> None. It was simply a way I figured out when I was reading up on JSON
>>> schema syntax. I wanted to split the definitions cleanly, since they
>>> are very different. And with "unevaluatedProperties: false" in the base
>>> schema it did seem to work, successfully evaluating existing device trees
>>> and producing errors when extra properties were added, or if types didn't
>>> match up.
>>
>> If they are very different, this should not have been one binding. There
>> is little benefit of that.
> 
> But how would one handle sharing a common fallback compatible if it were
> split? In v1 they were separate bindings, but then Angelo argued that they
> were in fact very similar and the variants can be detected through hardware
> registers.
> 
> Note that the vastly different regulator names here are done for aesthetic
> reasons. The MT6358 had names with underscores and IMHO unneeded prefixes.
> These can't be changed due to existing device trees using them. (Or we
> could break the ABI.) With the MT6366 I chose to simplify them to match
> the exact names from the datasheet, except for the underscores.
> 
> ChenYu
> 
>>> Now that you mention it, I suppose the preferred way to write it is to
>>> have all the properties in the base schema, then negate the ones that
>>> don't belong in the allOf: section? It just seems really repetitive given
>>> the child node names for the chip variants are completely different. OOTH
>>> I guess it would produce better error messages.
>>
>>
>> For regular cases yes, but not if devices differ so much.
>>

Summarizing the important info:
- Chips are not "very different"
- Main changes in schema are just cosmetic

Blurb below... :-)

MT6358 and MT6366 have minimal differences from a driver perspective but then
bindings describe hardware, not drivers, that's a fact and there's nothing to
argue about that (and infact I won't argue about that).

I've been arguing about using the same driver and about that one not needing
any special compatible for MT6366 because (as ChenYu said) the only difference
- again, from a software perspective - is that the big list of regulators "swaps"
(permit me the term...) 3 regulators and drops one: everything is handled the
very same way anyway.

This brings us to this point, where ChenYu *rightfully* wants to rename the actual
regulator names, because we shouldn't see underscores in devicetrees for multiple
reasons (which I surely don't have to explain of course) - even though the "right"
name as stated in datasheets contain underscores instead of dashes.

And there we go: all those changes in bindings are just because cosmetic stuff.

That said.....
I think that the real issue here can be solved with one easy question to Krzysztof:

in this case, where we want to use a different name (s/_/-/g) for regulators,
should we create a new yaml file, or should we update mt6358-regulator.yaml (but
obviously keeping the old cosmetics for the existing devicetrees and new for new)?

And - In case the best option would be to create a new mt6366-regulator.yaml,
would it be advisable to use a new compatible, or can we reuse the
"mediatek,mt6358-regulator" compatible?

Clearly, in the latter case, our target would be to have a devicetree declaring

regulator {
	compatible = "mediatek,mt6366-regulator", "mediatek,mt6358-regulator";
	... everything else ...
}

Cheers,
Angelo

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

* Re: [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC
@ 2023-09-15  8:44               ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 54+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-15  8:44 UTC (permalink / raw)
  To: Chen-Yu Tsai, Krzysztof Kozlowski
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, Mark Brown, Zhiyong Tao, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek

Il 23/08/23 10:07, Chen-Yu Tsai ha scritto:
> On Wed, Aug 23, 2023 at 1:45 PM Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
>>
>> On 23/08/2023 06:20, Chen-Yu Tsai wrote:
>>> On Wed, Aug 23, 2023 at 3:40 AM Krzysztof Kozlowski
>>> <krzysztof.kozlowski@linaro.org> wrote:
>>>>
>>>> On 22/08/2023 21:39, Krzysztof Kozlowski wrote:
>>>>> On 22/08/2023 10:45, Chen-Yu Tsai wrote:
>>>>>> From: Zhiyong Tao <zhiyong.tao@mediatek.com>
>>>>>>
>>>>>> The MediaTek MT6366 PMIC is similar to the MT6358 PMIC. It is designed
>>>>>> to be paired with the MediaTek MT8186 SoC. It has 9 buck regulators and
>>>>>> 29 LDO regulators, not counting ones that feed internally and basically
>>>>>> have no controls. The regulators are named after their intended usage
>>>>>> for the SoC and system design, thus not named generically as ldoX or
>>>>>> dcdcX, but as vcn33 or vgpu.
>>>>>>
>>>>>> Add a binding document describing all the regulators and their supplies.
>>>>>>
>>>>>> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
>>>>>> [wens@chromium.org: major rework and added commit message]
>>>>>> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
>>>>>> ---
>>>>>> Changes since v1:
>>>>>> - Replaced underscores in supply names to hyphens
>>>>>> - Merged with MT6358 regulator binding
>>>>>> - Added MT6358 fallback compatible to MT6366 regulator
>>>>>>
>>>>>> Changes since Zhiyong's last version (v4) [1]:
>>>>>> - simplified regulator names
>>>>>> - added descriptions to regulators
>>>>>> - removed bogus regulators (*_sshub)
>>>>>> - merged vcn33-wifi and vcn33-bt as vcn33
>>>>>> - added missing regulators (vm18, vmddr, vsram-core)
>>>>>> - cut down examples to a handful of cases and made them complete
>>>>>> - expanded commit message a lot
>>>>>>
>>>>>> [1] https://lore.kernel.org/linux-arm-kernel/20220823123745.14061-1-zhiyong.tao@mediatek.com/
>>>>>>   .../regulator/mediatek,mt6358-regulator.yaml  | 227 +++++++++++++-----
>>>>>>   1 file changed, 168 insertions(+), 59 deletions(-)
>>>>>>
>>>>>> diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>>>>>> index 82328fe17680..b350181f33ff 100644
>>>>>> --- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>>>>>> +++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
>>>>>> @@ -16,14 +16,18 @@ description: |
>>>>>>
>>>>>>   properties:
>>>>>>     compatible:
>>>>>> -    const: mediatek,mt6358-regulator
>>>>>> +    oneOf:
>>>>>> +      - const: mediatek,mt6358-regulator
>>>>>> +      - items:
>>>>>> +          - const: mediatek,mt6366-regulator
>>>>>> +          - const: mediatek,mt6358-regulator
>>>>>>
>>>>>>     vsys-ldo1-supply:
>>>>>>       description: Supply for LDOs vfe28, vxo22, vcn28, vaux18, vaud28, vsim1, vusb, vbif28
>>>>>>     vsys-ldo2-supply:
>>>>>> -    description: Supply for LDOs vldo28, vio28, vmc, vmch, vsim2
>>>>>> +    description: Supply for LDOs vldo28 (MT6358 only), vio28, vmc, vmch, vsim2
>>>>>>     vsys-ldo3-supply:
>>>>>> -    description: Supply for LDOs vcn33, vcama1, vcama2, vemc, vibr
>>>>>> +    description: Supply for LDOs vcn33, vcama[12] (MT6358 only), vemc, vibr
>>>>>>     vsys-vcore-supply:
>>>>>>       description: Supply for buck regulator vcore
>>>>>>     vsys-vdram1-supply:
>>>>>> @@ -43,75 +47,138 @@ properties:
>>>>>>     vsys-vs2-supply:
>>>>>>       description: Supply for buck regulator vs2
>>>>>>     vs1-ldo1-supply:
>>>>>> -    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio, vio18
>>>>>> +    description: Supply for LDOs vrf18, vefuse, vcn18, vcamio (MT6358 only), vio18
>>>>>>     vs2-ldo1-supply:
>>>>>> -    description: Supply for LDOs vdram2
>>>>>> +    description: Supply for LDOs vdram2, vmddr (MT6366 only)
>>>>>>     vs2-ldo2-supply:
>>>>>>       description: Supply for LDOs vrf12, va12
>>>>>>     vs2-ldo3-supply:
>>>>>> -    description: Supply for LDOs vsram-gpu, vsram-others, vsram-proc11, vsram-proc12
>>>>>> -  vs2-ldo4-supply:
>>>>>> -    description: Supply for LDO vcamd
>>>>>> -
>>>>>> -patternProperties:
>>>>>> -  "^buck_v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
>>>>>> -    description: Buck regulators
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_v(a|rf)12":
>>>>>> -    description: LDOs with fixed 1.2V output and 0~100/10mV tuning
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_v((aux|cn|io|rf)18|camio)":
>>>>>> -    description: LDOs with fixed 1.8V output and 0~100/10mV tuning
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_vxo22":
>>>>>> -    description: LDOs with fixed 2.2V output and 0~100/10mV tuning
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_v(aud|bif|cn|fe|io)28":
>>>>>> -    description: LDOs with fixed 2.8V output and 0~100/10mV tuning
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_vusb":
>>>>>> -    description: LDOs with fixed 3.0V output and 0~100/10mV tuning
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_vsram_(gpu|others|proc1[12])$":
>>>>>> -    description: LDOs with variable output
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>> -
>>>>>> -  "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
>>>>>> -    description: LDOs with variable output and 0~100/10mV tuning
>>>>>> -    type: object
>>>>>> -    $ref: regulator.yaml#
>>>>>> -    unevaluatedProperties: false
>>>>>
>>>>> I don't understand. You just added it and it is already wrong? Please,
>>>>> do not add code which is clearly incorrect.
>>>>
>>>> Sent too early - anyway properties cannot be defined in allOf:. That's
>>>> not the place for them and there is no single reason for it. From which
>>>> regulator binding you got this example?
>>>
>>> None. It was simply a way I figured out when I was reading up on JSON
>>> schema syntax. I wanted to split the definitions cleanly, since they
>>> are very different. And with "unevaluatedProperties: false" in the base
>>> schema it did seem to work, successfully evaluating existing device trees
>>> and producing errors when extra properties were added, or if types didn't
>>> match up.
>>
>> If they are very different, this should not have been one binding. There
>> is little benefit of that.
> 
> But how would one handle sharing a common fallback compatible if it were
> split? In v1 they were separate bindings, but then Angelo argued that they
> were in fact very similar and the variants can be detected through hardware
> registers.
> 
> Note that the vastly different regulator names here are done for aesthetic
> reasons. The MT6358 had names with underscores and IMHO unneeded prefixes.
> These can't be changed due to existing device trees using them. (Or we
> could break the ABI.) With the MT6366 I chose to simplify them to match
> the exact names from the datasheet, except for the underscores.
> 
> ChenYu
> 
>>> Now that you mention it, I suppose the preferred way to write it is to
>>> have all the properties in the base schema, then negate the ones that
>>> don't belong in the allOf: section? It just seems really repetitive given
>>> the child node names for the chip variants are completely different. OOTH
>>> I guess it would produce better error messages.
>>
>>
>> For regular cases yes, but not if devices differ so much.
>>

Summarizing the important info:
- Chips are not "very different"
- Main changes in schema are just cosmetic

Blurb below... :-)

MT6358 and MT6366 have minimal differences from a driver perspective but then
bindings describe hardware, not drivers, that's a fact and there's nothing to
argue about that (and infact I won't argue about that).

I've been arguing about using the same driver and about that one not needing
any special compatible for MT6366 because (as ChenYu said) the only difference
- again, from a software perspective - is that the big list of regulators "swaps"
(permit me the term...) 3 regulators and drops one: everything is handled the
very same way anyway.

This brings us to this point, where ChenYu *rightfully* wants to rename the actual
regulator names, because we shouldn't see underscores in devicetrees for multiple
reasons (which I surely don't have to explain of course) - even though the "right"
name as stated in datasheets contain underscores instead of dashes.

And there we go: all those changes in bindings are just because cosmetic stuff.

That said.....
I think that the real issue here can be solved with one easy question to Krzysztof:

in this case, where we want to use a different name (s/_/-/g) for regulators,
should we create a new yaml file, or should we update mt6358-regulator.yaml (but
obviously keeping the old cosmetics for the existing devicetrees and new for new)?

And - In case the best option would be to create a new mt6366-regulator.yaml,
would it be advisable to use a new compatible, or can we reuse the
"mediatek,mt6358-regulator" compatible?

Clearly, in the latter case, our target would be to have a devicetree declaring

regulator {
	compatible = "mediatek,mt6366-regulator", "mediatek,mt6358-regulator";
	... everything else ...
}

Cheers,
Angelo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 02/11] mfd: mt6358: Add registers for MT6366 specific regulators
  2023-08-22  8:45   ` Chen-Yu Tsai
@ 2023-09-15  8:55     ` AngeloGioacchino Del Regno
  -1 siblings, 0 replies; 54+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-15  8:55 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

Il 22/08/23 10:45, Chen-Yu Tsai ha scritto:
> The MT6366 PMIC, compared to the MT6358, does away with the VCAM*
> regulators. Two regulators VM18 and VMDDR reuse their register space.
> There's also a VSRAM type regulator VSRAM_CORE thats' split between
> the VCAM* register space and other parts.
> 
> Add register address macros for these MT6366 specific regulators.
> 
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>

For ease of applying to MFD, I think it's ok to have the header changes split
from the actual user; so:

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Cheers!

> ---
>   include/linux/mfd/mt6358/registers.h | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h
> index 5ea2590be710..d83e87298ac4 100644
> --- a/include/linux/mfd/mt6358/registers.h
> +++ b/include/linux/mfd/mt6358/registers.h
> @@ -294,4 +294,21 @@
>   #define MT6358_AUD_TOP_INT_CON0               0x2228
>   #define MT6358_AUD_TOP_INT_STATUS0            0x2234
>   
> +/*
> + * MT6366 has no VCAM*, but has other regulators in its place. The names
> + * keep the MT6358 prefix for ease of use in the regulator driver.
> + */
> +#define MT6358_LDO_VSRAM_CON5                 0x1bf8
> +#define MT6358_LDO_VM18_CON0                  MT6358_LDO_VCAMA1_CON0
> +#define MT6358_LDO_VM18_CON1                  MT6358_LDO_VCAMA1_CON1
> +#define MT6358_LDO_VM18_CON2                  MT6358_LDO_VCAMA1_CON2
> +#define MT6358_LDO_VMDDR_CON0                 MT6358_LDO_VCAMA2_CON0
> +#define MT6358_LDO_VMDDR_CON1                 MT6358_LDO_VCAMA2_CON1
> +#define MT6358_LDO_VMDDR_CON2                 MT6358_LDO_VCAMA2_CON2
> +#define MT6358_LDO_VSRAM_CORE_CON0            MT6358_LDO_VCAMD_CON0
> +#define MT6358_LDO_VSRAM_CORE_DBG0            0x1cb6
> +#define MT6358_LDO_VSRAM_CORE_DBG1            0x1cb8
> +#define MT6358_VM18_ANA_CON0                  MT6358_VCAMA1_ANA_CON0
> +#define MT6358_VMDDR_ANA_CON0                 MT6358_VCAMD_ANA_CON0
> +
>   #endif /* __MFD_MT6358_REGISTERS_H__ */


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

* Re: [PATCH v2 02/11] mfd: mt6358: Add registers for MT6366 specific regulators
@ 2023-09-15  8:55     ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 54+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-15  8:55 UTC (permalink / raw)
  To: Chen-Yu Tsai, Lee Jones, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, Mark Brown
  Cc: Zhiyong Tao, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

Il 22/08/23 10:45, Chen-Yu Tsai ha scritto:
> The MT6366 PMIC, compared to the MT6358, does away with the VCAM*
> regulators. Two regulators VM18 and VMDDR reuse their register space.
> There's also a VSRAM type regulator VSRAM_CORE thats' split between
> the VCAM* register space and other parts.
> 
> Add register address macros for these MT6366 specific regulators.
> 
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>

For ease of applying to MFD, I think it's ok to have the header changes split
from the actual user; so:

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Cheers!

> ---
>   include/linux/mfd/mt6358/registers.h | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h
> index 5ea2590be710..d83e87298ac4 100644
> --- a/include/linux/mfd/mt6358/registers.h
> +++ b/include/linux/mfd/mt6358/registers.h
> @@ -294,4 +294,21 @@
>   #define MT6358_AUD_TOP_INT_CON0               0x2228
>   #define MT6358_AUD_TOP_INT_STATUS0            0x2234
>   
> +/*
> + * MT6366 has no VCAM*, but has other regulators in its place. The names
> + * keep the MT6358 prefix for ease of use in the regulator driver.
> + */
> +#define MT6358_LDO_VSRAM_CON5                 0x1bf8
> +#define MT6358_LDO_VM18_CON0                  MT6358_LDO_VCAMA1_CON0
> +#define MT6358_LDO_VM18_CON1                  MT6358_LDO_VCAMA1_CON1
> +#define MT6358_LDO_VM18_CON2                  MT6358_LDO_VCAMA1_CON2
> +#define MT6358_LDO_VMDDR_CON0                 MT6358_LDO_VCAMA2_CON0
> +#define MT6358_LDO_VMDDR_CON1                 MT6358_LDO_VCAMA2_CON1
> +#define MT6358_LDO_VMDDR_CON2                 MT6358_LDO_VCAMA2_CON2
> +#define MT6358_LDO_VSRAM_CORE_CON0            MT6358_LDO_VCAMD_CON0
> +#define MT6358_LDO_VSRAM_CORE_DBG0            0x1cb6
> +#define MT6358_LDO_VSRAM_CORE_DBG1            0x1cb8
> +#define MT6358_VM18_ANA_CON0                  MT6358_VCAMA1_ANA_CON0
> +#define MT6358_VMDDR_ANA_CON0                 MT6358_VCAMD_ANA_CON0
> +
>   #endif /* __MFD_MT6358_REGISTERS_H__ */


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 02/11] mfd: mt6358: Add registers for MT6366 specific regulators
  2023-09-15  8:55     ` AngeloGioacchino Del Regno
@ 2023-09-18 10:22       ` Chen-Yu Tsai
  -1 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-09-18 10:22 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, Mark Brown, Zhiyong Tao, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek

On Fri, Sep 15, 2023 at 4:55 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Il 22/08/23 10:45, Chen-Yu Tsai ha scritto:
> > The MT6366 PMIC, compared to the MT6358, does away with the VCAM*
> > regulators. Two regulators VM18 and VMDDR reuse their register space.
> > There's also a VSRAM type regulator VSRAM_CORE thats' split between
> > the VCAM* register space and other parts.
> >
> > Add register address macros for these MT6366 specific regulators.
> >
> > Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
>
> For ease of applying to MFD, I think it's ok to have the header changes split
> from the actual user; so:

Actually that doesn't help, because this is a compile time dependency.
Merging this through the MFD tree and the rest through the regulator
tree would mean either creating an immutable branch, or Lee giving an
ack for this patch to go through the regulator tree. We would be doing
the latter if we squashed the patches together anyway. I think squashing
them does make sense.

ChenYu

> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>
> Cheers!
>
> > ---
> >   include/linux/mfd/mt6358/registers.h | 17 +++++++++++++++++
> >   1 file changed, 17 insertions(+)
> >
> > diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h
> > index 5ea2590be710..d83e87298ac4 100644
> > --- a/include/linux/mfd/mt6358/registers.h
> > +++ b/include/linux/mfd/mt6358/registers.h
> > @@ -294,4 +294,21 @@
> >   #define MT6358_AUD_TOP_INT_CON0               0x2228
> >   #define MT6358_AUD_TOP_INT_STATUS0            0x2234
> >
> > +/*
> > + * MT6366 has no VCAM*, but has other regulators in its place. The names
> > + * keep the MT6358 prefix for ease of use in the regulator driver.
> > + */
> > +#define MT6358_LDO_VSRAM_CON5                 0x1bf8
> > +#define MT6358_LDO_VM18_CON0                  MT6358_LDO_VCAMA1_CON0
> > +#define MT6358_LDO_VM18_CON1                  MT6358_LDO_VCAMA1_CON1
> > +#define MT6358_LDO_VM18_CON2                  MT6358_LDO_VCAMA1_CON2
> > +#define MT6358_LDO_VMDDR_CON0                 MT6358_LDO_VCAMA2_CON0
> > +#define MT6358_LDO_VMDDR_CON1                 MT6358_LDO_VCAMA2_CON1
> > +#define MT6358_LDO_VMDDR_CON2                 MT6358_LDO_VCAMA2_CON2
> > +#define MT6358_LDO_VSRAM_CORE_CON0            MT6358_LDO_VCAMD_CON0
> > +#define MT6358_LDO_VSRAM_CORE_DBG0            0x1cb6
> > +#define MT6358_LDO_VSRAM_CORE_DBG1            0x1cb8
> > +#define MT6358_VM18_ANA_CON0                  MT6358_VCAMA1_ANA_CON0
> > +#define MT6358_VMDDR_ANA_CON0                 MT6358_VCAMD_ANA_CON0
> > +
> >   #endif /* __MFD_MT6358_REGISTERS_H__ */
>

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

* Re: [PATCH v2 02/11] mfd: mt6358: Add registers for MT6366 specific regulators
@ 2023-09-18 10:22       ` Chen-Yu Tsai
  0 siblings, 0 replies; 54+ messages in thread
From: Chen-Yu Tsai @ 2023-09-18 10:22 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Matthias Brugger, Mark Brown, Zhiyong Tao, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek

On Fri, Sep 15, 2023 at 4:55 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Il 22/08/23 10:45, Chen-Yu Tsai ha scritto:
> > The MT6366 PMIC, compared to the MT6358, does away with the VCAM*
> > regulators. Two regulators VM18 and VMDDR reuse their register space.
> > There's also a VSRAM type regulator VSRAM_CORE thats' split between
> > the VCAM* register space and other parts.
> >
> > Add register address macros for these MT6366 specific regulators.
> >
> > Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
>
> For ease of applying to MFD, I think it's ok to have the header changes split
> from the actual user; so:

Actually that doesn't help, because this is a compile time dependency.
Merging this through the MFD tree and the rest through the regulator
tree would mean either creating an immutable branch, or Lee giving an
ack for this patch to go through the regulator tree. We would be doing
the latter if we squashed the patches together anyway. I think squashing
them does make sense.

ChenYu

> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>
> Cheers!
>
> > ---
> >   include/linux/mfd/mt6358/registers.h | 17 +++++++++++++++++
> >   1 file changed, 17 insertions(+)
> >
> > diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h
> > index 5ea2590be710..d83e87298ac4 100644
> > --- a/include/linux/mfd/mt6358/registers.h
> > +++ b/include/linux/mfd/mt6358/registers.h
> > @@ -294,4 +294,21 @@
> >   #define MT6358_AUD_TOP_INT_CON0               0x2228
> >   #define MT6358_AUD_TOP_INT_STATUS0            0x2234
> >
> > +/*
> > + * MT6366 has no VCAM*, but has other regulators in its place. The names
> > + * keep the MT6358 prefix for ease of use in the regulator driver.
> > + */
> > +#define MT6358_LDO_VSRAM_CON5                 0x1bf8
> > +#define MT6358_LDO_VM18_CON0                  MT6358_LDO_VCAMA1_CON0
> > +#define MT6358_LDO_VM18_CON1                  MT6358_LDO_VCAMA1_CON1
> > +#define MT6358_LDO_VM18_CON2                  MT6358_LDO_VCAMA1_CON2
> > +#define MT6358_LDO_VMDDR_CON0                 MT6358_LDO_VCAMA2_CON0
> > +#define MT6358_LDO_VMDDR_CON1                 MT6358_LDO_VCAMA2_CON1
> > +#define MT6358_LDO_VMDDR_CON2                 MT6358_LDO_VCAMA2_CON2
> > +#define MT6358_LDO_VSRAM_CORE_CON0            MT6358_LDO_VCAMD_CON0
> > +#define MT6358_LDO_VSRAM_CORE_DBG0            0x1cb6
> > +#define MT6358_LDO_VSRAM_CORE_DBG1            0x1cb8
> > +#define MT6358_VM18_ANA_CON0                  MT6358_VCAMA1_ANA_CON0
> > +#define MT6358_VMDDR_ANA_CON0                 MT6358_VCAMD_ANA_CON0
> > +
> >   #endif /* __MFD_MT6358_REGISTERS_H__ */
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 02/11] mfd: mt6358: Add registers for MT6366 specific regulators
  2023-08-22  8:45   ` Chen-Yu Tsai
@ 2023-09-21 10:41     ` Lee Jones
  -1 siblings, 0 replies; 54+ messages in thread
From: Lee Jones @ 2023-09-21 10:41 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, Mark Brown, Zhiyong Tao, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek

On Tue, 22 Aug 2023, Chen-Yu Tsai wrote:

> The MT6366 PMIC, compared to the MT6358, does away with the VCAM*
> regulators. Two regulators VM18 and VMDDR reuse their register space.
> There's also a VSRAM type regulator VSRAM_CORE thats' split between
> the VCAM* register space and other parts.
> 
> Add register address macros for these MT6366 specific regulators.
> 
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
>  include/linux/mfd/mt6358/registers.h | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)

Acked-by: Lee Jones <lee@kernel.org>

> diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h
> index 5ea2590be710..d83e87298ac4 100644
> --- a/include/linux/mfd/mt6358/registers.h
> +++ b/include/linux/mfd/mt6358/registers.h
> @@ -294,4 +294,21 @@
>  #define MT6358_AUD_TOP_INT_CON0               0x2228
>  #define MT6358_AUD_TOP_INT_STATUS0            0x2234
>  
> +/*
> + * MT6366 has no VCAM*, but has other regulators in its place. The names
> + * keep the MT6358 prefix for ease of use in the regulator driver.
> + */
> +#define MT6358_LDO_VSRAM_CON5                 0x1bf8
> +#define MT6358_LDO_VM18_CON0                  MT6358_LDO_VCAMA1_CON0
> +#define MT6358_LDO_VM18_CON1                  MT6358_LDO_VCAMA1_CON1
> +#define MT6358_LDO_VM18_CON2                  MT6358_LDO_VCAMA1_CON2
> +#define MT6358_LDO_VMDDR_CON0                 MT6358_LDO_VCAMA2_CON0
> +#define MT6358_LDO_VMDDR_CON1                 MT6358_LDO_VCAMA2_CON1
> +#define MT6358_LDO_VMDDR_CON2                 MT6358_LDO_VCAMA2_CON2
> +#define MT6358_LDO_VSRAM_CORE_CON0            MT6358_LDO_VCAMD_CON0
> +#define MT6358_LDO_VSRAM_CORE_DBG0            0x1cb6
> +#define MT6358_LDO_VSRAM_CORE_DBG1            0x1cb8
> +#define MT6358_VM18_ANA_CON0                  MT6358_VCAMA1_ANA_CON0
> +#define MT6358_VMDDR_ANA_CON0                 MT6358_VCAMD_ANA_CON0
> +
>  #endif /* __MFD_MT6358_REGISTERS_H__ */
> -- 
> 2.42.0.rc1.204.g551eb34607-goog
> 

-- 
Lee Jones [李琼斯]

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

* Re: [PATCH v2 02/11] mfd: mt6358: Add registers for MT6366 specific regulators
@ 2023-09-21 10:41     ` Lee Jones
  0 siblings, 0 replies; 54+ messages in thread
From: Lee Jones @ 2023-09-21 10:41 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, Mark Brown, Zhiyong Tao, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek

On Tue, 22 Aug 2023, Chen-Yu Tsai wrote:

> The MT6366 PMIC, compared to the MT6358, does away with the VCAM*
> regulators. Two regulators VM18 and VMDDR reuse their register space.
> There's also a VSRAM type regulator VSRAM_CORE thats' split between
> the VCAM* register space and other parts.
> 
> Add register address macros for these MT6366 specific regulators.
> 
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
>  include/linux/mfd/mt6358/registers.h | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)

Acked-by: Lee Jones <lee@kernel.org>

> diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h
> index 5ea2590be710..d83e87298ac4 100644
> --- a/include/linux/mfd/mt6358/registers.h
> +++ b/include/linux/mfd/mt6358/registers.h
> @@ -294,4 +294,21 @@
>  #define MT6358_AUD_TOP_INT_CON0               0x2228
>  #define MT6358_AUD_TOP_INT_STATUS0            0x2234
>  
> +/*
> + * MT6366 has no VCAM*, but has other regulators in its place. The names
> + * keep the MT6358 prefix for ease of use in the regulator driver.
> + */
> +#define MT6358_LDO_VSRAM_CON5                 0x1bf8
> +#define MT6358_LDO_VM18_CON0                  MT6358_LDO_VCAMA1_CON0
> +#define MT6358_LDO_VM18_CON1                  MT6358_LDO_VCAMA1_CON1
> +#define MT6358_LDO_VM18_CON2                  MT6358_LDO_VCAMA1_CON2
> +#define MT6358_LDO_VMDDR_CON0                 MT6358_LDO_VCAMA2_CON0
> +#define MT6358_LDO_VMDDR_CON1                 MT6358_LDO_VCAMA2_CON1
> +#define MT6358_LDO_VMDDR_CON2                 MT6358_LDO_VCAMA2_CON2
> +#define MT6358_LDO_VSRAM_CORE_CON0            MT6358_LDO_VCAMD_CON0
> +#define MT6358_LDO_VSRAM_CORE_DBG0            0x1cb6
> +#define MT6358_LDO_VSRAM_CORE_DBG1            0x1cb8
> +#define MT6358_VM18_ANA_CON0                  MT6358_VCAMA1_ANA_CON0
> +#define MT6358_VMDDR_ANA_CON0                 MT6358_VCAMD_ANA_CON0
> +
>  #endif /* __MFD_MT6358_REGISTERS_H__ */
> -- 
> 2.42.0.rc1.204.g551eb34607-goog
> 

-- 
Lee Jones [李琼斯]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-09-21 20:36 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-22  8:45 [PATCH v2 00/11] regulator: mt6366: Split out of MT6358 and cleanup Chen-Yu Tsai
2023-08-22  8:45 ` Chen-Yu Tsai
2023-08-22  8:45 ` [PATCH v2 01/11] dt-bindings: mfd: mt6397: Split out compatible for MediaTek MT6366 PMIC Chen-Yu Tsai
2023-08-22  8:45   ` Chen-Yu Tsai
2023-08-22 19:35   ` Krzysztof Kozlowski
2023-08-22 19:35     ` Krzysztof Kozlowski
2023-08-22  8:45 ` [PATCH v2 02/11] mfd: mt6358: Add registers for MT6366 specific regulators Chen-Yu Tsai
2023-08-22  8:45   ` Chen-Yu Tsai
2023-08-22 19:37   ` Krzysztof Kozlowski
2023-08-22 19:37     ` Krzysztof Kozlowski
2023-09-15  8:55   ` AngeloGioacchino Del Regno
2023-09-15  8:55     ` AngeloGioacchino Del Regno
2023-09-18 10:22     ` Chen-Yu Tsai
2023-09-18 10:22       ` Chen-Yu Tsai
2023-09-21 10:41   ` Lee Jones
2023-09-21 10:41     ` Lee Jones
2023-08-22  8:45 ` [PATCH v2 03/11] regulator: dt-bindings: mt6358: Convert to DT schema Chen-Yu Tsai
2023-08-22  8:45   ` Chen-Yu Tsai
2023-08-22 19:47   ` Krzysztof Kozlowski
2023-08-22 19:47     ` Krzysztof Kozlowski
2023-08-23  3:54     ` Chen-Yu Tsai
2023-08-23  3:54       ` Chen-Yu Tsai
2023-08-23  5:48       ` Krzysztof Kozlowski
2023-08-23  5:48         ` Krzysztof Kozlowski
2023-08-23  8:13         ` Chen-Yu Tsai
2023-08-23  8:13           ` Chen-Yu Tsai
2023-08-22  8:45 ` [PATCH v2 04/11] regulator: dt-bindings: mt6358: Add regulator supplies Chen-Yu Tsai
2023-08-22  8:45   ` Chen-Yu Tsai
2023-08-22  8:45 ` [PATCH v2 05/11] regulator: dt-bindings: mediatek: Add MT6366 PMIC Chen-Yu Tsai
2023-08-22  8:45   ` Chen-Yu Tsai
2023-08-22 19:39   ` Krzysztof Kozlowski
2023-08-22 19:39     ` Krzysztof Kozlowski
2023-08-22 19:40     ` Krzysztof Kozlowski
2023-08-22 19:40       ` Krzysztof Kozlowski
2023-08-23  4:20       ` Chen-Yu Tsai
2023-08-23  4:20         ` Chen-Yu Tsai
2023-08-23  5:45         ` Krzysztof Kozlowski
2023-08-23  5:45           ` Krzysztof Kozlowski
2023-08-23  8:07           ` Chen-Yu Tsai
2023-08-23  8:07             ` Chen-Yu Tsai
2023-09-15  8:44             ` AngeloGioacchino Del Regno
2023-09-15  8:44               ` AngeloGioacchino Del Regno
2023-08-22  8:45 ` [PATCH v2 06/11] regulator: mt6358: Add supply names for MT6358 regulators Chen-Yu Tsai
2023-08-22  8:45   ` Chen-Yu Tsai
2023-08-22  8:45 ` [PATCH v2 07/11] regulator: mt6358: fix and drop type prefix in MT6366 regulator node names Chen-Yu Tsai
2023-08-22  8:45   ` Chen-Yu Tsai
2023-08-22  8:45 ` [PATCH v2 08/11] regulator: mt6358: Make MT6366 vcn18 LDO configurable Chen-Yu Tsai
2023-08-22  8:45   ` Chen-Yu Tsai
2023-08-22  8:45 ` [PATCH v2 09/11] regulator: mt6358: Add missing regulators for MT6366 Chen-Yu Tsai
2023-08-22  8:45   ` Chen-Yu Tsai
2023-08-22  8:45 ` [PATCH v2 10/11] regulator: mt6358: Add supply names for MT6366 regulators Chen-Yu Tsai
2023-08-22  8:45   ` Chen-Yu Tsai
2023-08-22  8:45 ` [PATCH v2 11/11] arm64: dts: mediatek: mt8183-kukui: Add PMIC regulator supplies Chen-Yu Tsai
2023-08-22  8:45   ` Chen-Yu Tsai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.