2023-09-19 19:46:09

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH v3 00/12] regulator: mt6366: Split out of MT6358 and cleanup

Hi everyone,

This is v3 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 v2:
- Merged "mfd: mt6358: Add registers for MT6366 specific regulators"
into "regulator: mt6358: Add missing regulators for MT6366", as
suggested by Krzysztof.
- Reworked the bindings so that all the regulators are commonly defined,
then filtered out by compatible, like every other binding does.
- Added some missing end-of-string matches to the LDO patterns
- Added patches to reuse the MT6397 regulator binding macros
- regulator: dt-bindings: mt6358: Add regulator-allowed-modes property
- regulator: mt6358: Use mt6397-regulator.h binding header for buck mode macros
- Dropped "regulator-coupled-with" and "regulator-coupled-max-spread"
properties from the DT binding example. They don't make much sense
without the coupled regulator.
- Fixed up selector values in pickable linear ranges

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] and patch "regulator: mt6358: return error
for get/set mode op on linear range LDO" [2] patch. These are 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. This should go through the MFD tree. There are no build
time dependencies.

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

Patch 3 adds the "regulator-allowed-mode" property to the MT6358
regulator binding.

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 [3] 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 makes the MT6358 regulator driver use the mt6397-regulator.h
binding header for the operating mode macros.

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

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

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

Patch 10 adds regulators that were missing from the originally proposed
binding and driver. This includes MFD header changes and needs an ack
from Lee.

Patch 11 adds regulator supply names to the MT6366 regulators

Patch 12 adds regulator supplies to MT8183 Kukui boards.

Patch 1 should go through the mfd tree. Patches 3 through 11 should go
through the regulator tree after Lee acks patch 10. Patch 12 should go
through the MediaTek tree.

[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
[2] https://lore.kernel.org/linux-arm-kernel/[email protected]/
[3] https://lore.kernel.org/linux-arm-kernel/[email protected]/

Chen-Yu Tsai (11):
dt-bindings: mfd: mt6397: Split out compatible for MediaTek MT6366
PMIC
regulator: dt-bindings: mt6358: Convert to DT schema
regulator: dt-bindings: mt6358: Add regulator-allowed-modes property
regulator: dt-bindings: mt6358: Add regulator supplies
regulator: mt6358: Use mt6397-regulator.h binding header for buck mode
macros
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: mt6358: Add MT6366 PMIC

.../devicetree/bindings/mfd/mt6397.txt | 4 +-
.../regulator/mediatek,mt6358-regulator.yaml | 247 ++++++++++++
.../bindings/regulator/mt6358-regulator.txt | 350 ------------------
.../arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 28 ++
drivers/regulator/mt6358-regulator.c | 250 +++++++------
include/linux/mfd/mt6358/registers.h | 17 +
include/linux/regulator/mt6358-regulator.h | 3 +
7 files changed, 440 insertions(+), 459 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.459.ge4e396fd5e-goog


2023-09-19 20:53:05

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH v3 03/12] regulator: dt-bindings: mt6358: Add regulator-allowed-modes property

The MT6358 PMIC allows changing operating modes for the buck regulators,
but not the LDOs. Existing device trees and the Linux implementation
already utilize this through the standard regulator-allowed-modes
property.

The values currently used in existing device trees are simply raw
numbers. The values in the Linux driver are matching numbers defined
with macros denoting the two supported modes. Turns out these two
modes are common across parts of the larger MT63xx PMIC family. The
MT6397 regulator binding already has macros for the two modes, with
matching numbers.

Codify the supported values for regulator-allowed-modes for the MT6358
in the device tree binding: 0 and 1 are supported for buck regulators,
and the property should not be present for LDO regulators. Users should
use the dt-bindings/regulator/mediatek,mt6397-regulator.h header for
the macros, instead of using raw numbers.

Signed-off-by: Chen-Yu Tsai <[email protected]>
---
Changes since v2:
- new patch

.../regulator/mediatek,mt6358-regulator.yaml | 27 +++++++++++++++++++
1 file changed, 27 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
index 5daef024de3e..62e8fa6b4306 100644
--- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
@@ -23,48 +23,71 @@ patternProperties:
description: Buck regulators
type: object
$ref: regulator.yaml#
+ properties:
+ regulator-allowed-modes:
+ description: |
+ Buck regulatpr operating modes allowed. Valid values below.
+ Users should use the macros from dt-bindings/regulator/mediatek,mt6397-regulator.h
+ 0 (MT6397_BUCK_MODE_AUTO): Auto PFM/PWM mode
+ 1 (MT6397_BUCK_MODE_FORCE_PWM): Forced PWM mode
+ items:
+ enum: [0, 1]
unevaluatedProperties: false

"^ldo_v(a|rf)12$":
description: LDOs with fixed 1.2V output and 0~100/10mV tuning
type: object
$ref: regulator.yaml#
+ properties:
+ regulator-allowed-modes: false
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#
+ properties:
+ regulator-allowed-modes: false
unevaluatedProperties: false

"^ldo_vxo22$":
description: LDOs with fixed 2.2V output and 0~100/10mV tuning
type: object
$ref: regulator.yaml#
+ properties:
+ regulator-allowed-modes: false
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#
+ properties:
+ regulator-allowed-modes: false
unevaluatedProperties: false

"^ldo_vusb$":
description: LDOs with fixed 3.0V output and 0~100/10mV tuning
type: object
$ref: regulator.yaml#
+ properties:
+ regulator-allowed-modes: false
unevaluatedProperties: false

"^ldo_vsram_(gpu|others|proc1[12])$":
description: LDOs with variable output
type: object
$ref: regulator.yaml#
+ properties:
+ regulator-allowed-modes: false
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#
+ properties:
+ regulator-allowed-modes: false
unevaluatedProperties: false

required:
@@ -74,6 +97,8 @@ additionalProperties: false

examples:
- |
+ #include <dt-bindings/regulator/mediatek,mt6397-regulator.h>
+
regulator {
compatible = "mediatek,mt6358-regulator";

@@ -83,6 +108,8 @@ examples:
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>;
};

ldo_vsram_gpu {
--
2.42.0.459.ge4e396fd5e-goog

2023-09-19 21:04:13

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH v3 10/12] regulator: mt6358: Add missing regulators for MT6366

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 <[email protected]>
---
Changes since v2:
- Linear range selector values fixed

Angelo's reviewed-by was dropped.

drivers/regulator/mt6358-regulator.c | 20 ++++++++++++++++++++
include/linux/mfd/mt6358/registers.h | 17 +++++++++++++++++
include/linux/regulator/mt6358-regulator.h | 3 +++
3 files changed, 40 insertions(+)

diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt6358-regulator.c
index fdd4710d57d8..4e7891e514b6 100644
--- a/drivers/regulator/mt6358-regulator.c
+++ b/drivers/regulator/mt6358-regulator.c
@@ -325,6 +325,20 @@ static const struct linear_range vldo28_ranges[] = {
REGULATOR_LINEAR_RANGE(3000000, 0, 10, 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, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(800000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(900000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(1000000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(1100000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(1200000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(1300000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(1500000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(1800000, 0, 10, 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[] = {
@@ -608,6 +622,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,
@@ -616,6 +634,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/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__ */
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.459.ge4e396fd5e-goog

2023-09-19 21:52:07

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH v3 02/12] regulator: dt-bindings: mt6358: Convert to DT schema

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, minus some
properties that aren't covered by the bindings yet, or don't make
sense on their own.

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

Cc: Zhiyong Tao <[email protected]>
Signed-off-by: Chen-Yu Tsai <[email protected]>
---
Changes since v2:
- Added missing end-of-string match to regulator names
- regulator-coupled-* properties in example dropped
- #include and regulator-allowed-modes moved to new patch

.../regulator/mediatek,mt6358-regulator.yaml | 97 +++++
.../bindings/regulator/mt6358-regulator.txt | 350 ------------------
2 files changed, 97 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..5daef024de3e
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
@@ -0,0 +1,97 @@
+# 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 <[email protected]>
+
+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:
+ - |
+ 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>;
+ };
+
+ ldo_vsram_gpu {
+ regulator-name = "vsram_gpu";
+ regulator-min-microvolt = <850000>;
+ regulator-max-microvolt = <1000000>;
+ regulator-ramp-delay = <6250>;
+ regulator-enable-ramp-delay = <240>;
+ };
+ };
+
+...
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.459.ge4e396fd5e-goog

2023-09-20 05:53:53

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH v3 12/12] arm64: dts: mediatek: mt8183-kukui: Add PMIC regulator supplies

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 <[email protected]>
---
.../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.459.ge4e396fd5e-goog

Subject: Re: [PATCH v3 10/12] regulator: mt6358: Add missing regulators for MT6366

Il 19/09/23 12:43, Chen-Yu Tsai ha scritto:
> 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 <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>