diff mbox series

[v6,2/2] dt-bindings: mfd: mediatek: mt6397: Convert to DT schema format

Message ID 20240918064955.6518-2-macpaul.lin@mediatek.com (mailing list archive)
State New
Headers show
Series [v6,1/2] regulator: dt-bindings: mt6323: Convert to DT schema | expand

Commit Message

Macpaul Lin Sept. 18, 2024, 6:49 a.m. UTC
Convert the mfd: mediatek: mt6397 binding to DT schema format.

MT6323, MT6358, and MT6397 are PMIC devices with multiple function
subdevices. They share a common PMIC design but have variations in
subdevice combinations.

Key updates in this conversion:

1. RTC:
   - Convert rtc-mt6397.txt and merge into parent MT6397 PMIC DT schema.

2. Regulators:
   - Align to generic name "regulators".
   - Update references from .txt to .yaml for mt6323, mt6358, and mt6397
     regulators.
   - Simplify regulator name labels in device tree examples.

3. Audio Codec:
   - Convert sound/mt6358.txt and merge into parent MT6397 PMIC DT schema.
   - Align to generic name "audio-codec" for codec and sound subdevices.
   - Add "mediatek,dmic-mode" and "Avdd-supply" properties.

4. Clocks:
   - Align to generic name "clocks" for clockbuffer subdevices.

5. LEDs:
   - Convert leds-mt6323.txt and merge into parent MT6397 PMIC DT schema.
   - Update LED binding.

6. Keys:
   - Add detailed descriptions for power and home keys.
   - Add compatible: mediatek,mt6358-keys.

7. Power Controller:
   - Convert mt6323-poweroff.txt and merge into parent MT6397 PMIC DT
     schema.
   - Add #power-domain-cells property to fix dt-binding check error.
   - Clarify "BBPU" as "Baseband power up".

8. Pinctrl:
   - Align to generic name "pinctrl" instead of "pin-controller".

9. Compatible:
   - Drop "mediatek,mt6357" since there is a separated DT Schema
     for PMIC MT6357.

10. Examples:
   - MT6323: Retain complete examples for this PMIC.
   - MT6358 and MT6397: simplify settings in regulators.
    - Preserve "audio-codec", "clocks", "pinctrl", "rtc", and "keys"
      sections as they contain typical settings for different PMICs.

Additional updates:
- MAINTAINERS: Add co-maintainers and reference to
  mfd/mediatek,mt6397.yaml for LED and power-controller drivers.
- input/mediatek,pmic-keys.yaml: Update reference to
  mfd/mediatek,mt6397.yaml.

Signed-off-by: Sen Chu <sen.chu@mediatek.com>
Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
---
 .../bindings/input/mediatek,pmic-keys.yaml    |   2 +-
 .../devicetree/bindings/leds/leds-mt6323.txt  |  63 --
 .../bindings/mfd/mediatek,mt6397.yaml         | 601 ++++++++++++++++++
 .../devicetree/bindings/mfd/mt6397.txt        | 110 ----
 .../bindings/power/reset/mt6323-poweroff.txt  |  20 -
 .../devicetree/bindings/rtc/rtc-mt6397.txt    |  31 -
 .../devicetree/bindings/sound/mt6358.txt      |  26 -
 MAINTAINERS                                   |   8 +-
 8 files changed, 608 insertions(+), 253 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/leds/leds-mt6323.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
 delete mode 100644 Documentation/devicetree/bindings/mfd/mt6397.txt
 delete mode 100644 Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
 delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
 delete mode 100644 Documentation/devicetree/bindings/sound/mt6358.txt

Changes for v1:
 - This patch depends on conversion of mediatek,mt6397-regulator.yaml
   [1] https://lore.kernel.org/lkml/20240807091738.18387-1-macpaul.lin@mediatek.com/T/

Changes for v2:
 - This patch has been made base on linux-next/master git repo.
 - Keep the parent and child relationship with mediatek,pwrap in description.
   [2] https://lore.kernel.org/all/20240826-slurp-earphone-0d5173923ae8@spud/
 - Keep the $ref for regulators since dt_binding_check didn't report any issue
   based on linux-next/master repo.
 - Fix description of mt6397/mt6323 devices, use "power management chip"
   instead of "multifunction device"
 - Drop unnecessary comments or description according to the review.
 - Convert sub-modules to DT Schema:
  - RTC, LEDs, power-controllers, regulators
 - Drop duplicate sub node name and description for sub-modules
  - RTC, Keys
 - examples:
  - drop parent pwrap node
  - Add examples from mediatek,mt6323-regulator.yaml
  - Add examples from mediatek,mt6358-regulator.yaml
  - Add examples from mediatek,mt6397-regulator.yaml
  - Complete the examples as could as possible.

Changes for v3:
 - Rebased on linux-next/master git repo near next-20240906.
 - Revise commit message.
 - Regulators:
  - Use "additionalProperties: true" and add "contains" for matching
    $ref DT bindings.
  - Simplify regulator name labels in device tree examples.
 - LEDs:
  - Use LED bindings.
 - Squash following patches in v2 for removing old text format DT bindings
   into this patch, includes:
  - leds-mt6323.txt, mt6323-poweroff.txt, rtc-mt6397.txt, sound/mt6358.txt.
 - Fix file format of DT schemas, add blank between properties.
 - Fix 'make checkrefdoc' errors, update reference in mediatek,pmic-keys.yaml.

Changes for v4:
 - Remove "mediatek,mt6357" from PMIC's compatible string since there is a
   seperated DT schema for PMIC mt6357.

Changes for v5:
 - Rebase to next-20240913 (linux-next/master).
 - Fix the "title" (device type) of mfd/mediatek,mt6397.yaml to "PMIC".
 - RTC:
  - Drop "start-year"
 - Regulators:
  - Add blank lines between description and properties.
  - Drop allOf for the $ref section on property.
 - clocks:
  - Fix no need '|' in descriptoin.
  - Add blank lines between description and properties.
 - Keys:
  - Drop compatible since these enums are already in $ref.
 - pinctrl:
  - Drop compatible since it is already in $ref.
 - examples:
  - Fix indentations for leds and keys.

Changes for v6:
 - Commit message:
  - Add note for simplifying examples of mt6358 and mt6397.
 - examples:
  - Fix indentations for mt6323-keys.
  - MT6358 and MT6397: simplify settings in regulators.
   - Preserve "audio-codec", "clocks", "pinctrl", "rtc", and "keys"
     sections as they contain typical settings for different PMICs.

Comments

Alexandre Belloni Sept. 18, 2024, 11:51 a.m. UTC | #1
On 18/09/2024 14:49:55+0800, Macpaul Lin wrote:
> Convert the mfd: mediatek: mt6397 binding to DT schema format.
> 
> MT6323, MT6358, and MT6397 are PMIC devices with multiple function
> subdevices. They share a common PMIC design but have variations in
> subdevice combinations.
> 
> Key updates in this conversion:
> 
> 1. RTC:
>    - Convert rtc-mt6397.txt and merge into parent MT6397 PMIC DT schema.
> 
> 2. Regulators:
>    - Align to generic name "regulators".
>    - Update references from .txt to .yaml for mt6323, mt6358, and mt6397
>      regulators.
>    - Simplify regulator name labels in device tree examples.
> 
> 3. Audio Codec:
>    - Convert sound/mt6358.txt and merge into parent MT6397 PMIC DT schema.
>    - Align to generic name "audio-codec" for codec and sound subdevices.
>    - Add "mediatek,dmic-mode" and "Avdd-supply" properties.
> 
> 4. Clocks:
>    - Align to generic name "clocks" for clockbuffer subdevices.
> 
> 5. LEDs:
>    - Convert leds-mt6323.txt and merge into parent MT6397 PMIC DT schema.
>    - Update LED binding.
> 
> 6. Keys:
>    - Add detailed descriptions for power and home keys.
>    - Add compatible: mediatek,mt6358-keys.
> 
> 7. Power Controller:
>    - Convert mt6323-poweroff.txt and merge into parent MT6397 PMIC DT
>      schema.
>    - Add #power-domain-cells property to fix dt-binding check error.
>    - Clarify "BBPU" as "Baseband power up".
> 
> 8. Pinctrl:
>    - Align to generic name "pinctrl" instead of "pin-controller".
> 
> 9. Compatible:
>    - Drop "mediatek,mt6357" since there is a separated DT Schema
>      for PMIC MT6357.
> 
> 10. Examples:
>    - MT6323: Retain complete examples for this PMIC.
>    - MT6358 and MT6397: simplify settings in regulators.
>     - Preserve "audio-codec", "clocks", "pinctrl", "rtc", and "keys"
>       sections as they contain typical settings for different PMICs.
> 
> Additional updates:
> - MAINTAINERS: Add co-maintainers and reference to
>   mfd/mediatek,mt6397.yaml for LED and power-controller drivers.
> - input/mediatek,pmic-keys.yaml: Update reference to
>   mfd/mediatek,mt6397.yaml.
> 
> Signed-off-by: Sen Chu <sen.chu@mediatek.com>
> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> ---
>  .../bindings/input/mediatek,pmic-keys.yaml    |   2 +-
>  .../devicetree/bindings/leds/leds-mt6323.txt  |  63 --
>  .../bindings/mfd/mediatek,mt6397.yaml         | 601 ++++++++++++++++++
>  .../devicetree/bindings/mfd/mt6397.txt        | 110 ----
>  .../bindings/power/reset/mt6323-poweroff.txt  |  20 -
>  .../devicetree/bindings/rtc/rtc-mt6397.txt    |  31 -
>  .../devicetree/bindings/sound/mt6358.txt      |  26 -
>  MAINTAINERS                                   |   8 +-
>  8 files changed, 608 insertions(+), 253 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/leds/leds-mt6323.txt
>  create mode 100644 Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
>  delete mode 100644 Documentation/devicetree/bindings/mfd/mt6397.txt
>  delete mode 100644 Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
>  delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
>  delete mode 100644 Documentation/devicetree/bindings/sound/mt6358.txt
> 
> Changes for v1:
>  - This patch depends on conversion of mediatek,mt6397-regulator.yaml
>    [1] https://lore.kernel.org/lkml/20240807091738.18387-1-macpaul.lin@mediatek.com/T/
> 
> Changes for v2:
>  - This patch has been made base on linux-next/master git repo.
>  - Keep the parent and child relationship with mediatek,pwrap in description.
>    [2] https://lore.kernel.org/all/20240826-slurp-earphone-0d5173923ae8@spud/
>  - Keep the $ref for regulators since dt_binding_check didn't report any issue
>    based on linux-next/master repo.
>  - Fix description of mt6397/mt6323 devices, use "power management chip"
>    instead of "multifunction device"
>  - Drop unnecessary comments or description according to the review.
>  - Convert sub-modules to DT Schema:
>   - RTC, LEDs, power-controllers, regulators
>  - Drop duplicate sub node name and description for sub-modules
>   - RTC, Keys
>  - examples:
>   - drop parent pwrap node
>   - Add examples from mediatek,mt6323-regulator.yaml
>   - Add examples from mediatek,mt6358-regulator.yaml
>   - Add examples from mediatek,mt6397-regulator.yaml
>   - Complete the examples as could as possible.
> 
> Changes for v3:
>  - Rebased on linux-next/master git repo near next-20240906.
>  - Revise commit message.
>  - Regulators:
>   - Use "additionalProperties: true" and add "contains" for matching
>     $ref DT bindings.
>   - Simplify regulator name labels in device tree examples.
>  - LEDs:
>   - Use LED bindings.
>  - Squash following patches in v2 for removing old text format DT bindings
>    into this patch, includes:
>   - leds-mt6323.txt, mt6323-poweroff.txt, rtc-mt6397.txt, sound/mt6358.txt.
>  - Fix file format of DT schemas, add blank between properties.
>  - Fix 'make checkrefdoc' errors, update reference in mediatek,pmic-keys.yaml.
> 
> Changes for v4:
>  - Remove "mediatek,mt6357" from PMIC's compatible string since there is a
>    seperated DT schema for PMIC mt6357.
> 
> Changes for v5:
>  - Rebase to next-20240913 (linux-next/master).
>  - Fix the "title" (device type) of mfd/mediatek,mt6397.yaml to "PMIC".
>  - RTC:
>   - Drop "start-year"

Maybe, instead of dropping the property, you should add support in the
driver by setting range_min and range_max.

>  - Regulators:
>   - Add blank lines between description and properties.
>   - Drop allOf for the $ref section on property.
>  - clocks:
>   - Fix no need '|' in descriptoin.
>   - Add blank lines between description and properties.
>  - Keys:
>   - Drop compatible since these enums are already in $ref.
>  - pinctrl:
>   - Drop compatible since it is already in $ref.
>  - examples:
>   - Fix indentations for leds and keys.
> 
> Changes for v6:
>  - Commit message:
>   - Add note for simplifying examples of mt6358 and mt6397.
>  - examples:
>   - Fix indentations for mt6323-keys.
>   - MT6358 and MT6397: simplify settings in regulators.
>    - Preserve "audio-codec", "clocks", "pinctrl", "rtc", and "keys"
>      sections as they contain typical settings for different PMICs.
> 
> diff --git a/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml b/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> index 70567d9..466566a 100644
> --- a/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> +++ b/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> @@ -19,7 +19,7 @@ description: |
>    by the PMIC that is defined as a Multi-Function Device (MFD).
>  
>    For MediaTek MT6323/MT6397 PMIC bindings see
> -  Documentation/devicetree/bindings/mfd/mt6397.txt
> +  Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
>  
>  properties:
>    compatible:
> diff --git a/Documentation/devicetree/bindings/leds/leds-mt6323.txt b/Documentation/devicetree/bindings/leds/leds-mt6323.txt
> deleted file mode 100644
> index 052dccb8..0000000
> --- a/Documentation/devicetree/bindings/leds/leds-mt6323.txt
> +++ /dev/null
> @@ -1,63 +0,0 @@
> -Device Tree Bindings for LED support on MT6323 PMIC
> -
> -MT6323 LED controller is subfunction provided by MT6323 PMIC, so the LED
> -controllers are defined as the subnode of the function node provided by MT6323
> -PMIC controller that is being defined as one kind of Muti-Function Device (MFD)
> -using shared bus called PMIC wrapper for each subfunction to access remote
> -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/mediatek,pwrap.yaml
> -
> -Required properties:
> -- compatible : Must be one of
> -  - "mediatek,mt6323-led"
> -  - "mediatek,mt6331-led"
> -  - "mediatek,mt6332-led"
> -- address-cells : Must be 1
> -- size-cells : Must be 0
> -
> -Each led is represented as a child node of the mediatek,mt6323-led that
> -describes the initial behavior for each LED physically and currently only four
> -LED child nodes can be supported.
> -
> -Required properties for the LED child node:
> -- reg : LED channel number (0..3)
> -
> -Optional properties for the LED child node:
> -- label : See Documentation/devicetree/bindings/leds/common.txt
> -- linux,default-trigger : See Documentation/devicetree/bindings/leds/common.txt
> -- default-state: See Documentation/devicetree/bindings/leds/common.txt
> -
> -Example:
> -
> -	mt6323: pmic {
> -		compatible = "mediatek,mt6323";
> -
> -		...
> -
> -		mt6323led: leds {
> -			compatible = "mediatek,mt6323-led";
> -			#address-cells = <1>;
> -			#size-cells = <0>;
> -
> -			led@0 {
> -				reg = <0>;
> -				label = "LED0";
> -				linux,default-trigger = "timer";
> -				default-state = "on";
> -			};
> -			led@1 {
> -				reg = <1>;
> -				label = "LED1";
> -				default-state = "off";
> -			};
> -			led@2 {
> -				reg = <2>;
> -				label = "LED2";
> -				default-state = "on";
> -			};
> -		};
> -	};
> diff --git a/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml b/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> new file mode 100644
> index 0000000..953358b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> @@ -0,0 +1,601 @@
> +# 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 PMIC
> +
> +maintainers:
> +  - Sen Chu <sen.chu@mediatek.com>
> +  - Macpaul Lin <macpaul.lin@mediatek.com>
> +
> +description: |
> +  MT6397/MT6323 is a power management system chip.
> +  Please see the sub-modules below for supported features.
> +
> +  MT6397/MT6323 is a multifunction device with the following sub modules:
> +  - Regulators
> +  - 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 PMIC is a child device of pwrap.
> +  See the following for pwrap node definitions:
> +  Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - enum:
> +          - mediatek,mt6323
> +          - mediatek,mt6331 # "mediatek,mt6331" for PMIC MT6331 and MT6332.
> +          - mediatek,mt6358
> +          - mediatek,mt6359
> +          - mediatek,mt6397
> +      - items:
> +          - enum:
> +              - mediatek,mt6366
> +          - const: mediatek,mt6358
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  interrupt-controller: true
> +
> +  "#interrupt-cells":
> +    const: 2
> +
> +  rtc:
> +    type: object
> +    $ref: /schemas/rtc/rtc.yaml#
> +    unevaluatedProperties: false
> +    description:
> +      MT6397 Real Time Clock.
> +
> +    properties:
> +      compatible:
> +        oneOf:
> +          - enum:
> +              - mediatek,mt6323-rtc
> +              - mediatek,mt6331-rtc
> +              - mediatek,mt6358-rtc
> +              - mediatek,mt6397-rtc
> +          - items:
> +              - enum:
> +                  - mediatek,mt6366-rtc
> +              - const: mediatek,mt6358-rtc
> +
> +    required:
> +      - compatible
> +
> +  regulators:
> +    type: object
> +    description:
> +      List of child nodes that specify the regulators.
> +    additionalProperties: true
> +
> +    properties:
> +      compatible:
> +        oneOf:
> +          - enum:
> +              - mediatek,mt6323-regulator
> +              - mediatek,mt6358-regulator
> +              - mediatek,mt6397-regulator
> +          - items:
> +              - enum:
> +                  - mediatek,mt6366-regulator
> +              - const: mediatek,mt6358-regulator
> +
> +    required:
> +      - compatible
> +
> +  audio-codec:
> +    type: object
> +    additionalProperties: false
> +    description:
> +      Audio codec support with MT6397 and MT6358.
> +
> +    properties:
> +      compatible:
> +        oneOf:
> +          - enum:
> +              - mediatek,mt6397-codec
> +              - mediatek,mt6358-sound
> +          - items:
> +              - enum:
> +                  - mediatek,mt6366-sound
> +              - const: mediatek,mt6358-sound
> +
> +      mediatek,dmic-mode:
> +        description: |
> +          Indicates how many data pins are used to transmit two channels of PDM
> +          signal.
> +          0 - two wires;
> +          1 - one wire;
> +          Default value is 0.
> +        enum: [0, 1]
> +        default: 0
> +
> +      Avdd-supply:
> +        description: Power source of AVDD.
> +
> +    required:
> +      - compatible
> +
> +  clocks:
> +    type: object
> +    additionalProperties: false
> +    description:
> +      This is a clock buffer node for mt6397. However, there are no sub nodes
> +      or any public document exposed in public.
> +
> +    properties:
> +      compatible:
> +        const: mediatek,mt6397-clk
> +
> +      '#clock-cells':
> +        const: 1
> +
> +    required:
> +      - compatible
> +
> +  leds:
> +    type: object
> +    additionalProperties: false
> +    description: |
> +      MT6323 LED controller is subfunction provided by MT6323 PMIC, so the LED
> +      controllers are defined as the subnode of the function node provided by MT6323
> +      PMIC controller that is being defined as one kind of Muti-Function Device (MFD)
> +      using shared bus called PMIC wrapper for each subfunction to access remote
> +      MT6323 PMIC hardware.
> +
> +      Each led is represented as a child node of the mediatek,mt6323-led that
> +      describes the initial behavior for each LED physically and currently only four
> +      LED child nodes can be supported.
> +
> +    properties:
> +      compatible:
> +        enum:
> +          - mediatek,mt6323-led
> +          - mediatek,mt6331-led
> +          - mediatek,mt6332-led
> +
> +      reg:
> +        maxItems: 1
> +
> +      "#address-cells":
> +        const: 1
> +
> +      "#size-cells":
> +        const: 0
> +
> +    patternProperties:
> +      "^led@[0-3]$":
> +        type: object
> +        $ref: /schemas/leds/common.yaml#
> +        unevaluatedProperties: false
> +
> +        properties:
> +          reg:
> +            description:
> +              LED channel number (0..3)
> +            minimum: 0
> +            maximum: 3
> +
> +        required:
> +          - reg
> +
> +    required:
> +      - compatible
> +      - "#address-cells"
> +      - "#size-cells"
> +
> +  keys:
> +    type: object
> +    $ref: /schemas/input/mediatek,pmic-keys.yaml
> +    unevaluatedProperties: false
> +    description:
> +      Power and Home keys.
> +
> +  power-controller:
> +    type: object
> +    additionalProperties: false
> +    description:
> +      The power controller which could be found on PMIC is responsible for
> +      externally powering off or on the remote MediaTek SoC through the
> +      circuit BBPU (baseband power up).
> +
> +    properties:
> +      compatible:
> +        const: mediatek,mt6323-pwrc
> +
> +      '#power-domain-cells':
> +        const: 0
> +
> +  pinctrl:
> +    type: object
> +    $ref: /schemas/pinctrl/mediatek,mt65xx-pinctrl.yaml
> +    unevaluatedProperties: false
> +    description:
> +      Pin controller
> +
> +required:
> +  - compatible
> +  - regulators
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    #include <dt-bindings/leds/common.h>
> +
> +    pmic {
> +        compatible = "mediatek,mt6323";
> +        interrupt-parent = <&pio>;
> +        interrupts = <150 IRQ_TYPE_LEVEL_HIGH>;
> +        interrupt-controller;
> +        #interrupt-cells = <2>;
> +
> +        leds {
> +            compatible = "mediatek,mt6323-led";
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +        };
> +
> +        regulators {
> +            compatible = "mediatek,mt6323-regulator";
> +
> +            buck_vproc {
> +                regulator-name = "vproc";
> +                regulator-min-microvolt = < 700000>;
> +                regulator-max-microvolt = <1350000>;
> +                regulator-ramp-delay = <12500>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            buck_vsys {
> +                regulator-name = "vsys";
> +                regulator-min-microvolt = <1400000>;
> +                regulator-max-microvolt = <2987500>;
> +                regulator-ramp-delay = <25000>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            buck_vpa {
> +                regulator-name = "vpa";
> +                regulator-min-microvolt = < 500000>;
> +                regulator-max-microvolt = <3650000>;
> +            };
> +
> +            ldo_vtcxo {
> +                regulator-name = "vtcxo";
> +                regulator-min-microvolt = <2800000>;
> +                regulator-max-microvolt = <2800000>;
> +                regulator-enable-ramp-delay = <90>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vcn28 {
> +                regulator-name = "vcn28";
> +                regulator-min-microvolt = <2800000>;
> +                regulator-max-microvolt = <2800000>;
> +                regulator-enable-ramp-delay = <185>;
> +            };
> +
> +            ldo_vcn33_bt {
> +                regulator-name = "vcn33_bt";
> +                regulator-min-microvolt = <3300000>;
> +                regulator-max-microvolt = <3600000>;
> +                regulator-enable-ramp-delay = <185>;
> +            };
> +
> +            ldo_vcn33_wifi {
> +                regulator-name = "vcn33_wifi";
> +                regulator-min-microvolt = <3300000>;
> +                regulator-max-microvolt = <3600000>;
> +                regulator-enable-ramp-delay = <185>;
> +            };
> +
> +            ldo_va {
> +                regulator-name = "va";
> +                regulator-min-microvolt = <2800000>;
> +                regulator-max-microvolt = <2800000>;
> +                regulator-enable-ramp-delay = <216>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vcama {
> +                regulator-name = "vcama";
> +                regulator-min-microvolt = <1500000>;
> +                regulator-max-microvolt = <2800000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vio28 {
> +                regulator-name = "vio28";
> +                regulator-min-microvolt = <2800000>;
> +                regulator-max-microvolt = <2800000>;
> +                regulator-enable-ramp-delay = <216>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vusb {
> +                regulator-name = "vusb";
> +                regulator-min-microvolt = <3300000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <216>;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vmc {
> +                regulator-name = "vmc";
> +                regulator-min-microvolt = <1800000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <36>;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vmch {
> +                regulator-name = "vmch";
> +                regulator-min-microvolt = <3000000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <36>;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vemc3v3 {
> +                regulator-name = "vemc3v3";
> +                regulator-min-microvolt = <3000000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <36>;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vgp1 {
> +                regulator-name = "vgp1";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vgp2 {
> +                regulator-name = "vgp2";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <3000000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vgp3 {
> +                regulator-name = "vgp3";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <1800000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vcn18 {
> +                regulator-name = "vcn18";
> +                regulator-min-microvolt = <1800000>;
> +                regulator-max-microvolt = <1800000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vsim1 {
> +                regulator-name = "vsim1";
> +                regulator-min-microvolt = <1800000>;
> +                regulator-max-microvolt = <3000000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vsim2 {
> +                regulator-name = "vsim2";
> +                regulator-min-microvolt = <1800000>;
> +                regulator-max-microvolt = <3000000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vrtc {
> +                regulator-name = "vrtc";
> +                regulator-min-microvolt = <2800000>;
> +                regulator-max-microvolt = <2800000>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vcamaf {
> +                regulator-name = "vcamaf";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vibr {
> +                regulator-name = "vibr";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <36>;
> +            };
> +
> +            ldo_vrf18 {
> +                regulator-name = "vrf18";
> +                regulator-min-microvolt = <1825000>;
> +                regulator-max-microvolt = <1825000>;
> +                regulator-enable-ramp-delay = <187>;
> +            };
> +
> +            ldo_vm {
> +                regulator-name = "vm";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <1800000>;
> +                regulator-enable-ramp-delay = <216>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vio18 {
> +                regulator-name = "vio18";
> +                regulator-min-microvolt = <1800000>;
> +                regulator-max-microvolt = <1800000>;
> +                regulator-enable-ramp-delay = <216>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +           ldo_vcamd {
> +                regulator-name = "vcamd";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <1800000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vcamio {
> +                regulator-name = "vcamio";
> +                regulator-min-microvolt = <1800000>;
> +                regulator-max-microvolt = <1800000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +        };
> +
> +        keys {
> +            compatible = "mediatek,mt6323-keys";
> +            mediatek,long-press-mode = <1>;
> +            power-off-time-sec = <0>;
> +
> +            power {
> +                linux,keycodes = <116>;
> +                wakeup-source;
> +            };
> +
> +            home {
> +                linux,keycodes = <114>;
> +            };
> +        };
> +
> +        power-controller {
> +            compatible = "mediatek,mt6323-pwrc";
> +            #power-domain-cells = <0>;
> +        };
> +
> +        rtc {
> +            compatible = "mediatek,mt6323-rtc";
> +        };
> +    };
> +
> +  - |
> +    #include <dt-bindings/input/input.h>
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    pmic {
> +        compatible = "mediatek,mt6358";
> +        interrupt-controller;
> +        #interrupt-cells = <2>;
> +
> +        audio-codec {
> +            compatible = "mediatek,mt6358-sound";
> +            Avdd-supply = <&mt6358_vaud28_reg>;
> +            mediatek,dmic-mode = <0>;
> +        };
> +
> +        regulators {
> +            compatible = "mediatek,mt6358-regulator";
> +
> +            buck_vdram1 {
> +                regulator-name = "vdram1";
> +                regulator-min-microvolt = <500000>;
> +                regulator-max-microvolt = <2087500>;
> +                regulator-ramp-delay = <12500>;
> +                regulator-enable-ramp-delay = <0>;
> +                regulator-always-on;
> +                regulator-allowed-modes = <0 1>;
> +            };
> +
> +            // ...
> +
> +            ldo_vsim2 {
> +                regulator-name = "vsim2";
> +                regulator-min-microvolt = <1700000>;
> +                regulator-max-microvolt = <3100000>;
> +                regulator-enable-ramp-delay = <540>;
> +            };
> +        };
> +
> +        rtc {
> +            compatible = "mediatek,mt6358-rtc";
> +        };
> +
> +        keys {
> +            compatible = "mediatek,mt6358-keys";
> +
> +            power {
> +                linux,keycodes = <KEY_POWER>;
> +                wakeup-source;
> +            };
> +
> +            home {
> +                linux,keycodes = <KEY_HOME>;
> +            };
> +        };
> +    };
> +
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    pmic {
> +        compatible = "mediatek,mt6397";
> +
> +        interrupt-parent = <&pio>;
> +        interrupts-extended = <&pio 222 IRQ_TYPE_LEVEL_HIGH>;
> +        interrupt-controller;
> +        #interrupt-cells = <2>;
> +
> +        audio-codec {
> +            compatible = "mediatek,mt6397-codec";
> +        };
> +
> +        clocks {
> +            compatible = "mediatek,mt6397-clk";
> +            #clock-cells = <1>;
> +        };
> +
> +        pinctrl {
> +            compatible = "mediatek,mt6397-pinctrl";
> +            gpio-controller;
> +            #gpio-cells = <2>;
> +        };
> +
> +        regulators {
> +            compatible = "mediatek,mt6397-regulator";
> +
> +            buck_vpca15 {
> +                regulator-name = "vpca15";
> +                regulator-min-microvolt = < 850000>;
> +                regulator-max-microvolt = <1350000>;
> +                regulator-ramp-delay = <12500>;
> +                regulator-enable-ramp-delay = <200>;
> +            };
> +
> +            // ...
> +
> +            ldo_vibr {
> +                regulator-name = "vibr";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <218>;
> +            };
> +        };
> +
> +        rtc {
> +            compatible = "mediatek,mt6397-rtc";
> +        };
> +    };
> diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt
> deleted file mode 100644
> index 10540aa..0000000
> --- a/Documentation/devicetree/bindings/mfd/mt6397.txt
> +++ /dev/null
> @@ -1,110 +0,0 @@
> -MediaTek MT6397/MT6323 Multifunction Device Driver
> -
> -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.
> -
> -Required properties:
> -compatible:
> -	"mediatek,mt6323" for PMIC MT6323
> -	"mediatek,mt6331" for PMIC MT6331 and MT6332
> -	"mediatek,mt6357" for PMIC MT6357
> -	"mediatek,mt6358" for PMIC MT6358
> -	"mediatek,mt6359" for PMIC MT6359
> -	"mediatek,mt6366", "mediatek,mt6358" for PMIC MT6366
> -	"mediatek,mt6397" for PMIC MT6397
> -
> -Optional subnodes:
> -
> -- rtc
> -	Required properties: Should be one of follows
> -		- compatible: "mediatek,mt6323-rtc"
> -		- compatible: "mediatek,mt6331-rtc"
> -		- compatible: "mediatek,mt6358-rtc"
> -		- compatible: "mediatek,mt6397-rtc"
> -	For details, see ../rtc/rtc-mt6397.txt
> -- regulators
> -	Required properties:
> -		- compatible: "mediatek,mt6323-regulator"
> -	see ../regulator/mt6323-regulator.txt
> -		- compatible: "mediatek,mt6358-regulator"
> -		- compatible: "mediatek,mt6366-regulator", "mediatek-mt6358-regulator"
> -	see ../regulator/mt6358-regulator.txt
> -		- compatible: "mediatek,mt6397-regulator"
> -	see ../regulator/mt6397-regulator.txt
> -- codec
> -	Required properties:
> -		- compatible: "mediatek,mt6397-codec" or "mediatek,mt6358-sound"
> -- clk
> -	Required properties:
> -		- compatible: "mediatek,mt6397-clk"
> -- led
> -	Required properties:
> -		- compatible: "mediatek,mt6323-led"
> -	see ../leds/leds-mt6323.txt
> -
> -- keys
> -	Required properties: Should be one of the following
> -		- compatible: "mediatek,mt6323-keys"
> -		- compatible: "mediatek,mt6331-keys"
> -		- compatible: "mediatek,mt6397-keys"
> -	see ../input/mtk-pmic-keys.txt
> -
> -- power-controller
> -	Required properties:
> -		- compatible: "mediatek,mt6323-pwrc"
> -	For details, see ../power/reset/mt6323-poweroff.txt
> -
> -- pin-controller
> -	Required properties:
> -		- compatible: "mediatek,mt6397-pinctrl"
> -	For details, see ../pinctrl/pinctrl-mt65xx.txt
> -
> -Example:
> -	pwrap: pwrap@1000f000 {
> -		compatible = "mediatek,mt8135-pwrap";
> -
> -		...
> -
> -		pmic {
> -			compatible = "mediatek,mt6397";
> -
> -			codec: mt6397codec {
> -				compatible = "mediatek,mt6397-codec";
> -			};
> -
> -			regulators {
> -				compatible = "mediatek,mt6397-regulator";
> -
> -				mt6397_vpca15_reg: buck_vpca15 {
> -					regulator-compatible = "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-compatible = "ldo_vgp4";
> -					regulator-name = "vgp4";
> -					regulator-min-microvolt = <1200000>;
> -					regulator-max-microvolt = <3300000>;
> -					regulator-enable-ramp-delay = <218>;
> -				};
> -			};
> -		};
> -	};
> diff --git a/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt b/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
> deleted file mode 100644
> index 933f0c4..0000000
> --- a/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -Device Tree Bindings for Power Controller on MediaTek PMIC
> -
> -The power controller which could be found on PMIC is responsible for externally
> -powering off or on the remote MediaTek SoC through the circuit BBPU.
> -
> -Required properties:
> -- compatible: Should be one of follows
> -       "mediatek,mt6323-pwrc": for MT6323 PMIC
> -
> -Example:
> -
> -       pmic {
> -               compatible = "mediatek,mt6323";
> -
> -               ...
> -
> -               power-controller {
> -                       compatible = "mediatek,mt6323-pwrc";
> -               };
> -       }
> diff --git a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt b/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
> deleted file mode 100644
> index 7212076..0000000
> --- a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
> +++ /dev/null
> @@ -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";
> -               };
> -       };
> diff --git a/Documentation/devicetree/bindings/sound/mt6358.txt b/Documentation/devicetree/bindings/sound/mt6358.txt
> deleted file mode 100644
> index fbe9e55..0000000
> --- a/Documentation/devicetree/bindings/sound/mt6358.txt
> +++ /dev/null
> @@ -1,26 +0,0 @@
> -Mediatek MT6358 Audio Codec
> -
> -The communication between MT6358 and SoC is through Mediatek PMIC wrapper.
> -For more detail, please visit Mediatek PMIC wrapper documentation.
> -
> -Must be a child node of PMIC wrapper.
> -
> -Required properties:
> -
> -- compatible - "string" - One of:
> -    "mediatek,mt6358-sound"
> -    "mediatek,mt6366-sound"
> -- Avdd-supply : power source of AVDD
> -
> -Optional properties:
> -- mediatek,dmic-mode : Indicates how many data pins are used to transmit two
> -	channels of PDM signal. 0 means two wires, 1 means one wire. Default
> -	value is 0.
> -
> -Example:
> -
> -mt6358_snd {
> -	compatible = "mediatek,mt6358-sound";
> -	Avdd-supply = <&mt6358_vaud28_reg>;
> -	mediatek,dmic-mode = <0>;
> -};
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 2cdd7ca..e97b5ae 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -14418,10 +14418,12 @@ F:	Documentation/devicetree/bindings/net/bluetooth/mediatek,mt7921s-bluetooth.ya
>  F:	drivers/bluetooth/btmtkuart.c
>  
>  MEDIATEK BOARD LEVEL SHUTDOWN DRIVERS
> +M:	Sen Chu <sen.chu@mediatek.com>
>  M:	Sean Wang <sean.wang@mediatek.com>
> +M:	Macpaul Lin <macpaul.lin@mediatek.com>
>  L:	linux-pm@vger.kernel.org
>  S:	Maintained
> -F:	Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
> +F:	Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
>  F:	drivers/power/reset/mt6323-poweroff.c
>  
>  MEDIATEK CIR DRIVER
> @@ -14582,9 +14584,11 @@ F:	Documentation/devicetree/bindings/mtd/mediatek,mtk-nfc.yaml
>  F:	drivers/mtd/nand/raw/mtk_*
>  
>  MEDIATEK PMIC LED DRIVER
> +M:	Sen Chu <sen.chu@mediatek.com>
>  M:	Sean Wang <sean.wang@mediatek.com>
> +M:	Macpaul Lin <macpaul.lin@mediatek.com>
>  S:	Maintained
> -F:	Documentation/devicetree/bindings/leds/leds-mt6323.txt
> +F:	Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
>  F:	drivers/leds/leds-mt6323.c
>  
>  MEDIATEK RANDOM NUMBER GENERATOR SUPPORT
> -- 
> 2.45.2
> 
>
Alexandre Belloni Sept. 18, 2024, 11:56 a.m. UTC | #2
On 18/09/2024 13:51:51+0200, Alexandre Belloni wrote:
> > Changes for v4:
> >  - Remove "mediatek,mt6357" from PMIC's compatible string since there is a
> >    seperated DT schema for PMIC mt6357.
> > 
> > Changes for v5:
> >  - Rebase to next-20240913 (linux-next/master).
> >  - Fix the "title" (device type) of mfd/mediatek,mt6397.yaml to "PMIC".
> >  - RTC:
> >   - Drop "start-year"
> 
> Maybe, instead of dropping the property, you should add support in the
> driver by setting range_min and range_max.

Looking at this even more, the driver can probably be simplified by
setting start_year in probe and dropping RTC_MIN_YEAR_OFFSET.

> 
> >  - Regulators:
> >   - Add blank lines between description and properties.
> >   - Drop allOf for the $ref section on property.
> >  - clocks:
> >   - Fix no need '|' in descriptoin.
> >   - Add blank lines between description and properties.
> >  - Keys:
> >   - Drop compatible since these enums are already in $ref.
> >  - pinctrl:
> >   - Drop compatible since it is already in $ref.
> >  - examples:
> >   - Fix indentations for leds and keys.
> > 
> > Changes for v6:
> >  - Commit message:
> >   - Add note for simplifying examples of mt6358 and mt6397.
> >  - examples:
> >   - Fix indentations for mt6323-keys.
> >   - MT6358 and MT6397: simplify settings in regulators.
> >    - Preserve "audio-codec", "clocks", "pinctrl", "rtc", and "keys"
> >      sections as they contain typical settings for different PMICs.
> > 
> > diff --git a/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml b/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> > index 70567d9..466566a 100644
> > --- a/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> > +++ b/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> > @@ -19,7 +19,7 @@ description: |
> >    by the PMIC that is defined as a Multi-Function Device (MFD).
> >  
> >    For MediaTek MT6323/MT6397 PMIC bindings see
> > -  Documentation/devicetree/bindings/mfd/mt6397.txt
> > +  Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> >  
> >  properties:
> >    compatible:
> > diff --git a/Documentation/devicetree/bindings/leds/leds-mt6323.txt b/Documentation/devicetree/bindings/leds/leds-mt6323.txt
> > deleted file mode 100644
> > index 052dccb8..0000000
> > --- a/Documentation/devicetree/bindings/leds/leds-mt6323.txt
> > +++ /dev/null
> > @@ -1,63 +0,0 @@
> > -Device Tree Bindings for LED support on MT6323 PMIC
> > -
> > -MT6323 LED controller is subfunction provided by MT6323 PMIC, so the LED
> > -controllers are defined as the subnode of the function node provided by MT6323
> > -PMIC controller that is being defined as one kind of Muti-Function Device (MFD)
> > -using shared bus called PMIC wrapper for each subfunction to access remote
> > -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/mediatek,pwrap.yaml
> > -
> > -Required properties:
> > -- compatible : Must be one of
> > -  - "mediatek,mt6323-led"
> > -  - "mediatek,mt6331-led"
> > -  - "mediatek,mt6332-led"
> > -- address-cells : Must be 1
> > -- size-cells : Must be 0
> > -
> > -Each led is represented as a child node of the mediatek,mt6323-led that
> > -describes the initial behavior for each LED physically and currently only four
> > -LED child nodes can be supported.
> > -
> > -Required properties for the LED child node:
> > -- reg : LED channel number (0..3)
> > -
> > -Optional properties for the LED child node:
> > -- label : See Documentation/devicetree/bindings/leds/common.txt
> > -- linux,default-trigger : See Documentation/devicetree/bindings/leds/common.txt
> > -- default-state: See Documentation/devicetree/bindings/leds/common.txt
> > -
> > -Example:
> > -
> > -	mt6323: pmic {
> > -		compatible = "mediatek,mt6323";
> > -
> > -		...
> > -
> > -		mt6323led: leds {
> > -			compatible = "mediatek,mt6323-led";
> > -			#address-cells = <1>;
> > -			#size-cells = <0>;
> > -
> > -			led@0 {
> > -				reg = <0>;
> > -				label = "LED0";
> > -				linux,default-trigger = "timer";
> > -				default-state = "on";
> > -			};
> > -			led@1 {
> > -				reg = <1>;
> > -				label = "LED1";
> > -				default-state = "off";
> > -			};
> > -			led@2 {
> > -				reg = <2>;
> > -				label = "LED2";
> > -				default-state = "on";
> > -			};
> > -		};
> > -	};
> > diff --git a/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml b/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> > new file mode 100644
> > index 0000000..953358b
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> > @@ -0,0 +1,601 @@
> > +# 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 PMIC
> > +
> > +maintainers:
> > +  - Sen Chu <sen.chu@mediatek.com>
> > +  - Macpaul Lin <macpaul.lin@mediatek.com>
> > +
> > +description: |
> > +  MT6397/MT6323 is a power management system chip.
> > +  Please see the sub-modules below for supported features.
> > +
> > +  MT6397/MT6323 is a multifunction device with the following sub modules:
> > +  - Regulators
> > +  - 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 PMIC is a child device of pwrap.
> > +  See the following for pwrap node definitions:
> > +  Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
> > +
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      - enum:
> > +          - mediatek,mt6323
> > +          - mediatek,mt6331 # "mediatek,mt6331" for PMIC MT6331 and MT6332.
> > +          - mediatek,mt6358
> > +          - mediatek,mt6359
> > +          - mediatek,mt6397
> > +      - items:
> > +          - enum:
> > +              - mediatek,mt6366
> > +          - const: mediatek,mt6358
> > +
> > +  interrupts:
> > +    maxItems: 1
> > +
> > +  interrupt-controller: true
> > +
> > +  "#interrupt-cells":
> > +    const: 2
> > +
> > +  rtc:
> > +    type: object
> > +    $ref: /schemas/rtc/rtc.yaml#
> > +    unevaluatedProperties: false
> > +    description:
> > +      MT6397 Real Time Clock.
> > +
> > +    properties:
> > +      compatible:
> > +        oneOf:
> > +          - enum:
> > +              - mediatek,mt6323-rtc
> > +              - mediatek,mt6331-rtc
> > +              - mediatek,mt6358-rtc
> > +              - mediatek,mt6397-rtc
> > +          - items:
> > +              - enum:
> > +                  - mediatek,mt6366-rtc
> > +              - const: mediatek,mt6358-rtc
> > +
> > +    required:
> > +      - compatible
> > +
> > +  regulators:
> > +    type: object
> > +    description:
> > +      List of child nodes that specify the regulators.
> > +    additionalProperties: true
> > +
> > +    properties:
> > +      compatible:
> > +        oneOf:
> > +          - enum:
> > +              - mediatek,mt6323-regulator
> > +              - mediatek,mt6358-regulator
> > +              - mediatek,mt6397-regulator
> > +          - items:
> > +              - enum:
> > +                  - mediatek,mt6366-regulator
> > +              - const: mediatek,mt6358-regulator
> > +
> > +    required:
> > +      - compatible
> > +
> > +  audio-codec:
> > +    type: object
> > +    additionalProperties: false
> > +    description:
> > +      Audio codec support with MT6397 and MT6358.
> > +
> > +    properties:
> > +      compatible:
> > +        oneOf:
> > +          - enum:
> > +              - mediatek,mt6397-codec
> > +              - mediatek,mt6358-sound
> > +          - items:
> > +              - enum:
> > +                  - mediatek,mt6366-sound
> > +              - const: mediatek,mt6358-sound
> > +
> > +      mediatek,dmic-mode:
> > +        description: |
> > +          Indicates how many data pins are used to transmit two channels of PDM
> > +          signal.
> > +          0 - two wires;
> > +          1 - one wire;
> > +          Default value is 0.
> > +        enum: [0, 1]
> > +        default: 0
> > +
> > +      Avdd-supply:
> > +        description: Power source of AVDD.
> > +
> > +    required:
> > +      - compatible
> > +
> > +  clocks:
> > +    type: object
> > +    additionalProperties: false
> > +    description:
> > +      This is a clock buffer node for mt6397. However, there are no sub nodes
> > +      or any public document exposed in public.
> > +
> > +    properties:
> > +      compatible:
> > +        const: mediatek,mt6397-clk
> > +
> > +      '#clock-cells':
> > +        const: 1
> > +
> > +    required:
> > +      - compatible
> > +
> > +  leds:
> > +    type: object
> > +    additionalProperties: false
> > +    description: |
> > +      MT6323 LED controller is subfunction provided by MT6323 PMIC, so the LED
> > +      controllers are defined as the subnode of the function node provided by MT6323
> > +      PMIC controller that is being defined as one kind of Muti-Function Device (MFD)
> > +      using shared bus called PMIC wrapper for each subfunction to access remote
> > +      MT6323 PMIC hardware.
> > +
> > +      Each led is represented as a child node of the mediatek,mt6323-led that
> > +      describes the initial behavior for each LED physically and currently only four
> > +      LED child nodes can be supported.
> > +
> > +    properties:
> > +      compatible:
> > +        enum:
> > +          - mediatek,mt6323-led
> > +          - mediatek,mt6331-led
> > +          - mediatek,mt6332-led
> > +
> > +      reg:
> > +        maxItems: 1
> > +
> > +      "#address-cells":
> > +        const: 1
> > +
> > +      "#size-cells":
> > +        const: 0
> > +
> > +    patternProperties:
> > +      "^led@[0-3]$":
> > +        type: object
> > +        $ref: /schemas/leds/common.yaml#
> > +        unevaluatedProperties: false
> > +
> > +        properties:
> > +          reg:
> > +            description:
> > +              LED channel number (0..3)
> > +            minimum: 0
> > +            maximum: 3
> > +
> > +        required:
> > +          - reg
> > +
> > +    required:
> > +      - compatible
> > +      - "#address-cells"
> > +      - "#size-cells"
> > +
> > +  keys:
> > +    type: object
> > +    $ref: /schemas/input/mediatek,pmic-keys.yaml
> > +    unevaluatedProperties: false
> > +    description:
> > +      Power and Home keys.
> > +
> > +  power-controller:
> > +    type: object
> > +    additionalProperties: false
> > +    description:
> > +      The power controller which could be found on PMIC is responsible for
> > +      externally powering off or on the remote MediaTek SoC through the
> > +      circuit BBPU (baseband power up).
> > +
> > +    properties:
> > +      compatible:
> > +        const: mediatek,mt6323-pwrc
> > +
> > +      '#power-domain-cells':
> > +        const: 0
> > +
> > +  pinctrl:
> > +    type: object
> > +    $ref: /schemas/pinctrl/mediatek,mt65xx-pinctrl.yaml
> > +    unevaluatedProperties: false
> > +    description:
> > +      Pin controller
> > +
> > +required:
> > +  - compatible
> > +  - regulators
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> > +    #include <dt-bindings/leds/common.h>
> > +
> > +    pmic {
> > +        compatible = "mediatek,mt6323";
> > +        interrupt-parent = <&pio>;
> > +        interrupts = <150 IRQ_TYPE_LEVEL_HIGH>;
> > +        interrupt-controller;
> > +        #interrupt-cells = <2>;
> > +
> > +        leds {
> > +            compatible = "mediatek,mt6323-led";
> > +            #address-cells = <1>;
> > +            #size-cells = <0>;
> > +        };
> > +
> > +        regulators {
> > +            compatible = "mediatek,mt6323-regulator";
> > +
> > +            buck_vproc {
> > +                regulator-name = "vproc";
> > +                regulator-min-microvolt = < 700000>;
> > +                regulator-max-microvolt = <1350000>;
> > +                regulator-ramp-delay = <12500>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            buck_vsys {
> > +                regulator-name = "vsys";
> > +                regulator-min-microvolt = <1400000>;
> > +                regulator-max-microvolt = <2987500>;
> > +                regulator-ramp-delay = <25000>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            buck_vpa {
> > +                regulator-name = "vpa";
> > +                regulator-min-microvolt = < 500000>;
> > +                regulator-max-microvolt = <3650000>;
> > +            };
> > +
> > +            ldo_vtcxo {
> > +                regulator-name = "vtcxo";
> > +                regulator-min-microvolt = <2800000>;
> > +                regulator-max-microvolt = <2800000>;
> > +                regulator-enable-ramp-delay = <90>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vcn28 {
> > +                regulator-name = "vcn28";
> > +                regulator-min-microvolt = <2800000>;
> > +                regulator-max-microvolt = <2800000>;
> > +                regulator-enable-ramp-delay = <185>;
> > +            };
> > +
> > +            ldo_vcn33_bt {
> > +                regulator-name = "vcn33_bt";
> > +                regulator-min-microvolt = <3300000>;
> > +                regulator-max-microvolt = <3600000>;
> > +                regulator-enable-ramp-delay = <185>;
> > +            };
> > +
> > +            ldo_vcn33_wifi {
> > +                regulator-name = "vcn33_wifi";
> > +                regulator-min-microvolt = <3300000>;
> > +                regulator-max-microvolt = <3600000>;
> > +                regulator-enable-ramp-delay = <185>;
> > +            };
> > +
> > +            ldo_va {
> > +                regulator-name = "va";
> > +                regulator-min-microvolt = <2800000>;
> > +                regulator-max-microvolt = <2800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vcama {
> > +                regulator-name = "vcama";
> > +                regulator-min-microvolt = <1500000>;
> > +                regulator-max-microvolt = <2800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vio28 {
> > +                regulator-name = "vio28";
> > +                regulator-min-microvolt = <2800000>;
> > +                regulator-max-microvolt = <2800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vusb {
> > +                regulator-name = "vusb";
> > +                regulator-min-microvolt = <3300000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vmc {
> > +                regulator-name = "vmc";
> > +                regulator-min-microvolt = <1800000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <36>;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vmch {
> > +                regulator-name = "vmch";
> > +                regulator-min-microvolt = <3000000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <36>;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vemc3v3 {
> > +                regulator-name = "vemc3v3";
> > +                regulator-min-microvolt = <3000000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <36>;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vgp1 {
> > +                regulator-name = "vgp1";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vgp2 {
> > +                regulator-name = "vgp2";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <3000000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vgp3 {
> > +                regulator-name = "vgp3";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <1800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vcn18 {
> > +                regulator-name = "vcn18";
> > +                regulator-min-microvolt = <1800000>;
> > +                regulator-max-microvolt = <1800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vsim1 {
> > +                regulator-name = "vsim1";
> > +                regulator-min-microvolt = <1800000>;
> > +                regulator-max-microvolt = <3000000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vsim2 {
> > +                regulator-name = "vsim2";
> > +                regulator-min-microvolt = <1800000>;
> > +                regulator-max-microvolt = <3000000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vrtc {
> > +                regulator-name = "vrtc";
> > +                regulator-min-microvolt = <2800000>;
> > +                regulator-max-microvolt = <2800000>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vcamaf {
> > +                regulator-name = "vcamaf";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vibr {
> > +                regulator-name = "vibr";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <36>;
> > +            };
> > +
> > +            ldo_vrf18 {
> > +                regulator-name = "vrf18";
> > +                regulator-min-microvolt = <1825000>;
> > +                regulator-max-microvolt = <1825000>;
> > +                regulator-enable-ramp-delay = <187>;
> > +            };
> > +
> > +            ldo_vm {
> > +                regulator-name = "vm";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <1800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vio18 {
> > +                regulator-name = "vio18";
> > +                regulator-min-microvolt = <1800000>;
> > +                regulator-max-microvolt = <1800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +           ldo_vcamd {
> > +                regulator-name = "vcamd";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <1800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vcamio {
> > +                regulator-name = "vcamio";
> > +                regulator-min-microvolt = <1800000>;
> > +                regulator-max-microvolt = <1800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +        };
> > +
> > +        keys {
> > +            compatible = "mediatek,mt6323-keys";
> > +            mediatek,long-press-mode = <1>;
> > +            power-off-time-sec = <0>;
> > +
> > +            power {
> > +                linux,keycodes = <116>;
> > +                wakeup-source;
> > +            };
> > +
> > +            home {
> > +                linux,keycodes = <114>;
> > +            };
> > +        };
> > +
> > +        power-controller {
> > +            compatible = "mediatek,mt6323-pwrc";
> > +            #power-domain-cells = <0>;
> > +        };
> > +
> > +        rtc {
> > +            compatible = "mediatek,mt6323-rtc";
> > +        };
> > +    };
> > +
> > +  - |
> > +    #include <dt-bindings/input/input.h>
> > +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> > +
> > +    pmic {
> > +        compatible = "mediatek,mt6358";
> > +        interrupt-controller;
> > +        #interrupt-cells = <2>;
> > +
> > +        audio-codec {
> > +            compatible = "mediatek,mt6358-sound";
> > +            Avdd-supply = <&mt6358_vaud28_reg>;
> > +            mediatek,dmic-mode = <0>;
> > +        };
> > +
> > +        regulators {
> > +            compatible = "mediatek,mt6358-regulator";
> > +
> > +            buck_vdram1 {
> > +                regulator-name = "vdram1";
> > +                regulator-min-microvolt = <500000>;
> > +                regulator-max-microvolt = <2087500>;
> > +                regulator-ramp-delay = <12500>;
> > +                regulator-enable-ramp-delay = <0>;
> > +                regulator-always-on;
> > +                regulator-allowed-modes = <0 1>;
> > +            };
> > +
> > +            // ...
> > +
> > +            ldo_vsim2 {
> > +                regulator-name = "vsim2";
> > +                regulator-min-microvolt = <1700000>;
> > +                regulator-max-microvolt = <3100000>;
> > +                regulator-enable-ramp-delay = <540>;
> > +            };
> > +        };
> > +
> > +        rtc {
> > +            compatible = "mediatek,mt6358-rtc";
> > +        };
> > +
> > +        keys {
> > +            compatible = "mediatek,mt6358-keys";
> > +
> > +            power {
> > +                linux,keycodes = <KEY_POWER>;
> > +                wakeup-source;
> > +            };
> > +
> > +            home {
> > +                linux,keycodes = <KEY_HOME>;
> > +            };
> > +        };
> > +    };
> > +
> > +  - |
> > +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> > +
> > +    pmic {
> > +        compatible = "mediatek,mt6397";
> > +
> > +        interrupt-parent = <&pio>;
> > +        interrupts-extended = <&pio 222 IRQ_TYPE_LEVEL_HIGH>;
> > +        interrupt-controller;
> > +        #interrupt-cells = <2>;
> > +
> > +        audio-codec {
> > +            compatible = "mediatek,mt6397-codec";
> > +        };
> > +
> > +        clocks {
> > +            compatible = "mediatek,mt6397-clk";
> > +            #clock-cells = <1>;
> > +        };
> > +
> > +        pinctrl {
> > +            compatible = "mediatek,mt6397-pinctrl";
> > +            gpio-controller;
> > +            #gpio-cells = <2>;
> > +        };
> > +
> > +        regulators {
> > +            compatible = "mediatek,mt6397-regulator";
> > +
> > +            buck_vpca15 {
> > +                regulator-name = "vpca15";
> > +                regulator-min-microvolt = < 850000>;
> > +                regulator-max-microvolt = <1350000>;
> > +                regulator-ramp-delay = <12500>;
> > +                regulator-enable-ramp-delay = <200>;
> > +            };
> > +
> > +            // ...
> > +
> > +            ldo_vibr {
> > +                regulator-name = "vibr";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <218>;
> > +            };
> > +        };
> > +
> > +        rtc {
> > +            compatible = "mediatek,mt6397-rtc";
> > +        };
> > +    };
> > diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt
> > deleted file mode 100644
> > index 10540aa..0000000
> > --- a/Documentation/devicetree/bindings/mfd/mt6397.txt
> > +++ /dev/null
> > @@ -1,110 +0,0 @@
> > -MediaTek MT6397/MT6323 Multifunction Device Driver
> > -
> > -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.
> > -
> > -Required properties:
> > -compatible:
> > -	"mediatek,mt6323" for PMIC MT6323
> > -	"mediatek,mt6331" for PMIC MT6331 and MT6332
> > -	"mediatek,mt6357" for PMIC MT6357
> > -	"mediatek,mt6358" for PMIC MT6358
> > -	"mediatek,mt6359" for PMIC MT6359
> > -	"mediatek,mt6366", "mediatek,mt6358" for PMIC MT6366
> > -	"mediatek,mt6397" for PMIC MT6397
> > -
> > -Optional subnodes:
> > -
> > -- rtc
> > -	Required properties: Should be one of follows
> > -		- compatible: "mediatek,mt6323-rtc"
> > -		- compatible: "mediatek,mt6331-rtc"
> > -		- compatible: "mediatek,mt6358-rtc"
> > -		- compatible: "mediatek,mt6397-rtc"
> > -	For details, see ../rtc/rtc-mt6397.txt
> > -- regulators
> > -	Required properties:
> > -		- compatible: "mediatek,mt6323-regulator"
> > -	see ../regulator/mt6323-regulator.txt
> > -		- compatible: "mediatek,mt6358-regulator"
> > -		- compatible: "mediatek,mt6366-regulator", "mediatek-mt6358-regulator"
> > -	see ../regulator/mt6358-regulator.txt
> > -		- compatible: "mediatek,mt6397-regulator"
> > -	see ../regulator/mt6397-regulator.txt
> > -- codec
> > -	Required properties:
> > -		- compatible: "mediatek,mt6397-codec" or "mediatek,mt6358-sound"
> > -- clk
> > -	Required properties:
> > -		- compatible: "mediatek,mt6397-clk"
> > -- led
> > -	Required properties:
> > -		- compatible: "mediatek,mt6323-led"
> > -	see ../leds/leds-mt6323.txt
> > -
> > -- keys
> > -	Required properties: Should be one of the following
> > -		- compatible: "mediatek,mt6323-keys"
> > -		- compatible: "mediatek,mt6331-keys"
> > -		- compatible: "mediatek,mt6397-keys"
> > -	see ../input/mtk-pmic-keys.txt
> > -
> > -- power-controller
> > -	Required properties:
> > -		- compatible: "mediatek,mt6323-pwrc"
> > -	For details, see ../power/reset/mt6323-poweroff.txt
> > -
> > -- pin-controller
> > -	Required properties:
> > -		- compatible: "mediatek,mt6397-pinctrl"
> > -	For details, see ../pinctrl/pinctrl-mt65xx.txt
> > -
> > -Example:
> > -	pwrap: pwrap@1000f000 {
> > -		compatible = "mediatek,mt8135-pwrap";
> > -
> > -		...
> > -
> > -		pmic {
> > -			compatible = "mediatek,mt6397";
> > -
> > -			codec: mt6397codec {
> > -				compatible = "mediatek,mt6397-codec";
> > -			};
> > -
> > -			regulators {
> > -				compatible = "mediatek,mt6397-regulator";
> > -
> > -				mt6397_vpca15_reg: buck_vpca15 {
> > -					regulator-compatible = "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-compatible = "ldo_vgp4";
> > -					regulator-name = "vgp4";
> > -					regulator-min-microvolt = <1200000>;
> > -					regulator-max-microvolt = <3300000>;
> > -					regulator-enable-ramp-delay = <218>;
> > -				};
> > -			};
> > -		};
> > -	};
> > diff --git a/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt b/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
> > deleted file mode 100644
> > index 933f0c4..0000000
> > --- a/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
> > +++ /dev/null
> > @@ -1,20 +0,0 @@
> > -Device Tree Bindings for Power Controller on MediaTek PMIC
> > -
> > -The power controller which could be found on PMIC is responsible for externally
> > -powering off or on the remote MediaTek SoC through the circuit BBPU.
> > -
> > -Required properties:
> > -- compatible: Should be one of follows
> > -       "mediatek,mt6323-pwrc": for MT6323 PMIC
> > -
> > -Example:
> > -
> > -       pmic {
> > -               compatible = "mediatek,mt6323";
> > -
> > -               ...
> > -
> > -               power-controller {
> > -                       compatible = "mediatek,mt6323-pwrc";
> > -               };
> > -       }
> > diff --git a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt b/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
> > deleted file mode 100644
> > index 7212076..0000000
> > --- a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
> > +++ /dev/null
> > @@ -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";
> > -               };
> > -       };
> > diff --git a/Documentation/devicetree/bindings/sound/mt6358.txt b/Documentation/devicetree/bindings/sound/mt6358.txt
> > deleted file mode 100644
> > index fbe9e55..0000000
> > --- a/Documentation/devicetree/bindings/sound/mt6358.txt
> > +++ /dev/null
> > @@ -1,26 +0,0 @@
> > -Mediatek MT6358 Audio Codec
> > -
> > -The communication between MT6358 and SoC is through Mediatek PMIC wrapper.
> > -For more detail, please visit Mediatek PMIC wrapper documentation.
> > -
> > -Must be a child node of PMIC wrapper.
> > -
> > -Required properties:
> > -
> > -- compatible - "string" - One of:
> > -    "mediatek,mt6358-sound"
> > -    "mediatek,mt6366-sound"
> > -- Avdd-supply : power source of AVDD
> > -
> > -Optional properties:
> > -- mediatek,dmic-mode : Indicates how many data pins are used to transmit two
> > -	channels of PDM signal. 0 means two wires, 1 means one wire. Default
> > -	value is 0.
> > -
> > -Example:
> > -
> > -mt6358_snd {
> > -	compatible = "mediatek,mt6358-sound";
> > -	Avdd-supply = <&mt6358_vaud28_reg>;
> > -	mediatek,dmic-mode = <0>;
> > -};
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 2cdd7ca..e97b5ae 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -14418,10 +14418,12 @@ F:	Documentation/devicetree/bindings/net/bluetooth/mediatek,mt7921s-bluetooth.ya
> >  F:	drivers/bluetooth/btmtkuart.c
> >  
> >  MEDIATEK BOARD LEVEL SHUTDOWN DRIVERS
> > +M:	Sen Chu <sen.chu@mediatek.com>
> >  M:	Sean Wang <sean.wang@mediatek.com>
> > +M:	Macpaul Lin <macpaul.lin@mediatek.com>
> >  L:	linux-pm@vger.kernel.org
> >  S:	Maintained
> > -F:	Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
> > +F:	Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> >  F:	drivers/power/reset/mt6323-poweroff.c
> >  
> >  MEDIATEK CIR DRIVER
> > @@ -14582,9 +14584,11 @@ F:	Documentation/devicetree/bindings/mtd/mediatek,mtk-nfc.yaml
> >  F:	drivers/mtd/nand/raw/mtk_*
> >  
> >  MEDIATEK PMIC LED DRIVER
> > +M:	Sen Chu <sen.chu@mediatek.com>
> >  M:	Sean Wang <sean.wang@mediatek.com>
> > +M:	Macpaul Lin <macpaul.lin@mediatek.com>
> >  S:	Maintained
> > -F:	Documentation/devicetree/bindings/leds/leds-mt6323.txt
> > +F:	Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> >  F:	drivers/leds/leds-mt6323.c
> >  
> >  MEDIATEK RANDOM NUMBER GENERATOR SUPPORT
> > -- 
> > 2.45.2
> > 
> > 
> 
> -- 
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
Macpaul Lin Sept. 18, 2024, 2:18 p.m. UTC | #3
On 9/18/24 19:56, Alexandre Belloni wrote:
> 
> On 18/09/2024 13:51:51+0200, Alexandre Belloni wrote:
>> > Changes for v4:
>> >  - Remove "mediatek,mt6357" from PMIC's compatible string since there is a
>> >    seperated DT schema for PMIC mt6357.
>> > 
>> > Changes for v5:
>> >  - Rebase to next-20240913 (linux-next/master).
>> >  - Fix the "title" (device type) of mfd/mediatek,mt6397.yaml to "PMIC".
>> >  - RTC:
>> >   - Drop "start-year"
>> 
>> Maybe, instead of dropping the property, you should add support in the
>> driver by setting range_min and range_max.
> 
> Looking at this even more, the driver can probably be simplified by
> setting start_year in probe and dropping RTC_MIN_YEAR_OFFSET.

Thank you for pointing out where and how the driver should be changed.
However, I'm wondering if this should be a fix with a separated
patchset (bindings and the driver)? The board or SoC's device trees
should be reviewed as well. I'll need to get someone's help (permission) 
inside MediaTek to check those dts and construct the patch for RTC driver.
That will take sometime.

[snip]

Thanks.
Best Regards,
Macpaul Lin
AngeloGioacchino Del Regno Sept. 20, 2024, 7:31 a.m. UTC | #4
Il 18/09/24 16:18, Macpaul Lin ha scritto:
> 
> On 9/18/24 19:56, Alexandre Belloni wrote:
>>
>> On 18/09/2024 13:51:51+0200, Alexandre Belloni wrote:
>>> > Changes for v4:
>>> >  - Remove "mediatek,mt6357" from PMIC's compatible string since there is a
>>> >    seperated DT schema for PMIC mt6357.
>>> > > Changes for v5:
>>> >  - Rebase to next-20240913 (linux-next/master).
>>> >  - Fix the "title" (device type) of mfd/mediatek,mt6397.yaml to "PMIC".
>>> >  - RTC:
>>> >   - Drop "start-year"
>>>
>>> Maybe, instead of dropping the property, you should add support in the
>>> driver by setting range_min and range_max.
>>
>> Looking at this even more, the driver can probably be simplified by
>> setting start_year in probe and dropping RTC_MIN_YEAR_OFFSET.
> 
> Thank you for pointing out where and how the driver should be changed.
> However, I'm wondering if this should be a fix with a separated
> patchset (bindings and the driver)? The board or SoC's device trees
> should be reviewed as well. I'll need to get someone's help (permission) inside 
> MediaTek to check those dts and construct the patch for RTC driver.
> That will take sometime.
> 

Alexandre, I definitely agree with you on the fact that the MTK PMIC RTC driver
can (and needs to) be improved, and that it can make use of some nice cleanup...

... but!

This series performs a conversion to schema, and the previous txt file didn't
say anything about the start-year property - which was not mandatory to support
at that time (nor now, afaik?), so adding support for that is out of scope for
this series.

Eventually, that can come as a series on top, adding support for that in the
binding (and, of course, in the driver).

I should be able to tackle that... most probably next week - but still, the
improvements would come as a series on top of this one.

Cheers,
Angelo
Krzysztof Kozlowski Sept. 20, 2024, 1:07 p.m. UTC | #5
On 18/09/2024 08:49, Macpaul Lin wrote:
> Convert the mfd: mediatek: mt6397 binding to DT schema format.
> 
> MT6323, MT6358, and MT6397 are PMIC devices with multiple function
> subdevices. They share a common PMIC design but have variations in
> subdevice combinations.
> 
> Key updates in this conversion:


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

Best regards,
Krzysztof
Alexandre Belloni Sept. 20, 2024, 1:37 p.m. UTC | #6
On 20/09/2024 09:31:24+0200, AngeloGioacchino Del Regno wrote:
> Il 18/09/24 16:18, Macpaul Lin ha scritto:
> > 
> > On 9/18/24 19:56, Alexandre Belloni wrote:
> > > 
> > > On 18/09/2024 13:51:51+0200, Alexandre Belloni wrote:
> > > > > Changes for v4:
> > > > >  - Remove "mediatek,mt6357" from PMIC's compatible string since there is a
> > > > >    seperated DT schema for PMIC mt6357.
> > > > > > Changes for v5:
> > > > >  - Rebase to next-20240913 (linux-next/master).
> > > > >  - Fix the "title" (device type) of mfd/mediatek,mt6397.yaml to "PMIC".
> > > > >  - RTC:
> > > > >   - Drop "start-year"
> > > > 
> > > > Maybe, instead of dropping the property, you should add support in the
> > > > driver by setting range_min and range_max.
> > > 
> > > Looking at this even more, the driver can probably be simplified by
> > > setting start_year in probe and dropping RTC_MIN_YEAR_OFFSET.
> > 
> > Thank you for pointing out where and how the driver should be changed.
> > However, I'm wondering if this should be a fix with a separated
> > patchset (bindings and the driver)? The board or SoC's device trees
> > should be reviewed as well. I'll need to get someone's help (permission)
> > inside MediaTek to check those dts and construct the patch for RTC
> > driver.
> > That will take sometime.
> > 
> 
> Alexandre, I definitely agree with you on the fact that the MTK PMIC RTC driver
> can (and needs to) be improved, and that it can make use of some nice cleanup...
> 
> ... but!
> 
> This series performs a conversion to schema, and the previous txt file didn't
> say anything about the start-year property - which was not mandatory to support
> at that time (nor now, afaik?), so adding support for that is out of scope for
> this series.

It is mandatory now. I agree this can be done in a subsequent series.

> 
> Eventually, that can come as a series on top, adding support for that in the
> binding (and, of course, in the driver).
> 
> I should be able to tackle that... most probably next week - but still, the
> improvements would come as a series on top of this one.
> 
> Cheers,
> Angelo
AngeloGioacchino Del Regno Sept. 23, 2024, 9:53 a.m. UTC | #7
Il 18/09/24 08:49, Macpaul Lin ha scritto:
> Convert the mfd: mediatek: mt6397 binding to DT schema format.
> 
> MT6323, MT6358, and MT6397 are PMIC devices with multiple function
> subdevices. They share a common PMIC design but have variations in
> subdevice combinations.
> 
> Key updates in this conversion:
> 
> 1. RTC:
>     - Convert rtc-mt6397.txt and merge into parent MT6397 PMIC DT schema.
> 
> 2. Regulators:
>     - Align to generic name "regulators".
>     - Update references from .txt to .yaml for mt6323, mt6358, and mt6397
>       regulators.
>     - Simplify regulator name labels in device tree examples.
> 
> 3. Audio Codec:
>     - Convert sound/mt6358.txt and merge into parent MT6397 PMIC DT schema.
>     - Align to generic name "audio-codec" for codec and sound subdevices.
>     - Add "mediatek,dmic-mode" and "Avdd-supply" properties.
> 
> 4. Clocks:
>     - Align to generic name "clocks" for clockbuffer subdevices.
> 
> 5. LEDs:
>     - Convert leds-mt6323.txt and merge into parent MT6397 PMIC DT schema.
>     - Update LED binding.
> 
> 6. Keys:
>     - Add detailed descriptions for power and home keys.
>     - Add compatible: mediatek,mt6358-keys.
> 
> 7. Power Controller:
>     - Convert mt6323-poweroff.txt and merge into parent MT6397 PMIC DT
>       schema.
>     - Add #power-domain-cells property to fix dt-binding check error.
>     - Clarify "BBPU" as "Baseband power up".
> 
> 8. Pinctrl:
>     - Align to generic name "pinctrl" instead of "pin-controller".
> 
> 9. Compatible:
>     - Drop "mediatek,mt6357" since there is a separated DT Schema
>       for PMIC MT6357.
> 
> 10. Examples:
>     - MT6323: Retain complete examples for this PMIC.
>     - MT6358 and MT6397: simplify settings in regulators.
>      - Preserve "audio-codec", "clocks", "pinctrl", "rtc", and "keys"
>        sections as they contain typical settings for different PMICs.
> 
> Additional updates:
> - MAINTAINERS: Add co-maintainers and reference to
>    mfd/mediatek,mt6397.yaml for LED and power-controller drivers.
> - input/mediatek,pmic-keys.yaml: Update reference to
>    mfd/mediatek,mt6397.yaml.
> 
> Signed-off-by: Sen Chu <sen.chu@mediatek.com>
> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Macpaul Lin Sept. 23, 2024, 10:43 a.m. UTC | #8
On 9/20/24 21:37, Alexandre Belloni wrote:

[snip]

>> > > > >  - RTC:
>> > > > >   - Drop "start-year"
>> > > > 

[snip]

>> > 
>> 
>> Alexandre, I definitely agree with you on the fact that the MTK PMIC RTC driver
>> can (and needs to) be improved, and that it can make use of some nice cleanup...
>> 
>> ... but!
>> 
>> This series performs a conversion to schema, and the previous txt file didn't
>> say anything about the start-year property - which was not mandatory to support
>> at that time (nor now, afaik?), so adding support for that is out of scope for
>> this series.
> 
> It is mandatory now. I agree this can be done in a subsequent series.
> 

Thanks you all for helping with the review and kindly understanding the
situation. I see that Angelo has already submitted the RTC patch set.
I'll check it with the internal driver owner. It seems okay with a quick 
glance.

>> 
>> Eventually, that can come as a series on top, adding support for that in the
>> binding (and, of course, in the driver).
>> 
>> I should be able to tackle that... most probably next week - but still, the
>> improvements would come as a series on top of this one.
>> 
>> Cheers,
>> Angelo
> 

Thanks
Macpaul Lin
Krzysztof Kozlowski Sept. 27, 2024, 9:44 a.m. UTC | #9
On 20/09/2024 15:07, Krzysztof Kozlowski wrote:
> On 18/09/2024 08:49, Macpaul Lin wrote:
>> Convert the mfd: mediatek: mt6397 binding to DT schema format.
>>
>> MT6323, MT6358, and MT6397 are PMIC devices with multiple function
>> subdevices. They share a common PMIC design but have variations in
>> subdevice combinations.
>>
>> Key updates in this conversion:
> 
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Unreviewed. This is incomplete.

Do not send incorrect patches and then followups for them. Just fix the
incorrect patch before it gets applied.

Best regards,
Krzysztof
Krzysztof Kozlowski Sept. 27, 2024, 9:45 a.m. UTC | #10
On 18/09/2024 08:49, Macpaul Lin wrote:
> Convert the mfd: mediatek: mt6397 binding to DT schema format.
> 
> MT6323, MT6358, and MT6397 are PMIC devices with multiple function
> subdevices. They share a common PMIC design but have variations in
> subdevice combinations.
> 
> Key updates in this conversion:
> 
> 1. RTC:
>    - Convert rtc-mt6397.txt and merge into parent MT6397 PMIC DT schema.
> 
> 2. Regulators:
>    - Align to generic name "regulators".
>    - Update references from .txt to .yaml for mt6323, mt6358, and mt6397
>      regulators.
>    - Simplify regulator name labels in device tree examples.
> 
> 3. Audio Codec:
>    - Convert sound/mt6358.txt and merge into parent MT6397 PMIC DT schema.
>    - Align to generic name "audio-codec" for codec and sound subdevices.
>    - Add "mediatek,dmic-mode" and "Avdd-supply" properties.
> 
> 4. Clocks:
>    - Align to generic name "clocks" for clockbuffer subdevices.
> 
> 5. LEDs:
>    - Convert leds-mt6323.txt and merge into parent MT6397 PMIC DT schema.
>    - Update LED binding.
> 
> 6. Keys:
>    - Add detailed descriptions for power and home keys.
>    - Add compatible: mediatek,mt6358-keys.
> 
> 7. Power Controller:
>    - Convert mt6323-poweroff.txt and merge into parent MT6397 PMIC DT
>      schema.
>    - Add #power-domain-cells property to fix dt-binding check error.
>    - Clarify "BBPU" as "Baseband power up".
> 
> 8. Pinctrl:
>    - Align to generic name "pinctrl" instead of "pin-controller".
> 
> 9. Compatible:
>    - Drop "mediatek,mt6357" since there is a separated DT Schema
>      for PMIC MT6357.
> 
> 10. Examples:
>    - MT6323: Retain complete examples for this PMIC.
>    - MT6358 and MT6397: simplify settings in regulators.
>     - Preserve "audio-codec", "clocks", "pinctrl", "rtc", and "keys"
>       sections as they contain typical settings for different PMICs.
> 
> Additional updates:
> - MAINTAINERS: Add co-maintainers and reference to
>   mfd/mediatek,mt6397.yaml for LED and power-controller drivers.
> - input/mediatek,pmic-keys.yaml: Update reference to
>   mfd/mediatek,mt6397.yaml.
> 
> Signed-off-by: Sen Chu <sen.chu@mediatek.com>
> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>

NAK

Follow up patch pointed out this is incorrect. I don't understand this
concept of sending knowingly incorrect code, so please sort it out at v7.

Best regards,
Krzysztof
Macpaul Lin Sept. 27, 2024, 10:41 a.m. UTC | #11
On 9/27/24 17:45, Krzysztof Kozlowski wrote:
> 	
> 
> External email : Please do not click links or open attachments until you 
> have verified the sender or the content.
> 
> On 18/09/2024 08:49, Macpaul Lin wrote:
>> Convert the mfd: mediatek: mt6397 binding to DT schema format.
>> 
>> MT6323, MT6358, and MT6397 are PMIC devices with multiple function
>> subdevices. They share a common PMIC design but have variations in
>> subdevice combinations.
>> 
>> Key updates in this conversion:
>> 
>> 1. RTC:
>>    - Convert rtc-mt6397.txt and merge into parent MT6397 PMIC DT schema.
>> 
>> 2. Regulators:
>>    - Align to generic name "regulators".
>>    - Update references from .txt to .yaml for mt6323, mt6358, and mt6397
>>      regulators.
>>    - Simplify regulator name labels in device tree examples.
>> 
>> 3. Audio Codec:
>>    - Convert sound/mt6358.txt and merge into parent MT6397 PMIC DT schema.
>>    - Align to generic name "audio-codec" for codec and sound subdevices.
>>    - Add "mediatek,dmic-mode" and "Avdd-supply" properties.
>> 
>> 4. Clocks:
>>    - Align to generic name "clocks" for clockbuffer subdevices.
>> 
>> 5. LEDs:
>>    - Convert leds-mt6323.txt and merge into parent MT6397 PMIC DT schema.
>>    - Update LED binding.
>> 
>> 6. Keys:
>>    - Add detailed descriptions for power and home keys.
>>    - Add compatible: mediatek,mt6358-keys.
>> 
>> 7. Power Controller:
>>    - Convert mt6323-poweroff.txt and merge into parent MT6397 PMIC DT
>>      schema.
>>    - Add #power-domain-cells property to fix dt-binding check error.
>>    - Clarify "BBPU" as "Baseband power up".
>> 
>> 8. Pinctrl:
>>    - Align to generic name "pinctrl" instead of "pin-controller".
>> 
>> 9. Compatible:
>>    - Drop "mediatek,mt6357" since there is a separated DT Schema
>>      for PMIC MT6357.
>> 
>> 10. Examples:
>>    - MT6323: Retain complete examples for this PMIC.
>>    - MT6358 and MT6397: simplify settings in regulators.
>>     - Preserve "audio-codec", "clocks", "pinctrl", "rtc", and "keys"
>>       sections as they contain typical settings for different PMICs.
>> 
>> Additional updates:
>> - MAINTAINERS: Add co-maintainers and reference to
>>   mfd/mediatek,mt6397.yaml for LED and power-controller drivers.
>> - input/mediatek,pmic-keys.yaml: Update reference to
>>   mfd/mediatek,mt6397.yaml.
>> 
>> Signed-off-by: Sen Chu <sen.chu@mediatek.com>
>> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> 
> NAK
> 
> Follow up patch pointed out this is incorrect. I don't understand this
> concept of sending knowingly incorrect code, so please sort it out at v7.
> 
> Best regards,
> Krzysztof
> 

Sorry I didn't know mt6359-codec and mt6358-sound are similar device
until Sept 26 (just yesterday) when I was reviewing the DT
bindings. Until I've found the previous DT Schema of mt6359-codec 
incorrect.
See [1] 
https://lore.kernel.org/linux-arm-kernel/20240926092519.6556-3-macpaul.lin@mediatek.com/T/
and [2] 
https://lore.kernel.org/all/20240926092519.6556-2-macpaul.lin@mediatek.com/

And.. I don't understand, the origin this patch v6 should be a text file
conversion, shouldn't we keep the origin content just a conversion and
trying not to broken other relate modules?

Please help to indicates what is a better approach here:

Should I merge the properties of mt6359-codec, mt6358-sound, and 
mt6397-codec
together and put them all into to mt6359.yaml and redo the converting of 
mfd/medaitek,mt6397.yaml?

That will be much simpler for the audio-codec node for mediatek,mt6397.yaml.
However there will be a little mismatch from the origin text file.

Thanks
Macpaul Lin
Krzysztof Kozlowski Sept. 27, 2024, 12:10 p.m. UTC | #12
On 27/09/2024 12:41, Macpaul Lin wrote:
> 
> 
> On 9/27/24 17:45, Krzysztof Kozlowski wrote:
>> 	
>>
>> External email : Please do not click links or open attachments until you 
>> have verified the sender or the content.
>>
>> On 18/09/2024 08:49, Macpaul Lin wrote:
>>> Convert the mfd: mediatek: mt6397 binding to DT schema format.
>>>
>>> MT6323, MT6358, and MT6397 are PMIC devices with multiple function
>>> subdevices. They share a common PMIC design but have variations in
>>> subdevice combinations.
>>>
>>> Key updates in this conversion:
>>>
>>> 1. RTC:
>>>    - Convert rtc-mt6397.txt and merge into parent MT6397 PMIC DT schema.
>>>
>>> 2. Regulators:
>>>    - Align to generic name "regulators".
>>>    - Update references from .txt to .yaml for mt6323, mt6358, and mt6397
>>>      regulators.
>>>    - Simplify regulator name labels in device tree examples.
>>>
>>> 3. Audio Codec:
>>>    - Convert sound/mt6358.txt and merge into parent MT6397 PMIC DT schema.
>>>    - Align to generic name "audio-codec" for codec and sound subdevices.
>>>    - Add "mediatek,dmic-mode" and "Avdd-supply" properties.
>>>
>>> 4. Clocks:
>>>    - Align to generic name "clocks" for clockbuffer subdevices.
>>>
>>> 5. LEDs:
>>>    - Convert leds-mt6323.txt and merge into parent MT6397 PMIC DT schema.
>>>    - Update LED binding.
>>>
>>> 6. Keys:
>>>    - Add detailed descriptions for power and home keys.
>>>    - Add compatible: mediatek,mt6358-keys.
>>>
>>> 7. Power Controller:
>>>    - Convert mt6323-poweroff.txt and merge into parent MT6397 PMIC DT
>>>      schema.
>>>    - Add #power-domain-cells property to fix dt-binding check error.
>>>    - Clarify "BBPU" as "Baseband power up".
>>>
>>> 8. Pinctrl:
>>>    - Align to generic name "pinctrl" instead of "pin-controller".
>>>
>>> 9. Compatible:
>>>    - Drop "mediatek,mt6357" since there is a separated DT Schema
>>>      for PMIC MT6357.
>>>
>>> 10. Examples:
>>>    - MT6323: Retain complete examples for this PMIC.
>>>    - MT6358 and MT6397: simplify settings in regulators.
>>>     - Preserve "audio-codec", "clocks", "pinctrl", "rtc", and "keys"
>>>       sections as they contain typical settings for different PMICs.
>>>
>>> Additional updates:
>>> - MAINTAINERS: Add co-maintainers and reference to
>>>   mfd/mediatek,mt6397.yaml for LED and power-controller drivers.
>>> - input/mediatek,pmic-keys.yaml: Update reference to
>>>   mfd/mediatek,mt6397.yaml.
>>>
>>> Signed-off-by: Sen Chu <sen.chu@mediatek.com>
>>> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
>>
>> NAK
>>
>> Follow up patch pointed out this is incorrect. I don't understand this
>> concept of sending knowingly incorrect code, so please sort it out at v7.
>>
>> Best regards,
>> Krzysztof
>>
> 
> Sorry I didn't know mt6359-codec and mt6358-sound are similar device
> until Sept 26 (just yesterday) when I was reviewing the DT
> bindings. Until I've found the previous DT Schema of mt6359-codec 
> incorrect.
> See [1] 
> https://lore.kernel.org/linux-arm-kernel/20240926092519.6556-3-macpaul.lin@mediatek.com/T/
> and [2] 
> https://lore.kernel.org/all/20240926092519.6556-2-macpaul.lin@mediatek.com/
> 
> And.. I don't understand, the origin this patch v6 should be a text file
> conversion, shouldn't we keep the origin content just a conversion and
> trying not to broken other relate modules?

The conversion should be correct. Correct means each compatible has a
schema ending with additional/unevaluatedProperties: false.

If you need to change this binding to "true", it means above statement
was not fulfilled. You did not write proper conversion.

... or I do not understand what you wanted to achieve with the other patch.

> 
> Please help to indicates what is a better approach here:
> 
> Should I merge the properties of mt6359-codec, mt6358-sound, and 
> mt6397-codec
> together and put them all into to mt6359.yaml and redo the converting of 
> mfd/medaitek,mt6397.yaml?

Not sure, I don't know. Are these different devices? How are they
related? I expect you to know this, not me.

The problem is that you send a patch having a finished schema for child
node and then - in next patch in different patchset (!!!) - immediately
change it to false.

So the first code, which was not even merged, is incorrect. This is
heavily misleading.

> 
> That will be much simpler for the audio-codec node for mediatek,mt6397.yaml.
> However there will be a little mismatch from the origin text file.
> 
> Thanks
> Macpaul Lin

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml b/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
index 70567d9..466566a 100644
--- a/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
+++ b/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
@@ -19,7 +19,7 @@  description: |
   by the PMIC that is defined as a Multi-Function Device (MFD).
 
   For MediaTek MT6323/MT6397 PMIC bindings see
-  Documentation/devicetree/bindings/mfd/mt6397.txt
+  Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
 
 properties:
   compatible:
diff --git a/Documentation/devicetree/bindings/leds/leds-mt6323.txt b/Documentation/devicetree/bindings/leds/leds-mt6323.txt
deleted file mode 100644
index 052dccb8..0000000
--- a/Documentation/devicetree/bindings/leds/leds-mt6323.txt
+++ /dev/null
@@ -1,63 +0,0 @@ 
-Device Tree Bindings for LED support on MT6323 PMIC
-
-MT6323 LED controller is subfunction provided by MT6323 PMIC, so the LED
-controllers are defined as the subnode of the function node provided by MT6323
-PMIC controller that is being defined as one kind of Muti-Function Device (MFD)
-using shared bus called PMIC wrapper for each subfunction to access remote
-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/mediatek,pwrap.yaml
-
-Required properties:
-- compatible : Must be one of
-  - "mediatek,mt6323-led"
-  - "mediatek,mt6331-led"
-  - "mediatek,mt6332-led"
-- address-cells : Must be 1
-- size-cells : Must be 0
-
-Each led is represented as a child node of the mediatek,mt6323-led that
-describes the initial behavior for each LED physically and currently only four
-LED child nodes can be supported.
-
-Required properties for the LED child node:
-- reg : LED channel number (0..3)
-
-Optional properties for the LED child node:
-- label : See Documentation/devicetree/bindings/leds/common.txt
-- linux,default-trigger : See Documentation/devicetree/bindings/leds/common.txt
-- default-state: See Documentation/devicetree/bindings/leds/common.txt
-
-Example:
-
-	mt6323: pmic {
-		compatible = "mediatek,mt6323";
-
-		...
-
-		mt6323led: leds {
-			compatible = "mediatek,mt6323-led";
-			#address-cells = <1>;
-			#size-cells = <0>;
-
-			led@0 {
-				reg = <0>;
-				label = "LED0";
-				linux,default-trigger = "timer";
-				default-state = "on";
-			};
-			led@1 {
-				reg = <1>;
-				label = "LED1";
-				default-state = "off";
-			};
-			led@2 {
-				reg = <2>;
-				label = "LED2";
-				default-state = "on";
-			};
-		};
-	};
diff --git a/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml b/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
new file mode 100644
index 0000000..953358b
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
@@ -0,0 +1,601 @@ 
+# 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 PMIC
+
+maintainers:
+  - Sen Chu <sen.chu@mediatek.com>
+  - Macpaul Lin <macpaul.lin@mediatek.com>
+
+description: |
+  MT6397/MT6323 is a power management system chip.
+  Please see the sub-modules below for supported features.
+
+  MT6397/MT6323 is a multifunction device with the following sub modules:
+  - Regulators
+  - 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 PMIC is a child device of pwrap.
+  See the following for pwrap node definitions:
+  Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - mediatek,mt6323
+          - mediatek,mt6331 # "mediatek,mt6331" for PMIC MT6331 and MT6332.
+          - mediatek,mt6358
+          - mediatek,mt6359
+          - mediatek,mt6397
+      - items:
+          - enum:
+              - mediatek,mt6366
+          - const: mediatek,mt6358
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  "#interrupt-cells":
+    const: 2
+
+  rtc:
+    type: object
+    $ref: /schemas/rtc/rtc.yaml#
+    unevaluatedProperties: false
+    description:
+      MT6397 Real Time Clock.
+
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6323-rtc
+              - mediatek,mt6331-rtc
+              - mediatek,mt6358-rtc
+              - mediatek,mt6397-rtc
+          - items:
+              - enum:
+                  - mediatek,mt6366-rtc
+              - const: mediatek,mt6358-rtc
+
+    required:
+      - compatible
+
+  regulators:
+    type: object
+    description:
+      List of child nodes that specify the regulators.
+    additionalProperties: true
+
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6323-regulator
+              - mediatek,mt6358-regulator
+              - mediatek,mt6397-regulator
+          - items:
+              - enum:
+                  - mediatek,mt6366-regulator
+              - const: mediatek,mt6358-regulator
+
+    required:
+      - compatible
+
+  audio-codec:
+    type: object
+    additionalProperties: false
+    description:
+      Audio codec support with MT6397 and MT6358.
+
+    properties:
+      compatible:
+        oneOf:
+          - enum:
+              - mediatek,mt6397-codec
+              - mediatek,mt6358-sound
+          - items:
+              - enum:
+                  - mediatek,mt6366-sound
+              - const: mediatek,mt6358-sound
+
+      mediatek,dmic-mode:
+        description: |
+          Indicates how many data pins are used to transmit two channels of PDM
+          signal.
+          0 - two wires;
+          1 - one wire;
+          Default value is 0.
+        enum: [0, 1]
+        default: 0
+
+      Avdd-supply:
+        description: Power source of AVDD.
+
+    required:
+      - compatible
+
+  clocks:
+    type: object
+    additionalProperties: false
+    description:
+      This is a clock buffer node for mt6397. However, there are no sub nodes
+      or any public document exposed in public.
+
+    properties:
+      compatible:
+        const: mediatek,mt6397-clk
+
+      '#clock-cells':
+        const: 1
+
+    required:
+      - compatible
+
+  leds:
+    type: object
+    additionalProperties: false
+    description: |
+      MT6323 LED controller is subfunction provided by MT6323 PMIC, so the LED
+      controllers are defined as the subnode of the function node provided by MT6323
+      PMIC controller that is being defined as one kind of Muti-Function Device (MFD)
+      using shared bus called PMIC wrapper for each subfunction to access remote
+      MT6323 PMIC hardware.
+
+      Each led is represented as a child node of the mediatek,mt6323-led that
+      describes the initial behavior for each LED physically and currently only four
+      LED child nodes can be supported.
+
+    properties:
+      compatible:
+        enum:
+          - mediatek,mt6323-led
+          - mediatek,mt6331-led
+          - mediatek,mt6332-led
+
+      reg:
+        maxItems: 1
+
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+    patternProperties:
+      "^led@[0-3]$":
+        type: object
+        $ref: /schemas/leds/common.yaml#
+        unevaluatedProperties: false
+
+        properties:
+          reg:
+            description:
+              LED channel number (0..3)
+            minimum: 0
+            maximum: 3
+
+        required:
+          - reg
+
+    required:
+      - compatible
+      - "#address-cells"
+      - "#size-cells"
+
+  keys:
+    type: object
+    $ref: /schemas/input/mediatek,pmic-keys.yaml
+    unevaluatedProperties: false
+    description:
+      Power and Home keys.
+
+  power-controller:
+    type: object
+    additionalProperties: false
+    description:
+      The power controller which could be found on PMIC is responsible for
+      externally powering off or on the remote MediaTek SoC through the
+      circuit BBPU (baseband power up).
+
+    properties:
+      compatible:
+        const: mediatek,mt6323-pwrc
+
+      '#power-domain-cells':
+        const: 0
+
+  pinctrl:
+    type: object
+    $ref: /schemas/pinctrl/mediatek,mt65xx-pinctrl.yaml
+    unevaluatedProperties: false
+    description:
+      Pin controller
+
+required:
+  - compatible
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/leds/common.h>
+
+    pmic {
+        compatible = "mediatek,mt6323";
+        interrupt-parent = <&pio>;
+        interrupts = <150 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-controller;
+        #interrupt-cells = <2>;
+
+        leds {
+            compatible = "mediatek,mt6323-led";
+            #address-cells = <1>;
+            #size-cells = <0>;
+        };
+
+        regulators {
+            compatible = "mediatek,mt6323-regulator";
+
+            buck_vproc {
+                regulator-name = "vproc";
+                regulator-min-microvolt = < 700000>;
+                regulator-max-microvolt = <1350000>;
+                regulator-ramp-delay = <12500>;
+                regulator-always-on;
+                regulator-boot-on;
+            };
+
+            buck_vsys {
+                regulator-name = "vsys";
+                regulator-min-microvolt = <1400000>;
+                regulator-max-microvolt = <2987500>;
+                regulator-ramp-delay = <25000>;
+                regulator-always-on;
+                regulator-boot-on;
+            };
+
+            buck_vpa {
+                regulator-name = "vpa";
+                regulator-min-microvolt = < 500000>;
+                regulator-max-microvolt = <3650000>;
+            };
+
+            ldo_vtcxo {
+                regulator-name = "vtcxo";
+                regulator-min-microvolt = <2800000>;
+                regulator-max-microvolt = <2800000>;
+                regulator-enable-ramp-delay = <90>;
+                regulator-always-on;
+                regulator-boot-on;
+            };
+
+            ldo_vcn28 {
+                regulator-name = "vcn28";
+                regulator-min-microvolt = <2800000>;
+                regulator-max-microvolt = <2800000>;
+                regulator-enable-ramp-delay = <185>;
+            };
+
+            ldo_vcn33_bt {
+                regulator-name = "vcn33_bt";
+                regulator-min-microvolt = <3300000>;
+                regulator-max-microvolt = <3600000>;
+                regulator-enable-ramp-delay = <185>;
+            };
+
+            ldo_vcn33_wifi {
+                regulator-name = "vcn33_wifi";
+                regulator-min-microvolt = <3300000>;
+                regulator-max-microvolt = <3600000>;
+                regulator-enable-ramp-delay = <185>;
+            };
+
+            ldo_va {
+                regulator-name = "va";
+                regulator-min-microvolt = <2800000>;
+                regulator-max-microvolt = <2800000>;
+                regulator-enable-ramp-delay = <216>;
+                regulator-always-on;
+                regulator-boot-on;
+            };
+
+            ldo_vcama {
+                regulator-name = "vcama";
+                regulator-min-microvolt = <1500000>;
+                regulator-max-microvolt = <2800000>;
+                regulator-enable-ramp-delay = <216>;
+            };
+
+            ldo_vio28 {
+                regulator-name = "vio28";
+                regulator-min-microvolt = <2800000>;
+                regulator-max-microvolt = <2800000>;
+                regulator-enable-ramp-delay = <216>;
+                regulator-always-on;
+                regulator-boot-on;
+            };
+
+            ldo_vusb {
+                regulator-name = "vusb";
+                regulator-min-microvolt = <3300000>;
+                regulator-max-microvolt = <3300000>;
+                regulator-enable-ramp-delay = <216>;
+                regulator-boot-on;
+            };
+
+            ldo_vmc {
+                regulator-name = "vmc";
+                regulator-min-microvolt = <1800000>;
+                regulator-max-microvolt = <3300000>;
+                regulator-enable-ramp-delay = <36>;
+                regulator-boot-on;
+            };
+
+            ldo_vmch {
+                regulator-name = "vmch";
+                regulator-min-microvolt = <3000000>;
+                regulator-max-microvolt = <3300000>;
+                regulator-enable-ramp-delay = <36>;
+                regulator-boot-on;
+            };
+
+            ldo_vemc3v3 {
+                regulator-name = "vemc3v3";
+                regulator-min-microvolt = <3000000>;
+                regulator-max-microvolt = <3300000>;
+                regulator-enable-ramp-delay = <36>;
+                regulator-boot-on;
+            };
+
+            ldo_vgp1 {
+                regulator-name = "vgp1";
+                regulator-min-microvolt = <1200000>;
+                regulator-max-microvolt = <3300000>;
+                regulator-enable-ramp-delay = <216>;
+            };
+
+            ldo_vgp2 {
+                regulator-name = "vgp2";
+                regulator-min-microvolt = <1200000>;
+                regulator-max-microvolt = <3000000>;
+                regulator-enable-ramp-delay = <216>;
+            };
+
+            ldo_vgp3 {
+                regulator-name = "vgp3";
+                regulator-min-microvolt = <1200000>;
+                regulator-max-microvolt = <1800000>;
+                regulator-enable-ramp-delay = <216>;
+            };
+
+            ldo_vcn18 {
+                regulator-name = "vcn18";
+                regulator-min-microvolt = <1800000>;
+                regulator-max-microvolt = <1800000>;
+                regulator-enable-ramp-delay = <216>;
+            };
+
+            ldo_vsim1 {
+                regulator-name = "vsim1";
+                regulator-min-microvolt = <1800000>;
+                regulator-max-microvolt = <3000000>;
+                regulator-enable-ramp-delay = <216>;
+            };
+
+            ldo_vsim2 {
+                regulator-name = "vsim2";
+                regulator-min-microvolt = <1800000>;
+                regulator-max-microvolt = <3000000>;
+                regulator-enable-ramp-delay = <216>;
+            };
+
+            ldo_vrtc {
+                regulator-name = "vrtc";
+                regulator-min-microvolt = <2800000>;
+                regulator-max-microvolt = <2800000>;
+                regulator-always-on;
+                regulator-boot-on;
+            };
+
+            ldo_vcamaf {
+                regulator-name = "vcamaf";
+                regulator-min-microvolt = <1200000>;
+                regulator-max-microvolt = <3300000>;
+                regulator-enable-ramp-delay = <216>;
+            };
+
+            ldo_vibr {
+                regulator-name = "vibr";
+                regulator-min-microvolt = <1200000>;
+                regulator-max-microvolt = <3300000>;
+                regulator-enable-ramp-delay = <36>;
+            };
+
+            ldo_vrf18 {
+                regulator-name = "vrf18";
+                regulator-min-microvolt = <1825000>;
+                regulator-max-microvolt = <1825000>;
+                regulator-enable-ramp-delay = <187>;
+            };
+
+            ldo_vm {
+                regulator-name = "vm";
+                regulator-min-microvolt = <1200000>;
+                regulator-max-microvolt = <1800000>;
+                regulator-enable-ramp-delay = <216>;
+                regulator-always-on;
+                regulator-boot-on;
+            };
+
+            ldo_vio18 {
+                regulator-name = "vio18";
+                regulator-min-microvolt = <1800000>;
+                regulator-max-microvolt = <1800000>;
+                regulator-enable-ramp-delay = <216>;
+                regulator-always-on;
+                regulator-boot-on;
+            };
+
+           ldo_vcamd {
+                regulator-name = "vcamd";
+                regulator-min-microvolt = <1200000>;
+                regulator-max-microvolt = <1800000>;
+                regulator-enable-ramp-delay = <216>;
+            };
+
+            ldo_vcamio {
+                regulator-name = "vcamio";
+                regulator-min-microvolt = <1800000>;
+                regulator-max-microvolt = <1800000>;
+                regulator-enable-ramp-delay = <216>;
+            };
+        };
+
+        keys {
+            compatible = "mediatek,mt6323-keys";
+            mediatek,long-press-mode = <1>;
+            power-off-time-sec = <0>;
+
+            power {
+                linux,keycodes = <116>;
+                wakeup-source;
+            };
+
+            home {
+                linux,keycodes = <114>;
+            };
+        };
+
+        power-controller {
+            compatible = "mediatek,mt6323-pwrc";
+            #power-domain-cells = <0>;
+        };
+
+        rtc {
+            compatible = "mediatek,mt6323-rtc";
+        };
+    };
+
+  - |
+    #include <dt-bindings/input/input.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    pmic {
+        compatible = "mediatek,mt6358";
+        interrupt-controller;
+        #interrupt-cells = <2>;
+
+        audio-codec {
+            compatible = "mediatek,mt6358-sound";
+            Avdd-supply = <&mt6358_vaud28_reg>;
+            mediatek,dmic-mode = <0>;
+        };
+
+        regulators {
+            compatible = "mediatek,mt6358-regulator";
+
+            buck_vdram1 {
+                regulator-name = "vdram1";
+                regulator-min-microvolt = <500000>;
+                regulator-max-microvolt = <2087500>;
+                regulator-ramp-delay = <12500>;
+                regulator-enable-ramp-delay = <0>;
+                regulator-always-on;
+                regulator-allowed-modes = <0 1>;
+            };
+
+            // ...
+
+            ldo_vsim2 {
+                regulator-name = "vsim2";
+                regulator-min-microvolt = <1700000>;
+                regulator-max-microvolt = <3100000>;
+                regulator-enable-ramp-delay = <540>;
+            };
+        };
+
+        rtc {
+            compatible = "mediatek,mt6358-rtc";
+        };
+
+        keys {
+            compatible = "mediatek,mt6358-keys";
+
+            power {
+                linux,keycodes = <KEY_POWER>;
+                wakeup-source;
+            };
+
+            home {
+                linux,keycodes = <KEY_HOME>;
+            };
+        };
+    };
+
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    pmic {
+        compatible = "mediatek,mt6397";
+
+        interrupt-parent = <&pio>;
+        interrupts-extended = <&pio 222 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-controller;
+        #interrupt-cells = <2>;
+
+        audio-codec {
+            compatible = "mediatek,mt6397-codec";
+        };
+
+        clocks {
+            compatible = "mediatek,mt6397-clk";
+            #clock-cells = <1>;
+        };
+
+        pinctrl {
+            compatible = "mediatek,mt6397-pinctrl";
+            gpio-controller;
+            #gpio-cells = <2>;
+        };
+
+        regulators {
+            compatible = "mediatek,mt6397-regulator";
+
+            buck_vpca15 {
+                regulator-name = "vpca15";
+                regulator-min-microvolt = < 850000>;
+                regulator-max-microvolt = <1350000>;
+                regulator-ramp-delay = <12500>;
+                regulator-enable-ramp-delay = <200>;
+            };
+
+            // ...
+
+            ldo_vibr {
+                regulator-name = "vibr";
+                regulator-min-microvolt = <1200000>;
+                regulator-max-microvolt = <3300000>;
+                regulator-enable-ramp-delay = <218>;
+            };
+        };
+
+        rtc {
+            compatible = "mediatek,mt6397-rtc";
+        };
+    };
diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt
deleted file mode 100644
index 10540aa..0000000
--- a/Documentation/devicetree/bindings/mfd/mt6397.txt
+++ /dev/null
@@ -1,110 +0,0 @@ 
-MediaTek MT6397/MT6323 Multifunction Device Driver
-
-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.
-
-Required properties:
-compatible:
-	"mediatek,mt6323" for PMIC MT6323
-	"mediatek,mt6331" for PMIC MT6331 and MT6332
-	"mediatek,mt6357" for PMIC MT6357
-	"mediatek,mt6358" for PMIC MT6358
-	"mediatek,mt6359" for PMIC MT6359
-	"mediatek,mt6366", "mediatek,mt6358" for PMIC MT6366
-	"mediatek,mt6397" for PMIC MT6397
-
-Optional subnodes:
-
-- rtc
-	Required properties: Should be one of follows
-		- compatible: "mediatek,mt6323-rtc"
-		- compatible: "mediatek,mt6331-rtc"
-		- compatible: "mediatek,mt6358-rtc"
-		- compatible: "mediatek,mt6397-rtc"
-	For details, see ../rtc/rtc-mt6397.txt
-- regulators
-	Required properties:
-		- compatible: "mediatek,mt6323-regulator"
-	see ../regulator/mt6323-regulator.txt
-		- compatible: "mediatek,mt6358-regulator"
-		- compatible: "mediatek,mt6366-regulator", "mediatek-mt6358-regulator"
-	see ../regulator/mt6358-regulator.txt
-		- compatible: "mediatek,mt6397-regulator"
-	see ../regulator/mt6397-regulator.txt
-- codec
-	Required properties:
-		- compatible: "mediatek,mt6397-codec" or "mediatek,mt6358-sound"
-- clk
-	Required properties:
-		- compatible: "mediatek,mt6397-clk"
-- led
-	Required properties:
-		- compatible: "mediatek,mt6323-led"
-	see ../leds/leds-mt6323.txt
-
-- keys
-	Required properties: Should be one of the following
-		- compatible: "mediatek,mt6323-keys"
-		- compatible: "mediatek,mt6331-keys"
-		- compatible: "mediatek,mt6397-keys"
-	see ../input/mtk-pmic-keys.txt
-
-- power-controller
-	Required properties:
-		- compatible: "mediatek,mt6323-pwrc"
-	For details, see ../power/reset/mt6323-poweroff.txt
-
-- pin-controller
-	Required properties:
-		- compatible: "mediatek,mt6397-pinctrl"
-	For details, see ../pinctrl/pinctrl-mt65xx.txt
-
-Example:
-	pwrap: pwrap@1000f000 {
-		compatible = "mediatek,mt8135-pwrap";
-
-		...
-
-		pmic {
-			compatible = "mediatek,mt6397";
-
-			codec: mt6397codec {
-				compatible = "mediatek,mt6397-codec";
-			};
-
-			regulators {
-				compatible = "mediatek,mt6397-regulator";
-
-				mt6397_vpca15_reg: buck_vpca15 {
-					regulator-compatible = "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-compatible = "ldo_vgp4";
-					regulator-name = "vgp4";
-					regulator-min-microvolt = <1200000>;
-					regulator-max-microvolt = <3300000>;
-					regulator-enable-ramp-delay = <218>;
-				};
-			};
-		};
-	};
diff --git a/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt b/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
deleted file mode 100644
index 933f0c4..0000000
--- a/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
+++ /dev/null
@@ -1,20 +0,0 @@ 
-Device Tree Bindings for Power Controller on MediaTek PMIC
-
-The power controller which could be found on PMIC is responsible for externally
-powering off or on the remote MediaTek SoC through the circuit BBPU.
-
-Required properties:
-- compatible: Should be one of follows
-       "mediatek,mt6323-pwrc": for MT6323 PMIC
-
-Example:
-
-       pmic {
-               compatible = "mediatek,mt6323";
-
-               ...
-
-               power-controller {
-                       compatible = "mediatek,mt6323-pwrc";
-               };
-       }
diff --git a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt b/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
deleted file mode 100644
index 7212076..0000000
--- a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
+++ /dev/null
@@ -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";
-               };
-       };
diff --git a/Documentation/devicetree/bindings/sound/mt6358.txt b/Documentation/devicetree/bindings/sound/mt6358.txt
deleted file mode 100644
index fbe9e55..0000000
--- a/Documentation/devicetree/bindings/sound/mt6358.txt
+++ /dev/null
@@ -1,26 +0,0 @@ 
-Mediatek MT6358 Audio Codec
-
-The communication between MT6358 and SoC is through Mediatek PMIC wrapper.
-For more detail, please visit Mediatek PMIC wrapper documentation.
-
-Must be a child node of PMIC wrapper.
-
-Required properties:
-
-- compatible - "string" - One of:
-    "mediatek,mt6358-sound"
-    "mediatek,mt6366-sound"
-- Avdd-supply : power source of AVDD
-
-Optional properties:
-- mediatek,dmic-mode : Indicates how many data pins are used to transmit two
-	channels of PDM signal. 0 means two wires, 1 means one wire. Default
-	value is 0.
-
-Example:
-
-mt6358_snd {
-	compatible = "mediatek,mt6358-sound";
-	Avdd-supply = <&mt6358_vaud28_reg>;
-	mediatek,dmic-mode = <0>;
-};
diff --git a/MAINTAINERS b/MAINTAINERS
index 2cdd7ca..e97b5ae 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14418,10 +14418,12 @@  F:	Documentation/devicetree/bindings/net/bluetooth/mediatek,mt7921s-bluetooth.ya
 F:	drivers/bluetooth/btmtkuart.c
 
 MEDIATEK BOARD LEVEL SHUTDOWN DRIVERS
+M:	Sen Chu <sen.chu@mediatek.com>
 M:	Sean Wang <sean.wang@mediatek.com>
+M:	Macpaul Lin <macpaul.lin@mediatek.com>
 L:	linux-pm@vger.kernel.org
 S:	Maintained
-F:	Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
+F:	Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
 F:	drivers/power/reset/mt6323-poweroff.c
 
 MEDIATEK CIR DRIVER
@@ -14582,9 +14584,11 @@  F:	Documentation/devicetree/bindings/mtd/mediatek,mtk-nfc.yaml
 F:	drivers/mtd/nand/raw/mtk_*
 
 MEDIATEK PMIC LED DRIVER
+M:	Sen Chu <sen.chu@mediatek.com>
 M:	Sean Wang <sean.wang@mediatek.com>
+M:	Macpaul Lin <macpaul.lin@mediatek.com>
 S:	Maintained
-F:	Documentation/devicetree/bindings/leds/leds-mt6323.txt
+F:	Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
 F:	drivers/leds/leds-mt6323.c
 
 MEDIATEK RANDOM NUMBER GENERATOR SUPPORT