mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "robh@kernel.org" <robh@kernel.org>,
	"justinstitt@google.com" <justinstitt@google.com>,
	"Ming-Fan Chen (陳明汎)" <Ming-Fan.Chen@mediatek.com>,
	"Kyrie Wu (吴晗)" <Kyrie.Wu@mediatek.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"nathan@kernel.org" <nathan@kernel.org>,
	"bmasney+clk@redhat.com" <bmasney+clk@redhat.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"jbrunet+clk@baylibre.com" <jbrunet+clk@baylibre.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"morbo@google.com" <morbo@google.com>,
	"ndesaulniers@google.com" <ndesaulniers@google.com>,
	"Echo Zhang (张玉)" <Echo.Zhang@mediatek.com>,
	"llvm@lists.linux.dev" <llvm@lists.linux.dev>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"sboyd@kernel.org" <sboyd@kernel.org>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>
Subject: Re: [PATCH 2/7] dt-bindings: soc: mediatek: add MMDVFS binding
Date: Fri, 27 Nov 2026 03:05:44 +0000	[thread overview]
Message-ID: <0703deede7465178938807befe1052435d6a84a8.camel@mediatek.com> (raw)
In-Reply-To: <20261125060037.649659-3-echo.zhang@mediatek.com>

On Wed, 2026-11-25 at 14:00 +0800, Echo Zhang wrote:
> Describe the MMDVFS clock provider and its connection to VCP firmware
> in a common binding. Document the optional MMUP shared memory and IPI
> settings used by the firmware backend.
> 
> Add an MT8196 binding for the HWCCF syscon and seven mux OPP tables so
> the driver can map clock rate requests to hardware votes.
> 
> Signed-off-by: Echo Zhang <echo.zhang@mediatek.com>
> ---
>  .../soc/mediatek/mediatek,mmdvfs.yaml         | 60 +++++++++++++
>  .../soc/mediatek/mediatek,mt8196-mmdvfs.yaml  | 87 +++++++++++++++++++
>  2 files changed, 147 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,mmdvfs.yaml
>  create mode 100644 Documentation/devicetree/bindings/soc/mediatek/mediatek,mt8196-mmdvfs.yaml
> 
> diff --git a/Documentation/devicetree/bindings/soc/mediatek/mediatek,mmdvfs.yaml b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mmdvfs.yaml
> new file mode 100644
> index 000000000000..d65f4c9084cc
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mmdvfs.yaml
> @@ -0,0 +1,60 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: https://urldefense.com/v3/__http://devicetree.org/schemas/soc/mediatek/mediatek,mmdvfs.yaml*__;Iw!!CTRNKA9wMg0ARbw!isihfBOwIoaDSdB1zhyrxCZ-VyW6Xx26VWQ952_ym7I2h8Qv1o93cYHjzS38gjQP5xMHEhFXelooj1kKt-h5$ 
> +$schema: https://urldefense.com/v3/__http://devicetree.org/meta-schemas/core.yaml*__;Iw!!CTRNKA9wMg0ARbw!isihfBOwIoaDSdB1zhyrxCZ-VyW6Xx26VWQ952_ym7I2h8Qv1o93cYHjzS38gjQP5xMHEhFXelooj_iUTxPB$ 
> +
> +title: MediaTek Multimedia Dynamic Voltage and Frequency Scaling (MMDVFS)
> +
> +maintainers:
> +  - MediaTek MMDVFS Team <linux-mediatek@lists.infradead.org>
> +
> +description:
> +  MediaTek MMDVFS provides dynamic voltage and frequency scaling for multimedia
> +  hardware accelerators. The controller exposes virtual clocks that multimedia
> +  consumers use through the common clock framework. The driver aggregates
> +  consumer rate requests and sends the resulting DVFS votes to the multimedia
> +  hardware voter and VCP firmware.
> +
> +select: false
> +
> +properties:
> +  mediatek,vcp:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description:
> +      Phandle to the MediaTek VCP remote processor used for MMDVFS shared
> +      memory, feature registration, notifier, and IPI operations.
> +
> +  mediatek,mmup-sram:
> +    type: boolean
> +    description:
> +      Use the MMUP SRAM window for MMDVFS callback records and status data.
> +
> +  mediatek,mmup-enable:
> +    type: boolean
> +    description:
> +      Enable the MMUP path for MMDVFS shared memory and IPI handling.
> +
> +  mediatek,vcp-ipi-id:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description:
> +      VCP IPI channel id for MMDVFS. If omitted, the driver uses the platform
> +      default.
> +
> +  mediatek,mmup-ipi-id:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description:
> +      MMUP IPI channel id for MMDVFS. If omitted, the driver uses the platform
> +      default.
> +
> +  "#clock-cells":
> +    const: 1
> +    description:
> +      MMDVFS clock specifier. Consumers pass an SoC-specific MMDVFS clock
> +      index.
> +
> +required:
> +  - mediatek,vcp
> +  - "#clock-cells"
> +
> +additionalProperties: true
> diff --git a/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt8196-mmdvfs.yaml b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt8196-mmdvfs.yaml
> new file mode 100644
> index 000000000000..13381c78dbd1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/mediatek/mediatek,mt8196-mmdvfs.yaml
> @@ -0,0 +1,87 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: https://urldefense.com/v3/__http://devicetree.org/schemas/soc/mediatek/mediatek,mt8196-mmdvfs.yaml*__;Iw!!CTRNKA9wMg0ARbw!isihfBOwIoaDSdB1zhyrxCZ-VyW6Xx26VWQ952_ym7I2h8Qv1o93cYHjzS38gjQP5xMHEhFXelooj21Z8DCD$ 
> +$schema: https://urldefense.com/v3/__http://devicetree.org/meta-schemas/core.yaml*__;Iw!!CTRNKA9wMg0ARbw!isihfBOwIoaDSdB1zhyrxCZ-VyW6Xx26VWQ952_ym7I2h8Qv1o93cYHjzS38gjQP5xMHEhFXelooj_iUTxPB$ 
> +
> +title: MediaTek MT8196 Multimedia Dynamic Voltage and Frequency Scaling
> +
> +maintainers:
> +  - MediaTek MMDVFS Team <linux-mediatek@lists.infradead.org>
> +
> +allOf:
> +  - $ref: mediatek,mmdvfs.yaml#
> +
> +select:
> +  properties:
> +    compatible:
> +      contains:
> +        enum:
> +          - mediatek,mt8196-mmdvfs
> +  required:
> +    - compatible
> +
> +properties:
> +  compatible:
> +    enum:
> +      - mediatek,mt8196-mmdvfs
> +
> +  mediatek,hwccf:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description:
> +      Phandle to the MT8196 multimedia hardware clock control fabric syscon
> +      used for AP-side hardware votes.
> +
> +  mediatek,mux-opp-tables:
> +    $ref: /schemas/types.yaml#/definitions/phandle-array
> +    minItems: 7
> +    maxItems: 7
> +    description: |
> +      OPP tables for the seven MT8196 MMDVFS muxes, in this order:
> +      display, MDP, SMI, VENC, VDEC, IMG, CAM. MDP and MML share
> +      the MDP mux. Each OPP entry must have opp-hz and opp-level.
> +
> +required:
> +  - compatible
> +  - mediatek,hwccf
> +  - mediatek,mux-opp-tables
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/clock/mediatek,mt8196-mmdvfs.h>
> +
> +    soc {
> +        #address-cells = <2>;
> +        #size-cells = <2>;
> +
> +        vcp: remoteproc@31800000 {
> +            compatible = "mediatek,mt8196-vcp";
> +            reg = <0 0x31800000 0 0x100000>;
> +        };
> +
> +        mm_hwv: syscon@31b00000 {
> +            compatible = "mediatek,mt8196-mm-hwv", "syscon";
> +            reg = <0 0x31b00000 0 0x6000>;
> +        };
> +
> +        mmdvfs_opp: opp-table {
> +            compatible = "operating-points-v2";
> +            opp-0 {
> +                opp-hz = /bits/ 64 <100000000>;
> +                opp-level = <0>;
> +            };
> +        };
> +
> +        mmdvfs: mmdvfs-mux {
> +            compatible = "mediatek,mt8196-mmdvfs";
> +            mediatek,vcp = <&vcp>;
> +            mediatek,hwccf = <&mm_hwv>;
> +            mediatek,mux-opp-tables = <&mmdvfs_opp>, <&mmdvfs_opp>,
> +                                      <&mmdvfs_opp>, <&mmdvfs_opp>,
> +                                      <&mmdvfs_opp>, <&mmdvfs_opp>,
> +                                      <&mmdvfs_opp>;
> +            #clock-cells = <1>;
> +        };
> +    };

Your case is similar to Qualcomm sm8250[1] which a power domain works as performance controller.

So the suggested solution is:

In include/dt-bindings/power/mediatek,mt8196-mmdvfs.h:

/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
#ifndef _DT_BINDINGS_POWER_MEDIATEK_MT8196_MMDVFS_H
#define _DT_BINDINGS_POWER_MEDIATEK_MT8196_MMDVFS_H
 
#define MT8196_MMDVFS_DISP 0       /* ck2_disp_sel */
#define MT8196_MMDVFS_MDP 1       /* ck2_mdp_sel, shared by MDP and MML */
#define MT8196_MMDVFS_SMI   2       /* ck2_mminfra_sel */
#define MT8196_MMDVFS_VENC        3       /* ck2_venc_sel */
#define MT8196_MMDVFS_VDEC        4       /* ck2_vdec_sel */
#define MT8196_MMDVFS_IMG  5       /* ck2_img1_sel */
#define MT8196_MMDVFS_CAM 6       /* ck2_cam_sel */
 
#endif
 
In device tree:

#include <dt-bindings/power/mediatek,mt8196-mmdvfs.h>
 
mm_hwv: syscon@31b00000 {
          compatible = "mediatek,mt8196-mm-hwv", "syscon", "simple-mfd";
          reg = <0 0x31b00000 0 0x6000>;
 
          mmdvfs: performance-controller {
                   compatible = "mediatek,mt8196-mmdvfs";
                   #power-domain-cells = <1>;
                   mediatek,vcp = <&vcp>;
                   /* index order must match mediatek,mt8196-mmdvfs.h */
                   operating-points-v2 = <&mmdvfs_disp_opp>, <&mmdvfs_mdp_opp>,
                                            <&mmdvfs_smi_opp>, <&mmdvfs_venc_opp>,
                                            <&mmdvfs_vdec_opp>, <&mmdvfs_img_opp>,
                                            <&mmdvfs_cam_opp>;
          };
};
 
/* label = HW level, opp-level = HW level + 1 */
mmdvfs_venc_opp: opp-table-mmdvfs-venc {
          compatible = "operating-points-v2";
          mmdvfs_venc_lv0: opp-1 { opp-level = <1>; };
          mmdvfs_venc_lv1: opp-2 { opp-level = <2>; };
          mmdvfs_venc_lv2: opp-3 { opp-level = <3>; };
          mmdvfs_venc_lv3: opp-4 { opp-level = <4>; };
          mmdvfs_venc_lv4: opp-5 { opp-level = <5>; };
          mmdvfs_venc_lv5: opp-6 { opp-level = <6>; };
          mmdvfs_venc_lv6: opp-7 { opp-level = <7>; };
};
/* mmdvfs_disp_opp / mmdvfs_mdp_opp: 5 levels (opp-level 1..5)
* mmdvfs_smi_opp:                   7 levels (1..7)
* mmdvfs_vdec_opp / img / cam:      6 levels (1..6)            */
 
 
 
venc: video-codec@38020000 {
          compatible = "mediatek,mt8196-vcodec-enc";
          reg = <0 0x38020000 0 0x6000>;
          ...
          clocks = <&venc_gcon_clk CLK_VEN1_CKE1_VENC>;      /* only real gates */
          clock-names = "venc";
          power-domains = <&hfrpsys_hwv MT8196_POWER_DOMAIN_VEN0>,
                             <&mmdvfs MT8196_MMDVFS_VENC>;
          power-domain-names = "mtcmos", "perf";
          operating-points-v2 = <&venc_opp_table>;
 
          venc_opp_table: opp-table {
                   compatible = "operating-points-v2";
                   opp-250000000 {
                             opp-hz = /bits/ 64 <250000000>;
                             required-opps = <&mmdvfs_venc_lv0>;
                   };
                   opp-312000000 {
                             opp-hz = /bits/ 64 <312000000>;
                             required-opps = <&mmdvfs_venc_lv2>;
                   };
                   opp-458000000 {
                             opp-hz = /bits/ 64 <458000000>;
                             required-opps = <&mmdvfs_venc_lv3>;
                   };
                   opp-624000000 {
                             opp-hz = /bits/ 64 <624000000>;
                             required-opps = <&mmdvfs_venc_lv4>;
                   };
                   opp-832000000 {
                             opp-hz = /bits/ 64 <832000000>;
                             required-opps = <&mmdvfs_venc_lv5>;
                   };
          };
};


[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/qcom/sm8250.dtsi?h=v7.4-rc4#n4326

Regards,
CK



  parent reply	other threads:[~2026-11-27  3:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  6:00 [PATCH 0/7] soc: mediatek: add MMDVFS support for MT8196 Echo Zhang
2026-11-25  6:00 ` [PATCH 1/7] dt-bindings: clock: mediatek: add MT8196 MMDVFS clock IDs Echo Zhang
2026-11-25 10:55   ` Krzysztof Kozlowski
2026-11-25  6:00 ` [PATCH 2/7] dt-bindings: soc: mediatek: add MMDVFS binding Echo Zhang
2026-11-25  8:32   ` Roman Vivchar
2026-11-25 10:58   ` Krzysztof Kozlowski
2026-11-25 11:58   ` Krzysztof Kozlowski
2026-11-27  3:05   ` CK Hu (胡俊光) [this message]
2026-11-25  6:00 ` [PATCH 3/7] soc: mediatek: add MMDVFS core driver Echo Zhang
2026-11-25  8:35   ` Roman Vivchar
2026-11-25 10:54   ` Krzysztof Kozlowski
2026-11-25  6:00 ` [PATCH 4/7] soc: mediatek: mmdvfs: add VCP backend Echo Zhang
2026-11-25  8:38   ` Roman Vivchar
2026-11-25 10:59   ` Krzysztof Kozlowski
2026-11-25 11:00   ` Krzysztof Kozlowski
2026-11-25 14:32   ` Ben Grisdale
2026-11-27  2:58     ` Echo Zhang (张玉)
2026-11-25  6:00 ` [PATCH 5/7] soc: mediatek: mmdvfs: add MT8196 support Echo Zhang
2026-11-25  6:00 ` [PATCH 6/7] soc: mediatek: mmdvfs: add read-only status debug Echo Zhang
2026-11-25  6:00 ` [PATCH 7/7] MAINTAINERS: add MediaTek MMDVFS entry Echo Zhang
2026-11-26  9:13 [PATCH 2/7] dt-bindings: soc: mediatek: add MMDVFS binding Echo Zhang (张玉)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0703deede7465178938807befe1052435d6a84a8.camel@mediatek.com \
    --to=ck.hu@mediatek.com \
    --cc=Echo.Zhang@mediatek.com \
    --cc=Kyrie.Wu@mediatek.com \
    --cc=Ming-Fan.Chen@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bmasney+clk@redhat.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jbrunet+clk@baylibre.com \
    --cc=justinstitt@google.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=matthias.bgg@gmail.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®