2023-09-28 14:26:54

by Chen-Yu Tsai

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

Hi everyone,

This is v4 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
binding differences. The hardware however does have a chip ID register
that can be used to differentiate the variants within the driver. Thus
a fallback compatible to the base (MT6358) model is included.

Changes since v3:
- Rebased onto next-20230928
- Patch 2
- ldo_vxo22 and ldo_vusb moved to properties in the original binding
conversion
- Patch 5
- Expanded commit message to mention why a fallback compatible is used
- Adapted to ldo_vxo22 and ldo_vusb movement to properties in previous
patch
- Split example into two, one for each variant
- Renamed regulator node in examples to just "regulator"

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 | 250 +++++++++++++
.../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, 443 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.582.g8ccd20d70d-goog


2023-09-28 15:10:18

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH v4 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 as the
maintainer here.

Cc: Zhiyong Tao <[email protected]>
Signed-off-by: Chen-Yu Tsai <[email protected]>
---
Changes since v3:
- ldo_vxo22 and ldo_vusb moved to properties

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 | 98 +++++
.../bindings/regulator/mt6358-regulator.txt | 350 ------------------
2 files changed, 98 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..126f502a2bda
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
@@ -0,0 +1,98 @@
+# 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
+
+ ldo_vxo22:
+ description: LDOs with fixed 2.2V 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
+
+
+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_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_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.582.g8ccd20d70d-goog

2023-09-28 15:12:29

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH v4 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 v3:
- adapt to ldo_vxo22 and ldo_vusb movement to properties

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 126f502a2bda..e8c3299d698f 100644
--- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
@@ -22,12 +22,16 @@ properties:
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_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


@@ -36,36 +40,55 @@ 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_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_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:
@@ -75,6 +98,8 @@ additionalProperties: false

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

@@ -84,6 +109,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.582.g8ccd20d70d-goog

2023-09-28 15:49:23

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH v4 04/12] regulator: dt-bindings: mt6358: Add regulator supplies

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 <[email protected]>
---
.../regulator/mediatek,mt6358-regulator.yaml | 34 +++++++++++++++++++
1 file changed, 34 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
index e8c3299d698f..f2219d8656c2 100644
--- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
@@ -34,6 +34,40 @@ properties:
regulator-allowed-modes: false
unevaluatedProperties: false

+ 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])$":
--
2.42.0.582.g8ccd20d70d-goog

2023-09-28 16:31:47

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH v4 05/12] regulator: dt-bindings: mt6358: Add MT6366 PMIC

From: Zhiyong Tao <[email protected]>

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.

The differences compared to the MT6358 are minimal:
- Regulators removed: VCAMA1, VCAMA2, VCAMD, VCAMIO, VLDO28
- Regulators added: VM18, VMDDR, VSRAM_CORE

Both PMIC models contain a chip ID register at the same address that
can be used to differentiate the actual model. Thus, even though the
MT6366 is not fully backward compatible with the MT6358, it still falls
back on the MT6358 compatible string. It is up to the implementation
to use the chip ID register as a probing mechanism.

Update the MT6358 regulator binding and add entries for all the MT6366's
regulators and their supplies. The regulator node names follow a cleaned
up style without type prefixes and with underscores replaced with hyphens.

Signed-off-by: Zhiyong Tao <[email protected]>
[[email protected]: major rework and added commit message]
Signed-off-by: Chen-Yu Tsai <[email protected]>
---
Changes since v3:
- Expanded commit message to mention why a fallback compatible is used
- Adapted to ldo_vxo22 and ldo_vusb movement to properties in previous
patch
- Split example into two, one for each variant
- Renamed regulator node in examples to just "regulator"

Changes since v2:
- Merged all the propertyPatterns together; the if-then sections now
only block out invalid properties

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/[email protected]/

.../regulator/mediatek,mt6358-regulator.yaml | 149 ++++++++++++++----
1 file changed, 120 insertions(+), 29 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
index f2219d8656c2..c50402fcba72 100644
--- a/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
@@ -16,30 +16,18 @@ description:

properties:
compatible:
- const: mediatek,mt6358-regulator
-
- 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_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
+ 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:
@@ -59,18 +47,20 @@ 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, vm18 (MT6366 only)
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
+ description:
+ Supply for LDOs vsram-core (MT6366 only), 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])$":
+ "^(buck_)?v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$":
description: Buck regulators
type: object
$ref: regulator.yaml#
@@ -85,7 +75,7 @@ patternProperties:
enum: [0, 1]
unevaluatedProperties: false

- "^ldo_v(a|rf)12$":
+ "^(ldo_)?v(a|rf)12$":
description: LDOs with fixed 1.2V output and 0~100/10mV tuning
type: object
$ref: regulator.yaml#
@@ -93,15 +83,24 @@ patternProperties:
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
+ "^(ldo_)?v((aux|cn|io|rf)18|camio)$":
+ description:
+ LDOs with fixed 1.8V output and 0~100/10mV tuning (vcn18 on MT6366 has variable output)
+ 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$":
+ "^(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#
@@ -109,7 +108,15 @@ patternProperties:
regulator-allowed-modes: false
unevaluatedProperties: false

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

- "^ldo_v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|mc|mch|sim[12])$":
+ "^(ldo_)?v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|m18|mc|mch|mddr|sim[12])$":
description: LDOs with variable output and 0~100/10mV tuning
type: object
$ref: regulator.yaml#
@@ -130,6 +137,45 @@ required:

additionalProperties: false

+allOf:
+ - if:
+ properties:
+ compatible:
+ const: mediatek,mt6358-regulator
+ then:
+ patternProperties:
+ # Old regulator node name scheme (with prefix and underscores) only
+ # ([^y-] is used to avoid matching -supply
+ "^(?<!buck_)(?<!ldo_)v.*[^y-](?!-supply)$": false
+ "^ldo_vsram-": false
+ # vsram_core regulator doesn't exist on MT6358
+ "^ldo_vsram[-_]core$": false
+
+ properties:
+ # vm18 and vmddr regulators don't exist on MT6358
+ ldo_vm18: false
+ ldo_vmddr: false
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: mediatek,mt6366-regulator
+ then:
+ patternProperties:
+ # Prefer cleaned up regulator node names
+ "^(buck|ldo)_": false
+ # Don't allow underscores
+ "^vsram_": false
+ # vcam* regulators don't exist on MT6366
+ "^vcam": false
+
+ properties:
+ # vldo28 regulator doesn't exist on MT6366
+ vldo28: false
+ # vs2_ldo4 supply pin doesn't exist on MT6366
+ vs2-ldo4-supply: false
+
examples:
- |
#include <dt-bindings/regulator/mediatek,mt6397-regulator.h>
@@ -156,4 +202,49 @@ examples:
};
};

+ - |
+ #include <dt-bindings/regulator/mediatek,mt6397-regulator.h>
+
+ 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.582.g8ccd20d70d-goog

2023-09-28 21:03:18

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH v4 09/12] regulator: mt6358: Make MT6366 vcn18 LDO configurable

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 <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
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 14ed728fba69..946f62242718 100644
--- a/drivers/regulator/mt6358-regulator.c
+++ b/drivers/regulator/mt6358-regulator.c
@@ -325,6 +325,27 @@ static const struct linear_range vldo28_ranges[] = {
REGULATOR_LINEAR_RANGE(3000000, 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[] = {
+ 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(1400000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(1500000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(1600000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(1700000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(1800000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(1900000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(2000000, 0, 10, 10000),
+ REGULATOR_LINEAR_RANGE(2100000, 0, 10, 10000),
+};
+
static unsigned int mt6358_map_mode(unsigned int mode)
{
return mode == MT6397_BUCK_MODE_AUTO ?
@@ -559,7 +580,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),
@@ -592,6 +612,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.582.g8ccd20d70d-goog

2023-09-28 22:49:07

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH v4 01/12] dt-bindings: mfd: mt6397: Split out compatible for MediaTek MT6366 PMIC

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 <[email protected]>
Acked-by: Krzysztof Kozlowski <[email protected]>
---
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.582.g8ccd20d70d-goog

2023-10-02 16:22:47

by Rob Herring (Arm)

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


On Thu, 28 Sep 2023 16:55:25 +0800, 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, 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 as the
> maintainer here.
>
> Cc: Zhiyong Tao <[email protected]>
> Signed-off-by: Chen-Yu Tsai <[email protected]>
> ---
> Changes since v3:
> - ldo_vxo22 and ldo_vusb moved to properties
>
> 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 | 98 +++++
> .../bindings/regulator/mt6358-regulator.txt | 350 ------------------
> 2 files changed, 98 insertions(+), 350 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/regulator/mediatek,mt6358-regulator.yaml
> delete mode 100644 Documentation/devicetree/bindings/regulator/mt6358-regulator.txt
>

Reviewed-by: Rob Herring <[email protected]>

2023-10-02 16:41:57

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH v4 05/12] regulator: dt-bindings: mt6358: Add MT6366 PMIC


On Thu, 28 Sep 2023 16:55:28 +0800, Chen-Yu Tsai wrote:
> From: Zhiyong Tao <[email protected]>
>
> 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.
>
> The differences compared to the MT6358 are minimal:
> - Regulators removed: VCAMA1, VCAMA2, VCAMD, VCAMIO, VLDO28
> - Regulators added: VM18, VMDDR, VSRAM_CORE
>
> Both PMIC models contain a chip ID register at the same address that
> can be used to differentiate the actual model. Thus, even though the
> MT6366 is not fully backward compatible with the MT6358, it still falls
> back on the MT6358 compatible string. It is up to the implementation
> to use the chip ID register as a probing mechanism.
>
> Update the MT6358 regulator binding and add entries for all the MT6366's
> regulators and their supplies. The regulator node names follow a cleaned
> up style without type prefixes and with underscores replaced with hyphens.
>
> Signed-off-by: Zhiyong Tao <[email protected]>
> [[email protected]: major rework and added commit message]
> Signed-off-by: Chen-Yu Tsai <[email protected]>
> ---
> Changes since v3:
> - Expanded commit message to mention why a fallback compatible is used
> - Adapted to ldo_vxo22 and ldo_vusb movement to properties in previous
> patch
> - Split example into two, one for each variant
> - Renamed regulator node in examples to just "regulator"
>
> Changes since v2:
> - Merged all the propertyPatterns together; the if-then sections now
> only block out invalid properties
>
> 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/[email protected]/
>
> .../regulator/mediatek,mt6358-regulator.yaml | 149 ++++++++++++++----
> 1 file changed, 120 insertions(+), 29 deletions(-)
>

Reviewed-by: Rob Herring <[email protected]>

2023-10-02 17:08:49

by Rob Herring (Arm)

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


On Thu, 28 Sep 2023 16:55:26 +0800, Chen-Yu Tsai wrote:
> 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 v3:
> - adapt to ldo_vxo22 and ldo_vusb movement to properties
>
> Changes since v2:
> - new patch
>
> .../regulator/mediatek,mt6358-regulator.yaml | 27 +++++++++++++++++++
> 1 file changed, 27 insertions(+)
>

Reviewed-by: Rob Herring <[email protected]>

2023-10-02 17:08:55

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH v4 04/12] regulator: dt-bindings: mt6358: Add regulator supplies


On Thu, 28 Sep 2023 16:55:27 +0800, Chen-Yu Tsai wrote:
> 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 <[email protected]>
> ---
> .../regulator/mediatek,mt6358-regulator.yaml | 34 +++++++++++++++++++
> 1 file changed, 34 insertions(+)
>

Reviewed-by: Rob Herring <[email protected]>

2023-10-03 12:18:30

by Mark Brown

[permalink] [raw]
Subject: Re: (subset) [PATCH v4 00/12] regulator: mt6366: Split out of MT6358 and cleanup

On Thu, 28 Sep 2023 16:55:23 +0800, Chen-Yu Tsai wrote:
> This is v4 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
> binding differences. The hardware however does have a chip ID register
> that can be used to differentiate the variants within the driver. Thus
> a fallback compatible to the base (MT6358) model is included.
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[02/12] regulator: dt-bindings: mt6358: Convert to DT schema
commit: 93880f7e5c8c864309a57c47669ac0bc432524d5
[03/12] regulator: dt-bindings: mt6358: Add regulator-allowed-modes property
commit: 0bf4b56b5ecaf711865f313476f91c18338307bb
[04/12] regulator: dt-bindings: mt6358: Add regulator supplies
commit: 2f384e60acbac140732367d037c5f08db21513a0
[05/12] regulator: dt-bindings: mt6358: Add MT6366 PMIC
commit: c631494a69c55301a03af9c028892c9098019652
[06/12] regulator: mt6358: Use mt6397-regulator.h binding header for buck mode macros
commit: 9f3bec54d06f1eb4b47c7f78ef1401bc71977e9e
[07/12] regulator: mt6358: Add supply names for MT6358 regulators
commit: 3dfa8a7071d4e748d5a59566f9a96e381a9fccb2
[08/12] regulator: mt6358: fix and drop type prefix in MT6366 regulator node names
commit: 0c3697b8980dd44df05ed77222c09bd8fe729626
[09/12] regulator: mt6358: Make MT6366 vcn18 LDO configurable
commit: b7f3b89848b3bae3b1e3a97e75b82c65a4952cfc
[10/12] regulator: mt6358: Add missing regulators for MT6366
commit: b7768e67af9a5b6d6101cbfc146969fedf8df4be
[11/12] regulator: mt6358: Add supply names for MT6366 regulators
commit: ce8ab92e66ccc99591b9cbb6630d720d5e6ad6ec

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

2023-10-04 09:11:44

by Lee Jones

[permalink] [raw]
Subject: Re: (subset) [PATCH v4 01/12] dt-bindings: mfd: mt6397: Split out compatible for MediaTek MT6366 PMIC

On Thu, 28 Sep 2023 16:55:24 +0800, 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.
>
> [...]

Applied, thanks!

[01/12] dt-bindings: mfd: mt6397: Split out compatible for MediaTek MT6366 PMIC
commit: 9e2a2fd1ca0555bd0c278cd4061cc4bd9c8d0f7f

--
Lee Jones [李琼斯]