Skip to contentSkip to conversation

Add MediaTek MT6357 PMIC support

PATCH Superseded Alexandre Mergnat 2 participants 18 messages Nov 25, 2022 – Nov 29, 2022

Subsystems (8)

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v6 cover Add MediaTek MT6357 PMIC support

Hi,
This patch series adds MFD, PMIC keys, and regulator support for MT6357. MT6357 is a MediaTek PMIC very similar to MT6358.

Currently, MTK bindings related to the PMICs are not converted yet (still .txt):

soc/mediatek/pwrap.txt (all PMIC parent)

      |
      V
mfd/mt6397.txt (support lot of mt63XX PMIC)
      +---------------+----------------+---...
      V               V                V
regulator/...      rtc/...          codec/...

1) Convert pwrap to yaml is ok.

2) For the PMIC bindings, there are two option:
- Convert mt6397.txt to mediatek,mt6397.yaml and continue to support multiple PMIC with only one file. IMO, the file will be hard to read because the supported features aren't the same for each PMIC.

- Make a binding file for each PMIC ref:
- mfd/mediatek,mt6357.yaml
- mfd/mediatek,mt6358.yaml
- ...

3) All PMIC daughter bindings (regulator, rtc, codec, led, ...) aren't fully converted yet. Refering to the two PMIC convertion options above:
- To be clean, all daughter bindings should be converted. This is hard because a good understanding of each device is requiered to write efficient bindings.
- Only daughter bindings supported by the added PMIC should be converted, that allows to do the task conversion step by step.

In the V4 of this serie, I chose the second option.

Regards,
Alex

Changes in v6:
- Fix typo in documentations.
- Remove mediatek,mt6397-rtc.yaml example.
- Align pwrap convertion with the original .txt file.
- Remove unecessary include in the mt6357-regulator driver.
- Link to v5: https://lore.kernel.org/r/[email protected]

Changes in v5:
- Add missing maintainers
- Improve RTC binding by adding rtc.yaml ref and start-year property
- Split the txt->yaml conversion in one commit and the addition of the
new mt6357-rtc compatible in another commit.
- Improve PWRAP binding:
- clocks and clock-name have been refactored.
- reset-names is now properly dependent to resets.
- additionalProperties change from true to false.
- change example for a most recent and popular SoC.
- "allOf" part has been simplified.
- Pass binding tests with the updated tools. Here the command:
"make DT_CHECKER_FLAGS=-m dt_binding_check"
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- "dt-bindings: mfd: mt6397: add binding for MT6357" has been applied
by Lee Jones
- All fixed regulator are now refering to fixed-regulator.yaml
- vfe28 and vcamio18 regulators have been added
- pwrap binding has been converted and mt8365 support has been added
- mt6357 PMIC binding has been created
- mt6397 RTC binding has been converted and mt6357 support has been added
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- To be consistent with regulator/driver.h and helper.c, shift
variables have been removed and the mask values have been directly shifted.
- Remove index tables and rework volt tables to use set/get helper functions.
- Add comment to structure and function.
- Fix Fabien Parent mail address.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Rebase
- Fix typo
- Remove dependencies with https://lore.kernel.org/all/[email protected]/
which is no longer relevant.

Previous versions:
v1 - https://lore.kernel.org/all/[email protected]/

To: Lee Jones <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Matthias Brugger <[email protected]>
To: Dmitry Torokhov <[email protected]>
To: Chen Zhong <[email protected]>
To: Liam Girdwood <[email protected]>
To: Mark Brown <[email protected]>
To: Fabien Parent <[email protected]>
To: Alessandro Zummo <[email protected]>
To: Alexandre Belloni <[email protected]>
To: Sean Wang <[email protected]>
To: Pavel Machek <[email protected]>
To: Tianping Fang <[email protected]>
To: Flora Fu <[email protected]>

---
Alexandre Mergnat (6):
dt-bindings: rtc: mediatek: convert MT6397 rtc documentation
dt-bindings: rtc: mediatek: add MT6357 support
dt-bindings: soc: mediatek: convert pwrap documentation
dt-bindings: mfd: mediatek: Add bindings for MT6357 PMIC
arm64: dts: mt6358: change node names
arm64: dts: mt8173: change node name

Fabien Parent (4):
dt-bindings: input: mtk-pmic-keys: add binding for MT6357 PMIC
regulator: dt-bindings: Add binding schema for mt6357 regulators
regulator: add mt6357 regulator
Input: mtk-pmic-keys: add MT6357 support

 .../bindings/input/mediatek,pmic-keys.yaml         |   1 +
 .../devicetree/bindings/leds/leds-mt6323.txt       |   2 +-
 .../devicetree/bindings/mfd/mediatek,mt6357.yaml   | 105 +++++
 Documentation/devicetree/bindings/mfd/mt6397.txt   |   4 +-
 .../regulator/mediatek,mt6357-regulator.yaml       | 294 +++++++++++++
 .../bindings/rtc/mediatek,mt6397-rtc.yaml          |  36 ++
 .../devicetree/bindings/rtc/rtc-mt6397.txt         |  31 --
 .../bindings/soc/mediatek/mediatek,pwrap.yaml      | 147 +++++++
 .../devicetree/bindings/soc/mediatek/pwrap.txt     |  75 ----
 arch/arm64/boot/dts/mediatek/mt6358.dtsi           |   6 +-
 arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi       |   2 +-
 arch/arm64/boot/dts/mediatek/mt8173-evb.dts        |   2 +-
 drivers/input/keyboard/mtk-pmic-keys.c             |  17 +
 drivers/regulator/Kconfig                          |   9 +
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/mt6357-regulator.c               | 453 +++++++++++++++++++++
 include/linux/regulator/mt6357-regulator.h         |  51 +++
 17 files changed, 1122 insertions(+), 114 deletions(-)

---
base-commit: f6e37bb630736d880a319b7845e8837c8536dd59
change-id: 20221005-mt6357-support-55308b82e33f

Best regards,

Signature · 1 line
Alexandre Mergnat <[email protected]>
#1 lore raw

PATCH v6 1/10 dt-bindings: input: mtk-pmic-keys: add binding for MT6357 PMIC

From: Fabien Parent <[email protected]>

Add binding documentation for the PMIC keys on MT6357.

---
 Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml +1 -0
index 2f72ec418415..037c3ae9f1c3 100644
@@ -26,6 +26,7 @@ properties:
     enum:
       - mediatek,mt6323-keys
       - mediatek,mt6331-keys
+      - mediatek,mt6357-keys
       - mediatek,mt6358-keys
       - mediatek,mt6397-keys
 
Signature · 1 line
b4 0.10.1
#2 lore raw

PATCH v6 2/10 dt-bindings: rtc: mediatek: convert MT6397 rtc documentation

In reply to Alexandre Mergnat

- Convert rtc/rtc-mt6397.txt to rtc/mt6397-rtc.yaml
- Add maintainer
- Remove the .txt binding file

---
 Documentation/devicetree/bindings/mfd/mt6397.txt   |  2 +-
 .../bindings/rtc/mediatek,mt6397-rtc.yaml          | 35 ++++++++++++++++++++++
 .../devicetree/bindings/rtc/rtc-mt6397.txt         | 31 -------------------
 3 files changed, 36 insertions(+), 32 deletions(-)
Documentation/devicetree/bindings/mfd/mt6397.txt +1 -1
index 0088442efca1..79aaf21af8e9 100644
@@ -33,7 +33,7 @@ Optional subnodes:
 		- compatible: "mediatek,mt6331-rtc"
 		- compatible: "mediatek,mt6358-rtc"
 		- compatible: "mediatek,mt6397-rtc"
-	For details, see ../rtc/rtc-mt6397.txt
+	For details, see ../rtc/mediatek,mt6397-rtc.yaml
 - regulators
 	Required properties:
 		- compatible: "mediatek,mt6323-regulator"
Documentation/devicetree/bindings/rtc/mediatek,mt6397-rtc.yaml new file +35 -0
new file mode 100644
index 000000000000..97b09c81e548
@@ -0,0 +1,35 @@
+ # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rtc/mediatek,mt6397-rtc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT6397/MT6366/MT6358/MT6323 RTC
+
+maintainers:
+  - Tianping Fang <[email protected]>
+  - Alexandre Mergnat <[email protected]>
+
+description:
+  MediaTek PMIC based RTC is an independent function of MediaTek PMIC that works
+  as a type of multi-function device (MFD). The RTC can be configured and set up
+  with PMIC wrapper bus which is a common resource shared with the other
+  functions found on the same PMIC.
+
+allOf:
+  - $ref: rtc.yaml#
+
+properties:
+  compatible:
+    enum:
+      - mediatek,mt6323-rtc
+      - mediatek,mt6358-rtc
+      - mediatek,mt6366-rtc
+      - mediatek,mt6397-rtc
+
+  start-year: true
+
+additionalProperties: false
+
+required:
+  - compatible
Documentation/devicetree/bindings/rtc/rtc-mt6397.txt deleted +0 -31
deleted file mode 100644
index 7212076a8f1b..000000000000
@@ -1,31 +0,0 @@
-Device-Tree bindings for MediaTek PMIC based RTC
-
-MediaTek PMIC based RTC is an independent function of MediaTek PMIC that works
-as a type of multi-function device (MFD). The RTC can be configured and set up
-with PMIC wrapper bus which is a common resource shared with the other
-functions found on the same PMIC.
-
-For MediaTek PMIC MFD bindings, see:
-../mfd/mt6397.txt
-
-For MediaTek PMIC wrapper bus bindings, see:
-../soc/mediatek/pwrap.txt
-
-Required properties:
-- compatible: Should be one of follows
-       "mediatek,mt6323-rtc": for MT6323 PMIC
-       "mediatek,mt6358-rtc": for MT6358 PMIC
-       "mediatek,mt6366-rtc", "mediatek,mt6358-rtc": for MT6366 PMIC
-       "mediatek,mt6397-rtc": for MT6397 PMIC
-
-Example:
-
-       pmic {
-               compatible = "mediatek,mt6323";
-
-               ...
-
-               rtc {
-                       compatible = "mediatek,mt6323-rtc";
-               };
-       };
Signature · 1 line
b4 0.10.1
#3 lore raw

Re: [PATCH v6 02/10] dt-bindings: rtc: mediatek: convert MT6397 rtc documentation

Quoted 3 lines · Alexandre Mergnat

- Convert rtc/rtc-mt6397.txt to rtc/mt6397-rtc.yaml
- Add maintainer
- Remove the .txt binding file

Conversion includes removal, so you can skip the last comment.

Quoted 76 lines
---
 Documentation/devicetree/bindings/mfd/mt6397.txt   |  2 +-
 .../bindings/rtc/mediatek,mt6397-rtc.yaml          | 35 ++++++++++++++++++++++
 .../devicetree/bindings/rtc/rtc-mt6397.txt         | 31 -------------------
 3 files changed, 36 insertions(+), 32 deletions(-)
Documentation/devicetree/bindings/mfd/mt6397.txt +1 -1
index 0088442efca1..79aaf21af8e9 100644
@@ -33,7 +33,7 @@ Optional subnodes:
 		- compatible: "mediatek,mt6331-rtc"
 		- compatible: "mediatek,mt6358-rtc"
 		- compatible: "mediatek,mt6397-rtc"
-	For details, see ../rtc/rtc-mt6397.txt
+	For details, see ../rtc/mediatek,mt6397-rtc.yaml
 - regulators
 	Required properties:
 		- compatible: "mediatek,mt6323-regulator"
Documentation/devicetree/bindings/rtc/mediatek,mt6397-rtc.yaml new file +35 -0
new file mode 100644
index 000000000000..97b09c81e548
@@ -0,0 +1,35 @@
+ # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rtc/mediatek,mt6397-rtc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT6397/MT6366/MT6358/MT6323 RTC
+
+maintainers:
+  - Tianping Fang <[email protected]>
+  - Alexandre Mergnat <[email protected]>
+
+description:
+  MediaTek PMIC based RTC is an independent function of MediaTek PMIC that works
+  as a type of multi-function device (MFD). The RTC can be configured and set up
+  with PMIC wrapper bus which is a common resource shared with the other
+  functions found on the same PMIC.
+
+allOf:
+  - $ref: rtc.yaml#
+
+properties:
+  compatible:
+    enum:
+      - mediatek,mt6323-rtc
+      - mediatek,mt6358-rtc
+      - mediatek,mt6366-rtc
+      - mediatek,mt6397-rtc
+
+  start-year: true
+
+additionalProperties: false
+
+required:
+  - compatible
Documentation/devicetree/bindings/rtc/rtc-mt6397.txt deleted +0 -8
deleted file mode 100644
index 7212076a8f1b..000000000000
@@ -1,31 +0,0 @@
-Device-Tree bindings for MediaTek PMIC based RTC
-
-MediaTek PMIC based RTC is an independent function of MediaTek PMIC that works
-as a type of multi-function device (MFD). The RTC can be configured and set up
-with PMIC wrapper bus which is a common resource shared with the other
-functions found on the same PMIC.
-
-For MediaTek PMIC MFD bindings, see:

Documentation/devicetree/bindings/rtc/rtc-mt6397.txt line 18

Quoted 10 lines
Documentation/devicetree/bindings/rtc/rtc-mt6397.txt deleted +0 -10
-../mfd/mt6397.txt
-
-For MediaTek PMIC wrapper bus bindings, see:
-../soc/mediatek/pwrap.txt
-
-Required properties:
-- compatible: Should be one of follows
-       "mediatek,mt6323-rtc": for MT6323 PMIC
-       "mediatek,mt6358-rtc": for MT6358 PMIC
-       "mediatek,mt6366-rtc", "mediatek,mt6358-rtc": for MT6366 PMIC

That's not equivalent change and you did not mention any differences from conversion.

Regardless of it, Rob suggested squashing it into MFD device schema and I think his proposal is still valid - you have here only two properties...

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH v6 02/10] dt-bindings: rtc: mediatek: convert MT6397 rtc documentation

Quoted 4 lines · Krzysztof Kozlowski

Regardless of it, Rob suggested squashing it into MFD device schema and I think his proposal is still valid - you have here only two properties...

Ok, I thought the conversion was worth it with the latest changes. I will remove this patch and write RTC properties directly in the MFD schema.

Alex

#5 lore raw

PATCH v6 3/10 dt-bindings: rtc: mediatek: add MT6357 support

In reply to Alexandre Mergnat

Add binding documentation of mediatek,mt6397-rtc for mt6357 SoC.

---
 Documentation/devicetree/bindings/rtc/mediatek,mt6397-rtc.yaml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/rtc/mediatek,mt6397-rtc.yaml +2 -1
index 97b09c81e548..d582625430e3 100644
@@ -4,7 +4,7 @@
 $id: http://devicetree.org/schemas/rtc/mediatek,mt6397-rtc.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: MediaTek MT6397/MT6366/MT6358/MT6323 RTC
+title: MediaTek MT6397/MT6366/MT6358/MT6357/MT6323 RTC
 
 maintainers:
   - Tianping Fang <[email protected]>
@@ -23,6 +23,7 @@ properties:
   compatible:
     enum:
       - mediatek,mt6323-rtc
+      - mediatek,mt6357-rtc
       - mediatek,mt6358-rtc
       - mediatek,mt6366-rtc
       - mediatek,mt6397-rtc
Signature · 1 line
b4 0.10.1
#6 lore raw

PATCH v6 4/10 regulator: dt-bindings: Add binding schema for mt6357 regulators

In reply to Alexandre Mergnat

From: Fabien Parent <[email protected]>

Add YAML schema for the MediaTek MT6357 regulators.

---
 .../regulator/mediatek,mt6357-regulator.yaml       | 294 +++++++++++++++++++++
 1 file changed, 294 insertions(+)
Documentation/devicetree/bindings/regulator/mediatek,mt6357-regulator.yaml new file +294 -0
new file mode 100644
index 000000000000..6327bb2f6ee0
@@ -0,0 +1,294 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/mediatek,mt6357-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT6357 Regulators
+
+maintainers:
+  - Chen Zhong <[email protected]>
+  - Fabien Parent <[email protected]>
+  - Alexandre Mergnat <[email protected]>
+
+description: |
+  The MT6357 PMIC provides 5 BUCK and 29 LDO.
+  Regulators and nodes are named according to the regulator type:
+  - buck-<name>
+  - ldo-<name>.
+  MT6357 regulators node should be sub node of the MT6397 MFD node.
+
+patternProperties:
+  "^buck-v(core|modem|pa|proc|s1)$":
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    description:
+      Properties for single BUCK regulator.
+
+    required:
+      - regulator-name
+      - regulator-min-microvolt
+      - regulator-max-microvolt
+
+  "^ldo-v(camio18|aud28|aux18|io18|io28|rf12|rf18|cn18|cn28|fe28)$":
+    type: object
+    $ref: fixed-regulator.yaml#
+    unevaluatedProperties: false
+    description:
+      Properties for single fixed LDO regulator.
+
+    required:
+      - regulator-name
+      - regulator-min-microvolt
+      - regulator-max-microvolt
+
+  "^ldo-v(efuse|ibr|ldo28|mch|cama|camd|cn33-bt|cn33-wifi)$":
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    description:
+      Properties for single LDO regulator.
+
+    required:
+      - regulator-name
+      - regulator-min-microvolt
+      - regulator-max-microvolt
+
+  "^ldo-v(xo22|emc|mc|sim1|sim2|sram-others|sram-proc|dram|usb33)$":
+    type: object
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+    description:
+      Properties for single LDO regulator.
+
+    required:
+      - regulator-name
+      - regulator-min-microvolt
+      - regulator-max-microvolt
+
+additionalProperties: false
+
+examples:
+  - |
+    pmic {
+      regulators {
+        mt6357_vproc_reg: buck-vproc {
+          regulator-name = "vproc";
+          regulator-min-microvolt = <518750>;
+          regulator-max-microvolt = <1312500>;
+          regulator-ramp-delay = <6250>;
+          regulator-enable-ramp-delay = <220>;
+          regulator-always-on;
+        };
+        mt6357_vcore_reg: buck-vcore {
+          regulator-name = "vcore";
+          regulator-min-microvolt = <518750>;
+          regulator-max-microvolt = <1312500>;
+          regulator-ramp-delay = <6250>;
+          regulator-enable-ramp-delay = <220>;
+          regulator-always-on;
+        };
+        mt6357_vmodem_reg: buck-vmodem {
+          regulator-name = "vmodem";
+          regulator-min-microvolt = <500000>;
+          regulator-max-microvolt = <1193750>;
+          regulator-ramp-delay = <6250>;
+          regulator-enable-ramp-delay = <220>;
+        };
+        mt6357_vs1_reg: buck-vs1 {
+          regulator-name = "vs1";
+          regulator-min-microvolt = <1200000>;
+          regulator-max-microvolt = <2200000>;
+          regulator-ramp-delay = <12500>;
+          regulator-enable-ramp-delay = <220>;
+          regulator-always-on;
+        };
+        mt6357_vpa_reg: buck-vpa {
+          regulator-name = "vpa";
+          regulator-min-microvolt = <500000>;
+          regulator-max-microvolt = <3650000>;
+          regulator-ramp-delay = <50000>;
+          regulator-enable-ramp-delay = <220>;
+        };
+        mt6357_vfe28_reg: ldo-vfe28 {
+          compatible = "regulator-fixed";
+          regulator-name = "vfe28";
+          regulator-min-microvolt = <2800000>;
+          regulator-max-microvolt = <2800000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vxo22_reg: ldo-vxo22 {
+          regulator-name = "vxo22";
+          regulator-min-microvolt = <2200000>;
+          regulator-max-microvolt = <2400000>;
+          regulator-enable-ramp-delay = <110>;
+        };
+        mt6357_vrf18_reg: ldo-vrf18 {
+          compatible = "regulator-fixed";
+          regulator-name = "vrf18";
+          regulator-min-microvolt = <1800000>;
+          regulator-max-microvolt = <1800000>;
+          regulator-enable-ramp-delay = <110>;
+        };
+        mt6357_vrf12_reg: ldo-vrf12 {
+          compatible = "regulator-fixed";
+          regulator-name = "vrf12";
+          regulator-min-microvolt = <1200000>;
+          regulator-max-microvolt = <1200000>;
+          regulator-enable-ramp-delay = <110>;
+        };
+        mt6357_vefuse_reg: ldo-vefuse {
+          regulator-name = "vefuse";
+          regulator-min-microvolt = <1200000>;
+          regulator-max-microvolt = <3300000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vcn33_bt_reg: ldo-vcn33-bt {
+          regulator-name = "vcn33-bt";
+          regulator-min-microvolt = <3300000>;
+          regulator-max-microvolt = <3500000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vcn33_wifi_reg: ldo-vcn33-wifi {
+          regulator-name = "vcn33-wifi";
+          regulator-min-microvolt = <3300000>;
+          regulator-max-microvolt = <3500000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vcn28_reg: ldo-vcn28 {
+          compatible = "regulator-fixed";
+          regulator-name = "vcn28";
+          regulator-min-microvolt = <2800000>;
+          regulator-max-microvolt = <2800000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vcn18_reg: ldo-vcn18 {
+          compatible = "regulator-fixed";
+          regulator-name = "vcn18";
+          regulator-min-microvolt = <1800000>;
+          regulator-max-microvolt = <1800000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vcama_reg: ldo-vcama {
+          regulator-name = "vcama";
+          regulator-min-microvolt = <2500000>;
+          regulator-max-microvolt = <2800000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vcamd_reg: ldo-vcamd {
+          regulator-name = "vcamd";
+          regulator-min-microvolt = <1000000>;
+          regulator-max-microvolt = <1800000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vcamio_reg: ldo-vcamio18 {
+          compatible = "regulator-fixed";
+          regulator-name = "vcamio";
+          regulator-min-microvolt = <1800000>;
+          regulator-max-microvolt = <1800000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vldo28_reg: ldo-vldo28 {
+          regulator-name = "vldo28";
+          regulator-min-microvolt = <2800000>;
+          regulator-max-microvolt = <3000000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vsram_others_reg: ldo-vsram-others {
+          regulator-name = "vsram-others";
+          regulator-min-microvolt = <518750>;
+          regulator-max-microvolt = <1312500>;
+          regulator-ramp-delay = <6250>;
+          regulator-enable-ramp-delay = <110>;
+          regulator-always-on;
+        };
+        mt6357_vsram_proc_reg: ldo-vsram-proc {
+          regulator-name = "vsram-proc";
+          regulator-min-microvolt = <518750>;
+          regulator-max-microvolt = <1312500>;
+          regulator-ramp-delay = <6250>;
+          regulator-enable-ramp-delay = <110>;
+          regulator-always-on;
+        };
+        mt6357_vaux18_reg: ldo-vaux18 {
+          compatible = "regulator-fixed";
+          regulator-name = "vaux18";
+          regulator-min-microvolt = <1800000>;
+          regulator-max-microvolt = <1800000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vaud28_reg: ldo-vaud28 {
+          compatible = "regulator-fixed";
+          regulator-name = "vaud28";
+          regulator-min-microvolt = <2800000>;
+          regulator-max-microvolt = <2800000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vio28_reg: ldo-vio28 {
+          compatible = "regulator-fixed";
+          regulator-name = "vio28";
+          regulator-min-microvolt = <2800000>;
+          regulator-max-microvolt = <2800000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vio18_reg: ldo-vio18 {
+          compatible = "regulator-fixed";
+          regulator-name = "vio18";
+          regulator-min-microvolt = <1800000>;
+          regulator-max-microvolt = <1800000>;
+          regulator-enable-ramp-delay = <264>;
+          regulator-always-on;
+        };
+        mt6357_vdram_reg: ldo-vdram {
+          regulator-name = "vdram";
+          regulator-min-microvolt = <1100000>;
+          regulator-max-microvolt = <1200000>;
+          regulator-enable-ramp-delay = <3300>;
+        };
+        mt6357_vmc_reg: ldo-vmc {
+          regulator-name = "vmc";
+          regulator-min-microvolt = <1800000>;
+          regulator-max-microvolt = <3300000>;
+          regulator-enable-ramp-delay = <44>;
+        };
+        mt6357_vmch_reg: ldo-vmch {
+          regulator-name = "vmch";
+          regulator-min-microvolt = <2900000>;
+          regulator-max-microvolt = <3300000>;
+          regulator-enable-ramp-delay = <44>;
+        };
+        mt6357_vemc_reg: ldo-vemc {
+          regulator-name = "vemc";
+          regulator-min-microvolt = <2900000>;
+          regulator-max-microvolt = <3300000>;
+          regulator-enable-ramp-delay = <44>;
+          regulator-always-on;
+        };
+        mt6357_vsim1_reg: ldo-vsim1 {
+          regulator-name = "vsim1";
+          regulator-min-microvolt = <1700000>;
+          regulator-max-microvolt = <3100000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vsim2_reg: ldo-vsim2 {
+          regulator-name = "vsim2";
+          regulator-min-microvolt = <1700000>;
+          regulator-max-microvolt = <3100000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+        mt6357_vibr_reg: ldo-vibr {
+          regulator-name = "vibr";
+          regulator-min-microvolt = <1200000>;
+          regulator-max-microvolt = <3300000>;
+          regulator-enable-ramp-delay = <44>;
+        };
+        mt6357_vusb33_reg: ldo-vusb33 {
+          regulator-name = "vusb33";
+          regulator-min-microvolt = <3000000>;
+          regulator-max-microvolt = <3100000>;
+          regulator-enable-ramp-delay = <264>;
+        };
+      };
+    };
+...
Signature · 1 line
b4 0.10.1
#7 lore raw

PATCH v6 5/10 dt-bindings: soc: mediatek: convert pwrap documentation

In reply to Alexandre Mergnat

- Convert soc/mediatek/pwrap.txt to soc/mediatek/mediatek,pwrap.yaml
- Add syscon compatible const for mt8186 and mt8195 to match the DTS needs.

---
 .../devicetree/bindings/leds/leds-mt6323.txt       |   2 +-
 Documentation/devicetree/bindings/mfd/mt6397.txt   |   2 +-
 .../bindings/soc/mediatek/mediatek,pwrap.yaml      | 147 +++++++++++++++++++++
 .../devicetree/bindings/soc/mediatek/pwrap.txt     |  75 -----------
 4 files changed, 149 insertions(+), 77 deletions(-)
Documentation/devicetree/bindings/leds/leds-mt6323.txt +1 -1
index 45bf9f7d85f3..73353692efa1 100644
@@ -9,7 +9,7 @@ MT6323 PMIC hardware.
 For MT6323 MFD bindings see:
 Documentation/devicetree/bindings/mfd/mt6397.txt
 For MediaTek PMIC wrapper bindings see:
-Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
+Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
 
 Required properties:
 - compatible : Must be "mediatek,mt6323-led"
Documentation/devicetree/bindings/mfd/mt6397.txt +1 -1
index 79aaf21af8e9..3bee4a42555d 100644
@@ -13,7 +13,7 @@ MT6397/MT6323 is a multifunction device with the following sub modules:
 It is interfaced to host controller using SPI interface by a proprietary hardware
 called PMIC wrapper or pwrap. MT6397/MT6323 MFD is a child device of pwrap.
 See the following for pwarp node definitions:
-../soc/mediatek/pwrap.txt
+../soc/mediatek/mediatek,pwrap.yaml
 
 This document describes the binding for MFD device and its sub module.
 
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +147 -0

147 lines not on this page · raw message

Documentation/devicetree/bindings/soc/mediatek/pwrap.txt deleted +0 -75

75 lines not on this page · raw message

Signature · 1 line
b4 0.10.1
#8 lore raw

Re: [PATCH v6 05/10] dt-bindings: soc: mediatek: convert pwrap documentation

Quoted 130 lines · Alexandre Mergnat

- Convert soc/mediatek/pwrap.txt to soc/mediatek/mediatek,pwrap.yaml
- Add syscon compatible const for mt8186 and mt8195 to match the DTS needs.

---
 .../devicetree/bindings/leds/leds-mt6323.txt       |   2 +-
 Documentation/devicetree/bindings/mfd/mt6397.txt   |   2 +-
 .../bindings/soc/mediatek/mediatek,pwrap.yaml      | 147 +++++++++++++++++++++
 .../devicetree/bindings/soc/mediatek/pwrap.txt     |  75 -----------
 4 files changed, 149 insertions(+), 77 deletions(-)
Documentation/devicetree/bindings/leds/leds-mt6323.txt +1 -1
index 45bf9f7d85f3..73353692efa1 100644
@@ -9,7 +9,7 @@ MT6323 PMIC hardware.
 For MT6323 MFD bindings see:
 Documentation/devicetree/bindings/mfd/mt6397.txt
 For MediaTek PMIC wrapper bindings see:
-Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
+Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
 
 Required properties:
 - compatible : Must be "mediatek,mt6323-led"
Documentation/devicetree/bindings/mfd/mt6397.txt +1 -1
index 79aaf21af8e9..3bee4a42555d 100644
@@ -13,7 +13,7 @@ MT6397/MT6323 is a multifunction device with the following sub modules:
 It is interfaced to host controller using SPI interface by a proprietary hardware
 called PMIC wrapper or pwrap. MT6397/MT6323 MFD is a child device of pwrap.
 See the following for pwarp node definitions:
-../soc/mediatek/pwrap.txt
+../soc/mediatek/mediatek,pwrap.yaml
 
 This document describes the binding for MFD device and its sub module.
 
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +87 -0
new file mode 100644
index 000000000000..3969871eaced
@@ -0,0 +1,147 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/mediatek/mediatek,pwrap.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Mediatek PMIC Wrapper
+
+maintainers:
+  - Flora Fu <[email protected]>
+  - Alexandre Mergnat <[email protected]>
+
+description:
+  On MediaTek SoCs the PMIC is connected via SPI. The SPI master interface
+  is not directly visible to the CPU, but only through the PMIC wrapper
+  inside the SoC. The communication between the SoC and the PMIC can
+  optionally be encrypted. Also a non standard Dual IO SPI mode can be
+  used to increase speed.
+
+  IP Pairing
+
+  On MT8135 the pins of some SoC internal peripherals can be on the PMIC.
+  The signals of these pins are routed over the SPI bus using the pwrap
+  bridge. In the binding description below the properties needed for bridging
+  are marked with "IP Pairing". These are optional on SoCs which do not support
+  IP Pairing
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - mediatek,mt2701-pwrap
+              - mediatek,mt6765-pwrap
+              - mediatek,mt6779-pwrap
+              - mediatek,mt6797-pwrap
+              - mediatek,mt6873-pwrap
+              - mediatek,mt7622-pwrap
+              - mediatek,mt8135-pwrap
+              - mediatek,mt8173-pwrap
+              - mediatek,mt8183-pwrap
+              - mediatek,mt8186-pwrap
+              - mediatek,mt8188-pwrap
+              - mediatek,mt8195-pwrap
+              - mediatek,mt8365-pwrap
+              - mediatek,mt8516-pwrap
+      - items:
+          - enum:
+              - mediatek,mt8186-pwrap
+              - mediatek,mt8195-pwrap
+          - const: syscon
+
+  reg:
+    minItems: 1
+    items:
+      - description: PMIC wrapper registers
+      - description: IP pairing registers
+
+  reg-names:
+    minItems: 1
+    items:
+      - const: pwrap
+      - const: pwrap-bridge
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    minItems: 2
+    items:
+      - description: SPI bus clock
+      - description: Main module clock
+      - description: System module clock
+      - description: Timer module clock
+
+  clock-names:
+    minItems: 2
+    items:
+      - const: spi
+      - const: wrap
+      - const: sys
+      - const: tmr
+
+  resets:
+    minItems: 1
+    items:
+      - description: PMIC wrapper reset

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 97

Quoted 10 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +10 -0
+      - description: IP pairing reset
+
+  reset-names:
+    minItems: 1
+    items:
+      - const: pwrap
+      - const: pwrap-bridge
+
+  pmic:
+    type: object

What's here? Other schema? If not then maybe compatible? What about description?

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 108

Quoted 11 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +11 -0
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - interrupts
+  - clocks
+  - clock-names
+
+dependentRequired:
+  resets: [reset-names]

Drop.

Quoted 4 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +4 -0
+
+allOf:
+  - if:
+      properties:

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 122

Quoted 10 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +10 -0
+        compatible:
+          contains:
+            const: mediatek,mt8365-pwrap
+    then:
+      properties:
+        clocks:
+          minItems: 4
+
+        clock-names:
+          minItems: 4

else:
???

Quoted 5 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +5 -0
+
+additionalProperties: false
+
+examples:
+  - |

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 137

Quoted 10 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +10 -0
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/reset/mt8135-resets.h>
+
+    soc {
+        #address-cells = <2>;
+        #size-cells = <2>;
+        pwrap@1000d000 {
+            compatible = "mediatek,mt8135-pwrap";
+            reg = <0 0x1000f000 0 0x1000>,

This does not match your unit address. No warnings when compile testing?

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 145

Quoted 8 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +8 -0
+                  <0 0x11017000 0 0x1000>;
+            reg-names = "pwrap", "pwrap-bridge";
+            interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>;
+            clocks = <&clk26m>, <&clk26m>;
+            clock-names = "spi", "wrap";
+            resets = <&infracfg MT8135_INFRA_PMIC_WRAP_RST>,
+                     <&pericfg MT8135_PERI_PWRAP_BRIDGE_SW_RST>;
+            reset-names = "pwrap", "pwrap-bridge";

Missing pmic. Make your example complete.

Best regards,
Krzysztof

#9 lore raw

Re: [PATCH v6 05/10] dt-bindings: soc: mediatek: convert pwrap documentation

Quoted 13 lines · Krzysztof Kozlowski
Quoted 12 lines · Alexandre Mergnat

- Convert soc/mediatek/pwrap.txt to soc/mediatek/mediatek,pwrap.yaml
- Add syscon compatible const for mt8186 and mt8195 to match the DTS needs.

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +9 -0
+  resets:
+    minItems: 1
+    items:
+      - description: PMIC wrapper reset
+      - description: IP pairing reset
+
+  reset-names:
+    minItems: 1
+    items:
Quoted 8 lines

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 97

Quoted 5 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +5 -0
+      - const: pwrap
+      - const: pwrap-bridge
+
+  pmic:
+    type: object

What's here? Other schema? If not then maybe compatible? What about description?

I guess this was comment from Rob, so it's fine.

Quoted 24 lines

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 108

Quoted 12 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +11 -0
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - interrupts
+  - clocks
+  - clock-names
+
+dependentRequired:
+  resets: [reset-names]

Drop.

Quoted 9 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +9 -0
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: mediatek,mt8365-pwrap
+    then:
+      properties:
Quoted 8 lines

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 122

Quoted 5 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +5 -0
+        clocks:
+          minItems: 4
+
+        clock-names:
+          minItems: 4

else:
???

Actually this looks less complete than your previous patch.

else:
clocks:
maxItems: 2
same for clock-names

Quoted 28 lines
Quoted 6 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +5 -0
+
+additionalProperties: false
+
+examples:
+  - |

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 137

Quoted 10 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +10 -0
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/reset/mt8135-resets.h>
+
+    soc {
+        #address-cells = <2>;
+        #size-cells = <2>;
+        pwrap@1000d000 {
+            compatible = "mediatek,mt8135-pwrap";
+            reg = <0 0x1000f000 0 0x1000>,

This does not match your unit address. No warnings when compile testing?

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 145

Quoted 8 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +8 -0
+                  <0 0x11017000 0 0x1000>;
+            reg-names = "pwrap", "pwrap-bridge";
+            interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>;
+            clocks = <&clk26m>, <&clk26m>;
+            clock-names = "spi", "wrap";
+            resets = <&infracfg MT8135_INFRA_PMIC_WRAP_RST>,
+                     <&pericfg MT8135_PERI_PWRAP_BRIDGE_SW_RST>;
+            reset-names = "pwrap", "pwrap-bridge";
Quoted 1 line

Missing pmic. Make your example complete.

Probably pmic should be skipped, I understand it is described in MFD binding.

Best regards,
Krzysztof

#10 lore raw

Re: [PATCH v6 05/10] dt-bindings: soc: mediatek: convert pwrap documentation

Quoted 8 lines · Krzysztof Kozlowski
Quoted 6 lines

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 97

Quoted 3 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +2 -0
+  pmic:
+    type: object

What's here? Other schema? If not then maybe compatible? What about description?

I guess this was comment from Rob, so it's fine.

Yes it is.

Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +8 -0
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: mediatek,mt8365-pwrap
+    then:
+      properties:
Quoted 8 lines

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 122

Quoted 5 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +5 -0
+        clocks:
+          minItems: 4
+
+        clock-names:
+          minItems: 4

else:
???

Quoted 7 lines

Actually this looks less complete than your previous patch.

else:
clocks:
maxItems: 2
same for clock-names

I think I’ve followed the feedback done here [1]
I’ve declared minItems: 2 globally and override it to 4 if mediatek,mt8365-pwrap is used. Isn’t it the right way to implement it ?

Quoted 5 lines
Quoted 5 lines

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 137

Quoted 2 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +2 -0
+            compatible = "mediatek,mt8135-pwrap";
+            reg = <0 0x1000f000 0 0x1000>,

This does not match your unit address. No warnings when compile testing?

There are no warnings when compile testing. I will fix the unit address anyway, sorry.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +8 -0
+                  <0 0x11017000 0 0x1000>;
+            reg-names = "pwrap", "pwrap-bridge";
+            interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>;
+            clocks = <&clk26m>, <&clk26m>;
+            clock-names = "spi", "wrap";
+            resets = <&infracfg MT8135_INFRA_PMIC_WRAP_RST>,
+                     <&pericfg MT8135_PERI_PWRAP_BRIDGE_SW_RST>;
+            reset-names = "pwrap", "pwrap-bridge";
Quoted 5 lines
Quoted 1 line

Missing pmic. Make your example complete.

Probably pmic should be skipped, I understand it is described in MFD binding.

Put the pmic in the example have 2 constraints:
- The original pmic "mediatek,mt6397" isn’t supported by a yaml schema, so I’ve a dt_binding_check fail: failed to match any schema with compatible: ['mediatek,mt6397']
- If I put another pmic that supports a yaml schema, I need to put all required properties for the pmic, which I thought was unnecessary since it’s already done in its own schema and can change for another pmic, so less consistent.

Then yes, IMHO, PMIC should be skipped in the example.

[1] https://lore.kernel.org/all/[email protected]/

Alex

#11 lore raw

Re: [PATCH v6 05/10] dt-bindings: soc: mediatek: convert pwrap documentation

Quoted 26 lines · Alexandre Mergnat
Quoted 18 lines
Quoted 17 lines
Quoted 4 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +3 -0
+allOf:
+  - if:
+      properties:

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 122

Quoted 10 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +10 -0
+        compatible:
+          contains:
+            const: mediatek,mt8365-pwrap
+    then:
+      properties:
+        clocks:
+          minItems: 4
+
+        clock-names:
+          minItems: 4

else:
???

Quoted 7 lines

Actually this looks less complete than your previous patch.

else:
clocks:
maxItems: 2
same for clock-names

Quoted 4 lines

I think I’ve followed the feedback done here [1]
I’ve declared minItems: 2 globally and override it to 4 if mediatek,mt8365-pwrap is used. Isn’t it the right way to implement it ?

Yes, just the other part of comment is missing:
"If you really want to force a validation error when using mediatek,mt8365-pwrap
and not providing sys and tmr clocks, you can just override minItems."

but that's fine if this was your intention.

Quoted 34 lines
Quoted 6 lines
Quoted 6 lines

Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml line 137

Quoted 3 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +2 -0
+            compatible = "mediatek,mt8135-pwrap";
+            reg = <0 0x1000f000 0 0x1000>,

This does not match your unit address. No warnings when compile testing?

There are no warnings when compile testing. I will fix the unit address anyway, sorry.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml new file +8 -0
+                  <0 0x11017000 0 0x1000>;
+            reg-names = "pwrap", "pwrap-bridge";
+            interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>;
+            clocks = <&clk26m>, <&clk26m>;
+            clock-names = "spi", "wrap";
+            resets = <&infracfg MT8135_INFRA_PMIC_WRAP_RST>,
+                     <&pericfg MT8135_PERI_PWRAP_BRIDGE_SW_RST>;
+            reset-names = "pwrap", "pwrap-bridge";
Quoted 5 lines
Quoted 1 line

Missing pmic. Make your example complete.

Probably pmic should be skipped, I understand it is described in MFD binding.

Put the pmic in the example have 2 constraints:
- The original pmic "mediatek,mt6397" isn’t supported by a yaml schema, so I’ve a dt_binding_check fail: failed to match any schema with compatible: ['mediatek,mt6397']
- If I put another pmic that supports a yaml schema, I need to put all required properties for the pmic, which I thought was unnecessary since it’s already done in its own schema and can change for another pmic, so less consistent.

Quoted 1 line

Then yes, IMHO, PMIC should be skipped in the example.

Yes, you're right.

Best regards,
Krzysztof

#12 lore raw

PATCH v6 6/10 dt-bindings: mfd: mediatek: Add bindings for MT6357 PMIC

In reply to Alexandre Mergnat

Currently, almost all MT63XX PMIC are documented mfd/mt6397.txt. Unfortunately, the PMICs haven't always similar HW sub-features. To have a better human readable schema, I chose to make one PMIC schema to match the exact HW capabilities instead of convert mt6397.txt to mediatek,mt63xx.yaml and put a bunch of properties behind "if contain ... then ..."

- add interrupt property
- change property refs to match with new yaml documentation

---
 .../devicetree/bindings/mfd/mediatek,mt6357.yaml   | 105 +++++++++++++++++++++
 1 file changed, 105 insertions(+)
Documentation/devicetree/bindings/mfd/mediatek,mt6357.yaml new file +105 -0
new file mode 100644
index 000000000000..2aa8025d1e24
@@ -0,0 +1,105 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/mediatek,mt6357.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT6357 PMIC
+
+maintainers:
+  - Flora Fu <[email protected]>
+  - Alexandre Mergnat <[email protected]>
+
+description: |
+  MT6357 is a power management system chip containing 5 buck
+  converters and 29 LDOs. Supported features are audio codec,
+  USB battery charging, fuel gauge, RTC
+
+  This is a multifunction device with the following sub modules:
+  - Regulator
+  - RTC
+  - Keys
+
+  It is interfaced to host controller using SPI interface by a proprietary hardware
+  called PMIC wrapper or pwrap. This MFD is a child device of pwrap.
+  See the following for pwrap node definitions:
+  Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
+
+properties:
+  compatible:
+    const: mediatek,mt6357
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  "#interrupt-cells":
+    const: 2
+
+  regulators:
+    type: object
+    $ref: /schemas/regulator/mediatek,mt6357-regulator.yaml
+    description:
+      List of MT6357 BUCKs and LDOs regulators.
+
+  rtc:
+    type: object
+    $ref: /schemas/rtc/mediatek,mt6397-rtc.yaml
+    description:
+      MT6357 Real Time Clock.
+
+  keys:
+    type: object
+    $ref: /schemas/input/mediatek,pmic-keys.yaml
+    description:
+      MT6357 power and home keys.
+
+required:
+  - compatible
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    pwrap {
+        pmic {
+            compatible = "mediatek,mt6357";
+
+            interrupt-parent = <&pio>;
+            interrupts = <145 IRQ_TYPE_LEVEL_HIGH>;
+            interrupt-controller;
+            #interrupt-cells = <2>;
+
+            regulators {
+                mt6357_vproc_reg: buck-vproc {
+                    regulator-name = "vproc";
+                    regulator-min-microvolt = <518750>;
+                    regulator-max-microvolt = <1312500>;
+                    regulator-ramp-delay = <6250>;
+                    regulator-enable-ramp-delay = <220>;
+                    regulator-always-on;
+                };
+
+                // ...
+
+                mt6357_vusb33_reg: ldo-vusb33 {
+                    regulator-name = "vusb33";
+                    regulator-min-microvolt = <3000000>;
+                    regulator-max-microvolt = <3100000>;
+                    regulator-enable-ramp-delay = <264>;
+                };
+            };
+
+            rtc {
+                compatible = "mediatek,mt6357-rtc";
+            };
+
+            keys {
+                compatible = "mediatek,mt6357-keys";
+            };
+        };
+    };
Signature · 1 line
b4 0.10.1
Reviewed-by on v6 6/10
#13 lore raw

Re: [PATCH v6 06/10] dt-bindings: mfd: mediatek: Add bindings for MT6357 PMIC

Quoted 7 lines · Alexandre Mergnat

Currently, almost all MT63XX PMIC are documented mfd/mt6397.txt. Unfortunately, the PMICs haven't always similar HW sub-features. To have a better human readable schema, I chose to make one PMIC schema to match the exact HW capabilities instead of convert mt6397.txt to mediatek,mt63xx.yaml and put a bunch of properties behind "if contain ... then ..."

Quoted 5 lines

- add interrupt property
- change property refs to match with new yaml documentation

---

Best regards,
Krzysztof

#14 lore raw

PATCH v6 7/10 arm64: dts: mt6358: change node names

In reply to Alexandre Mergnat

- Change the node name from "mt6358" to "pmic", "mt6358rtc" to "rtc" and "mt6358keys" to "keys" to be consistent with the generic names recommendation.

---
 arch/arm64/boot/dts/mediatek/mt6358.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/mediatek/mt6358.dtsi +3 -3
index 98f3b0e0c9f6..b605313bed99 100644
@@ -5,7 +5,7 @@
 #include <dt-bindings/input/input.h>
 
 &pwrap {
-	pmic: mt6358 {
+	pmic: pmic {
 		compatible = "mediatek,mt6358";
 		interrupt-controller;
 		interrupt-parent = <&pio>;
@@ -355,11 +355,11 @@ mt6358_vsim2_reg: ldo_vsim2 {
 			};
 		};
 
-		mt6358rtc: mt6358rtc {
+		mt6358rtc: rtc {
 			compatible = "mediatek,mt6358-rtc";
 		};
 
-		mt6358keys: mt6358keys {
+		mt6358keys: keys {
 			compatible = "mediatek,mt6358-keys";
 			power {
 				linux,keycodes = <KEY_POWER>;
Signature · 1 line
b4 0.10.1
#15 lore raw

PATCH v6 8/10 arm64: dts: mt8173: change node name

In reply to Alexandre Mergnat

- Change the node name from "mt6397" to "pmic" to be consistent with the generic names recommendation.

---
 arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi | 2 +-
 arch/arm64/boot/dts/mediatek/mt8173-evb.dts  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi +1 -1
index e21feb85d822..a8f5c48e1782 100644
@@ -913,7 +913,7 @@ &pwm0 {
 };
 
 &pwrap {
-	pmic: mt6397 {
+	pmic: pmic {
 		compatible = "mediatek,mt6397";
 		#address-cells = <1>;
 		#size-cells = <1>;
arch/arm64/boot/dts/mediatek/mt8173-evb.dts +1 -1
index 0b5f154007be..755df5694234 100644
@@ -300,7 +300,7 @@ &pwrap {
 	/* Only MT8173 E1 needs USB power domain */
 	power-domains = <&spm MT8173_POWER_DOMAIN_USB>;
 
-	pmic: mt6397 {
+	pmic: pmic {
 		compatible = "mediatek,mt6397";
 		interrupt-parent = <&pio>;
 		interrupts = <11 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
b4 0.10.1
#16 lore raw

PATCH v6 9/10 regulator: add mt6357 regulator

In reply to Alexandre Mergnat

From: Fabien Parent <[email protected]>

Add regulator driver for the MT6357 PMIC.

---
 drivers/regulator/Kconfig                  |   9 +
 drivers/regulator/Makefile                 |   1 +
 drivers/regulator/mt6357-regulator.c       | 453 +++++++++++++++++++++++++++++
 include/linux/regulator/mt6357-regulator.h |  51 ++++
 4 files changed, 514 insertions(+)
drivers/regulator/Kconfig +9 -0
index 070e4403c6c2..a659a57438f4 100644
@@ -805,6 +805,15 @@ config REGULATOR_MT6332
 	  This driver supports the control of different power rails of device
 	  through regulator interface
 
+config REGULATOR_MT6357
+	tristate "MediaTek MT6357 PMIC"
+	depends on MFD_MT6397
+	help
+	  Say y here to select this option to enable the power regulator of
+	  MediaTek MT6357 PMIC.
+	  This driver supports the control of different power rails of device
+	  through regulator interface.
+
 config REGULATOR_MT6358
 	tristate "MediaTek MT6358 PMIC"
 	depends on MFD_MT6397
drivers/regulator/Makefile +1 -0
index 5962307e1130..e4d67b7b1af6 100644
@@ -97,6 +97,7 @@ obj-$(CONFIG_REGULATOR_MT6315) += mt6315-regulator.o
 obj-$(CONFIG_REGULATOR_MT6323)	+= mt6323-regulator.o
 obj-$(CONFIG_REGULATOR_MT6331)	+= mt6331-regulator.o
 obj-$(CONFIG_REGULATOR_MT6332)	+= mt6332-regulator.o
+obj-$(CONFIG_REGULATOR_MT6357)	+= mt6357-regulator.o
 obj-$(CONFIG_REGULATOR_MT6358)	+= mt6358-regulator.o
 obj-$(CONFIG_REGULATOR_MT6359)	+= mt6359-regulator.o
 obj-$(CONFIG_REGULATOR_MT6360) += mt6360-regulator.o
drivers/regulator/mt6357-regulator.c new file +453 -0

453 lines not on this page · raw message

include/linux/regulator/mt6357-regulator.h new file +51 -0

51 lines not on this page · raw message

Signature · 1 line
b4 0.10.1
#17 lore raw

PATCH v6 10/10 Input: mtk-pmic-keys: add MT6357 support

In reply to Alexandre Mergnat

From: Fabien Parent <[email protected]>

Add PMIC Keys support on MT6357 SoC.

---
 drivers/input/keyboard/mtk-pmic-keys.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/input/keyboard/mtk-pmic-keys.c +17 -0
index 9b34da0ec260..2a63e0718eb6 100644
@@ -10,6 +10,7 @@
 #include <linux/kernel.h>
 #include <linux/mfd/mt6323/registers.h>
 #include <linux/mfd/mt6331/registers.h>
+#include <linux/mfd/mt6357/registers.h>
 #include <linux/mfd/mt6358/registers.h>
 #include <linux/mfd/mt6397/core.h>
 #include <linux/mfd/mt6397/registers.h>
@@ -90,6 +91,19 @@ static const struct mtk_pmic_regs mt6331_regs = {
 	.rst_lprst_mask = MTK_PMIC_MT6331_RST_DU_MASK,
 };
 
+static const struct mtk_pmic_regs mt6357_regs = {
+	.keys_regs[MTK_PMIC_PWRKEY_INDEX] =
+		MTK_PMIC_KEYS_REGS(MT6357_TOPSTATUS,
+				   0x2, MT6357_PSC_TOP_INT_CON0, 0x5,
+				   MTK_PMIC_PWRKEY_RST),
+	.keys_regs[MTK_PMIC_HOMEKEY_INDEX] =
+		MTK_PMIC_KEYS_REGS(MT6357_TOPSTATUS,
+				   0x8, MT6357_PSC_TOP_INT_CON0, 0xa,
+				   MTK_PMIC_HOMEKEY_INDEX),
+	.pmic_rst_reg = MT6357_TOP_RST_MISC,
+	.rst_lprst_mask = MTK_PMIC_RST_DU_MASK,
+};
+
 static const struct mtk_pmic_regs mt6358_regs = {
 	.keys_regs[MTK_PMIC_PWRKEY_INDEX] =
 		MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
@@ -276,6 +290,9 @@ static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = {
 	}, {
 		.compatible = "mediatek,mt6331-keys",
 		.data = &mt6331_regs,
+	}, {
+		.compatible = "mediatek,mt6357-keys",
+		.data = &mt6357_regs,
 	}, {
 		.compatible = "mediatek,mt6358-keys",
 		.data = &mt6358_regs,
Signature · 1 line
b4 0.10.1