Skip to contentSkip to conversation

Add MT8196 VMM driver support

PATCH NAK Nancy.Lin 4 participants 11 messages May 22, 2025 – May 28, 2025

Subsystems (3)
lore
Share & tools
lore

Nancy.Lin

author
#0 lore raw

cover Add MT8196 VMM driver support

From: Nancy Lin <[email protected]>

Add a driver for the MediaTek MT8196 VMM (Vcore for MultiMedia) controller.

Nancy Lin (2):
dt-bindings: regulator: mediatek: Add MT8196 vmm controller
soc: mediatek: Add MT8196 VMM driver support

 .../mediatek,mt8196-vmm-regulator.yaml        |  70 +++
 drivers/soc/mediatek/Kconfig                  |  12 +
 drivers/soc/mediatek/Makefile                 |   1 +
 drivers/soc/mediatek/mtk-vmm-drv.c            | 471 ++++++++++++++++++
 4 files changed, 554 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml
 create mode 100644 drivers/soc/mediatek/mtk-vmm-drv.c
Signature · 1 line
2.45.2
author
#1 lore raw

PATCH 1/2 dt-bindings: regulator: mediatek: Add MT8196 vmm controller

From: Nancy Lin <[email protected]>

Add a device tree binding document for the MediaTek MT8196 VMM (Vcore for MultiMedia) regulator controller. The VMM controller acts as the main power supplier for multimedia power domains, such as those used by display, video encode and decode subsystems. It provides virtual regulators that serve as the power sources for various multimedia IPs, and coordinates with the hardware common clock framework (hwccf) and the Video Companion Processor (VCP) to manage the power domains of these components. The regulator is controlled by the VCP firmware, and the operating system signals its requirement through a voting hardware block (hwccf).

---
 .../mediatek,mt8196-vmm-regulator.yaml        | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml
Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml new file +70 -0
new file mode 100644
index 000000000000..a50e35c2e238
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/regulator/mediatek,mt8196-vmm-regulator.yaml#"
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT8196 VMM (Vcore for MultiMedia) Regulator Controller
+
+maintainers:
+  - Nancy Lin <[email protected]>
+
+description: |
+  The MediaTek MT8196 VMM (Vcore for Multi Media) controller acts as the
+  main power supplier for multimedia power domains, such as those used by
+  display, video encode and decode subsystems. The VMM hardware block
+  provides virtual regulators that serve as the power sources (suppliers)
+  for various multimedia IPs. It coordinates with the MediaTek hardware
+  common clock framework (HWCCF) and the Video Companion Processor (VCP)
+  to manage the power domains of these multimedia components.
+
+  Each child node under the VMM node represents a virtual regulator
+  (e.g., vdisp, vdec-vcore) and must specify a 'regulator-name'.
+
+properties:
+  compatible:
+    const: "mediatek,mt8196-vmm"
+
+  mediatek,hw-ccf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the hardware common clock framework syscon controller.
+
+  mediatek,vcp:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the Video Co-Processor (VCP) node.
+
+patternProperties:
+  "^(vdisp|vdec-vcore)$":
+    type: object
+    description: |
+      Virtual regulator for a specific multimedia domain.
+      The node name should match the supported regulator (e.g., vdisp, vdec-vcore).
+    properties:
+      regulator-name:
+        type: string
+        description: The name of the virtual regulator.
+    required:
+      - regulator-name
+    additionalProperties: false
+
+required:
+  - compatible
+  - mediatek,hw-ccf
+  - mediatek,vcp
+
+additionalProperties: false
+
+examples:
+  - |
+    vmm: vmm {
+      compatible = "mediatek,mt8196-vmm";
+      mediatek,hw-ccf = <&mm_hwv>;
+      mediatek,vcp = <&vcp>;
+
+      vdisp: vdisp {
+        regulator-name = "vdisp";
+      };
+      vdec_vcore: vdec-vcore {
+        regulator-name = "vdec-vcore";
+      };
+    };
Signature · 1 line
2.45.2
#2 lore raw

Re: [PATCH 1/2] dt-bindings: regulator: mediatek: Add MT8196 vmm controller

Quoted 7 lines · Nancy.Lin

From: Nancy Lin <[email protected]>

Add a device tree binding document for the MediaTek MT8196 VMM (Vcore for MultiMedia) regulator controller. The VMM controller acts as the main power supplier for multimedia power domains, such as those used by display, video encode and decode subsystems. It provides virtual regulators that serve as the power sources for various multimedia IPs,

Virtual regulators do not sound real, so feels like you want some sort of power domains?

A nit, subject: drop second/last, redundant "bindings". The "dt-bindings" prefix is already stating that these are bindings. See also:
https://elixir.bootlin.com/linux/v6.7-rc8/source/Documentation/devicetree/bindings/submitting-patches.rst#L18

Quoted 34 lines

and coordinates with the hardware common clock framework (hwccf) and the Video Companion Processor (VCP) to manage the power domains of these components. The regulator is controlled by the VCP firmware, and the operating system signals its requirement through a voting hardware block (hwccf).

---
 .../mediatek,mt8196-vmm-regulator.yaml        | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml
Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml new file +16 -0
new file mode 100644
index 000000000000..a50e35c2e238
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/regulator/mediatek,mt8196-vmm-regulator.yaml#"
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT8196 VMM (Vcore for MultiMedia) Regulator Controller
+
+maintainers:
+  - Nancy Lin <[email protected]>
+
+description: |
+  The MediaTek MT8196 VMM (Vcore for Multi Media) controller acts as the
+  main power supplier for multimedia power domains, such as those used by
+  display, video encode and decode subsystems. The VMM hardware block
+  provides virtual regulators that serve as the power sources (suppliers)

Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml line 26

Quoted 10 lines
Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml new file +10 -0
+  for various multimedia IPs. It coordinates with the MediaTek hardware
+  common clock framework (HWCCF) and the Video Companion Processor (VCP)
+  to manage the power domains of these multimedia components.
+
+  Each child node under the VMM node represents a virtual regulator
+  (e.g., vdisp, vdec-vcore) and must specify a 'regulator-name'.
+
+properties:
+  compatible:
+    const: "mediatek,mt8196-vmm"

Not tested...

Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml line 30

Quoted 4 lines
Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml new file +4 -0
+
+  mediatek,hw-ccf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the hardware common clock framework syscon controller.

No, you cannot express clocks with syscon.

Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml line 34

Quoted 4 lines
Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml new file +4 -0
+
+  mediatek,vcp:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the Video Co-Processor (VCP) node.

For what purpose?

Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml line 37

Quoted 3 lines
Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml new file +3 -0
+
+patternProperties:
+  "^(vdisp|vdec-vcore)$":

Redundant nodes, useless. Drop these completely.

Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml line 43

Quoted 6 lines
Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml new file +6 -0
+    type: object
+    description: |
+      Virtual regulator for a specific multimedia domain.
+      The node name should match the supported regulator (e.g., vdisp, vdec-vcore).
+    properties:
+      regulator-name:

No, you cannot start redefining properties. This binding is nowhere close to hardware description. Looks like some copy-paste downstream driver, so binding to fulfill driver needs.

Please rework to match hardware. I suggest reaching internally to get some help how upstream drivers and bindings look like *prior* sending downstream code.

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH 1/2] dt-bindings: regulator: mediatek: Add MT8196 vmm controller

Quoted 9 lines · Krzysztof Kozlowski
Quoted 7 lines · Nancy.Lin

From: Nancy Lin <[email protected]>

Add a device tree binding document for the MediaTek MT8196 VMM (Vcore for MultiMedia) regulator controller. The VMM controller acts as the main power supplier for multimedia power domains, such as those used by display, video encode and decode subsystems. It provides virtual regulators that serve as the power sources for various multimedia IPs,

Quoted 7 lines

Virtual regulators do not sound real, so feels like you want some sort of power domains?

A nit, subject: drop second/last, redundant "bindings". The "dt-bindings" prefix is already stating that these are bindings. See also:
https://elixir.bootlin.com/linux/v6.7-rc8/source/Documentation/devicetree/bindings/submitting-patches.rst#L18

Wrong keyword... Please fix the subject prefixes:

For bindings, the preferred subjects are explained here:
https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH 1/2] dt-bindings: regulator: mediatek: Add MT8196 vmm controller

In reply to Krzysztof Kozlowski

Hi Krzysztof,

Thanks for your review.

Quoted 18 lines · Krzysztof Kozlowski

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

Quoted 11 lines · Nancy.Lin

From: Nancy Lin <[email protected]>

Add a device tree binding document for the MediaTek MT8196 VMM (Vcore
for MultiMedia) regulator controller. The VMM controller acts as the
main power supplier for multimedia power domains, such as those used
by display, video encode and decode subsystems. It provides virtual regulators that serve as the power sources for various multimedia IPs,

Quoted 4 lines

Virtual regulators do not sound real, so feels like you want some sort
of power domains?

This regulator supplies power to the power domain. Before the power domain can be powered up, the MediaTek PM driver first enables the regulator that the power domain relies on, and then powers up the domain. While "virtual" might not be the best term, it accurately describes a regulator used to control the power switch.

Ultimately, the VCP (uP) handles the on/off control of the regulator. Therefore, we encapsulate it as a standard regulator in the kernel.

The internal control of the VMM regulator is as follows:
kernel HWCCF VCP (uP)

|--------------|      |--------------|   irq    |---------------------|
| VMM reglator | ---> | hardware     |  ----->  | get buck on/off irq |
|              |      | voter        |          | and then turn on/off|
|              |      |              |          | buck                |
|--------------|      |--------------|          |---------------------|

When the regulator needs to be turned on or off, it uses the voter provided by hwccf to cast a vote for on/off. The VCP then receives the corresponding IRQ for the regulator and performs the buck on/off accordingly.

Quoted 5 lines

A nit, subject: drop second/last, redundant "bindings". The "dt-bindings" prefix is already stating that these are bindings. See also:
https://urldefense.com/v3/__https://elixir.bootlin.com/linux/v6.7-rc8/source/Documentation/devicetree/bindings/submitting-patches.rst*L18__;Iw!!CTRNKA9wMg0ARbw!lBqtzZ8DmC6f2kNnLXRCpHsof7XOYvrIMG4o_DXuvjYbg1SyFRrXrtEMLjIxS31cq82hqQowrczWRg$

OK, I will remove the binding/document word in commit message body. And change title to
regulator: dt-bindings: Add MT8196 vmm controller

Quoted 60 lines
Quoted 60 lines

and coordinates with the hardware common clock framework (hwccf) and
the Video Companion Processor (VCP) to manage the power domains of these components. The regulator is controlled by the VCP firmware, and the operating system signals its requirement through a voting hardware block (hwccf).

---
 .../mediatek,mt8196-vmm-regulator.yaml        | 70
+++++++++++++++++++

 1 file changed, 70 insertions(+)

 create mode 100644 Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm- regulator.yaml

diff --git a/Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm- regulator.yaml b/Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm- regulator.yaml
new file mode 100644
index 000000000000..a50e35c2e238

Documentation/devicetree/bindings/regulator/mediatek,mt8196- new file +0 -0

vmm-regulator.yaml

Documentation/devicetree/bindings/regulator/mediatek,mt8196- new file +4 -0
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id:

"https://urldefense.com/v3/__http://devicetree.org/schemas/regulato r/mediatek,mt8196-vmm- regulator.yaml*__;Iw!!CTRNKA9wMg0ARbw!lBqtzZ8DmC6f2kNnLXRCpHsof7XOY vrIMG4o_DXuvjYbg1SyFRrXrtEMLjIxS31cq82hqQrOgUATjA$ " +$schema:
https://urldefense.com/v3/__http://devicetree.org/meta-schemas/core.yaml*__;Iw!!CTRNKA9wMg0ARbw!lBqtzZ8DmC6f2kNnLXRCpHsof7XOYvrIMG4o_DXuvjYbg1SyFRrXrtEMLjIxS31cq82hqQr4UitgLg$

Documentation/devicetree/bindings/regulator/mediatek,mt8196- new file +2 -0
+
+title: MediaTek MT8196 VMM (Vcore for MultiMedia) Regulator

Controller

Documentation/devicetree/bindings/regulator/mediatek,mt8196- new file +6 -0
+
+maintainers:
+  - Nancy Lin <[email protected]>
+
+description: |
+  The MediaTek MT8196 VMM (Vcore for Multi Media) controller acts

as the
+  main power supplier for multimedia power domains, such as those used by
+  display, video encode and decode subsystems. The VMM hardware block
+  provides virtual regulators that serve as the power sources (suppliers)
+  for various multimedia IPs. It coordinates with the MediaTek hardware
+  common clock framework (HWCCF) and the Video Companion Processor (VCP)
+  to manage the power domains of these multimedia components. +
+  Each child node under the VMM node represents a virtual

Quoted 9 lines

Documentation/devicetree/bindings/regulator/mediatek,mt8196-

Quoted 6 lines

regulator
+  (e.g., vdisp, vdec-vcore) and must specify a 'regulator-name'.

Documentation/devicetree/bindings/regulator/mediatek,mt8196- new file +4 -0
+
+properties:
+  compatible:
+    const: "mediatek,mt8196-vmm"

Not tested...

My bad, I accidentally added extra quotation marks, but I ran dt_binding_check and didn't see this error being detected.

Quoted 8 lines
Quoted 5 lines

+
+  mediatek,hw-ccf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the hardware common clock framework syscon controller.

No, you cannot express clocks with syscon.

HWCCF is MediaTek's internal naming; the functionality of the hardware IP is voter. We use the IP to vote for buck on/off, and the VCP will get the voting result to perform buck on/off. I will refine the naming/description to "voter."

Quoted 7 lines
Quoted 4 lines

+
+  mediatek,vcp:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the Video Co-Processor (VCP) node.

For what purpose?

This is used to ensure that the VCP uP is ready to receive the hwccf IRQ and handle the corresponding buck on/off operations.

Quoted 6 lines

Documentation/devicetree/bindings/regulator/mediatek,mt8196-

Quoted 3 lines
Documentation/devicetree/bindings/regulator/mediatek,mt8196- new file +3 -0
+
+patternProperties:
+  "^(vdisp|vdec-vcore)$":

Redundant nodes, useless. Drop these completely.

OK.

Quoted 9 lines
Quoted 8 lines

+    type: object
+    description: |
+      Virtual regulator for a specific multimedia domain. +      The node name should match the supported regulator (e.g., vdisp, vdec-vcore).
+    properties:
+      regulator-name:

Quoted 8 lines

No, you cannot start redefining properties. This binding is nowhere close to hardware description. Looks like some copy-paste downstream driver, so binding to fulfill driver needs.

Please rework to match hardware. I suggest reaching internally to get some help how upstream drivers and bindings look like *prior* sending downstream code.

I will review and refine the binding internally before submitting it. Thanks!

Best regards,
Nancy

Quoted 2 lines

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH 1/2] dt-bindings: regulator: mediatek: Add MT8196 vmm controller

Quoted 22 lines · Nancy Lin (林欣螢)
Quoted 5 lines

Virtual regulators do not sound real, so feels like you want some sort
of power domains?

This regulator supplies power to the power domain. Before the power domain can be powered up, the MediaTek PM driver first enables the regulator that the power domain relies on, and then powers up the domain. While "virtual" might not be the best term, it accurately describes a regulator used to control the power switch.

Ultimately, the VCP (uP) handles the on/off control of the regulator. Therefore, we encapsulate it as a standard regulator in the kernel.

The internal control of the VMM regulator is as follows:
kernel HWCCF VCP (uP)

|--------------|      |--------------|   irq    |---------------------|
| VMM reglator | ---> | hardware     |  ----->  | get buck on/off irq |
|              |      | voter        |          | and then turn on/off|
|              |      |              |          | buck                |
|--------------|      |--------------|          |---------------------|
Quoted 4 lines

When the regulator needs to be turned on or off, it uses the voter provided by hwccf to cast a vote for on/off. The VCP then receives the corresponding IRQ for the regulator and performs the buck on/off accordingly.

OK, thanks for explanation.

Quoted 1 line

...

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

+
+  mediatek,hw-ccf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the hardware common clock framework syscon controller.

Quoted 6 lines
Quoted 2 lines

No, you cannot express clocks with syscon.

HWCCF is MediaTek's internal naming; the functionality of the hardware IP is voter. We use the IP to vote for buck on/off, and the VCP will get the voting result to perform buck on/off. I will refine the naming/description to "voter."

OK, that was a bit confusing, but now I have more questions:

Why isn't this a child of the HWCCF? You do not have here any resources, so this looks just to instantiate device for Linux.

Looking at your diagram earlier (maybe include it in binding description if this stays as is at the end) I would imagine phandle only to hwccf. But you have two phandles - HWCCF and VCP.

So maybe this is part of VCP device, not HWCCF? I don't know. I am afraid the moment I will suggest you something someone from Collabora will be pointing out that my advice us wrong and I don't know this hardware. Yeah, I don't know it. You should know it.

Quoted 11 lines
Quoted 8 lines
Quoted 5 lines

+
+  mediatek,vcp:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the Video Co-Processor (VCP) node.

For what purpose?

This is used to ensure that the VCP uP is ready to receive the hwccf IRQ and handle the corresponding buck on/off operations.

Quoted 7 lines
Quoted 6 lines

Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml line 37

Quoted 3 lines
Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml new file +3 -0
+
+patternProperties:
+  "^(vdisp|vdec-vcore)$":

Redundant nodes, useless. Drop these completely.

OK.

Best regards,
Krzysztof

#6 lore raw

Re: [PATCH 1/2] dt-bindings: regulator: mediatek: Add MT8196 vmm controller

In reply to Nancy.Lin
Quoted 13 lines · Nancy.Lin

From: Nancy Lin <[email protected]>

Add a device tree binding document for the MediaTek MT8196 VMM (Vcore for MultiMedia) regulator controller. The VMM controller acts as the main power supplier for multimedia power domains, such as those used by display, video encode and decode subsystems. It provides virtual regulators that serve as the power sources for various multimedia IPs, and coordinates with the hardware common clock framework (hwccf) and the Video Companion Processor (VCP) to manage the power domains of these components. The regulator is controlled by the VCP firmware, and the operating system signals its requirement through a voting hardware block (hwccf).

Quoted 6 lines
---
 .../mediatek,mt8196-vmm-regulator.yaml        | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml

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

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml: patternProperties:^(vdisp|vdec-vcore)$:properties:regulator-name:type: 'string' is not one of ['boolean', 'object']
from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.example.dtb: vmm (mediatek,mt8196-vmm): vdisp:regulator-name: ['vdisp'] is not of type 'string'
from schema $id: http://devicetree.org/schemas/regulator/mediatek,mt8196-vmm-regulator.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.example.dtb: vmm (mediatek,mt8196-vmm): vdec-vcore:regulator-name: ['vdec-vcore'] is not of type 'string'
from schema $id: http://devicetree.org/schemas/regulator/mediatek,mt8196-vmm-regulator.yaml#

doc reference errors (make refcheckdocs):

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

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

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

pip3 install dtschema --upgrade

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

#7 lore raw

Re: [PATCH 1/2] dt-bindings: regulator: mediatek: Add MT8196 vmm controller

In reply to Nancy.Lin
Quoted 85 lines · Nancy.Lin

From: Nancy Lin <[email protected]>

Add a device tree binding document for the MediaTek MT8196 VMM (Vcore for MultiMedia) regulator controller. The VMM controller acts as the main power supplier for multimedia power domains, such as those used by display, video encode and decode subsystems. It provides virtual regulators that serve as the power sources for various multimedia IPs, and coordinates with the hardware common clock framework (hwccf) and the Video Companion Processor (VCP) to manage the power domains of these components. The regulator is controlled by the VCP firmware, and the operating system signals its requirement through a voting hardware block (hwccf).

---
 .../mediatek,mt8196-vmm-regulator.yaml        | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml
Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml new file +60 -0
new file mode 100644
index 000000000000..a50e35c2e238
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "https://urldefense.com/v3/__http://devicetree.org/schemas/regulator/mediatek,mt8196-vmm-regulator.yaml*__;Iw!!CTRNKA9wMg0ARbw!gawATNOT3u6UBtTwtgnoZggwdwVL3VBuFZQyf-baV8j1wUMIV1sIaqBvhcqtfnZSlmXFesengtZaYxCWtDo$ "
+$schema: https://urldefense.com/v3/__http://devicetree.org/meta-schemas/core.yaml*__;Iw!!CTRNKA9wMg0ARbw!gawATNOT3u6UBtTwtgnoZggwdwVL3VBuFZQyf-baV8j1wUMIV1sIaqBvhcqtfnZSlmXFesengtZaLcnGLmw$ 
+
+title: MediaTek MT8196 VMM (Vcore for MultiMedia) Regulator Controller
+
+maintainers:
+  - Nancy Lin <[email protected]>
+
+description: |
+  The MediaTek MT8196 VMM (Vcore for Multi Media) controller acts as the
+  main power supplier for multimedia power domains, such as those used by
+  display, video encode and decode subsystems. The VMM hardware block
+  provides virtual regulators that serve as the power sources (suppliers)
+  for various multimedia IPs. It coordinates with the MediaTek hardware
+  common clock framework (HWCCF) and the Video Companion Processor (VCP)
+  to manage the power domains of these multimedia components.
+
+  Each child node under the VMM node represents a virtual regulator
+  (e.g., vdisp, vdec-vcore) and must specify a 'regulator-name'.
+
+properties:
+  compatible:
+    const: "mediatek,mt8196-vmm"
+
+  mediatek,hw-ccf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the hardware common clock framework syscon controller.
+
+  mediatek,vcp:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the Video Co-Processor (VCP) node.
+
+patternProperties:
+  "^(vdisp|vdec-vcore)$":
+    type: object
+    description: |
+      Virtual regulator for a specific multimedia domain.
+      The node name should match the supported regulator (e.g., vdisp, vdec-vcore).
+    properties:
+      regulator-name:
+        type: string
+        description: The name of the virtual regulator.
+    required:
+      - regulator-name
+    additionalProperties: false
+
+required:
+  - compatible
+  - mediatek,hw-ccf
+  - mediatek,vcp
+
+additionalProperties: false
+
+examples:
+  - |
+    vmm: vmm {
+      compatible = "mediatek,mt8196-vmm";

Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml line 70

Quoted 10 lines
Documentation/devicetree/bindings/regulator/mediatek,mt8196-vmm-regulator.yaml new file +10 -0
+      mediatek,hw-ccf = <&mm_hwv>;
+      mediatek,vcp = <&vcp>;
+
+      vdisp: vdisp {
+        regulator-name = "vdisp";
+      };
+      vdec_vcore: vdec-vcore {
+        regulator-name = "vdec-vcore";
+      };
+    };

device tree is used to describe real hardware.
vmm is a virtual device which is used for software to integrate the related driver, so it should not have this virtual device.
According to your description, vcp is the master to control regulator, so I think the device tree would be

vcp {
	regulator-name = "vdisp", "vdec-vcore";
};

And vcp driver control these regulator.

I'm not sure what does hw-ccf do, if it's also controlled by vcp, the node should be

vcp {
	mediatek,hw-ccf = <&mm_hwv>;
	regulator-name = "vdisp", "vdec-vcore";
};

Regards,
CK

author
#8 lore raw

PATCH 2/2 soc: mediatek: Add MT8196 VMM driver support

In reply to Nancy.Lin

From: Nancy Lin <[email protected]>

Add a driver for the MediaTek MT8196 VMM (Vcore for MultiMedia) controller, which acts as the main power supplier for multimedia power domains such as display, video encode, and video decode on MediaTek SoCs.

The VMM controller provides virtual regulators for multimedia IPs and coordinates with the hardware common clock framework (hwccf) and the Video Companioin Processor (VCP) to manage power domains. The driver uses a hardware voter through HWCCF to notify the VCP to turn on or off VMM-related bucks.

---
 drivers/soc/mediatek/Kconfig       |  12 +
 drivers/soc/mediatek/Makefile      |   1 +
 drivers/soc/mediatek/mtk-vmm-drv.c | 471 +++++++++++++++++++++++++++++
 3 files changed, 484 insertions(+)
 create mode 100644 drivers/soc/mediatek/mtk-vmm-drv.c
drivers/soc/mediatek/Kconfig +12 -0
index d7293977f06e..4db4a0876083 100644
@@ -69,6 +69,18 @@ config MTK_MMSYS
 	  Say yes here to add support for the MediaTek Multimedia
 	  Subsystem (MMSYS).
 
+config MTK_VMM
+	tristate "MediaTek VMM driver"
+	help
+	  Say Y here to enable support for the MediaTek VMM (Vcore for
+	  MultiMedia) controller, which acts as the main power supplier
+	  for multimedia power domains such as display, video encode and
+	  decode on MediaTek SoCs. The VMM controller provides virtual
+	  regulators for multimedia IPs and coordinates with the hardware
+	  common clock framework (hwccf) and the Video Companion Processor
+	  (VCP) to manage power domains. The VMM driver uses hardware voter
+	  through hwccf to notify VCP to turn on/off VMM-related bucks.
+
 config MTK_SVS
 	tristate "MediaTek Smart Voltage Scaling(SVS)"
 	depends on NVMEM_MTK_EFUSE && NVMEM
drivers/soc/mediatek/Makefile +1 -0
index 0665573e3c4b..2b2071614ac4 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o
 obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o
 obj-$(CONFIG_MTK_REGULATOR_COUPLER) += mtk-regulator-coupler.o
 obj-$(CONFIG_MTK_MMSYS) += mtk-mmsys.o
+obj-$(CONFIG_MTK_VMM) += mtk-vmm-drv.o
 obj-$(CONFIG_MTK_MMSYS) += mtk-mutex.o
 obj-$(CONFIG_MTK_SVS) += mtk-svs.o
 obj-$(CONFIG_MTK_SOCINFO) += mtk-socinfo.o
drivers/soc/mediatek/mtk-vmm-drv.c new file +471 -0

471 lines not on this page · raw message

Signature · 1 line
2.45.2
#9 lore raw

Re: [PATCH 2/2] soc: mediatek: Add MT8196 VMM driver support

Quoted 70 lines · Nancy.Lin

From: Nancy Lin <[email protected]>

Add a driver for the MediaTek MT8196 VMM (Vcore for MultiMedia) controller, which acts as the main power supplier for multimedia power domains such as display, video encode, and video decode on MediaTek SoCs.

The VMM controller provides virtual regulators for multimedia IPs and coordinates with the hardware common clock framework (hwccf) and the Video Companioin Processor (VCP) to manage power domains. The driver uses a hardware voter through HWCCF to notify the VCP to turn on or off VMM-related bucks.

---
 drivers/soc/mediatek/Kconfig       |  12 +
 drivers/soc/mediatek/Makefile      |   1 +
 drivers/soc/mediatek/mtk-vmm-drv.c | 471 +++++++++++++++++++++++++++++
 3 files changed, 484 insertions(+)
 create mode 100644 drivers/soc/mediatek/mtk-vmm-drv.c
drivers/soc/mediatek/Kconfig +12 -0
index d7293977f06e..4db4a0876083 100644
@@ -69,6 +69,18 @@ config MTK_MMSYS
 	  Say yes here to add support for the MediaTek Multimedia
 	  Subsystem (MMSYS).
 
+config MTK_VMM
+	tristate "MediaTek VMM driver"
+	help
+	  Say Y here to enable support for the MediaTek VMM (Vcore for
+	  MultiMedia) controller, which acts as the main power supplier
+	  for multimedia power domains such as display, video encode and
+	  decode on MediaTek SoCs. The VMM controller provides virtual
+	  regulators for multimedia IPs and coordinates with the hardware
+	  common clock framework (hwccf) and the Video Companion Processor
+	  (VCP) to manage power domains. The VMM driver uses hardware voter
+	  through hwccf to notify VCP to turn on/off VMM-related bucks.
+
 config MTK_SVS
 	tristate "MediaTek Smart Voltage Scaling(SVS)"
 	depends on NVMEM_MTK_EFUSE && NVMEM
drivers/soc/mediatek/Makefile +1 -0
index 0665573e3c4b..2b2071614ac4 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o
 obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o
 obj-$(CONFIG_MTK_REGULATOR_COUPLER) += mtk-regulator-coupler.o
 obj-$(CONFIG_MTK_MMSYS) += mtk-mmsys.o
+obj-$(CONFIG_MTK_VMM) += mtk-vmm-drv.o
 obj-$(CONFIG_MTK_MMSYS) += mtk-mutex.o
 obj-$(CONFIG_MTK_SVS) += mtk-svs.o
 obj-$(CONFIG_MTK_SOCINFO) += mtk-socinfo.o
drivers/soc/mediatek/mtk-vmm-drv.c new file +9 -0
new file mode 100644
index 000000000000..de4ceb7d59fa
@@ -0,0 +1,471 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (c) 2025 MediaTek Inc.
+ * Author: Yunfei Dong <[email protected]>
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/device.h>

drivers/soc/mediatek/mtk-vmm-drv.c line 19

Quoted 10 lines
drivers/soc/mediatek/mtk-vmm-drv.c new file +10 -0
+#include <linux/kthread.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/pm_domain.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/regulator/driver.h>
+#if IS_ENABLED(CONFIG_MTK_VCP_RPROC)

And that's the proof you send some sort of downstream code.

This does not exist.

drivers/soc/mediatek/mtk-vmm-drv.c line 25

Quoted 6 lines
drivers/soc/mediatek/mtk-vmm-drv.c new file +6 -0
+#include <linux/remoteproc.h>
+#include <linux/remoteproc/mtk_vcp_public.h>
+#endif
+
+#define mtk_vmm_dbg(dev, fmt, args...) \
+	dev_dbg(dev, "[vmm] %s(%d): " fmt "\n", __func__, __LINE__, ##args)

No, you do not get your own debug code.

NAK.

This is nowhere close to upstream code. Don't send us downstream patterns please.

Best regards,
Krzysztof

#10 lore raw

Re: [PATCH 2/2] soc: mediatek: Add MT8196 VMM driver support

Hi Krzysztof,

Thanks for your review.

Quoted 106 lines · Krzysztof Kozlowski

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

Quoted 87 lines · Nancy.Lin

From: Nancy Lin <[email protected]>

Add a driver for the MediaTek MT8196 VMM (Vcore for MultiMedia) controller, which acts as the main power supplier for multimedia power
domains such as display, video encode, and video decode on MediaTek SoCs.

The VMM controller provides virtual regulators for multimedia IPs and
coordinates with the hardware common clock framework (hwccf) and the
Video Companioin Processor (VCP) to manage power domains. The driver
uses a hardware voter through HWCCF to notify the VCP to turn on or off VMM-related bucks.

---
 drivers/soc/mediatek/Kconfig       |  12 +
 drivers/soc/mediatek/Makefile      |   1 +
 drivers/soc/mediatek/mtk-vmm-drv.c | 471
+++++++++++++++++++++++++++++

 3 files changed, 484 insertions(+)

 create mode 100644 drivers/soc/mediatek/mtk-vmm-drv.c

drivers/soc/mediatek/Kconfig +0 -0
index d7293977f06e..4db4a0876083 100644
@@ -69,6 +69,18 @@ config MTK_MMSYS

        Say yes here to add support for the MediaTek Multimedia Subsystem (MMSYS).

+config MTK_VMM
+     tristate "MediaTek VMM driver"
+     help
+       Say Y here to enable support for the MediaTek VMM (Vcore for
+       MultiMedia) controller, which acts as the main power supplier
+       for multimedia power domains such as display, video encode and
+       decode on MediaTek SoCs. The VMM controller provides virtual
+       regulators for multimedia IPs and coordinates with the hardware
+       common clock framework (hwccf) and the Video Companion Processor
+       (VCP) to manage power domains. The VMM driver uses hardware voter
+       through hwccf to notify VCP to turn on/off VMM-related bucks.
+
 config MTK_SVS
      tristate "MediaTek Smart Voltage Scaling(SVS)" depends on NVMEM_MTK_EFUSE && NVMEM

drivers/soc/mediatek/Makefile +0 -0
index 0665573e3c4b..2b2071614ac4 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o

 obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o obj-$(CONFIG_MTK_REGULATOR_COUPLER) += mtk-regulator-coupler.o obj-$(CONFIG_MTK_MMSYS) += mtk-mmsys.o +obj-$(CONFIG_MTK_VMM) += mtk-vmm-drv.o obj-$(CONFIG_MTK_MMSYS) += mtk-mutex.o obj-$(CONFIG_MTK_SVS) += mtk-svs.o obj-$(CONFIG_MTK_SOCINFO) += mtk-socinfo.o

drivers/soc/mediatek/mtk-vmm-drv.c new file +9 -0
new file mode 100644
index 000000000000..de4ceb7d59fa
@@ -0,0 +1,471 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (c) 2025 MediaTek Inc.
+ * Author: Yunfei Dong <[email protected]>
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/device.h>

drivers/soc/mediatek/mtk-vmm-drv.c line 19

Quoted 10 lines
drivers/soc/mediatek/mtk-vmm-drv.c new file +10 -0
+#include <linux/kthread.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/pm_domain.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/regulator/driver.h>
+#if IS_ENABLED(CONFIG_MTK_VCP_RPROC)

And that's the proof you send some sort of downstream code.

Quoted 2 lines

This does not exist.

Sorry, I forgot add reference patch. This patch is based on [1].

[1] Add vcp driver
https://patchwork.kernel.org/project/linux-mediatek/list/?series=949232

Quoted 10 lines
Quoted 7 lines
drivers/soc/mediatek/mtk-vmm-drv.c new file +6 -0
+#include <linux/remoteproc.h>
+#include <linux/remoteproc/mtk_vcp_public.h>
+#endif
+
+#define mtk_vmm_dbg(dev, fmt, args...) \
+     dev_dbg(dev, "[vmm] %s(%d): " fmt "\n", __func__, __LINE__,

##args)

No, you do not get your own debug code.

Quoted 5 lines

NAK.

This is nowhere close to upstream code. Don't send us downstream patterns please.

OK, I will remove own debug code and refine it. Thanks!

Best regards,
Nancy

Quoted 2 lines

Best regards,
Krzysztof