Skip to contentSkip to conversation

dt-bindings: mfd: mediatek: mt6397: Convert to DT schema format

PATCH In review Macpaul Lin 3 participants 5 messages Aug 8, 2024 – Aug 23, 2024

Subsystems (5)
lore
Share & tools
lore

Macpaul Lin

author maintainer
#0 lore raw

PATCH 1/1 dt-bindings: mfd: mediatek: mt6397: Convert to DT schema format

Convert the mfd: mediatek: mt6397 binding to DT schema format.

New updates in this conversion:
- Align generic names of DT schema "audio-codec" and "regulators".
- mt6397-regulators: Replace the "txt" reference with newly added DT schema.

---
 .../bindings/mfd/mediatek,mt6397.yaml         | 202 ++++++++++++++++++
 .../devicetree/bindings/mfd/mt6397.txt        | 110 ----------
 2 files changed, 202 insertions(+), 110 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
 delete mode 100644 Documentation/devicetree/bindings/mfd/mt6397.txt

Changes for v1:
- This patch depends on conversion of mediatek,mt6397-regulator.yaml
[1] https://lore.kernel.org/lkml/[email protected]/T/

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +202 -0
new file mode 100644
index 0000000..cfbf2215
@@ -0,0 +1,202 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/mediatek,mt6397.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT6397/MT6323 Multifunction Device
+
+maintainers:
+  - Sen Chu <[email protected]>
+  - Macpaul Lin <[email protected]>
+
+description: |
+  MT6397/MT6323 is a multifunction device with the following sub modules:
+  - Regulator
+  - RTC
+  - Audio codec
+  - GPIO
+  - Clock
+  - LED
+  - Keys
+  - Power controller
+
+  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/mediatek,pwrap.yaml
+
+  This document describes the binding for MFD device and its sub module.
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - mediatek,mt6323
+          - mediatek,mt6331 # "mediatek,mt6331" for PMIC MT6331 and MT6332.
+          - mediatek,mt6357
+          - mediatek,mt6358
+          - mediatek,mt6359
+          - mediatek,mt6397
+      - items:
+          - enum:
+              - mediatek,mt6366 # "mediatek,mt6366", "mediatek,mt6358" for PMIC MT6366
+          - const: mediatek,mt6358
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  "#interrupt-cells":
+    const: 2
+
+  rtc:
+    type: object
+    unevaluatedProperties: false
+    description:
+      Real Time Clock (RTC)
+      See ../rtc/rtc-mt6397.txt
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6323-rtc
+              - mediatek,mt6331-rtc
+              - mediatek,mt6358-rtc
+              - mediatek,mt6397-rtc
+          - items:
+              - enum:
+                  - mediatek,mt6366-rtc # RTC MT6366
+              - const: mediatek,mt6358-rtc
+
+  regulators:
+    type: object
+    oneOf:
+      - $ref: /schemas/regulator/mediatek,mt6358-regulator.yaml
+      - $ref: /schemas/regulator/mediatek,mt6397-regulator.yaml
+    unevaluatedProperties: false
+    description:
+      Regulators
+      For mt6323, see ../regulator/mt6323-regulator.txt
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6323-regulator
+              - mediatek,mt6358-regulator
+              - mediatek,mt6397-regulator
+          - items:
+              - enum:
+                  - mediatek,mt6366-regulator # Regulator MT6366
+              - const: mediatek,mt6358-regulator
+
+  audio-codec:
+    type: object
+    unevaluatedProperties: false
+    description:
+      Audio codec
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6397-codec
+              - mediatek,mt6358-sound
+          - items:
+              - enum:
+                  - mediatek,mt6366-sound # Codec MT6366
+              - const: mediatek,mt6358-sound
+
+  clk:
+    type: object
+    unevaluatedProperties: false
+    description:
+      Clock
+    properties:
+      compatible:
+        const: mediatek,mt6397-clk
+
+  led:
+    type: object
+    unevaluatedProperties: false
+    description:
+      LED
+      See ../leds/leds-mt6323.txt for more information
+    properties:
+      compatible:
+        const: mediatek,mt6323-led
+
+  keys:
+    type: object
+    $ref: /schemas/input/mediatek,pmic-keys.yaml
+    unevaluatedProperties: false
+    description: Keys
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6323-keys
+              - mediatek,mt6331-keys
+              - mediatek,mt6397-keys
+
+  power-controller:
+    type: object
+    unevaluatedProperties: false
+    description:
+      Power controller
+      See ../power/reset/mt6323-poweroff.txt
+    properties:
+      compatible:
+        const: mediatek,mt6323-pwrc
+
+  pin-controller:
+    type: object
+    $ref: /schemas/pinctrl/mediatek,mt65xx-pinctrl.yaml
+    unevaluatedProperties: false
+    description:
+      Pin controller
+    properties:
+      compatible:
+        const: mediatek,mt6397-pinctrl
+
+required:
+  - compatible
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    pwrap {
+        pmic {
+            compatible = "mediatek,mt6397";
+            interrupts-extended = <&pio 222 IRQ_TYPE_LEVEL_HIGH>;
+            interrupt-controller;
+            #interrupt-cells = <2>;
+
+            mt6397_codec: audio-codec {
+                compatible = "mediatek,mt6397-codec";
+            };
+
+            mt6397_regulators: regulators {
+                compatible = "mediatek,mt6397-regulator";
+
+                mt6397_vpca15_reg: buck_vpca15 {
+                    regulator-name = "vpca15";
+                    regulator-min-microvolt = <850000>;
+                    regulator-max-microvolt = <1400000>;
+                    regulator-ramp-delay = <12500>;
+                    regulator-always-on;
+                };
+
+                mt6397_vgp4_reg: ldo_vgp4 {
+                    regulator-name = "vgp4";
+                    regulator-min-microvolt = <1200000>;
+                    regulator-max-microvolt = <3300000>;
+                    regulator-enable-ramp-delay = <218>;
+                };
+            };
+        };
+    };
Documentation/devicetree/bindings/mfd/mt6397.txt deleted +0 -110

110 lines not on this page · raw message

Signature · 1 line
2.18.0
#1 lore raw
Quoted 7 lines · Macpaul Lin

Convert the mfd: mediatek: mt6397 binding to DT schema format.

New updates in this conversion:
- Align generic names of DT schema "audio-codec" and "regulators".
- mt6397-regulators: Replace the "txt" reference with newly added DT schema.

Quoted 5 lines
---
 .../bindings/mfd/mediatek,mt6397.yaml         | 202 ++++++++++++++++++
 .../devicetree/bindings/mfd/mt6397.txt        | 110 ----------

You are doing conversions in odd order... and ignore my comments. The example from your regulator binding is supposed to be here - I wrote it last time.

Due to doing changes totally unsynchronized, this CANNOT be merged without unnecessary maintainer coordination, because of dependency.

Sorry, that's not how it works for MFD devices.

Perform conversion of entire device in ONE patchset.

Quoted 18 lines
 2 files changed, 202 insertions(+), 110 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
 delete mode 100644 Documentation/devicetree/bindings/mfd/mt6397.txt

Changes for v1:
- This patch depends on conversion of mediatek,mt6397-regulator.yaml
[1] https://lore.kernel.org/lkml/[email protected]/T/

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +4 -0
new file mode 100644
index 0000000..cfbf2215
@@ -0,0 +1,202 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/mediatek,mt6397.yaml#

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 14

Quoted 10 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +10 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT6397/MT6323 Multifunction Device
+
+maintainers:
+  - Sen Chu <[email protected]>
+  - Macpaul Lin <[email protected]>
+
+description: |
+  MT6397/MT6323 is a multifunction device with the following sub modules:

MFD is Linuxism, avoid it.

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 27

Quoted 13 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +13 -0
+  - Regulator
+  - RTC
+  - Audio codec
+  - GPIO
+  - Clock
+  - LED
+  - Keys
+  - Power controller
+
+  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/mediatek,pwrap.yaml

Drop, instead add proper ref or compatible in parent node.

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 29

Quoted 2 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +2 -0
+
+  This document describes the binding for MFD device and its sub module.

Drop

Quoted 4 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +4 -0
+
+properties:
+  compatible:
+    oneOf:

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 43

Quoted 10 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +10 -0
+      - enum:
+          - mediatek,mt6323
+          - mediatek,mt6331 # "mediatek,mt6331" for PMIC MT6331 and MT6332.
+          - mediatek,mt6357
+          - mediatek,mt6358
+          - mediatek,mt6359
+          - mediatek,mt6397
+      - items:
+          - enum:
+              - mediatek,mt6366 # "mediatek,mt6366", "mediatek,mt6358" for PMIC MT6366

Drop comment, it is obvious. Don't repeat constraints in free form text.

Quoted 6 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +6 -0
+          - const: mediatek,mt6358
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-controller: true

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 59

Quoted 10 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +10 -0
+
+  "#interrupt-cells":
+    const: 2
+
+  rtc:
+    type: object
+    unevaluatedProperties: false
+    description:
+      Real Time Clock (RTC)
+      See ../rtc/rtc-mt6397.txt

No, convert the binding.

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 70

Quoted 11 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +11 -0
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6323-rtc
+              - mediatek,mt6331-rtc
+              - mediatek,mt6358-rtc
+              - mediatek,mt6397-rtc
+          - items:
+              - enum:
+                  - mediatek,mt6366-rtc # RTC MT6366

Drop all such comments.

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 77

Quoted 7 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +7 -0
+              - const: mediatek,mt6358-rtc
+
+  regulators:
+    type: object
+    oneOf:
+      - $ref: /schemas/regulator/mediatek,mt6358-regulator.yaml
+      - $ref: /schemas/regulator/mediatek,mt6397-regulator.yaml

And how is it supposed to be tested?

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 81

Quoted 4 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +4 -0
+    unevaluatedProperties: false
+    description:
+      Regulators
+      For mt6323, see ../regulator/mt6323-regulator.txt

Drop, useless.

Quoted 5 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +5 -0
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6323-regulator

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 96

Quoted 10 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +10 -0
+              - mediatek,mt6358-regulator
+              - mediatek,mt6397-regulator
+          - items:
+              - enum:
+                  - mediatek,mt6366-regulator # Regulator MT6366
+              - const: mediatek,mt6358-regulator
+
+  audio-codec:
+    type: object
+    unevaluatedProperties: false

This does not make sense. You do not have any ref here.

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 108

Quoted 12 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +12 -0
+    description:
+      Audio codec
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6397-codec
+              - mediatek,mt6358-sound
+          - items:
+              - enum:
+                  - mediatek,mt6366-sound # Codec MT6366
+              - const: mediatek,mt6358-sound

This wasn't in the old binding. Commit msg also does not explain why you are doing changes from conversion.

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 112

Quoted 4 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +4 -0
+
+  clk:
+    type: object
+    unevaluatedProperties: false

Again, no, it does not work like this. See example schema for explanation of this.

Convert all children - entire device. Then either use ref or
additionalProperties: true. See Qualcomm mdss bindings for example.

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 114

Quoted 2 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +2 -0
+    description:
+      Clock

Your descriptions are useless. You just said "clk" node is "clock". Really?

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 124

Quoted 10 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +10 -0
+    properties:
+      compatible:
+        const: mediatek,mt6397-clk
+
+  led:
+    type: object
+    unevaluatedProperties: false
+    description:
+      LED
+      See ../leds/leds-mt6323.txt for more information

No

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 133

Quoted 9 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +9 -0
+    properties:
+      compatible:
+        const: mediatek,mt6323-led
+
+  keys:
+    type: object
+    $ref: /schemas/input/mediatek,pmic-keys.yaml
+    unevaluatedProperties: false
+    description: Keys

Keys are keys? Could keys be anything else?

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 172

Quoted 8 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +8 -0
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    pwrap {

Drop

Quoted 18 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +18 -0
+        pmic {
+            compatible = "mediatek,mt6397";
+            interrupts-extended = <&pio 222 IRQ_TYPE_LEVEL_HIGH>;
+            interrupt-controller;
+            #interrupt-cells = <2>;
+
+            mt6397_codec: audio-codec {
+                compatible = "mediatek,mt6397-codec";
+            };
+
+            mt6397_regulators: regulators {
+                compatible = "mediatek,mt6397-regulator";
+
+                mt6397_vpca15_reg: buck_vpca15 {
+                    regulator-name = "vpca15";
+                    regulator-min-microvolt = <850000>;
+                    regulator-max-microvolt = <1400000>;
+                    regulator-ramp-delay = <12500>;

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 200

Quoted 10 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +10 -0
+                    regulator-always-on;
+                };
+
+                mt6397_vgp4_reg: ldo_vgp4 {
+                    regulator-name = "vgp4";
+                    regulator-min-microvolt = <1200000>;
+                    regulator-max-microvolt = <3300000>;
+                    regulator-enable-ramp-delay = <218>;
+                };
+            };

Incomplete.

The parent device example is supposed to be 100% complete.

Best regards,
Krzysztof

author maintainer
#2 lore raw
Quoted 22 lines · Krzysztof Kozlowski

External email : Please do not click links or open attachments until you have verified the sender or the content.

Quoted 7 lines · Macpaul Lin

Convert the mfd: mediatek: mt6397 binding to DT schema format.

New updates in this conversion:
- Align generic names of DT schema "audio-codec" and "regulators".
- mt6397-regulators: Replace the "txt" reference with newly added DT schema.

Quoted 5 lines
---
 .../bindings/mfd/mediatek,mt6397.yaml         | 202 ++++++++++++++++++
 .../devicetree/bindings/mfd/mt6397.txt        | 110 ----------

You are doing conversions in odd order... and ignore my comments. The example from your regulator binding is supposed to be here - I wrote it last time.

Quoted 6 lines

Due to doing changes totally unsynchronized, this CANNOT be merged without unnecessary maintainer coordination, because of dependency.

Sorry, that's not how it works for MFD devices.

Perform conversion of entire device in ONE patchset.

Okay, will collect the conversion of mt6323-regulator.txt and rtc-mt6397.txt in the next version.

Quoted 7 lines
Quoted 7 lines
 2 files changed, 202 insertions(+), 110 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
 delete mode 100644 Documentation/devicetree/bindings/mfd/mt6397.txt

Changes for v1:
- This patch depends on conversion of mediatek,mt6397-regulator.yaml
[1] https://lore.kernel.org/lkml/[email protected]/T/

[snip]

Quoted 5 lines
Quoted 5 lines

+$id: http://devicetree.org/schemas/mfd/mediatek,mt6397.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +3 -0
+
+title: MediaTek MT6397/MT6323 Multifunction Device
+
Quoted 8 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 14

Quoted 6 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +6 -0
+maintainers:
+  - Sen Chu <[email protected]>
+  - Macpaul Lin <[email protected]>
+
+description: |
+  MT6397/MT6323 is a multifunction device with the following sub modules:

MFD is Linuxism, avoid it.

Will replace MFD with "power management system chip with sub-modules" something like this in next version.

Quoted 14 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 27

Quoted 13 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +13 -0
+  - Regulator
+  - RTC
+  - Audio codec
+  - GPIO
+  - Clock
+  - LED
+  - Keys
+  - Power controller
+
+  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/mediatek,pwrap.yaml
Quoted 1 line

Drop, instead add proper ref or compatible in parent node.

I'm confused here. I've checked mediatek,mt6357.yaml as a reference .
It uses the similar method here.
"See the following for pwarp node definitions:" "Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml"

If "$ref: /schemas/soc/mediatek/mediatek,pwrap.yaml" is added here, dt_bindings_check will complain the following errors and more.

Documentation/devicetree/bindings/mfd/mediatek,mt6397.example.dtb: pmic: compatible: 'oneOf' conditional failed, one must be fixed:

        ['mediatek,mt6397'] is too short
        'mediatek,mt6397' is not one of ['mediatek,mt2701-pwrap', 
'mediatek,mt6765-pwrap', 'mediatek,mt6779-pwrap', 'mediatek,mt6795-pwrap', 'mediatek,mt6797-pwrap', 'mediatek,mt6873-pwrap', 'mediatek,mt7622-pwrap', 'mediatek,mt8135-pwrap', 'mediatek,mt8173-pwrap', 'mediatek,mt8183-pwrap', 'mediatek,mt8186-pwrap', 'mediatek,mt8195-pwrap', 'mediatek,mt8365-pwrap', 'mediatek,mt8516-pwrap']
        'mediatek,mt6397' is not one of ['mediatek,mt8186-pwrap', 

'mediatek,mt8195-pwrap']
'mediatek,mt6397' is not one of ['mediatek,mt8188-pwrap'] from schema $id:
http://devicetree.org/schemas/mfd/mediatek,mt6397.yaml#

Which also conflicts with the comments in the examples..

Quoted 3 lines
Quoted 1 line

+ pwrap {

Drop

Please help to check if a $ref or a compatible of pwrap should be added here.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+  This document describes the binding for MFD device and its sub module.

Drop

Will fix it in next version.

Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +8 -0
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - mediatek,mt6323
+          - mediatek,mt6331 # "mediatek,mt6331" for PMIC MT6331 and MT6332.
+          - mediatek,mt6357
Quoted 8 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 43

Quoted 6 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +6 -0
+          - mediatek,mt6358
+          - mediatek,mt6359
+          - mediatek,mt6397
+      - items:
+          - enum:
+              - mediatek,mt6366 # "mediatek,mt6366", "mediatek,mt6358" for PMIC MT6366

Drop comment, it is obvious. Don't repeat constraints in free form text.

Will fix it in next version.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +10 -0
+          - const: mediatek,mt6358
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  "#interrupt-cells":
+    const: 2
+
Quoted 8 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 59

Quoted 6 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +6 -0
+  rtc:
+    type: object
+    unevaluatedProperties: false
+    description:
+      Real Time Clock (RTC)
+      See ../rtc/rtc-mt6397.txt

No, convert the binding.

Will convert it rtc-mt6397.txt and put it into
"mfd/mediatek,mt6397.yaml" together.

Quoted 23 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 70

Quoted 12 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +11 -0
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6323-rtc
+              - mediatek,mt6331-rtc
+              - mediatek,mt6358-rtc
+              - mediatek,mt6397-rtc
+          - items:
+              - enum:
+                  - mediatek,mt6366-rtc # RTC MT6366

Drop all such comments.

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 77

Quoted 7 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +7 -0
+              - const: mediatek,mt6358-rtc
+
+  regulators:
+    type: object
+    oneOf:
+      - $ref: /schemas/regulator/mediatek,mt6358-regulator.yaml
+      - $ref: /schemas/regulator/mediatek,mt6397-regulator.yaml
Quoted 1 line

And how is it supposed to be tested?

The dt_bindings_check didn't complain eny thing about these.
Of course I've included the conversion patch of mediatek,mt6397-regulator.yaml.

Quoted 6 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 81

Quoted 4 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +4 -0
+    unevaluatedProperties: false
+    description:
+      Regulators
+      For mt6323, see ../regulator/mt6323-regulator.txt

Drop, useless.

Should I convert it to DT schema and add to $ref above together?

Quoted 17 lines
Quoted 6 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +5 -0
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6323-regulator

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 96

Quoted 10 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +10 -0
+              - mediatek,mt6358-regulator
+              - mediatek,mt6397-regulator
+          - items:
+              - enum:
+                  - mediatek,mt6366-regulator # Regulator MT6366
+              - const: mediatek,mt6358-regulator
+
+  audio-codec:
+    type: object
+    unevaluatedProperties: false
Quoted 1 line

This does not make sense. You do not have any ref here.

The dt_bindings_check will complain error here. Will replace it with "additionalProperties: false".

Quoted 13 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 108

Quoted 12 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +12 -0
+    description:
+      Audio codec
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6397-codec
+              - mediatek,mt6358-sound
+          - items:
+              - enum:
+                  - mediatek,mt6366-sound # Codec MT6366
+              - const: mediatek,mt6358-sound
Quoted 2 lines

This wasn't in the old binding. Commit msg also does not explain why you are doing changes from conversion.

Will update new added item into commit message in next version.

Quoted 7 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 112

Quoted 4 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +4 -0
+
+  clk:
+    type: object
+    unevaluatedProperties: false

Again, no, it does not work like this. See example schema for explanation of this.

Will replace it with "additionalProperties: false".

Quoted 2 lines

Convert all children - entire device. Then either use ref or
additionalProperties: true. See Qualcomm mdss bindings for example.

There is no more children available for the clock node of this PMIC. This is a clock buffer node. However, there are no sub nodes or any public document explain these clock buffer in public domain. What I've got is the compatible string in the driver.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+    description:
+      Clock

Your descriptions are useless. You just said "clk" node is "clock". Really?

Will improve it in next version.

Quoted 11 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 124

Quoted 10 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +10 -0
+    properties:
+      compatible:
+        const: mediatek,mt6397-clk
+
+  led:
+    type: object
+    unevaluatedProperties: false
+    description:
+      LED
+      See ../leds/leds-mt6323.txt for more information
Quoted 1 line

No

Will convert "leds-mt6323.txt" and move it together with "mfd/mediatek,mt6397.yaml"

Quoted 11 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 133

Quoted 9 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +9 -0
+    properties:
+      compatible:
+        const: mediatek,mt6323-led
+
+  keys:
+    type: object
+    $ref: /schemas/input/mediatek,pmic-keys.yaml
+    unevaluatedProperties: false
+    description: Keys

Keys are keys? Could keys be anything else?

Will fix it in the next version.

Quoted 10 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 172

Quoted 8 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +8 -0
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    pwrap {

Drop

Will fix it in the next version.

Quoted 31 lines
Quoted 18 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +18 -0
+        pmic {
+            compatible = "mediatek,mt6397";
+            interrupts-extended = <&pio 222 IRQ_TYPE_LEVEL_HIGH>;
+            interrupt-controller;
+            #interrupt-cells = <2>;
+
+            mt6397_codec: audio-codec {
+                compatible = "mediatek,mt6397-codec";
+            };
+
+            mt6397_regulators: regulators {
+                compatible = "mediatek,mt6397-regulator";
+
+                mt6397_vpca15_reg: buck_vpca15 {
+                    regulator-name = "vpca15";
+                    regulator-min-microvolt = <850000>;
+                    regulator-max-microvolt = <1400000>;
+                    regulator-ramp-delay = <12500>;

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 200

Quoted 10 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +10 -0
+                    regulator-always-on;
+                };
+
+                mt6397_vgp4_reg: ldo_vgp4 {
+                    regulator-name = "vgp4";
+                    regulator-min-microvolt = <1200000>;
+                    regulator-max-microvolt = <3300000>;
+                    regulator-enable-ramp-delay = <218>;
+                };
+            };

Incomplete.

Quoted 1 line

The parent device example is supposed to be 100% complete.

Will complete the example with MT6397 and MT6323 as reference in the next version.

Quoted 2 lines

Best regards,
Krzysztof

Thanks for the review and still some questions listed above. Please help to clarify the correction method for the questions.

Best regards,
Macpaul Lin

#3 lore raw
Quoted 76 lines · Macpaul Lin
Quoted 23 lines · Krzysztof Kozlowski

External email : Please do not click links or open attachments until you have verified the sender or the content.

Quoted 7 lines · Macpaul Lin

Convert the mfd: mediatek: mt6397 binding to DT schema format.

New updates in this conversion:
- Align generic names of DT schema "audio-codec" and "regulators".
- mt6397-regulators: Replace the "txt" reference with newly added DT schema.

Quoted 5 lines
---
 .../bindings/mfd/mediatek,mt6397.yaml         | 202 ++++++++++++++++++
 .../devicetree/bindings/mfd/mt6397.txt        | 110 ----------

You are doing conversions in odd order... and ignore my comments. The example from your regulator binding is supposed to be here - I wrote it last time.

Quoted 6 lines

Due to doing changes totally unsynchronized, this CANNOT be merged without unnecessary maintainer coordination, because of dependency.

Sorry, that's not how it works for MFD devices.

Perform conversion of entire device in ONE patchset.

Okay, will collect the conversion of mt6323-regulator.txt and rtc-mt6397.txt in the next version.

Quoted 7 lines
Quoted 7 lines
 2 files changed, 202 insertions(+), 110 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
 delete mode 100644 Documentation/devicetree/bindings/mfd/mt6397.txt

Changes for v1:
- This patch depends on conversion of mediatek,mt6397-regulator.yaml
[1] https://lore.kernel.org/lkml/[email protected]/T/

[snip]

Quoted 5 lines
Quoted 5 lines

+$id: http://devicetree.org/schemas/mfd/mediatek,mt6397.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +3 -0
+
+title: MediaTek MT6397/MT6323 Multifunction Device
+
Quoted 8 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 14

Quoted 6 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +6 -0
+maintainers:
+  - Sen Chu <[email protected]>
+  - Macpaul Lin <[email protected]>
+
+description: |
+  MT6397/MT6323 is a multifunction device with the following sub modules:

MFD is Linuxism, avoid it.

Will replace MFD with "power management system chip with sub-modules" something like this in next version.

Quoted 14 lines
Quoted 13 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +13 -0
+  - Regulator
+  - RTC
+  - Audio codec
+  - GPIO
+  - Clock
+  - LED
+  - Keys
+  - Power controller
+
+  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/mediatek,pwrap.yaml
Quoted 7 lines
Quoted 1 line

Drop, instead add proper ref or compatible in parent node.

I'm confused here. I've checked mediatek,mt6357.yaml as a reference .
It uses the similar method here.
"See the following for pwarp node definitions:" "Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml"

What exactly is confusing? The other example is wrong. It's not a schema, but free form text. Write schema so it would be applied and would validate the DTS.

Quoted 14 lines

If "$ref: /schemas/soc/mediatek/mediatek,pwrap.yaml" is added here, dt_bindings_check will complain the following errors and more.

Documentation/devicetree/bindings/mfd/mediatek,mt6397.example.dtb: pmic:
compatible: 'oneOf' conditional failed, one must be fixed:

         ['mediatek,mt6397'] is too short
         'mediatek,mt6397' is not one of ['mediatek,mt2701-pwrap', 

'mediatek,mt6765-pwrap', 'mediatek,mt6779-pwrap', 'mediatek,mt6795-pwrap', 'mediatek,mt6797-pwrap', 'mediatek,mt6873-pwrap', 'mediatek,mt7622-pwrap', 'mediatek,mt8135-pwrap', 'mediatek,mt8173-pwrap', 'mediatek,mt8183-pwrap', 'mediatek,mt8186-pwrap', 'mediatek,mt8195-pwrap', 'mediatek,mt8365-pwrap', 'mediatek,mt8516-pwrap']

Quoted 7 lines
         'mediatek,mt6397' is not one of ['mediatek,mt8186-pwrap', 

'mediatek,mt8195-pwrap']
'mediatek,mt6397' is not one of ['mediatek,mt8188-pwrap'] from schema $id:
http://devicetree.org/schemas/mfd/mediatek,mt6397.yaml#

Which also conflicts with the comments in the examples..

So investigate and fix this, instead of hiding the problem.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

+ pwrap {

Drop

Please help to check if a $ref or a compatible of pwrap should be added here.

Where did you add the $ref? The child node should have it, not parent, obviously. Just look at one of many other examples having children.

...

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +7 -0
+              - const: mediatek,mt6358-rtc
+
+  regulators:
+    type: object
+    oneOf:
+      - $ref: /schemas/regulator/mediatek,mt6358-regulator.yaml
+      - $ref: /schemas/regulator/mediatek,mt6397-regulator.yaml
Quoted 3 lines
Quoted 1 line

And how is it supposed to be tested?

The dt_bindings_check didn't complain eny thing about these.

Really? Then checkout the maintainer tree, apply this patch and test again. You know, it is impossible for us to apply a patch on top of linux-next...

Quoted 5 lines

Of course I've included the conversion patch of
mediatek,mt6397-regulator.yaml.

Quoted 7 lines
Quoted 6 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 81

Quoted 4 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +4 -0
+    unevaluatedProperties: false
+    description:
+      Regulators
+      For mt6323, see ../regulator/mt6323-regulator.txt

Drop, useless.

Should I convert it to DT schema and add to $ref above together?

Or just use compatibles. There are also examples of this - in MFD devices, Qcom display.

Quoted 47 lines
Quoted 18 lines
Quoted 7 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +5 -0
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6323-regulator

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 96

Quoted 10 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +10 -0
+              - mediatek,mt6358-regulator
+              - mediatek,mt6397-regulator
+          - items:
+              - enum:
+                  - mediatek,mt6366-regulator # Regulator MT6366
+              - const: mediatek,mt6358-regulator
+
+  audio-codec:
+    type: object
+    unevaluatedProperties: false
Quoted 1 line

This does not make sense. You do not have any ref here.

The dt_bindings_check will complain error here. Will replace it with "additionalProperties: false".

Quoted 13 lines

Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml line 108

Quoted 12 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +12 -0
+    description:
+      Audio codec
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6397-codec
+              - mediatek,mt6358-sound
+          - items:
+              - enum:
+                  - mediatek,mt6366-sound # Codec MT6366
+              - const: mediatek,mt6358-sound
Quoted 2 lines

This wasn't in the old binding. Commit msg also does not explain why you are doing changes from conversion.

Will update new added item into commit message in next version.

Quoted 5 lines
Quoted 4 lines
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml new file +4 -0
+
+  clk:
+    type: object
+    unevaluatedProperties: false
Quoted 7 lines
Quoted 2 lines

Again, no, it does not work like this. See example schema for explanation of this.

Will replace it with "additionalProperties: false".

Quoted 2 lines

Convert all children - entire device. Then either use ref or
additionalProperties: true. See Qualcomm mdss bindings for example.

Oh, look here, I even mentioned Qualcomm to use as an example...

Quoted 5 lines

There is no more children available for the clock node of this PMIC. This is a clock buffer node. However, there are no sub nodes or any public document explain these clock buffer in public domain. What I've got is the compatible string in the driver.

Then I don't know what you want to express here.

Quoted 7 lines
Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+    description:
+      Clock

Your descriptions are useless. You just said "clk" node is "clock". Really?

Will improve it in next version.

Best regards,
Krzysztof

#4 lore raw
In reply to Macpaul Lin
Quoted 16 lines · Macpaul Lin

Convert the mfd: mediatek: mt6397 binding to DT schema format.

New updates in this conversion:
- Align generic names of DT schema "audio-codec" and "regulators".
- mt6397-regulators: Replace the "txt" reference with newly added DT schema.

---
 .../bindings/mfd/mediatek,mt6397.yaml         | 202 ++++++++++++++++++
 .../devicetree/bindings/mfd/mt6397.txt        | 110 ----------
 2 files changed, 202 insertions(+), 110 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
 delete mode 100644 Documentation/devicetree/bindings/mfd/mt6397.txt
Quoted 4 lines

Changes for v1:
- This patch depends on conversion of mediatek,mt6397-regulator.yaml
[1] https://lore.kernel.org/lkml/[email protected]/T/

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/mediatek,mt6397.example.dtb: pmic: regulators: 'oneOf' conditional failed, one must be fixed:
'buck_vpca15', 'ldo_vgp4' do not match any of the regexes: '^(buck_)?v(core|dram1|gpu|modem|pa|proc1[12]|s[12])$', '^(ldo_)?v((aux|cn|io|rf)18|camio)$', '^(ldo_)?v(aud|bif|cn|fe|io)28$', '^(ldo_)?v(a|rf)12$', '^(ldo_)?v(cama[12]|camd|cn33|dram2|efuse|emc|ibr|ldo28|m18|mc|mch|mddr|sim[12])$', '^(ldo_)?vsram[_-](core|gpu|others|proc1[12])$', '^(ldo_)?vusb$', '^(ldo_)?vxo22$', 'pinctrl-[0-9]+' False schema does not allow {'compatible': ['mediatek,mt6397-regulator'], 'buck_vpca15': {'regulator-name': ['vpca15'], 'regulator-min-microvolt': [[850000]], 'regulator-max-microvolt': [[1400000]], 'regulator-ramp-delay': 12500, 'regulator-always-on': True}, 'ldo_vgp4': {'regulator-name': ['vgp4'], 'regulator-min-microvolt': [[1200000]], 'regulator-max-microvolt': [[3300000]], 'regulator-enable-ramp-delay': 218}} /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/mediatek,mt6397.example.dtb: pmic: regulators:compatible: 'oneOf' conditional failed, one must be fixed:
['mediatek,mt6397-regulator'] is too short
'mediatek,mt6358-regulator' was expected
'mediatek,mt6366-regulator' was expected
from schema $id: http://devicetree.org/schemas/mfd/mediatek,mt6397.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/mediatek,mt6397.example.dtb: pmic: regulators: Unevaluated properties are not allowed ('buck_vpca15', 'ldo_vgp4' were unexpected)
from schema $id: http://devicetree.org/schemas/mfd/mediatek,mt6397.yaml#

doc reference errors (make refcheckdocs):
Warning: Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml references a file that doesn't exist: Documentation/devicetree/bindings/mfd/mt6397.txt
Warning: Documentation/devicetree/bindings/leds/leds-mt6323.txt references a file that doesn't exist: Documentation/devicetree/bindings/mfd/mt6397.txt Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml: Documentation/devicetree/bindings/mfd/mt6397.txt Documentation/devicetree/bindings/leds/leds-mt6323.txt: Documentation/devicetree/bindings/mfd/mt6397.txt

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.