public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] powervr: MT8173 GPU support
@ 2026-03-25  7:19 Chen-Yu Tsai
  2026-03-25  7:19 ` [PATCH v2 1/5] dt-bindings: clock: mediatek: Add mt8173 mfgtop Chen-Yu Tsai
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: Chen-Yu Tsai @ 2026-03-25  7:19 UTC (permalink / raw)
  To: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: Icenowy Zheng, Icenowy Zheng, Chen-Yu Tsai, David Airlie,
	Simona Vetter, linux-clk, devicetree, linux-mediatek, dri-devel,
	linux-arm-kernel, linux-kernel

Hi everyone,

This is v2 of my MT8173 PowerVR GPU support series.

Changes since v1:
- Adapted to changed DT bindings
- Dropped driver change
- Use same power domain for "a" and "b" GPU power domains

This update was requested by Icenowy.


This series enables the PowerVR GPU found in the MT8173 SoC, found in
some Chromebooks.

This version is different from the initial powervr driver submission [1]
in that it splits out the GPU glue layer support out of the powervr
driver and into a separate clock and power domain driver. The glue code
is otherwise the same, and also the same as found in the ChromeOS
kernels, with some extra comments and macro names added where possible.

Patch 1 adds a binding for the glue layer, called mfgtop. The glue layer
contains clock and power controls for the GPU.

Patch 2 adds a driver for the glue layer.

Patch 3 adds an entry for the MT8173 GPU and 6XT series to the PowerVR
binding.

Patch 4 adds an entry for the PowerVR 6XT series GPU to the driver.

Patch 5 corrects the clock for the GPU (called MFG) power domain.

Patch 6 adds device nodes for the GPU and glue layer to the MT8173 dtsi
file.

Patch 2 and 6 depend on patch 1 to build. I suppose some common
immutable tree would be needed from the MediaTek maintainers.

The kernel driver successfully probes the hardware and loads the
"rogue_4.40.2.51_v1.fw" firmware provided by Imagination Technologies [2].
Userspace was tested with Mesa 24.0.8 from Debian Trixie rebuilt with
the powervr vulkan driver enabled. `vulkaninfo` gives some information
about the GPU (attached at the end), but running the `triangle` example
from the Sascha Willems demos [3] with -DUSE_D2D_WSI=ON as recommended [4]
failed with:

    Can't find a display and a display mode!

Same program worked correctly on a BeaglePlay and displayed a color
gradient triangle. Not sure what went wrong here.

Anyway, please have a look and test.


Thanks
ChenYu

[1] https://lore.kernel.org/dri-devel/20220815165156.118212-2-sarah.walker@imgtec.com/
[2] https://gitlab.freedesktop.org/imagination/linux-firmware/-/tree/powervr
[3] https://github.com/SaschaWillems/Vulkan
[4] https://lore.kernel.org/dri-devel/f2b2671e-5acc-4dec-9c2e-3c9cd2e1f19e@imgtec.com/

Chen-Yu Tsai (5):
  dt-bindings: clock: mediatek: Add mt8173 mfgtop
  clk: mediatek: Add mt8173-mfgtop driver
  dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU
  arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock
  arm64: dts: mediatek: mt8173: Add GPU device nodes

 .../clock/mediatek,mt8173-mfgtop.yaml         |  70 +++++
 .../bindings/gpu/img,powervr-rogue.yaml       |   1 +
 arch/arm64/boot/dts/mediatek/mt8173.dtsi      |  33 ++-
 drivers/clk/mediatek/Kconfig                  |   9 +
 drivers/clk/mediatek/Makefile                 |   1 +
 drivers/clk/mediatek/clk-mt8173-mfgtop.c      | 243 ++++++++++++++++++
 include/dt-bindings/clock/mt8173-clk.h        |   7 +
 7 files changed, 363 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml
 create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c

-- 
2.53.0.1018.g2bb0e51243-goog



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v2 1/5] dt-bindings: clock: mediatek: Add mt8173 mfgtop
  2026-03-25  7:19 [PATCH v2 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
@ 2026-03-25  7:19 ` Chen-Yu Tsai
  2026-03-25  7:19 ` [PATCH v2 2/5] clk: mediatek: Add mt8173-mfgtop driver Chen-Yu Tsai
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: Chen-Yu Tsai @ 2026-03-25  7:19 UTC (permalink / raw)
  To: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: Icenowy Zheng, Icenowy Zheng, Chen-Yu Tsai, David Airlie,
	Simona Vetter, linux-clk, devicetree, linux-mediatek, dri-devel,
	linux-arm-kernel, linux-kernel, Conor Dooley

The MFG (GPU) block on the MT8173 has a small glue layer, named MFG_TOP
in the datasheet, that contains clock gates, some power sequence signal
delays, and other unknown registers that get toggled when the GPU is
powered on.

The clock gates are exposed as clocks provided by a clock controller,
while the power sequencing bits are exposed as one singular power domain.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
---
Changes since v1:
- Dropped minItems for clocks
- Dropped label in example
---
 .../clock/mediatek,mt8173-mfgtop.yaml         | 70 +++++++++++++++++++
 include/dt-bindings/clock/mt8173-clk.h        |  7 ++
 2 files changed, 77 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml

diff --git a/Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml b/Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml
new file mode 100644
index 000000000000..03db1ee9e594
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+
+$id: http://devicetree.org/schemas/clock/mediatek,mt8173-mfgtop.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT8173 MFG TOP controller
+
+maintainers:
+  - AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+
+description:
+  The MFG TOP glue layer controls various signals going to the MFG (GPU)
+  block on the MT8173.
+
+properties:
+  compatible:
+    const: mediatek,mt8173-mfgtop
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 4
+
+  clock-names:
+    items:
+      - const: sys
+      - const: mem
+      - const: core
+      - const: clk26m
+
+  power-domains:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 1
+
+  '#power-domain-cells':
+    const: 0
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - power-domains
+  - '#clock-cells'
+  - '#power-domain-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+        #include <dt-bindings/clock/mt8173-clk.h>
+        #include <dt-bindings/power/mt8173-power.h>
+
+        clock-controller@13fff000 {
+            compatible = "mediatek,mt8173-mfgtop";
+            reg = <0x13fff000 0x1000>;
+            clocks = <&topckgen CLK_TOP_AXI_MFG_IN_SEL>,
+                     <&topckgen CLK_TOP_MEM_MFG_IN_SEL>,
+                     <&topckgen CLK_TOP_MFG_SEL>,
+                     <&clk26m>;
+            clock-names = "sys", "mem", "core", "clk26m";
+            power-domains = <&spm MT8173_POWER_DOMAIN_MFG>;
+            #clock-cells = <1>;
+            #power-domain-cells = <0>;
+        };
diff --git a/include/dt-bindings/clock/mt8173-clk.h b/include/dt-bindings/clock/mt8173-clk.h
index 3d00c98b9654..89e982f771db 100644
--- a/include/dt-bindings/clock/mt8173-clk.h
+++ b/include/dt-bindings/clock/mt8173-clk.h
@@ -243,6 +243,13 @@
 #define CLK_IMG_FD			7
 #define CLK_IMG_NR_CLK			8
 
+/* MFG_SYS */
+
+#define CLK_MFG_AXI			0
+#define CLK_MFG_MEM			1
+#define CLK_MFG_G3D			2
+#define CLK_MFG_26M			3
+
 /* MM_SYS */
 
 #define CLK_MM_SMI_COMMON		1
-- 
2.53.0.1018.g2bb0e51243-goog



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 2/5] clk: mediatek: Add mt8173-mfgtop driver
  2026-03-25  7:19 [PATCH v2 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
  2026-03-25  7:19 ` [PATCH v2 1/5] dt-bindings: clock: mediatek: Add mt8173 mfgtop Chen-Yu Tsai
@ 2026-03-25  7:19 ` Chen-Yu Tsai
  2026-03-25 14:26   ` Brian Masney
                     ` (2 more replies)
  2026-03-25  7:19 ` [PATCH v2 3/5] dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU Chen-Yu Tsai
                   ` (3 subsequent siblings)
  5 siblings, 3 replies; 17+ messages in thread
From: Chen-Yu Tsai @ 2026-03-25  7:19 UTC (permalink / raw)
  To: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: Icenowy Zheng, Icenowy Zheng, Chen-Yu Tsai, David Airlie,
	Simona Vetter, linux-clk, devicetree, linux-mediatek, dri-devel,
	linux-arm-kernel, linux-kernel

The MFG (GPU) block on the MT8173 has a small glue layer, named MFG_TOP
in the datasheet, that contains clock gates, some power sequence signal
delays, and other unknown registers that get toggled when the GPU is
powered on.

The clock gates are exposed as clocks provided by a clock controller,
while the power sequencing bits are exposed as one singular power domain.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
Changes since v1:
- Reduce tab after GATE_MFG() by one tab
- Move of_match_clk_mt8173_mfgtop to just before clk_mt8173_mfgtop_drv
- Rename power domain to "mfg-top"
- Add FORCE_ABORT and ACTIVE_PWRCTL_EN bits and explicitly clear
  ACTIVE_PWRCTL_EN bit
---
 drivers/clk/mediatek/Kconfig             |   9 +
 drivers/clk/mediatek/Makefile            |   1 +
 drivers/clk/mediatek/clk-mt8173-mfgtop.c | 243 +++++++++++++++++++++++
 3 files changed, 253 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c

diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
index 2c09fd729bab..8dbd9f14be62 100644
--- a/drivers/clk/mediatek/Kconfig
+++ b/drivers/clk/mediatek/Kconfig
@@ -537,6 +537,15 @@ config COMMON_CLK_MT8173_IMGSYS
 	help
 	  This driver supports MediaTek MT8173 imgsys clocks.
 
+config COMMON_CLK_MT8173_MFGTOP
+	tristate "Clock and power driver for MediaTek MT8173 mfgtop"
+	depends on COMMON_CLK_MT8173
+	default COMMON_CLK_MT8173
+	select PM_GENERIC_DOMAINS
+	select PM_GENERIC_DOMAINS_OF
+	help
+	  This driver supports MediaTek MT8173 mfgtop clocks and power domain.
+
 config COMMON_CLK_MT8173_MMSYS
        tristate "Clock driver for MediaTek MT8173 mmsys"
        depends on COMMON_CLK_MT8173
diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
index d8736a060dbd..892a54eeb281 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -82,6 +82,7 @@ obj-$(CONFIG_COMMON_CLK_MT8167_VDECSYS) += clk-mt8167-vdec.o
 obj-$(CONFIG_COMMON_CLK_MT8173) += clk-mt8173-apmixedsys.o clk-mt8173-infracfg.o \
 				   clk-mt8173-pericfg.o clk-mt8173-topckgen.o
 obj-$(CONFIG_COMMON_CLK_MT8173_IMGSYS) += clk-mt8173-img.o
+obj-$(CONFIG_COMMON_CLK_MT8173_MFGTOP) += clk-mt8173-mfgtop.o
 obj-$(CONFIG_COMMON_CLK_MT8173_MMSYS) += clk-mt8173-mm.o
 obj-$(CONFIG_COMMON_CLK_MT8173_VDECSYS) += clk-mt8173-vdecsys.o
 obj-$(CONFIG_COMMON_CLK_MT8173_VENCSYS) += clk-mt8173-vencsys.o
diff --git a/drivers/clk/mediatek/clk-mt8173-mfgtop.c b/drivers/clk/mediatek/clk-mt8173-mfgtop.c
new file mode 100644
index 000000000000..9e18f34166ae
--- /dev/null
+++ b/drivers/clk/mediatek/clk-mt8173-mfgtop.c
@@ -0,0 +1,243 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2024 Google LLC
+ * Author: Chen-Yu Tsai <wenst@chromium.org>
+ *
+ * Based on driver in downstream ChromeOS v5.15 kernel.
+ *
+ * Copyright (c) 2014 MediaTek Inc.
+ * Author: Chiawen Lee <chiawen.lee@mediatek.com>
+ */
+
+#include <dt-bindings/clock/mt8173-clk.h>
+
+#include <linux/bitfield.h>
+#include <linux/clk.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/pm_domain.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+
+#include "clk-gate.h"
+#include "clk-mtk.h"
+
+static const struct mtk_gate_regs mfg_cg_regs = {
+	.sta_ofs = 0x0000,
+	.clr_ofs = 0x0008,
+	.set_ofs = 0x0004,
+};
+
+#define GATE_MFG(_id, _name, _parent, _shift, _flags)	\
+	GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr, _flags)
+
+/* TODO: The block actually has dividers for the core and mem clocks. */
+static const struct mtk_gate mfg_clks[] = {
+	GATE_MFG(CLK_MFG_AXI, "mfg_axi", "axi_mfg_in_sel", 0, CLK_SET_RATE_PARENT),
+	GATE_MFG(CLK_MFG_MEM, "mfg_mem", "mem_mfg_in_sel", 1, CLK_SET_RATE_PARENT),
+	GATE_MFG(CLK_MFG_G3D, "mfg_g3d", "mfg_sel", 2, CLK_SET_RATE_PARENT),
+	GATE_MFG(CLK_MFG_26M, "mfg_26m", "clk26m", 3, 0),
+};
+
+static const struct mtk_clk_desc mfg_desc = {
+	.clks = mfg_clks,
+	.num_clks = ARRAY_SIZE(mfg_clks),
+};
+
+struct mt8173_mfgtop_data {
+	struct clk_hw_onecell_data *clk_data;
+	struct regmap *regmap;
+	struct generic_pm_domain genpd;
+	struct of_phandle_args parent_pd, child_pd;
+	struct clk *clk_26m;
+};
+
+/* Delay count in clock cycles */
+#define MFG_ACTIVE_POWER_CON0	0x24
+ #define RST_B_DELAY_CNT	GENMASK(7, 0)	/* pwr_rst_b de-assert delay during power-up */
+ #define CLK_EN_DELAY_CNT	GENMASK(15, 8)	/* CLK_DIS deassert delay during power-up */
+ #define CLK_DIS_DELAY_CNT	GENMASK(23, 16)	/* CLK_DIS assert delay during power-down */
+ #define FORCE_ABORT		BIT(30)		/* write 1 to force abort a power event */
+ #define ACTIVE_PWRCTL_EN	BIT(31)		/* enable ACTIVE_POWER */
+
+#define MFG_ACTIVE_POWER_CON1	0x28
+ #define PWR_ON_S_DELAY_CNT	GENMASK(7, 0)	/* pwr_on_s assert delay during power-up */
+ #define ISO_DELAY_CNT		GENMASK(15, 8)	/* ISO assert delay during power-down */
+ #define ISOOFF_DELAY_CNT	GENMASK(23, 16)	/* ISO de-assert delay during power-up */
+ #define RST__DELAY_CNT		GENMASK(31, 24) /* pwr_rsb_b assert delay during power-down */
+
+static int clk_mt8173_mfgtop_power_on(struct generic_pm_domain *domain)
+{
+	struct mt8173_mfgtop_data *data = container_of(domain, struct mt8173_mfgtop_data, genpd);
+
+	/* drives internal power management */
+	clk_prepare_enable(data->clk_26m);
+
+	/* Power on/off delays for various signals */
+	regmap_write(data->regmap, MFG_ACTIVE_POWER_CON0,
+		     FIELD_PREP(RST_B_DELAY_CNT, 77) |
+		     FIELD_PREP(CLK_EN_DELAY_CNT, 61) |
+		     FIELD_PREP(CLK_DIS_DELAY_CNT, 60) |
+		     FIELD_PREP(ACTIVE_PWRCTL_EN, 0));
+	regmap_write(data->regmap, MFG_ACTIVE_POWER_CON1,
+		     FIELD_PREP(PWR_ON_S_DELAY_CNT, 11) |
+		     FIELD_PREP(ISO_DELAY_CNT, 68) |
+		     FIELD_PREP(ISOOFF_DELAY_CNT, 69) |
+		     FIELD_PREP(RST__DELAY_CNT, 77));
+
+	/* Magic numbers related to core switch sequence and delays */
+	regmap_write(data->regmap, 0xe0, 0x7a710184);
+	regmap_write(data->regmap, 0xe4, 0x835f6856);
+	regmap_write(data->regmap, 0xe8, 0x002b0234);
+	regmap_write(data->regmap, 0xec, 0x80000000);
+	regmap_write(data->regmap, 0xa0, 0x08000000);
+
+	return 0;
+}
+
+static int clk_mt8173_mfgtop_power_off(struct generic_pm_domain *domain)
+{
+	struct mt8173_mfgtop_data *data = container_of(domain, struct mt8173_mfgtop_data, genpd);
+
+	/* Magic numbers related to core switch sequence and delays */
+	regmap_write(data->regmap, 0xec, 0);
+
+	/* drives internal power management */
+	clk_disable_unprepare(data->clk_26m);
+
+	return 0;
+}
+
+static int clk_mt8173_mfgtop_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *node = dev->of_node;
+	struct mt8173_mfgtop_data *data;
+	int ret;
+
+	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, data);
+
+	data->clk_data = mtk_devm_alloc_clk_data(dev, ARRAY_SIZE(mfg_clks));
+	if (!data->clk_data)
+		return -ENOMEM;
+
+	/* MTK clock gates also uses regmap */
+	data->regmap = device_node_to_regmap(node);
+	if (IS_ERR(data->regmap))
+		return dev_err_probe(dev, PTR_ERR(data->regmap), "Failed to get regmap\n");
+
+	data->child_pd.np = node;
+	data->child_pd.args_count = 0;
+	ret = of_parse_phandle_with_args(node, "power-domains", "#power-domain-cells", 0,
+					 &data->parent_pd);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to parse power domain\n");
+
+	devm_pm_runtime_enable(dev);
+	/*
+	 * Do a pm_runtime_resume_and_get() to workaround a possible
+	 * deadlock between clk_register() and the genpd framework.
+	 */
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret) {
+		dev_err_probe(dev, ret, "Failed to runtime resume device\n");
+		goto put_of_node;
+	}
+
+	ret = mtk_clk_register_gates(dev, node, mfg_clks, ARRAY_SIZE(mfg_clks),
+				     data->clk_data);
+	if (ret) {
+		dev_err_probe(dev, ret, "Failed to register clock gates\n");
+		goto put_pm_runtime;
+	}
+
+	data->clk_26m = clk_hw_get_clk(data->clk_data->hws[CLK_MFG_26M], "26m");
+	if (IS_ERR(data->clk_26m)) {
+		dev_err_probe(dev, PTR_ERR(data->clk_26m), "Failed to get 26 MHz clock\n");
+		goto unregister_clks;
+	}
+
+	ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, data->clk_data);
+	if (ret) {
+		dev_err_probe(dev, ret, "Failed to add clk OF provider\n");
+		goto put_26m_clk;
+	}
+
+	data->genpd.name = "mfg-top";
+	data->genpd.power_on = clk_mt8173_mfgtop_power_on;
+	data->genpd.power_off = clk_mt8173_mfgtop_power_off;
+	ret = pm_genpd_init(&data->genpd, NULL, true);
+	if (ret) {
+		dev_err_probe(dev, ret, "Failed to add power domain\n");
+		goto del_clk_provider;
+	}
+
+	ret = of_genpd_add_provider_simple(node, &data->genpd);
+	if (ret) {
+		dev_err_probe(dev, ret, "Failed to add power domain OF provider\n");
+		goto remove_pd;
+	}
+
+	ret = of_genpd_add_subdomain(&data->parent_pd, &data->child_pd);
+	if (ret) {
+		dev_err_probe(dev, ret, "Failed to link PM domains\n");
+		goto del_pd_provider;
+	}
+
+	pm_runtime_put(dev);
+	return 0;
+
+del_pd_provider:
+	of_genpd_del_provider(node);
+remove_pd:
+	pm_genpd_remove(&data->genpd);
+del_clk_provider:
+	of_clk_del_provider(node);
+put_26m_clk:
+	clk_put(data->clk_26m);
+unregister_clks:
+	mtk_clk_unregister_gates(mfg_clks, ARRAY_SIZE(mfg_clks), data->clk_data);
+put_pm_runtime:
+	pm_runtime_put(dev);
+put_of_node:
+	of_node_put(data->parent_pd.np);
+	return ret;
+}
+
+static void clk_mt8173_mfgtop_remove(struct platform_device *pdev)
+{
+	struct mt8173_mfgtop_data *data = platform_get_drvdata(pdev);
+	struct device_node *node = pdev->dev.of_node;
+
+	of_genpd_remove_subdomain(&data->parent_pd, &data->child_pd);
+	of_genpd_del_provider(node);
+	pm_genpd_remove(&data->genpd);
+	of_clk_del_provider(node);
+	clk_put(data->clk_26m);
+	mtk_clk_unregister_gates(mfg_clks, ARRAY_SIZE(mfg_clks), data->clk_data);
+}
+
+static const struct of_device_id of_match_clk_mt8173_mfgtop[] = {
+	{ .compatible = "mediatek,mt8173-mfgtop", .data = &mfg_desc },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, of_match_clk_mt8173_mfgtop);
+
+static struct platform_driver clk_mt8173_mfgtop_drv = {
+	.probe = clk_mt8173_mfgtop_probe,
+	.remove = clk_mt8173_mfgtop_remove,
+	.driver = {
+		.name = "clk-mt8173-mfgtop",
+		.of_match_table = of_match_clk_mt8173_mfgtop,
+	},
+};
+module_platform_driver(clk_mt8173_mfgtop_drv);
+
+MODULE_DESCRIPTION("MediaTek MT8173 mfgtop clock driver");
+MODULE_LICENSE("GPL");
-- 
2.53.0.1018.g2bb0e51243-goog



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 3/5] dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU
  2026-03-25  7:19 [PATCH v2 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
  2026-03-25  7:19 ` [PATCH v2 1/5] dt-bindings: clock: mediatek: Add mt8173 mfgtop Chen-Yu Tsai
  2026-03-25  7:19 ` [PATCH v2 2/5] clk: mediatek: Add mt8173-mfgtop driver Chen-Yu Tsai
@ 2026-03-25  7:19 ` Chen-Yu Tsai
  2026-03-25  7:19 ` [PATCH v2 4/5] arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock Chen-Yu Tsai
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: Chen-Yu Tsai @ 2026-03-25  7:19 UTC (permalink / raw)
  To: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: Icenowy Zheng, Icenowy Zheng, Chen-Yu Tsai, David Airlie,
	Simona Vetter, linux-clk, devicetree, linux-mediatek, dri-devel,
	linux-arm-kernel, linux-kernel, Conor Dooley

The MediaTek MT8173 comes with a PowerVR Rogue GX6250, which is one
of the Series6XT GPUs, another sub-family of the Rogue family.

This was part of the very first few versions of the PowerVR submission,
but was later dropped.

[1] https://lore.kernel.org/dri-devel/6eeccb26e09aad67fb30ffcd523c793a43c79c2a.camel@imgtec.com/

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
---
Changes since v1:
- Adapted to recent changes, now only adds SoC-specific compatible string
---
 Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml b/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
index a1f54dbae3f3..53131cd4cc2a 100644
--- a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
+++ b/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
@@ -15,6 +15,7 @@ properties:
     oneOf:
       - items:
           - enum:
+              - mediatek,mt8173-gpu
               - renesas,r8a7796-gpu
               - renesas,r8a77961-gpu
           - const: img,img-gx6250
-- 
2.53.0.1018.g2bb0e51243-goog



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 4/5] arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock
  2026-03-25  7:19 [PATCH v2 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
                   ` (2 preceding siblings ...)
  2026-03-25  7:19 ` [PATCH v2 3/5] dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU Chen-Yu Tsai
@ 2026-03-25  7:19 ` Chen-Yu Tsai
  2026-03-25  7:19 ` [PATCH v2 5/5] arm64: dts: mediatek: mt8173: Add GPU device nodes Chen-Yu Tsai
  2026-03-25  8:03 ` [PATCH v2 0/5] powervr: MT8173 GPU support Icenowy Zheng
  5 siblings, 0 replies; 17+ messages in thread
From: Chen-Yu Tsai @ 2026-03-25  7:19 UTC (permalink / raw)
  To: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: Icenowy Zheng, Icenowy Zheng, Chen-Yu Tsai, David Airlie,
	Simona Vetter, linux-clk, devicetree, linux-mediatek, dri-devel,
	linux-arm-kernel, linux-kernel

The MFG_ASYNC domain, which is likely associated to the whole MFG block,
currently specifies clk26m as its domain clock. This is bogus, since the
clock is an external crystal with no controls. Also, the MFG block has
a independent CLK_TOP_AXI_MFG_IN_SEL clock, which according to the block
diagram, gates access to the hardware registers. Having this one as the
domain clock makes much more sense. This also fixes access to the MFGTOP
registers.

Change the MFG_ASYNC domain clock to CLK_TOP_AXI_MFG_IN_SEL.

Fixes: 8b6562644df9 ("arm64: dts: mediatek: Add mt8173 power domain controller")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index 78c2ccd5be13..556e806b7787 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -505,7 +505,7 @@ power-domain@MT8173_POWER_DOMAIN_USB {
 				};
 				mfg_async: power-domain@MT8173_POWER_DOMAIN_MFG_ASYNC {
 					reg = <MT8173_POWER_DOMAIN_MFG_ASYNC>;
-					clocks = <&clk26m>;
+					clocks = <&topckgen CLK_TOP_AXI_MFG_IN_SEL>;
 					clock-names = "mfg";
 					#address-cells = <1>;
 					#size-cells = <0>;
-- 
2.53.0.1018.g2bb0e51243-goog



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 5/5] arm64: dts: mediatek: mt8173: Add GPU device nodes
  2026-03-25  7:19 [PATCH v2 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
                   ` (3 preceding siblings ...)
  2026-03-25  7:19 ` [PATCH v2 4/5] arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock Chen-Yu Tsai
@ 2026-03-25  7:19 ` Chen-Yu Tsai
  2026-03-25  8:03 ` [PATCH v2 0/5] powervr: MT8173 GPU support Icenowy Zheng
  5 siblings, 0 replies; 17+ messages in thread
From: Chen-Yu Tsai @ 2026-03-25  7:19 UTC (permalink / raw)
  To: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: Icenowy Zheng, Icenowy Zheng, Chen-Yu Tsai, David Airlie,
	Simona Vetter, linux-clk, devicetree, linux-mediatek, dri-devel,
	linux-arm-kernel, linux-kernel

The MediaTek MT8173 comes with a PowerVR Rogue GX6250, which is part
of the Series6XT, another variation of the Rogue family of GPUs.

On top of the GPU is a glue layer that handles some clock and power
signals.

Add device nodes for both. While there is supposed to be two different
power domains to the GPU, MediaTek does not have any information on how
this is integrated internally. Assign the same GPU power domain to both.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 31 ++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index 556e806b7787..169ba4fd183e 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -1002,6 +1002,37 @@ u2port1: usb-phy@11291000 {
 			};
 		};
 
+		gpu: gpu@13000000 {
+			compatible = "mediatek,mt8173-gpu", "img,img-gx6250",
+				     "img,img-rogue";
+			reg = <0 0x13000000 0 0x10000>;
+			interrupts = <GIC_SPI 217 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&mfgtop CLK_MFG_G3D>,
+				 <&mfgtop CLK_MFG_MEM>,
+				 <&mfgtop CLK_MFG_AXI>;
+			clock-names = "core", "mem", "sys";
+			/*
+			 * Binding and GPU core HW have two power domain
+			 * inputs, but MediaTek does not have information
+			 * on how this is done internally.
+			 */
+			power-domains = <&mfgtop>, <&mfgtop>;
+			power-domain-names = "a", "b";
+		};
+
+		mfgtop: clock-controller@13fff000 {
+			compatible = "mediatek,mt8173-mfgtop";
+			reg = <0 0x13fff000 0 0x1000>;
+			clocks = <&topckgen CLK_TOP_AXI_MFG_IN_SEL>,
+				 <&topckgen CLK_TOP_MEM_MFG_IN_SEL>,
+				 <&topckgen CLK_TOP_MFG_SEL>,
+				 <&clk26m>;
+			clock-names = "sys", "mem", "core", "clk26m";
+			power-domains = <&spm MT8173_POWER_DOMAIN_MFG>;
+			#clock-cells = <1>;
+			#power-domain-cells = <0>;
+		};
+
 		mmsys: syscon@14000000 {
 			compatible = "mediatek,mt8173-mmsys", "syscon";
 			reg = <0 0x14000000 0 0x1000>;
-- 
2.53.0.1018.g2bb0e51243-goog



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 0/5] powervr: MT8173 GPU support
  2026-03-25  7:19 [PATCH v2 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
                   ` (4 preceding siblings ...)
  2026-03-25  7:19 ` [PATCH v2 5/5] arm64: dts: mediatek: mt8173: Add GPU device nodes Chen-Yu Tsai
@ 2026-03-25  8:03 ` Icenowy Zheng
  2026-03-25  8:08   ` Chen-Yu Tsai
  5 siblings, 1 reply; 17+ messages in thread
From: Icenowy Zheng @ 2026-03-25  8:03 UTC (permalink / raw)
  To: Chen-Yu Tsai, Stephen Boyd, Matthias Brugger,
	AngeloGioacchino Del Regno, Frank Binns, Matt Coster,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: David Airlie, Simona Vetter, linux-clk, devicetree,
	linux-mediatek, dri-devel, linux-arm-kernel, linux-kernel

在 2026-03-25三的 15:19 +0800,Chen-Yu Tsai写道:
> Hi everyone,
> 
> This is v2 of my MT8173 PowerVR GPU support series.
> 
> Changes since v1:
> - Adapted to changed DT bindings
> - Dropped driver change
> - Use same power domain for "a" and "b" GPU power domains
> 
> This update was requested by Icenowy.
> 
> 
> This series enables the PowerVR GPU found in the MT8173 SoC, found in
> some Chromebooks.
> 
> This version is different from the initial powervr driver submission
> [1]
> in that it splits out the GPU glue layer support out of the powervr
> driver and into a separate clock and power domain driver. The glue
> code
> is otherwise the same, and also the same as found in the ChromeOS
> kernels, with some extra comments and macro names added where
> possible.
> 
> Patch 1 adds a binding for the glue layer, called mfgtop. The glue
> layer
> contains clock and power controls for the GPU.
> 
> Patch 2 adds a driver for the glue layer.
> 
> Patch 3 adds an entry for the MT8173 GPU and 6XT series to the
> PowerVR
> binding.
> 
> Patch 4 adds an entry for the PowerVR 6XT series GPU to the driver.
> 
> Patch 5 corrects the clock for the GPU (called MFG) power domain.
> 
> Patch 6 adds device nodes for the GPU and glue layer to the MT8173
> dtsi
> file.
> 
> Patch 2 and 6 depend on patch 1 to build. I suppose some common
> immutable tree would be needed from the MediaTek maintainers.
> 
> The kernel driver successfully probes the hardware and loads the
> "rogue_4.40.2.51_v1.fw" firmware provided by Imagination Technologies
> [2].
> Userspace was tested with Mesa 24.0.8 from Debian Trixie rebuilt with
> the powervr vulkan driver enabled. `vulkaninfo` gives some
> information
> about the GPU (attached at the end), but running the `triangle`
> example
> from the Sascha Willems demos [3] with -DUSE_D2D_WSI=ON as
> recommended [4]
> failed with:
> 
>     Can't find a display and a display mode!

I think when using D2D the demos want width and height to be explicitly
specified, otherwise it seems to hardcode 1280x720.

If you're using an elm, could you try to add `-w 1920 -h 1080` or for
hana `-w 1366 -h 768` ?

Thanks
Icenowy

> 
> Same program worked correctly on a BeaglePlay and displayed a color
> gradient triangle. Not sure what went wrong here.
> 
> Anyway, please have a look and test.
> 
> 
> Thanks
> ChenYu
> 
> [1]
> https://lore.kernel.org/dri-devel/20220815165156.118212-2-sarah.walker@imgtec.com/
> [2]
> https://gitlab.freedesktop.org/imagination/linux-firmware/-/tree/powervr
> [3] https://github.com/SaschaWillems/Vulkan
> [4]
> https://lore.kernel.org/dri-devel/f2b2671e-5acc-4dec-9c2e-3c9cd2e1f19e@imgtec.com/
> 
> Chen-Yu Tsai (5):
>   dt-bindings: clock: mediatek: Add mt8173 mfgtop
>   clk: mediatek: Add mt8173-mfgtop driver
>   dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU
>   arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock
>   arm64: dts: mediatek: mt8173: Add GPU device nodes
> 
>  .../clock/mediatek,mt8173-mfgtop.yaml         |  70 +++++
>  .../bindings/gpu/img,powervr-rogue.yaml       |   1 +
>  arch/arm64/boot/dts/mediatek/mt8173.dtsi      |  33 ++-
>  drivers/clk/mediatek/Kconfig                  |   9 +
>  drivers/clk/mediatek/Makefile                 |   1 +
>  drivers/clk/mediatek/clk-mt8173-mfgtop.c      | 243
> ++++++++++++++++++
>  include/dt-bindings/clock/mt8173-clk.h        |   7 +
>  7 files changed, 363 insertions(+), 1 deletion(-)
>  create mode 100644
> Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml
>  create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 0/5] powervr: MT8173 GPU support
  2026-03-25  8:03 ` [PATCH v2 0/5] powervr: MT8173 GPU support Icenowy Zheng
@ 2026-03-25  8:08   ` Chen-Yu Tsai
  2026-03-25  8:30     ` Icenowy Zheng
  0 siblings, 1 reply; 17+ messages in thread
From: Chen-Yu Tsai @ 2026-03-25  8:08 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, linux-clk,
	devicetree, linux-mediatek, dri-devel, linux-arm-kernel,
	linux-kernel

On Wed, Mar 25, 2026 at 4:04 PM Icenowy Zheng <uwu@icenowy.me> wrote:
>
> 在 2026-03-25三的 15:19 +0800,Chen-Yu Tsai写道:
> > Hi everyone,
> >
> > This is v2 of my MT8173 PowerVR GPU support series.
> >
> > Changes since v1:
> > - Adapted to changed DT bindings
> > - Dropped driver change
> > - Use same power domain for "a" and "b" GPU power domains
> >
> > This update was requested by Icenowy.
> >
> >
> > This series enables the PowerVR GPU found in the MT8173 SoC, found in
> > some Chromebooks.
> >
> > This version is different from the initial powervr driver submission
> > [1]
> > in that it splits out the GPU glue layer support out of the powervr
> > driver and into a separate clock and power domain driver. The glue
> > code
> > is otherwise the same, and also the same as found in the ChromeOS
> > kernels, with some extra comments and macro names added where
> > possible.
> >
> > Patch 1 adds a binding for the glue layer, called mfgtop. The glue
> > layer
> > contains clock and power controls for the GPU.
> >
> > Patch 2 adds a driver for the glue layer.
> >
> > Patch 3 adds an entry for the MT8173 GPU and 6XT series to the
> > PowerVR
> > binding.
> >
> > Patch 4 adds an entry for the PowerVR 6XT series GPU to the driver.
> >
> > Patch 5 corrects the clock for the GPU (called MFG) power domain.
> >
> > Patch 6 adds device nodes for the GPU and glue layer to the MT8173
> > dtsi
> > file.
> >
> > Patch 2 and 6 depend on patch 1 to build. I suppose some common
> > immutable tree would be needed from the MediaTek maintainers.
> >
> > The kernel driver successfully probes the hardware and loads the
> > "rogue_4.40.2.51_v1.fw" firmware provided by Imagination Technologies
> > [2].
> > Userspace was tested with Mesa 24.0.8 from Debian Trixie rebuilt with
> > the powervr vulkan driver enabled. `vulkaninfo` gives some
> > information
> > about the GPU (attached at the end), but running the `triangle`
> > example
> > from the Sascha Willems demos [3] with -DUSE_D2D_WSI=ON as
> > recommended [4]
> > failed with:
> >
> >     Can't find a display and a display mode!
>
> I think when using D2D the demos want width and height to be explicitly
> specified, otherwise it seems to hardcode 1280x720.
>
> If you're using an elm, could you try to add `-w 1920 -h 1080` or for
> hana `-w 1366 -h 768` ?

I only did the basic `vulkaninfo` test this time around. To do anything
interesting probably requires the Mesa 26.1 release.

    PVR_I_WANT_A_BROKEN_VULKAN_DRIVER=1 \
        vkmark --winsys kms -D b81f54f8568deb0fb70a6a1ed845b65d

just reports "Error: Device specified by uuid is not available"

This is with Mesa 26.0.2 packages from Debian testing. At least now
have the powervr vulkan driver enabled by default, so I don't have
to rebuild the packages again.


ChenYu

> Thanks
> Icenowy
>
> >
> > Same program worked correctly on a BeaglePlay and displayed a color
> > gradient triangle. Not sure what went wrong here.
> >
> > Anyway, please have a look and test.
> >
> >
> > Thanks
> > ChenYu
> >
> > [1]
> > https://lore.kernel.org/dri-devel/20220815165156.118212-2-sarah.walker@imgtec.com/
> > [2]
> > https://gitlab.freedesktop.org/imagination/linux-firmware/-/tree/powervr
> > [3] https://github.com/SaschaWillems/Vulkan
> > [4]
> > https://lore.kernel.org/dri-devel/f2b2671e-5acc-4dec-9c2e-3c9cd2e1f19e@imgtec.com/
> >
> > Chen-Yu Tsai (5):
> >   dt-bindings: clock: mediatek: Add mt8173 mfgtop
> >   clk: mediatek: Add mt8173-mfgtop driver
> >   dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU
> >   arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock
> >   arm64: dts: mediatek: mt8173: Add GPU device nodes
> >
> >  .../clock/mediatek,mt8173-mfgtop.yaml         |  70 +++++
> >  .../bindings/gpu/img,powervr-rogue.yaml       |   1 +
> >  arch/arm64/boot/dts/mediatek/mt8173.dtsi      |  33 ++-
> >  drivers/clk/mediatek/Kconfig                  |   9 +
> >  drivers/clk/mediatek/Makefile                 |   1 +
> >  drivers/clk/mediatek/clk-mt8173-mfgtop.c      | 243
> > ++++++++++++++++++
> >  include/dt-bindings/clock/mt8173-clk.h        |   7 +
> >  7 files changed, 363 insertions(+), 1 deletion(-)
> >  create mode 100644
> > Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml
> >  create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 0/5] powervr: MT8173 GPU support
  2026-03-25  8:08   ` Chen-Yu Tsai
@ 2026-03-25  8:30     ` Icenowy Zheng
  2026-03-25  8:41       ` Icenowy Zheng
  2026-03-25  9:11       ` Icenowy Zheng
  0 siblings, 2 replies; 17+ messages in thread
From: Icenowy Zheng @ 2026-03-25  8:30 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, linux-clk,
	devicetree, linux-mediatek, dri-devel, linux-arm-kernel,
	linux-kernel

在 2026-03-25三的 16:08 +0800,Chen-Yu Tsai写道:
> On Wed, Mar 25, 2026 at 4:04 PM Icenowy Zheng <uwu@icenowy.me> wrote:
> > 
> > 在 2026-03-25三的 15:19 +0800,Chen-Yu Tsai写道:
> > > Hi everyone,
> > > 
> > > This is v2 of my MT8173 PowerVR GPU support series.
> > > 
> > > Changes since v1:
> > > - Adapted to changed DT bindings
> > > - Dropped driver change
> > > - Use same power domain for "a" and "b" GPU power domains
> > > 
> > > This update was requested by Icenowy.
> > > 
> > > 
> > > This series enables the PowerVR GPU found in the MT8173 SoC,
> > > found in
> > > some Chromebooks.
> > > 
> > > This version is different from the initial powervr driver
> > > submission
> > > [1]
> > > in that it splits out the GPU glue layer support out of the
> > > powervr
> > > driver and into a separate clock and power domain driver. The
> > > glue
> > > code
> > > is otherwise the same, and also the same as found in the ChromeOS
> > > kernels, with some extra comments and macro names added where
> > > possible.
> > > 
> > > Patch 1 adds a binding for the glue layer, called mfgtop. The
> > > glue
> > > layer
> > > contains clock and power controls for the GPU.
> > > 
> > > Patch 2 adds a driver for the glue layer.
> > > 
> > > Patch 3 adds an entry for the MT8173 GPU and 6XT series to the
> > > PowerVR
> > > binding.
> > > 
> > > Patch 4 adds an entry for the PowerVR 6XT series GPU to the
> > > driver.
> > > 
> > > Patch 5 corrects the clock for the GPU (called MFG) power domain.
> > > 
> > > Patch 6 adds device nodes for the GPU and glue layer to the
> > > MT8173
> > > dtsi
> > > file.
> > > 
> > > Patch 2 and 6 depend on patch 1 to build. I suppose some common
> > > immutable tree would be needed from the MediaTek maintainers.
> > > 
> > > The kernel driver successfully probes the hardware and loads the
> > > "rogue_4.40.2.51_v1.fw" firmware provided by Imagination
> > > Technologies
> > > [2].
> > > Userspace was tested with Mesa 24.0.8 from Debian Trixie rebuilt
> > > with
> > > the powervr vulkan driver enabled. `vulkaninfo` gives some
> > > information
> > > about the GPU (attached at the end), but running the `triangle`
> > > example
> > > from the Sascha Willems demos [3] with -DUSE_D2D_WSI=ON as
> > > recommended [4]
> > > failed with:
> > > 
> > >     Can't find a display and a display mode!
> > 
> > I think when using D2D the demos want width and height to be
> > explicitly
> > specified, otherwise it seems to hardcode 1280x720.
> > 
> > If you're using an elm, could you try to add `-w 1920 -h 1080` or
> > for
> > hana `-w 1366 -h 768` ?
> 
> I only did the basic `vulkaninfo` test this time around. To do
> anything
> interesting probably requires the Mesa 26.1 release.
> 
>     PVR_I_WANT_A_BROKEN_VULKAN_DRIVER=1 \
>         vkmark --winsys kms -D b81f54f8568deb0fb70a6a1ed845b65d
> 
> just reports "Error: Device specified by uuid is not available"

I am very sorry to tell you that, when I run Sascha's demo with Mesa
main, I got GPU lost immediately...

```
[  441.509433] powervr 13000000.gpu: [drm] *ERROR* GPU device lost
```

Icenowy

> 
> This is with Mesa 26.0.2 packages from Debian testing. At least now
> have the powervr vulkan driver enabled by default, so I don't have
> to rebuild the packages again.
> 
> 
> ChenYu
> 
> > Thanks
> > Icenowy
> > 
> > > 
> > > Same program worked correctly on a BeaglePlay and displayed a
> > > color
> > > gradient triangle. Not sure what went wrong here.
> > > 
> > > Anyway, please have a look and test.
> > > 
> > > 
> > > Thanks
> > > ChenYu
> > > 
> > > [1]
> > > https://lore.kernel.org/dri-devel/20220815165156.118212-2-sarah.walker@imgtec.com/
> > > [2]
> > > https://gitlab.freedesktop.org/imagination/linux-firmware/-/tree/powervr
> > > [3] https://github.com/SaschaWillems/Vulkan
> > > [4]
> > > https://lore.kernel.org/dri-devel/f2b2671e-5acc-4dec-9c2e-3c9cd2e1f19e@imgtec.com/
> > > 
> > > Chen-Yu Tsai (5):
> > >   dt-bindings: clock: mediatek: Add mt8173 mfgtop
> > >   clk: mediatek: Add mt8173-mfgtop driver
> > >   dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU
> > >   arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock
> > >   arm64: dts: mediatek: mt8173: Add GPU device nodes
> > > 
> > >  .../clock/mediatek,mt8173-mfgtop.yaml         |  70 +++++
> > >  .../bindings/gpu/img,powervr-rogue.yaml       |   1 +
> > >  arch/arm64/boot/dts/mediatek/mt8173.dtsi      |  33 ++-
> > >  drivers/clk/mediatek/Kconfig                  |   9 +
> > >  drivers/clk/mediatek/Makefile                 |   1 +
> > >  drivers/clk/mediatek/clk-mt8173-mfgtop.c      | 243
> > > ++++++++++++++++++
> > >  include/dt-bindings/clock/mt8173-clk.h        |   7 +
> > >  7 files changed, 363 insertions(+), 1 deletion(-)
> > >  create mode 100644
> > > Documentation/devicetree/bindings/clock/mediatek,mt8173-
> > > mfgtop.yaml
> > >  create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 0/5] powervr: MT8173 GPU support
  2026-03-25  8:30     ` Icenowy Zheng
@ 2026-03-25  8:41       ` Icenowy Zheng
  2026-03-25  9:17         ` Chen-Yu Tsai
  2026-03-25  9:11       ` Icenowy Zheng
  1 sibling, 1 reply; 17+ messages in thread
From: Icenowy Zheng @ 2026-03-25  8:41 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, linux-clk,
	devicetree, linux-mediatek, dri-devel, linux-arm-kernel,
	linux-kernel

在 2026-03-25三的 16:30 +0800,Icenowy Zheng写道:
> 在 2026-03-25三的 16:08 +0800,Chen-Yu Tsai写道:
> > On Wed, Mar 25, 2026 at 4:04 PM Icenowy Zheng <uwu@icenowy.me>
> > wrote:
> > > 
> > > 在 2026-03-25三的 15:19 +0800,Chen-Yu Tsai写道:
> > > > Hi everyone,
> > > > 
> > > > This is v2 of my MT8173 PowerVR GPU support series.
> > > > 
> > > > Changes since v1:
> > > > - Adapted to changed DT bindings
> > > > - Dropped driver change
> > > > - Use same power domain for "a" and "b" GPU power domains
> > > > 
> > > > This update was requested by Icenowy.
> > > > 
> > > > 
> > > > This series enables the PowerVR GPU found in the MT8173 SoC,
> > > > found in
> > > > some Chromebooks.
> > > > 
> > > > This version is different from the initial powervr driver
> > > > submission
> > > > [1]
> > > > in that it splits out the GPU glue layer support out of the
> > > > powervr
> > > > driver and into a separate clock and power domain driver. The
> > > > glue
> > > > code
> > > > is otherwise the same, and also the same as found in the
> > > > ChromeOS
> > > > kernels, with some extra comments and macro names added where
> > > > possible.
> > > > 
> > > > Patch 1 adds a binding for the glue layer, called mfgtop. The
> > > > glue
> > > > layer
> > > > contains clock and power controls for the GPU.
> > > > 
> > > > Patch 2 adds a driver for the glue layer.
> > > > 
> > > > Patch 3 adds an entry for the MT8173 GPU and 6XT series to the
> > > > PowerVR
> > > > binding.
> > > > 
> > > > Patch 4 adds an entry for the PowerVR 6XT series GPU to the
> > > > driver.
> > > > 
> > > > Patch 5 corrects the clock for the GPU (called MFG) power
> > > > domain.
> > > > 
> > > > Patch 6 adds device nodes for the GPU and glue layer to the
> > > > MT8173
> > > > dtsi
> > > > file.
> > > > 
> > > > Patch 2 and 6 depend on patch 1 to build. I suppose some common
> > > > immutable tree would be needed from the MediaTek maintainers.
> > > > 
> > > > The kernel driver successfully probes the hardware and loads
> > > > the
> > > > "rogue_4.40.2.51_v1.fw" firmware provided by Imagination
> > > > Technologies
> > > > [2].
> > > > Userspace was tested with Mesa 24.0.8 from Debian Trixie
> > > > rebuilt
> > > > with
> > > > the powervr vulkan driver enabled. `vulkaninfo` gives some
> > > > information
> > > > about the GPU (attached at the end), but running the `triangle`
> > > > example
> > > > from the Sascha Willems demos [3] with -DUSE_D2D_WSI=ON as
> > > > recommended [4]
> > > > failed with:
> > > > 
> > > >     Can't find a display and a display mode!
> > > 
> > > I think when using D2D the demos want width and height to be
> > > explicitly
> > > specified, otherwise it seems to hardcode 1280x720.
> > > 
> > > If you're using an elm, could you try to add `-w 1920 -h 1080` or
> > > for
> > > hana `-w 1366 -h 768` ?
> > 
> > I only did the basic `vulkaninfo` test this time around. To do
> > anything
> > interesting probably requires the Mesa 26.1 release.
> > 
> >     PVR_I_WANT_A_BROKEN_VULKAN_DRIVER=1 \
> >         vkmark --winsys kms -D b81f54f8568deb0fb70a6a1ed845b65d
> > 
> > just reports "Error: Device specified by uuid is not available"
> 
> I am very sorry to tell you that, when I run Sascha's demo with Mesa
> main, I got GPU lost immediately...
> 
> ```
> [  441.509433] powervr 13000000.gpu: [drm] *ERROR* GPU device lost
> ```

Sidenote: I think this is some power domain management issue, because I
saw the kernel saying `vgpu: disabling` , which shouldn't happen if the
GPU is active?

> 
> Icenowy
> 
> > 
> > This is with Mesa 26.0.2 packages from Debian testing. At least now
> > have the powervr vulkan driver enabled by default, so I don't have
> > to rebuild the packages again.
> > 
> > 
> > ChenYu
> > 
> > > Thanks
> > > Icenowy
> > > 
> > > > 
> > > > Same program worked correctly on a BeaglePlay and displayed a
> > > > color
> > > > gradient triangle. Not sure what went wrong here.
> > > > 
> > > > Anyway, please have a look and test.
> > > > 
> > > > 
> > > > Thanks
> > > > ChenYu
> > > > 
> > > > [1]
> > > > https://lore.kernel.org/dri-devel/20220815165156.118212-2-sarah.walker@imgtec.com/
> > > > [2]
> > > > https://gitlab.freedesktop.org/imagination/linux-firmware/-/tree/powervr
> > > > [3] https://github.com/SaschaWillems/Vulkan
> > > > [4]
> > > > https://lore.kernel.org/dri-devel/f2b2671e-5acc-4dec-9c2e-3c9cd2e1f19e@imgtec.com/
> > > > 
> > > > Chen-Yu Tsai (5):
> > > >   dt-bindings: clock: mediatek: Add mt8173 mfgtop
> > > >   clk: mediatek: Add mt8173-mfgtop driver
> > > >   dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU
> > > >   arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain
> > > > clock
> > > >   arm64: dts: mediatek: mt8173: Add GPU device nodes
> > > > 
> > > >  .../clock/mediatek,mt8173-mfgtop.yaml         |  70 +++++
> > > >  .../bindings/gpu/img,powervr-rogue.yaml       |   1 +
> > > >  arch/arm64/boot/dts/mediatek/mt8173.dtsi      |  33 ++-
> > > >  drivers/clk/mediatek/Kconfig                  |   9 +
> > > >  drivers/clk/mediatek/Makefile                 |   1 +
> > > >  drivers/clk/mediatek/clk-mt8173-mfgtop.c      | 243
> > > > ++++++++++++++++++
> > > >  include/dt-bindings/clock/mt8173-clk.h        |   7 +
> > > >  7 files changed, 363 insertions(+), 1 deletion(-)
> > > >  create mode 100644
> > > > Documentation/devicetree/bindings/clock/mediatek,mt8173-
> > > > mfgtop.yaml
> > > >  create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 0/5] powervr: MT8173 GPU support
  2026-03-25  8:30     ` Icenowy Zheng
  2026-03-25  8:41       ` Icenowy Zheng
@ 2026-03-25  9:11       ` Icenowy Zheng
  2026-03-26  5:56         ` Icenowy Zheng
  1 sibling, 1 reply; 17+ messages in thread
From: Icenowy Zheng @ 2026-03-25  9:11 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, linux-clk,
	devicetree, linux-mediatek, dri-devel, linux-arm-kernel,
	linux-kernel

在 2026-03-25三的 16:30 +0800,Icenowy Zheng写道:
> 在 2026-03-25三的 16:08 +0800,Chen-Yu Tsai写道:
> > On Wed, Mar 25, 2026 at 4:04 PM Icenowy Zheng <uwu@icenowy.me>
> > wrote:
> > > 
> > > 在 2026-03-25三的 15:19 +0800,Chen-Yu Tsai写道:
> > > > Hi everyone,
> > > > 
> > > > This is v2 of my MT8173 PowerVR GPU support series.
> > > > 
> > > > Changes since v1:
> > > > - Adapted to changed DT bindings
> > > > - Dropped driver change
> > > > - Use same power domain for "a" and "b" GPU power domains
> > > > 
> > > > This update was requested by Icenowy.
> > > > 
> > > > 
> > > > This series enables the PowerVR GPU found in the MT8173 SoC,
> > > > found in
> > > > some Chromebooks.
> > > > 
> > > > This version is different from the initial powervr driver
> > > > submission
> > > > [1]
> > > > in that it splits out the GPU glue layer support out of the
> > > > powervr
> > > > driver and into a separate clock and power domain driver. The
> > > > glue
> > > > code
> > > > is otherwise the same, and also the same as found in the
> > > > ChromeOS
> > > > kernels, with some extra comments and macro names added where
> > > > possible.
> > > > 
> > > > Patch 1 adds a binding for the glue layer, called mfgtop. The
> > > > glue
> > > > layer
> > > > contains clock and power controls for the GPU.
> > > > 
> > > > Patch 2 adds a driver for the glue layer.
> > > > 
> > > > Patch 3 adds an entry for the MT8173 GPU and 6XT series to the
> > > > PowerVR
> > > > binding.
> > > > 
> > > > Patch 4 adds an entry for the PowerVR 6XT series GPU to the
> > > > driver.
> > > > 
> > > > Patch 5 corrects the clock for the GPU (called MFG) power
> > > > domain.
> > > > 
> > > > Patch 6 adds device nodes for the GPU and glue layer to the
> > > > MT8173
> > > > dtsi
> > > > file.
> > > > 
> > > > Patch 2 and 6 depend on patch 1 to build. I suppose some common
> > > > immutable tree would be needed from the MediaTek maintainers.
> > > > 
> > > > The kernel driver successfully probes the hardware and loads
> > > > the
> > > > "rogue_4.40.2.51_v1.fw" firmware provided by Imagination
> > > > Technologies
> > > > [2].
> > > > Userspace was tested with Mesa 24.0.8 from Debian Trixie
> > > > rebuilt
> > > > with
> > > > the powervr vulkan driver enabled. `vulkaninfo` gives some
> > > > information
> > > > about the GPU (attached at the end), but running the `triangle`
> > > > example
> > > > from the Sascha Willems demos [3] with -DUSE_D2D_WSI=ON as
> > > > recommended [4]
> > > > failed with:
> > > > 
> > > >     Can't find a display and a display mode!
> > > 
> > > I think when using D2D the demos want width and height to be
> > > explicitly
> > > specified, otherwise it seems to hardcode 1280x720.
> > > 
> > > If you're using an elm, could you try to add `-w 1920 -h 1080` or
> > > for
> > > hana `-w 1366 -h 768` ?
> > 
> > I only did the basic `vulkaninfo` test this time around. To do
> > anything
> > interesting probably requires the Mesa 26.1 release.
> > 
> >     PVR_I_WANT_A_BROKEN_VULKAN_DRIVER=1 \
> >         vkmark --winsys kms -D b81f54f8568deb0fb70a6a1ed845b65d
> > 
> > just reports "Error: Device specified by uuid is not available"
> 
> I am very sorry to tell you that, when I run Sascha's demo with Mesa
> main, I got GPU lost immediately...
> 
> ```
> [  441.509433] powervr 13000000.gpu: [drm] *ERROR* GPU device lost
> ```

However, Zink on PowerVR works, and on Lichee Pi 4A I also got
`VK_ERROR_DEVICE_LOST` when running Sascha's demos (although the kernel
does not report device lost).

I bet it's a regression on the VK_KHR_display code.

Thanks,
Icenowy

> 
> Icenowy
> 
> > 
> > This is with Mesa 26.0.2 packages from Debian testing. At least now
> > have the powervr vulkan driver enabled by default, so I don't have
> > to rebuild the packages again.
> > 
> > 
> > ChenYu
> > 
> > > Thanks
> > > Icenowy
> > > 
> > > > 
> > > > Same program worked correctly on a BeaglePlay and displayed a
> > > > color
> > > > gradient triangle. Not sure what went wrong here.
> > > > 
> > > > Anyway, please have a look and test.
> > > > 
> > > > 
> > > > Thanks
> > > > ChenYu
> > > > 
> > > > [1]
> > > > https://lore.kernel.org/dri-devel/20220815165156.118212-2-sarah.walker@imgtec.com/
> > > > [2]
> > > > https://gitlab.freedesktop.org/imagination/linux-firmware/-/tree/powervr
> > > > [3] https://github.com/SaschaWillems/Vulkan
> > > > [4]
> > > > https://lore.kernel.org/dri-devel/f2b2671e-5acc-4dec-9c2e-3c9cd2e1f19e@imgtec.com/
> > > > 
> > > > Chen-Yu Tsai (5):
> > > >   dt-bindings: clock: mediatek: Add mt8173 mfgtop
> > > >   clk: mediatek: Add mt8173-mfgtop driver
> > > >   dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU
> > > >   arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain
> > > > clock
> > > >   arm64: dts: mediatek: mt8173: Add GPU device nodes
> > > > 
> > > >  .../clock/mediatek,mt8173-mfgtop.yaml         |  70 +++++
> > > >  .../bindings/gpu/img,powervr-rogue.yaml       |   1 +
> > > >  arch/arm64/boot/dts/mediatek/mt8173.dtsi      |  33 ++-
> > > >  drivers/clk/mediatek/Kconfig                  |   9 +
> > > >  drivers/clk/mediatek/Makefile                 |   1 +
> > > >  drivers/clk/mediatek/clk-mt8173-mfgtop.c      | 243
> > > > ++++++++++++++++++
> > > >  include/dt-bindings/clock/mt8173-clk.h        |   7 +
> > > >  7 files changed, 363 insertions(+), 1 deletion(-)
> > > >  create mode 100644
> > > > Documentation/devicetree/bindings/clock/mediatek,mt8173-
> > > > mfgtop.yaml
> > > >  create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 0/5] powervr: MT8173 GPU support
  2026-03-25  8:41       ` Icenowy Zheng
@ 2026-03-25  9:17         ` Chen-Yu Tsai
  0 siblings, 0 replies; 17+ messages in thread
From: Chen-Yu Tsai @ 2026-03-25  9:17 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, linux-clk,
	devicetree, linux-mediatek, dri-devel, linux-arm-kernel,
	linux-kernel

On Wed, Mar 25, 2026 at 4:42 PM Icenowy Zheng <uwu@icenowy.me> wrote:
>
> 在 2026-03-25三的 16:30 +0800,Icenowy Zheng写道:
> > 在 2026-03-25三的 16:08 +0800,Chen-Yu Tsai写道:
> > > On Wed, Mar 25, 2026 at 4:04 PM Icenowy Zheng <uwu@icenowy.me>
> > > wrote:
> > > >
> > > > 在 2026-03-25三的 15:19 +0800,Chen-Yu Tsai写道:
> > > > > Hi everyone,
> > > > >
> > > > > This is v2 of my MT8173 PowerVR GPU support series.
> > > > >
> > > > > Changes since v1:
> > > > > - Adapted to changed DT bindings
> > > > > - Dropped driver change
> > > > > - Use same power domain for "a" and "b" GPU power domains
> > > > >
> > > > > This update was requested by Icenowy.
> > > > >
> > > > >
> > > > > This series enables the PowerVR GPU found in the MT8173 SoC,
> > > > > found in
> > > > > some Chromebooks.
> > > > >
> > > > > This version is different from the initial powervr driver
> > > > > submission
> > > > > [1]
> > > > > in that it splits out the GPU glue layer support out of the
> > > > > powervr
> > > > > driver and into a separate clock and power domain driver. The
> > > > > glue
> > > > > code
> > > > > is otherwise the same, and also the same as found in the
> > > > > ChromeOS
> > > > > kernels, with some extra comments and macro names added where
> > > > > possible.
> > > > >
> > > > > Patch 1 adds a binding for the glue layer, called mfgtop. The
> > > > > glue
> > > > > layer
> > > > > contains clock and power controls for the GPU.
> > > > >
> > > > > Patch 2 adds a driver for the glue layer.
> > > > >
> > > > > Patch 3 adds an entry for the MT8173 GPU and 6XT series to the
> > > > > PowerVR
> > > > > binding.
> > > > >
> > > > > Patch 4 adds an entry for the PowerVR 6XT series GPU to the
> > > > > driver.
> > > > >
> > > > > Patch 5 corrects the clock for the GPU (called MFG) power
> > > > > domain.
> > > > >
> > > > > Patch 6 adds device nodes for the GPU and glue layer to the
> > > > > MT8173
> > > > > dtsi
> > > > > file.
> > > > >
> > > > > Patch 2 and 6 depend on patch 1 to build. I suppose some common
> > > > > immutable tree would be needed from the MediaTek maintainers.
> > > > >
> > > > > The kernel driver successfully probes the hardware and loads
> > > > > the
> > > > > "rogue_4.40.2.51_v1.fw" firmware provided by Imagination
> > > > > Technologies
> > > > > [2].
> > > > > Userspace was tested with Mesa 24.0.8 from Debian Trixie
> > > > > rebuilt
> > > > > with
> > > > > the powervr vulkan driver enabled. `vulkaninfo` gives some
> > > > > information
> > > > > about the GPU (attached at the end), but running the `triangle`
> > > > > example
> > > > > from the Sascha Willems demos [3] with -DUSE_D2D_WSI=ON as
> > > > > recommended [4]
> > > > > failed with:
> > > > >
> > > > >     Can't find a display and a display mode!
> > > >
> > > > I think when using D2D the demos want width and height to be
> > > > explicitly
> > > > specified, otherwise it seems to hardcode 1280x720.
> > > >
> > > > If you're using an elm, could you try to add `-w 1920 -h 1080` or
> > > > for
> > > > hana `-w 1366 -h 768` ?
> > >
> > > I only did the basic `vulkaninfo` test this time around. To do
> > > anything
> > > interesting probably requires the Mesa 26.1 release.
> > >
> > >     PVR_I_WANT_A_BROKEN_VULKAN_DRIVER=1 \
> > >         vkmark --winsys kms -D b81f54f8568deb0fb70a6a1ed845b65d
> > >
> > > just reports "Error: Device specified by uuid is not available"
> >
> > I am very sorry to tell you that, when I run Sascha's demo with Mesa
> > main, I got GPU lost immediately...
> >
> > ```
> > [  441.509433] powervr 13000000.gpu: [drm] *ERROR* GPU device lost
> > ```
>
> Sidenote: I think this is some power domain management issue, because I
> saw the kernel saying `vgpu: disabling` , which shouldn't happen if the
> GPU is active?

AFAICT "vgpu" is the vgpu output from the primary PMIC. This one is unused.
The actual regulator supplying the GPU is from the secondary PMIC. The
rail is called VBUCKB...


ChenYu


> >
> > Icenowy
> >
> > >
> > > This is with Mesa 26.0.2 packages from Debian testing. At least now
> > > have the powervr vulkan driver enabled by default, so I don't have
> > > to rebuild the packages again.
> > >
> > >
> > > ChenYu
> > >
> > > > Thanks
> > > > Icenowy
> > > >
> > > > >
> > > > > Same program worked correctly on a BeaglePlay and displayed a
> > > > > color
> > > > > gradient triangle. Not sure what went wrong here.
> > > > >
> > > > > Anyway, please have a look and test.
> > > > >
> > > > >
> > > > > Thanks
> > > > > ChenYu
> > > > >
> > > > > [1]
> > > > > https://lore.kernel.org/dri-devel/20220815165156.118212-2-sarah.walker@imgtec.com/
> > > > > [2]
> > > > > https://gitlab.freedesktop.org/imagination/linux-firmware/-/tree/powervr
> > > > > [3] https://github.com/SaschaWillems/Vulkan
> > > > > [4]
> > > > > https://lore.kernel.org/dri-devel/f2b2671e-5acc-4dec-9c2e-3c9cd2e1f19e@imgtec.com/
> > > > >
> > > > > Chen-Yu Tsai (5):
> > > > >   dt-bindings: clock: mediatek: Add mt8173 mfgtop
> > > > >   clk: mediatek: Add mt8173-mfgtop driver
> > > > >   dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU
> > > > >   arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain
> > > > > clock
> > > > >   arm64: dts: mediatek: mt8173: Add GPU device nodes
> > > > >
> > > > >  .../clock/mediatek,mt8173-mfgtop.yaml         |  70 +++++
> > > > >  .../bindings/gpu/img,powervr-rogue.yaml       |   1 +
> > > > >  arch/arm64/boot/dts/mediatek/mt8173.dtsi      |  33 ++-
> > > > >  drivers/clk/mediatek/Kconfig                  |   9 +
> > > > >  drivers/clk/mediatek/Makefile                 |   1 +
> > > > >  drivers/clk/mediatek/clk-mt8173-mfgtop.c      | 243
> > > > > ++++++++++++++++++
> > > > >  include/dt-bindings/clock/mt8173-clk.h        |   7 +
> > > > >  7 files changed, 363 insertions(+), 1 deletion(-)
> > > > >  create mode 100644
> > > > > Documentation/devicetree/bindings/clock/mediatek,mt8173-
> > > > > mfgtop.yaml
> > > > >  create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 2/5] clk: mediatek: Add mt8173-mfgtop driver
  2026-03-25  7:19 ` [PATCH v2 2/5] clk: mediatek: Add mt8173-mfgtop driver Chen-Yu Tsai
@ 2026-03-25 14:26   ` Brian Masney
  2026-03-26  1:24   ` kernel test robot
  2026-03-26  7:58   ` Dan Carpenter
  2 siblings, 0 replies; 17+ messages in thread
From: Brian Masney @ 2026-03-25 14:26 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Icenowy Zheng, Icenowy Zheng, David Airlie,
	Simona Vetter, linux-clk, devicetree, linux-mediatek, dri-devel,
	linux-arm-kernel, linux-kernel

On Wed, Mar 25, 2026 at 03:19:46PM +0800, Chen-Yu Tsai wrote:
> The MFG (GPU) block on the MT8173 has a small glue layer, named MFG_TOP
> in the datasheet, that contains clock gates, some power sequence signal
> delays, and other unknown registers that get toggled when the GPU is
> powered on.
> 
> The clock gates are exposed as clocks provided by a clock controller,
> while the power sequencing bits are exposed as one singular power domain.
> 
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> Changes since v1:
> - Reduce tab after GATE_MFG() by one tab
> - Move of_match_clk_mt8173_mfgtop to just before clk_mt8173_mfgtop_drv
> - Rename power domain to "mfg-top"
> - Add FORCE_ABORT and ACTIVE_PWRCTL_EN bits and explicitly clear
>   ACTIVE_PWRCTL_EN bit
> ---
>  drivers/clk/mediatek/Kconfig             |   9 +
>  drivers/clk/mediatek/Makefile            |   1 +
>  drivers/clk/mediatek/clk-mt8173-mfgtop.c | 243 +++++++++++++++++++++++
>  3 files changed, 253 insertions(+)
>  create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c
> 
> diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
> index 2c09fd729bab..8dbd9f14be62 100644
> --- a/drivers/clk/mediatek/Kconfig
> +++ b/drivers/clk/mediatek/Kconfig
> @@ -537,6 +537,15 @@ config COMMON_CLK_MT8173_IMGSYS
>  	help
>  	  This driver supports MediaTek MT8173 imgsys clocks.
>  
> +config COMMON_CLK_MT8173_MFGTOP
> +	tristate "Clock and power driver for MediaTek MT8173 mfgtop"
> +	depends on COMMON_CLK_MT8173
> +	default COMMON_CLK_MT8173
> +	select PM_GENERIC_DOMAINS
> +	select PM_GENERIC_DOMAINS_OF
> +	help
> +	  This driver supports MediaTek MT8173 mfgtop clocks and power domain.
> +
>  config COMMON_CLK_MT8173_MMSYS
>         tristate "Clock driver for MediaTek MT8173 mmsys"
>         depends on COMMON_CLK_MT8173
> diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
> index d8736a060dbd..892a54eeb281 100644
> --- a/drivers/clk/mediatek/Makefile
> +++ b/drivers/clk/mediatek/Makefile
> @@ -82,6 +82,7 @@ obj-$(CONFIG_COMMON_CLK_MT8167_VDECSYS) += clk-mt8167-vdec.o
>  obj-$(CONFIG_COMMON_CLK_MT8173) += clk-mt8173-apmixedsys.o clk-mt8173-infracfg.o \
>  				   clk-mt8173-pericfg.o clk-mt8173-topckgen.o
>  obj-$(CONFIG_COMMON_CLK_MT8173_IMGSYS) += clk-mt8173-img.o
> +obj-$(CONFIG_COMMON_CLK_MT8173_MFGTOP) += clk-mt8173-mfgtop.o
>  obj-$(CONFIG_COMMON_CLK_MT8173_MMSYS) += clk-mt8173-mm.o
>  obj-$(CONFIG_COMMON_CLK_MT8173_VDECSYS) += clk-mt8173-vdecsys.o
>  obj-$(CONFIG_COMMON_CLK_MT8173_VENCSYS) += clk-mt8173-vencsys.o
> diff --git a/drivers/clk/mediatek/clk-mt8173-mfgtop.c b/drivers/clk/mediatek/clk-mt8173-mfgtop.c
> new file mode 100644
> index 000000000000..9e18f34166ae
> --- /dev/null
> +++ b/drivers/clk/mediatek/clk-mt8173-mfgtop.c
> @@ -0,0 +1,243 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (c) 2024 Google LLC
> + * Author: Chen-Yu Tsai <wenst@chromium.org>
> + *
> + * Based on driver in downstream ChromeOS v5.15 kernel.
> + *
> + * Copyright (c) 2014 MediaTek Inc.
> + * Author: Chiawen Lee <chiawen.lee@mediatek.com>
> + */
> +
> +#include <dt-bindings/clock/mt8173-clk.h>
> +
> +#include <linux/bitfield.h>
> +#include <linux/clk.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm_domain.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/regmap.h>
> +
> +#include "clk-gate.h"
> +#include "clk-mtk.h"
> +
> +static const struct mtk_gate_regs mfg_cg_regs = {
> +	.sta_ofs = 0x0000,
> +	.clr_ofs = 0x0008,
> +	.set_ofs = 0x0004,
> +};
> +
> +#define GATE_MFG(_id, _name, _parent, _shift, _flags)	\
> +	GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr, _flags)
> +
> +/* TODO: The block actually has dividers for the core and mem clocks. */
> +static const struct mtk_gate mfg_clks[] = {
> +	GATE_MFG(CLK_MFG_AXI, "mfg_axi", "axi_mfg_in_sel", 0, CLK_SET_RATE_PARENT),
> +	GATE_MFG(CLK_MFG_MEM, "mfg_mem", "mem_mfg_in_sel", 1, CLK_SET_RATE_PARENT),
> +	GATE_MFG(CLK_MFG_G3D, "mfg_g3d", "mfg_sel", 2, CLK_SET_RATE_PARENT),
> +	GATE_MFG(CLK_MFG_26M, "mfg_26m", "clk26m", 3, 0),
> +};
> +
> +static const struct mtk_clk_desc mfg_desc = {
> +	.clks = mfg_clks,
> +	.num_clks = ARRAY_SIZE(mfg_clks),
> +};
> +
> +struct mt8173_mfgtop_data {
> +	struct clk_hw_onecell_data *clk_data;
> +	struct regmap *regmap;
> +	struct generic_pm_domain genpd;
> +	struct of_phandle_args parent_pd, child_pd;
> +	struct clk *clk_26m;
> +};
> +
> +/* Delay count in clock cycles */
> +#define MFG_ACTIVE_POWER_CON0	0x24
> + #define RST_B_DELAY_CNT	GENMASK(7, 0)	/* pwr_rst_b de-assert delay during power-up */
> + #define CLK_EN_DELAY_CNT	GENMASK(15, 8)	/* CLK_DIS deassert delay during power-up */
> + #define CLK_DIS_DELAY_CNT	GENMASK(23, 16)	/* CLK_DIS assert delay during power-down */
> + #define FORCE_ABORT		BIT(30)		/* write 1 to force abort a power event */
> + #define ACTIVE_PWRCTL_EN	BIT(31)		/* enable ACTIVE_POWER */
> +
> +#define MFG_ACTIVE_POWER_CON1	0x28
> + #define PWR_ON_S_DELAY_CNT	GENMASK(7, 0)	/* pwr_on_s assert delay during power-up */
> + #define ISO_DELAY_CNT		GENMASK(15, 8)	/* ISO assert delay during power-down */
> + #define ISOOFF_DELAY_CNT	GENMASK(23, 16)	/* ISO de-assert delay during power-up */
> + #define RST__DELAY_CNT		GENMASK(31, 24) /* pwr_rsb_b assert delay during power-down */

Is the double underscore expected in the name?

> +
> +static int clk_mt8173_mfgtop_power_on(struct generic_pm_domain *domain)
> +{
> +	struct mt8173_mfgtop_data *data = container_of(domain, struct mt8173_mfgtop_data, genpd);
> +
> +	/* drives internal power management */
> +	clk_prepare_enable(data->clk_26m);
> +
> +	/* Power on/off delays for various signals */
> +	regmap_write(data->regmap, MFG_ACTIVE_POWER_CON0,

Should the return value of clk_prepare_enable() and regmap_write() be
checked?

> +		     FIELD_PREP(RST_B_DELAY_CNT, 77) |
> +		     FIELD_PREP(CLK_EN_DELAY_CNT, 61) |
> +		     FIELD_PREP(CLK_DIS_DELAY_CNT, 60) |
> +		     FIELD_PREP(ACTIVE_PWRCTL_EN, 0));
> +	regmap_write(data->regmap, MFG_ACTIVE_POWER_CON1,
> +		     FIELD_PREP(PWR_ON_S_DELAY_CNT, 11) |
> +		     FIELD_PREP(ISO_DELAY_CNT, 68) |
> +		     FIELD_PREP(ISOOFF_DELAY_CNT, 69) |
> +		     FIELD_PREP(RST__DELAY_CNT, 77));
> +
> +	/* Magic numbers related to core switch sequence and delays */
> +	regmap_write(data->regmap, 0xe0, 0x7a710184);
> +	regmap_write(data->regmap, 0xe4, 0x835f6856);
> +	regmap_write(data->regmap, 0xe8, 0x002b0234);
> +	regmap_write(data->regmap, 0xec, 0x80000000);
> +	regmap_write(data->regmap, 0xa0, 0x08000000);
> +
> +	return 0;
> +}
> +
> +static int clk_mt8173_mfgtop_power_off(struct generic_pm_domain *domain)
> +{
> +	struct mt8173_mfgtop_data *data = container_of(domain, struct mt8173_mfgtop_data, genpd);
> +
> +	/* Magic numbers related to core switch sequence and delays */
> +	regmap_write(data->regmap, 0xec, 0);
> +
> +	/* drives internal power management */
> +	clk_disable_unprepare(data->clk_26m);
> +
> +	return 0;
> +}
> +
> +static int clk_mt8173_mfgtop_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct device_node *node = dev->of_node;
> +	struct mt8173_mfgtop_data *data;
> +	int ret;
> +
> +	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> +	if (!data)
> +		return -ENOMEM;
> +
> +	platform_set_drvdata(pdev, data);
> +
> +	data->clk_data = mtk_devm_alloc_clk_data(dev, ARRAY_SIZE(mfg_clks));
> +	if (!data->clk_data)
> +		return -ENOMEM;
> +
> +	/* MTK clock gates also uses regmap */
> +	data->regmap = device_node_to_regmap(node);
> +	if (IS_ERR(data->regmap))
> +		return dev_err_probe(dev, PTR_ERR(data->regmap), "Failed to get regmap\n");
> +
> +	data->child_pd.np = node;
> +	data->child_pd.args_count = 0;
> +	ret = of_parse_phandle_with_args(node, "power-domains", "#power-domain-cells", 0,
> +					 &data->parent_pd);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "Failed to parse power domain\n");
> +
> +	devm_pm_runtime_enable(dev);
> +	/*
> +	 * Do a pm_runtime_resume_and_get() to workaround a possible
> +	 * deadlock between clk_register() and the genpd framework.
> +	 */
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret) {
> +		dev_err_probe(dev, ret, "Failed to runtime resume device\n");
> +		goto put_of_node;
> +	}
> +
> +	ret = mtk_clk_register_gates(dev, node, mfg_clks, ARRAY_SIZE(mfg_clks),
> +				     data->clk_data);
> +	if (ret) {
> +		dev_err_probe(dev, ret, "Failed to register clock gates\n");
> +		goto put_pm_runtime;
> +	}
> +
> +	data->clk_26m = clk_hw_get_clk(data->clk_data->hws[CLK_MFG_26M], "26m");
> +	if (IS_ERR(data->clk_26m)) {
> +		dev_err_probe(dev, PTR_ERR(data->clk_26m), "Failed to get 26 MHz clock\n");
> +		goto unregister_clks;
> +	}
> +
> +	ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, data->clk_data);
> +	if (ret) {
> +		dev_err_probe(dev, ret, "Failed to add clk OF provider\n");
> +		goto put_26m_clk;
> +	}
> +
> +	data->genpd.name = "mfg-top";
> +	data->genpd.power_on = clk_mt8173_mfgtop_power_on;
> +	data->genpd.power_off = clk_mt8173_mfgtop_power_off;
> +	ret = pm_genpd_init(&data->genpd, NULL, true);
> +	if (ret) {
> +		dev_err_probe(dev, ret, "Failed to add power domain\n");
> +		goto del_clk_provider;
> +	}
> +
> +	ret = of_genpd_add_provider_simple(node, &data->genpd);
> +	if (ret) {
> +		dev_err_probe(dev, ret, "Failed to add power domain OF provider\n");
> +		goto remove_pd;
> +	}
> +
> +	ret = of_genpd_add_subdomain(&data->parent_pd, &data->child_pd);
> +	if (ret) {
> +		dev_err_probe(dev, ret, "Failed to link PM domains\n");
> +		goto del_pd_provider;
> +	}
> +
> +	pm_runtime_put(dev);
> +	return 0;
> +
> +del_pd_provider:
> +	of_genpd_del_provider(node);
> +remove_pd:
> +	pm_genpd_remove(&data->genpd);
> +del_clk_provider:
> +	of_clk_del_provider(node);
> +put_26m_clk:
> +	clk_put(data->clk_26m);
> +unregister_clks:
> +	mtk_clk_unregister_gates(mfg_clks, ARRAY_SIZE(mfg_clks), data->clk_data);
> +put_pm_runtime:
> +	pm_runtime_put(dev);
> +put_of_node:
> +	of_node_put(data->parent_pd.np);
> +	return ret;
> +}
> +
> +static void clk_mt8173_mfgtop_remove(struct platform_device *pdev)
> +{
> +	struct mt8173_mfgtop_data *data = platform_get_drvdata(pdev);
> +	struct device_node *node = pdev->dev.of_node;
> +
> +	of_genpd_remove_subdomain(&data->parent_pd, &data->child_pd);
> +	of_genpd_del_provider(node);
> +	pm_genpd_remove(&data->genpd);
> +	of_clk_del_provider(node);
> +	clk_put(data->clk_26m);
> +	mtk_clk_unregister_gates(mfg_clks, ARRAY_SIZE(mfg_clks), data->clk_data);
> +}
> +
> +static const struct of_device_id of_match_clk_mt8173_mfgtop[] = {
> +	{ .compatible = "mediatek,mt8173-mfgtop", .data = &mfg_desc },

Is the match data and mfg_desc used?

Brian

> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, of_match_clk_mt8173_mfgtop);
> +
> +static struct platform_driver clk_mt8173_mfgtop_drv = {
> +	.probe = clk_mt8173_mfgtop_probe,
> +	.remove = clk_mt8173_mfgtop_remove,
> +	.driver = {
> +		.name = "clk-mt8173-mfgtop",
> +		.of_match_table = of_match_clk_mt8173_mfgtop,
> +	},
> +};
> +module_platform_driver(clk_mt8173_mfgtop_drv);
> +
> +MODULE_DESCRIPTION("MediaTek MT8173 mfgtop clock driver");
> +MODULE_LICENSE("GPL");
> -- 
> 2.53.0.1018.g2bb0e51243-goog
> 



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 2/5] clk: mediatek: Add mt8173-mfgtop driver
  2026-03-25  7:19 ` [PATCH v2 2/5] clk: mediatek: Add mt8173-mfgtop driver Chen-Yu Tsai
  2026-03-25 14:26   ` Brian Masney
@ 2026-03-26  1:24   ` kernel test robot
  2026-03-26  7:58   ` Dan Carpenter
  2 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2026-03-26  1:24 UTC (permalink / raw)
  To: Chen-Yu Tsai, Stephen Boyd, Matthias Brugger,
	AngeloGioacchino Del Regno, Frank Binns, Matt Coster,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: oe-kbuild-all, Icenowy Zheng, Chen-Yu Tsai, David Airlie,
	Simona Vetter, linux-clk, devicetree, linux-mediatek, dri-devel,
	linux-arm-kernel, linux-kernel

Hi Chen-Yu,

kernel test robot noticed the following build errors:

[auto build test ERROR on clk/clk-next]
[also build test ERROR on robh/for-next drm-misc/drm-misc-next linus/master v7.0-rc5 next-20260325]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Chen-Yu-Tsai/dt-bindings-clock-mediatek-Add-mt8173-mfgtop/20260325-202618
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
patch link:    https://lore.kernel.org/r/20260325071951.544031-3-wenst%40chromium.org
patch subject: [PATCH v2 2/5] clk: mediatek: Add mt8173-mfgtop driver
config: loongarch-randconfig-002-20260326 (https://download.01.org/0day-ci/archive/20260326/202603260926.gAEaAK0A-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 14.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260326/202603260926.gAEaAK0A-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603260926.gAEaAK0A-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/pmdomain/governor.c: In function 'default_suspend_ok':
>> drivers/pmdomain/governor.c:88:24: error: 'struct dev_pm_info' has no member named 'ignore_children'
      88 |         if (!dev->power.ignore_children)
         |                        ^
--
   drivers/pmdomain/core.c: In function 'genpd_queue_power_off_work':
>> drivers/pmdomain/core.c:941:20: error: 'pm_wq' undeclared (first use in this function)
     941 |         queue_work(pm_wq, &genpd->power_off_work);
         |                    ^~~~~
   drivers/pmdomain/core.c:941:20: note: each undeclared identifier is reported only once for each function it appears in
   drivers/pmdomain/core.c: In function 'genpd_dev_pm_qos_notifier':
>> drivers/pmdomain/core.c:1138:39: error: 'struct dev_pm_info' has no member named 'ignore_children'
    1138 |                 if (!dev || dev->power.ignore_children)
         |                                       ^
   drivers/pmdomain/core.c: In function 'rtpm_status_str':
>> drivers/pmdomain/core.c:3614:23: error: 'struct dev_pm_info' has no member named 'runtime_error'
    3614 |         if (dev->power.runtime_error)
         |                       ^
>> drivers/pmdomain/core.c:3616:28: error: 'struct dev_pm_info' has no member named 'disable_depth'
    3616 |         else if (dev->power.disable_depth)
         |                            ^
>> drivers/pmdomain/core.c:3618:28: error: 'struct dev_pm_info' has no member named 'runtime_status'
    3618 |         else if (dev->power.runtime_status < ARRAY_SIZE(status_lookup))
         |                            ^
   drivers/pmdomain/core.c:3619:45: error: 'struct dev_pm_info' has no member named 'runtime_status'
    3619 |                 p = status_lookup[dev->power.runtime_status];
         |                                             ^

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for PM_GENERIC_DOMAINS
   Depends on [n]: PM [=n]
   Selected by [m]:
   - COMMON_CLK_MT8173_MFGTOP [=m] && COMMON_CLK [=y] && (ARCH_MEDIATEK || COMPILE_TEST [=y]) && COMMON_CLK_MT8173 [=m]


vim +88 drivers/pmdomain/governor.c

a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29   49  
b02c999ac325e9 drivers/base/power/domain_governor.c Rafael J. Wysocki 2011-12-01   50  /**
9df3921e026532 drivers/base/power/domain_governor.c Ulf Hansson       2016-03-31   51   * default_suspend_ok - Default PM domain governor routine to suspend devices.
b02c999ac325e9 drivers/base/power/domain_governor.c Rafael J. Wysocki 2011-12-01   52   * @dev: Device to check.
3b2714c5d2d26d drivers/base/power/domain_governor.c Randy Dunlap      2023-12-05   53   *
3b2714c5d2d26d drivers/base/power/domain_governor.c Randy Dunlap      2023-12-05   54   * Returns: true if OK to suspend, false if not OK to suspend
b02c999ac325e9 drivers/base/power/domain_governor.c Rafael J. Wysocki 2011-12-01   55   */
9df3921e026532 drivers/base/power/domain_governor.c Ulf Hansson       2016-03-31   56  static bool default_suspend_ok(struct device *dev)
b02c999ac325e9 drivers/base/power/domain_governor.c Rafael J. Wysocki 2011-12-01   57  {
66d29d802ef3bf drivers/base/power/domain_governor.c Ulf Hansson       2022-05-11   58  	struct gpd_timing_data *td = dev_gpd_data(dev)->td;
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   59  	unsigned long flags;
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29   60  	s64 constraint_ns;
b02c999ac325e9 drivers/base/power/domain_governor.c Rafael J. Wysocki 2011-12-01   61  
b02c999ac325e9 drivers/base/power/domain_governor.c Rafael J. Wysocki 2011-12-01   62  	dev_dbg(dev, "%s()\n", __func__);
b02c999ac325e9 drivers/base/power/domain_governor.c Rafael J. Wysocki 2011-12-01   63  
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   64  	spin_lock_irqsave(&dev->power.lock, flags);
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   65  
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   66  	if (!td->constraint_changed) {
9df3921e026532 drivers/base/power/domain_governor.c Ulf Hansson       2016-03-31   67  		bool ret = td->cached_suspend_ok;
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   68  
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   69  		spin_unlock_irqrestore(&dev->power.lock, flags);
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   70  		return ret;
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   71  	}
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   72  	td->constraint_changed = false;
9df3921e026532 drivers/base/power/domain_governor.c Ulf Hansson       2016-03-31   73  	td->cached_suspend_ok = false;
0759e80b84e34a drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07   74  	td->effective_constraint_ns = 0;
8262331eaaf751 drivers/base/power/domain_governor.c Viresh Kumar      2019-07-04   75  	constraint_ns = __dev_pm_qos_resume_latency(dev);
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   76  
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   77  	spin_unlock_irqrestore(&dev->power.lock, flags);
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   78  
0759e80b84e34a drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07   79  	if (constraint_ns == 0)
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29   80  		return false;
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29   81  
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29   82  	constraint_ns *= NSEC_PER_USEC;
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29   83  	/*
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29   84  	 * We can walk the children without any additional locking, because
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   85  	 * they all have been suspended at this point and their
6ff7bb0d02f829 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-05-01   86  	 * effective_constraint_ns fields won't be modified in parallel with us.
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29   87  	 */
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29  @88  	if (!dev->power.ignore_children)
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29   89  		device_for_each_child(dev, &constraint_ns,
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29   90  				      dev_update_qos_constraint);
b02c999ac325e9 drivers/base/power/domain_governor.c Rafael J. Wysocki 2011-12-01   91  
0759e80b84e34a drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07   92  	if (constraint_ns == PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS) {
704d2ce6603f7e drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07   93  		/* "No restriction", so the device is allowed to suspend. */
0759e80b84e34a drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07   94  		td->effective_constraint_ns = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS;
704d2ce6603f7e drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07   95  		td->cached_suspend_ok = true;
0759e80b84e34a drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07   96  	} else if (constraint_ns == 0) {
704d2ce6603f7e drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07   97  		/*
704d2ce6603f7e drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07   98  		 * This triggers if one of the children that don't belong to a
0759e80b84e34a drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07   99  		 * domain has a zero PM QoS constraint and it's better not to
0759e80b84e34a drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  100  		 * suspend then.  effective_constraint_ns is zero already and
0759e80b84e34a drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  101  		 * cached_suspend_ok is false, so bail out.
704d2ce6603f7e drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  102  		 */
704d2ce6603f7e drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  103  		return false;
704d2ce6603f7e drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  104  	} else {
2b1d88cda32f81 drivers/base/power/domain_governor.c Ulf Hansson       2015-10-15  105  		constraint_ns -= td->suspend_latency_ns +
2b1d88cda32f81 drivers/base/power/domain_governor.c Ulf Hansson       2015-10-15  106  				td->resume_latency_ns;
704d2ce6603f7e drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  107  		/*
0759e80b84e34a drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  108  		 * effective_constraint_ns is zero already and cached_suspend_ok
0759e80b84e34a drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  109  		 * is false, so if the computed value is not positive, return
0759e80b84e34a drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  110  		 * right away.
704d2ce6603f7e drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  111  		 */
704d2ce6603f7e drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  112  		if (constraint_ns <= 0)
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29  113  			return false;
704d2ce6603f7e drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  114  
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29  115  		td->effective_constraint_ns = constraint_ns;
704d2ce6603f7e drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  116  		td->cached_suspend_ok = true;
704d2ce6603f7e drivers/base/power/domain_governor.c Rafael J. Wysocki 2017-11-07  117  	}
a98f1b78ecf325 drivers/base/power/domain_governor.c Ulf Hansson       2015-10-13  118  
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29  119  	/*
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29  120  	 * The children have been suspended already, so we don't need to take
9df3921e026532 drivers/base/power/domain_governor.c Ulf Hansson       2016-03-31  121  	 * their suspend latencies into account here.
a5bef810ad9816 drivers/base/power/domain_governor.c Rafael J. Wysocki 2012-04-29  122  	 */
9df3921e026532 drivers/base/power/domain_governor.c Ulf Hansson       2016-03-31  123  	return td->cached_suspend_ok;
b02c999ac325e9 drivers/base/power/domain_governor.c Rafael J. Wysocki 2011-12-01  124  }
b02c999ac325e9 drivers/base/power/domain_governor.c Rafael J. Wysocki 2011-12-01  125  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 0/5] powervr: MT8173 GPU support
  2026-03-25  9:11       ` Icenowy Zheng
@ 2026-03-26  5:56         ` Icenowy Zheng
  2026-03-26  9:55           ` Icenowy Zheng
  0 siblings, 1 reply; 17+ messages in thread
From: Icenowy Zheng @ 2026-03-26  5:56 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, linux-clk,
	devicetree, linux-mediatek, dri-devel, linux-arm-kernel,
	linux-kernel

在 2026-03-25三的 17:11 +0800,Icenowy Zheng写道:
> 在 2026-03-25三的 16:30 +0800,Icenowy Zheng写道:
> > 在 2026-03-25三的 16:08 +0800,Chen-Yu Tsai写道:
> > > On Wed, Mar 25, 2026 at 4:04 PM Icenowy Zheng <uwu@icenowy.me>
> > > wrote:
> > > > 
> > > > 在 2026-03-25三的 15:19 +0800,Chen-Yu Tsai写道:
> > > > > Hi everyone,
> > > > > 
> > > > > This is v2 of my MT8173 PowerVR GPU support series.
> > > > > 
> > > > > Changes since v1:
> > > > > - Adapted to changed DT bindings
> > > > > - Dropped driver change
> > > > > - Use same power domain for "a" and "b" GPU power domains
> > > > > 
> > > > > This update was requested by Icenowy.
> > > > > 
> > > > > 
> > > > > This series enables the PowerVR GPU found in the MT8173 SoC,
> > > > > found in
> > > > > some Chromebooks.
> > > > > 
> > > > > This version is different from the initial powervr driver
> > > > > submission
> > > > > [1]
> > > > > in that it splits out the GPU glue layer support out of the
> > > > > powervr
> > > > > driver and into a separate clock and power domain driver. The
> > > > > glue
> > > > > code
> > > > > is otherwise the same, and also the same as found in the
> > > > > ChromeOS
> > > > > kernels, with some extra comments and macro names added where
> > > > > possible.
> > > > > 
> > > > > Patch 1 adds a binding for the glue layer, called mfgtop. The
> > > > > glue
> > > > > layer
> > > > > contains clock and power controls for the GPU.
> > > > > 
> > > > > Patch 2 adds a driver for the glue layer.
> > > > > 
> > > > > Patch 3 adds an entry for the MT8173 GPU and 6XT series to
> > > > > the
> > > > > PowerVR
> > > > > binding.
> > > > > 
> > > > > Patch 4 adds an entry for the PowerVR 6XT series GPU to the
> > > > > driver.
> > > > > 
> > > > > Patch 5 corrects the clock for the GPU (called MFG) power
> > > > > domain.
> > > > > 
> > > > > Patch 6 adds device nodes for the GPU and glue layer to the
> > > > > MT8173
> > > > > dtsi
> > > > > file.
> > > > > 
> > > > > Patch 2 and 6 depend on patch 1 to build. I suppose some
> > > > > common
> > > > > immutable tree would be needed from the MediaTek maintainers.
> > > > > 
> > > > > The kernel driver successfully probes the hardware and loads
> > > > > the
> > > > > "rogue_4.40.2.51_v1.fw" firmware provided by Imagination
> > > > > Technologies
> > > > > [2].
> > > > > Userspace was tested with Mesa 24.0.8 from Debian Trixie
> > > > > rebuilt
> > > > > with
> > > > > the powervr vulkan driver enabled. `vulkaninfo` gives some
> > > > > information
> > > > > about the GPU (attached at the end), but running the
> > > > > `triangle`
> > > > > example
> > > > > from the Sascha Willems demos [3] with -DUSE_D2D_WSI=ON as
> > > > > recommended [4]
> > > > > failed with:
> > > > > 
> > > > >     Can't find a display and a display mode!
> > > > 
> > > > I think when using D2D the demos want width and height to be
> > > > explicitly
> > > > specified, otherwise it seems to hardcode 1280x720.
> > > > 
> > > > If you're using an elm, could you try to add `-w 1920 -h 1080`
> > > > or
> > > > for
> > > > hana `-w 1366 -h 768` ?
> > > 
> > > I only did the basic `vulkaninfo` test this time around. To do
> > > anything
> > > interesting probably requires the Mesa 26.1 release.
> > > 
> > >     PVR_I_WANT_A_BROKEN_VULKAN_DRIVER=1 \
> > >         vkmark --winsys kms -D b81f54f8568deb0fb70a6a1ed845b65d
> > > 
> > > just reports "Error: Device specified by uuid is not available"
> > 
> > I am very sorry to tell you that, when I run Sascha's demo with
> > Mesa
> > main, I got GPU lost immediately...
> > 
> > ```
> > [  441.509433] powervr 13000000.gpu: [drm] *ERROR* GPU device lost
> > ```

The device lost message seems to be some bug of the open source KMD or
the firmware.

When I disable runtime power management of the 13000000.gpu device,
this message does not appear, instead the following message appears and
the GPU can continue to accept jobs:

```
powervr 13000000.gpu: [drm] Received unknown FWCCB command 2abc0070
```

> 
> However, Zink on PowerVR works, and on Lichee Pi 4A I also got
> `VK_ERROR_DEVICE_LOST` when running Sascha's demos (although the
> kernel
> does not report device lost).
> 
> I bet it's a regression on the VK_KHR_display code.

I'm now sure that it's a regression, it's now tracked at [1].

[1] https://gitlab.freedesktop.org/mesa/mesa/-/issues/15161

> 
> Thanks,
> Icenowy
> 
> > 
> > Icenowy
> > 
> > > 
> > > This is with Mesa 26.0.2 packages from Debian testing. At least
> > > now
> > > have the powervr vulkan driver enabled by default, so I don't
> > > have
> > > to rebuild the packages again.
> > > 
> > > 
> > > ChenYu
> > > 
> > > > Thanks
> > > > Icenowy
> > > > 
> > > > > 
> > > > > Same program worked correctly on a BeaglePlay and displayed a
> > > > > color
> > > > > gradient triangle. Not sure what went wrong here.
> > > > > 
> > > > > Anyway, please have a look and test.
> > > > > 
> > > > > 
> > > > > Thanks
> > > > > ChenYu
> > > > > 
> > > > > [1]
> > > > > https://lore.kernel.org/dri-devel/20220815165156.118212-2-sarah.walker@imgtec.com/
> > > > > [2]
> > > > > https://gitlab.freedesktop.org/imagination/linux-firmware/-/tree/powervr
> > > > > [3] https://github.com/SaschaWillems/Vulkan
> > > > > [4]
> > > > > https://lore.kernel.org/dri-devel/f2b2671e-5acc-4dec-9c2e-3c9cd2e1f19e@imgtec.com/
> > > > > 
> > > > > Chen-Yu Tsai (5):
> > > > >   dt-bindings: clock: mediatek: Add mt8173 mfgtop
> > > > >   clk: mediatek: Add mt8173-mfgtop driver
> > > > >   dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU
> > > > >   arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain
> > > > > clock
> > > > >   arm64: dts: mediatek: mt8173: Add GPU device nodes
> > > > > 
> > > > >  .../clock/mediatek,mt8173-mfgtop.yaml         |  70 +++++
> > > > >  .../bindings/gpu/img,powervr-rogue.yaml       |   1 +
> > > > >  arch/arm64/boot/dts/mediatek/mt8173.dtsi      |  33 ++-
> > > > >  drivers/clk/mediatek/Kconfig                  |   9 +
> > > > >  drivers/clk/mediatek/Makefile                 |   1 +
> > > > >  drivers/clk/mediatek/clk-mt8173-mfgtop.c      | 243
> > > > > ++++++++++++++++++
> > > > >  include/dt-bindings/clock/mt8173-clk.h        |   7 +
> > > > >  7 files changed, 363 insertions(+), 1 deletion(-)
> > > > >  create mode 100644
> > > > > Documentation/devicetree/bindings/clock/mediatek,mt8173-
> > > > > mfgtop.yaml
> > > > >  create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 2/5] clk: mediatek: Add mt8173-mfgtop driver
  2026-03-25  7:19 ` [PATCH v2 2/5] clk: mediatek: Add mt8173-mfgtop driver Chen-Yu Tsai
  2026-03-25 14:26   ` Brian Masney
  2026-03-26  1:24   ` kernel test robot
@ 2026-03-26  7:58   ` Dan Carpenter
  2 siblings, 0 replies; 17+ messages in thread
From: Dan Carpenter @ 2026-03-26  7:58 UTC (permalink / raw)
  To: oe-kbuild, Chen-Yu Tsai, Stephen Boyd, Matthias Brugger,
	AngeloGioacchino Del Regno, Frank Binns, Matt Coster,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: lkp, oe-kbuild-all, Icenowy Zheng, Chen-Yu Tsai, David Airlie,
	Simona Vetter, linux-clk, devicetree, linux-mediatek, dri-devel,
	linux-arm-kernel, linux-kernel

Hi Chen-Yu,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Chen-Yu-Tsai/dt-bindings-clock-mediatek-Add-mt8173-mfgtop/20260325-202618
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
patch link:    https://lore.kernel.org/r/20260325071951.544031-3-wenst%40chromium.org
patch subject: [PATCH v2 2/5] clk: mediatek: Add mt8173-mfgtop driver
config: csky-randconfig-r073-20260326 (https://download.01.org/0day-ci/archive/20260326/202603261444.jANdMbNC-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 11.5.0
smatch: v0.5.0-9004-gb810ac53

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202603261444.jANdMbNC-lkp@intel.com/

smatch warnings:
drivers/clk/mediatek/clk-mt8173-mfgtop.c:163 clk_mt8173_mfgtop_probe() warn: missing error code 'ret'

vim +/ret +163 drivers/clk/mediatek/clk-mt8173-mfgtop.c

edc2074329e271 Chen-Yu Tsai 2026-03-25  153  	ret = mtk_clk_register_gates(dev, node, mfg_clks, ARRAY_SIZE(mfg_clks),
edc2074329e271 Chen-Yu Tsai 2026-03-25  154  				     data->clk_data);
edc2074329e271 Chen-Yu Tsai 2026-03-25  155  	if (ret) {
edc2074329e271 Chen-Yu Tsai 2026-03-25  156  		dev_err_probe(dev, ret, "Failed to register clock gates\n");
edc2074329e271 Chen-Yu Tsai 2026-03-25  157  		goto put_pm_runtime;
edc2074329e271 Chen-Yu Tsai 2026-03-25  158  	}
edc2074329e271 Chen-Yu Tsai 2026-03-25  159  
edc2074329e271 Chen-Yu Tsai 2026-03-25  160  	data->clk_26m = clk_hw_get_clk(data->clk_data->hws[CLK_MFG_26M], "26m");
edc2074329e271 Chen-Yu Tsai 2026-03-25  161  	if (IS_ERR(data->clk_26m)) {
edc2074329e271 Chen-Yu Tsai 2026-03-25  162  		dev_err_probe(dev, PTR_ERR(data->clk_26m), "Failed to get 26 MHz clock\n");
edc2074329e271 Chen-Yu Tsai 2026-03-25 @163  		goto unregister_clks;

ret = dev_err_probe() or ret = PTR_ERR(data->clk_26m)?

edc2074329e271 Chen-Yu Tsai 2026-03-25  164  	}
edc2074329e271 Chen-Yu Tsai 2026-03-25  165  
edc2074329e271 Chen-Yu Tsai 2026-03-25  166  	ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, data->clk_data);
edc2074329e271 Chen-Yu Tsai 2026-03-25  167  	if (ret) {
edc2074329e271 Chen-Yu Tsai 2026-03-25  168  		dev_err_probe(dev, ret, "Failed to add clk OF provider\n");
edc2074329e271 Chen-Yu Tsai 2026-03-25  169  		goto put_26m_clk;
edc2074329e271 Chen-Yu Tsai 2026-03-25  170  	}
edc2074329e271 Chen-Yu Tsai 2026-03-25  171  
edc2074329e271 Chen-Yu Tsai 2026-03-25  172  	data->genpd.name = "mfg-top";
edc2074329e271 Chen-Yu Tsai 2026-03-25  173  	data->genpd.power_on = clk_mt8173_mfgtop_power_on;
edc2074329e271 Chen-Yu Tsai 2026-03-25  174  	data->genpd.power_off = clk_mt8173_mfgtop_power_off;
edc2074329e271 Chen-Yu Tsai 2026-03-25  175  	ret = pm_genpd_init(&data->genpd, NULL, true);
edc2074329e271 Chen-Yu Tsai 2026-03-25  176  	if (ret) {
edc2074329e271 Chen-Yu Tsai 2026-03-25  177  		dev_err_probe(dev, ret, "Failed to add power domain\n");
edc2074329e271 Chen-Yu Tsai 2026-03-25  178  		goto del_clk_provider;
edc2074329e271 Chen-Yu Tsai 2026-03-25  179  	}
edc2074329e271 Chen-Yu Tsai 2026-03-25  180  
edc2074329e271 Chen-Yu Tsai 2026-03-25  181  	ret = of_genpd_add_provider_simple(node, &data->genpd);
edc2074329e271 Chen-Yu Tsai 2026-03-25  182  	if (ret) {
edc2074329e271 Chen-Yu Tsai 2026-03-25  183  		dev_err_probe(dev, ret, "Failed to add power domain OF provider\n");
edc2074329e271 Chen-Yu Tsai 2026-03-25  184  		goto remove_pd;
edc2074329e271 Chen-Yu Tsai 2026-03-25  185  	}
edc2074329e271 Chen-Yu Tsai 2026-03-25  186  
edc2074329e271 Chen-Yu Tsai 2026-03-25  187  	ret = of_genpd_add_subdomain(&data->parent_pd, &data->child_pd);
edc2074329e271 Chen-Yu Tsai 2026-03-25  188  	if (ret) {
edc2074329e271 Chen-Yu Tsai 2026-03-25  189  		dev_err_probe(dev, ret, "Failed to link PM domains\n");
edc2074329e271 Chen-Yu Tsai 2026-03-25  190  		goto del_pd_provider;
edc2074329e271 Chen-Yu Tsai 2026-03-25  191  	}
edc2074329e271 Chen-Yu Tsai 2026-03-25  192  
edc2074329e271 Chen-Yu Tsai 2026-03-25  193  	pm_runtime_put(dev);
edc2074329e271 Chen-Yu Tsai 2026-03-25  194  	return 0;
edc2074329e271 Chen-Yu Tsai 2026-03-25  195  
edc2074329e271 Chen-Yu Tsai 2026-03-25  196  del_pd_provider:
edc2074329e271 Chen-Yu Tsai 2026-03-25  197  	of_genpd_del_provider(node);
edc2074329e271 Chen-Yu Tsai 2026-03-25  198  remove_pd:
edc2074329e271 Chen-Yu Tsai 2026-03-25  199  	pm_genpd_remove(&data->genpd);
edc2074329e271 Chen-Yu Tsai 2026-03-25  200  del_clk_provider:
edc2074329e271 Chen-Yu Tsai 2026-03-25  201  	of_clk_del_provider(node);
edc2074329e271 Chen-Yu Tsai 2026-03-25  202  put_26m_clk:
edc2074329e271 Chen-Yu Tsai 2026-03-25  203  	clk_put(data->clk_26m);
edc2074329e271 Chen-Yu Tsai 2026-03-25  204  unregister_clks:
edc2074329e271 Chen-Yu Tsai 2026-03-25  205  	mtk_clk_unregister_gates(mfg_clks, ARRAY_SIZE(mfg_clks), data->clk_data);
edc2074329e271 Chen-Yu Tsai 2026-03-25  206  put_pm_runtime:
edc2074329e271 Chen-Yu Tsai 2026-03-25  207  	pm_runtime_put(dev);
edc2074329e271 Chen-Yu Tsai 2026-03-25  208  put_of_node:
edc2074329e271 Chen-Yu Tsai 2026-03-25  209  	of_node_put(data->parent_pd.np);
edc2074329e271 Chen-Yu Tsai 2026-03-25  210  	return ret;
edc2074329e271 Chen-Yu Tsai 2026-03-25  211  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 0/5] powervr: MT8173 GPU support
  2026-03-26  5:56         ` Icenowy Zheng
@ 2026-03-26  9:55           ` Icenowy Zheng
  0 siblings, 0 replies; 17+ messages in thread
From: Icenowy Zheng @ 2026-03-26  9:55 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, linux-clk,
	devicetree, linux-mediatek, dri-devel, linux-arm-kernel,
	linux-kernel

在 2026-03-26四的 13:56 +0800,Icenowy Zheng写道:
> 在 2026-03-25三的 17:11 +0800,Icenowy Zheng写道:
> > 在 2026-03-25三的 16:30 +0800,Icenowy Zheng写道:
> > > 在 2026-03-25三的 16:08 +0800,Chen-Yu Tsai写道:
> > > > On Wed, Mar 25, 2026 at 4:04 PM Icenowy Zheng <uwu@icenowy.me>
> > > > wrote:
> > > > > 
> > > > > 在 2026-03-25三的 15:19 +0800,Chen-Yu Tsai写道:
> > > > > > Hi everyone,
> > > > > > 
> > > > > > This is v2 of my MT8173 PowerVR GPU support series.
> > > > > > 
> > > > > > Changes since v1:
> > > > > > - Adapted to changed DT bindings
> > > > > > - Dropped driver change
> > > > > > - Use same power domain for "a" and "b" GPU power domains
> > > > > > 
> > > > > > This update was requested by Icenowy.
> > > > > > 
> > > > > > 
> > > > > > This series enables the PowerVR GPU found in the MT8173
> > > > > > SoC,
> > > > > > found in
> > > > > > some Chromebooks.
> > > > > > 
> > > > > > This version is different from the initial powervr driver
> > > > > > submission
> > > > > > [1]
> > > > > > in that it splits out the GPU glue layer support out of the
> > > > > > powervr
> > > > > > driver and into a separate clock and power domain driver.
> > > > > > The
> > > > > > glue
> > > > > > code
> > > > > > is otherwise the same, and also the same as found in the
> > > > > > ChromeOS
> > > > > > kernels, with some extra comments and macro names added
> > > > > > where
> > > > > > possible.
> > > > > > 
> > > > > > Patch 1 adds a binding for the glue layer, called mfgtop.
> > > > > > The
> > > > > > glue
> > > > > > layer
> > > > > > contains clock and power controls for the GPU.
> > > > > > 
> > > > > > Patch 2 adds a driver for the glue layer.
> > > > > > 
> > > > > > Patch 3 adds an entry for the MT8173 GPU and 6XT series to
> > > > > > the
> > > > > > PowerVR
> > > > > > binding.
> > > > > > 
> > > > > > Patch 4 adds an entry for the PowerVR 6XT series GPU to the
> > > > > > driver.
> > > > > > 
> > > > > > Patch 5 corrects the clock for the GPU (called MFG) power
> > > > > > domain.
> > > > > > 
> > > > > > Patch 6 adds device nodes for the GPU and glue layer to the
> > > > > > MT8173
> > > > > > dtsi
> > > > > > file.
> > > > > > 
> > > > > > Patch 2 and 6 depend on patch 1 to build. I suppose some
> > > > > > common
> > > > > > immutable tree would be needed from the MediaTek
> > > > > > maintainers.
> > > > > > 
> > > > > > The kernel driver successfully probes the hardware and
> > > > > > loads
> > > > > > the
> > > > > > "rogue_4.40.2.51_v1.fw" firmware provided by Imagination
> > > > > > Technologies
> > > > > > [2].
> > > > > > Userspace was tested with Mesa 24.0.8 from Debian Trixie
> > > > > > rebuilt
> > > > > > with
> > > > > > the powervr vulkan driver enabled. `vulkaninfo` gives some
> > > > > > information
> > > > > > about the GPU (attached at the end), but running the
> > > > > > `triangle`
> > > > > > example
> > > > > > from the Sascha Willems demos [3] with -DUSE_D2D_WSI=ON as
> > > > > > recommended [4]
> > > > > > failed with:
> > > > > > 
> > > > > >     Can't find a display and a display mode!
> > > > > 
> > > > > I think when using D2D the demos want width and height to be
> > > > > explicitly
> > > > > specified, otherwise it seems to hardcode 1280x720.
> > > > > 
> > > > > If you're using an elm, could you try to add `-w 1920 -h
> > > > > 1080`
> > > > > or
> > > > > for
> > > > > hana `-w 1366 -h 768` ?
> > > > 
> > > > I only did the basic `vulkaninfo` test this time around. To do
> > > > anything
> > > > interesting probably requires the Mesa 26.1 release.
> > > > 
> > > >     PVR_I_WANT_A_BROKEN_VULKAN_DRIVER=1 \
> > > >         vkmark --winsys kms -D b81f54f8568deb0fb70a6a1ed845b65d
> > > > 
> > > > just reports "Error: Device specified by uuid is not available"
> > > 
> > > I am very sorry to tell you that, when I run Sascha's demo with
> > > Mesa
> > > main, I got GPU lost immediately...
> > > 
> > > ```
> > > [  441.509433] powervr 13000000.gpu: [drm] *ERROR* GPU device
> > > lost
> > > ```
> 
> The device lost message seems to be some bug of the open source KMD
> or
> the firmware.
> 
> When I disable runtime power management of the 13000000.gpu device,
> this message does not appear, instead the following message appears
> and
> the GPU can continue to accept jobs:
> 
> ```
> powervr 13000000.gpu: [drm] Received unknown FWCCB command 2abc0070
> ```

Both the device lost behavior and this message are suspicious, but at
least they shouldn't be this patchset's fault.

So, for patches 2, 4, 5 in this patchset:

`Tested-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>`

(DT binding maintainers suggest not to give binding patches t-b tags)

> 
> > 
> > However, Zink on PowerVR works, and on Lichee Pi 4A I also got
> > `VK_ERROR_DEVICE_LOST` when running Sascha's demos (although the
> > kernel
> > does not report device lost).
> > 
> > I bet it's a regression on the VK_KHR_display code.
> 
> I'm now sure that it's a regression, it's now tracked at [1].

It's now getting fixed (Mesa MR !40640, already being processed by
Marge Bot).

Thanks,
Icenowy

> 
> [1] https://gitlab.freedesktop.org/mesa/mesa/-/issues/15161
> 
> > 
> > Thanks,
> > Icenowy
> > 
> > > 
> > > Icenowy
> > > 
> > > > 
> > > > This is with Mesa 26.0.2 packages from Debian testing. At least
> > > > now
> > > > have the powervr vulkan driver enabled by default, so I don't
> > > > have
> > > > to rebuild the packages again.
> > > > 
> > > > 
> > > > ChenYu
> > > > 
> > > > > Thanks
> > > > > Icenowy
> > > > > 
> > > > > > 
> > > > > > Same program worked correctly on a BeaglePlay and displayed
> > > > > > a
> > > > > > color
> > > > > > gradient triangle. Not sure what went wrong here.
> > > > > > 
> > > > > > Anyway, please have a look and test.
> > > > > > 
> > > > > > 
> > > > > > Thanks
> > > > > > ChenYu
> > > > > > 
> > > > > > [1]
> > > > > > https://lore.kernel.org/dri-devel/20220815165156.118212-2-sarah.walker@imgtec.com/
> > > > > > [2]
> > > > > > https://gitlab.freedesktop.org/imagination/linux-firmware/-/tree/powervr
> > > > > > [3] https://github.com/SaschaWillems/Vulkan
> > > > > > [4]
> > > > > > https://lore.kernel.org/dri-devel/f2b2671e-5acc-4dec-9c2e-3c9cd2e1f19e@imgtec.com/
> > > > > > 
> > > > > > Chen-Yu Tsai (5):
> > > > > >   dt-bindings: clock: mediatek: Add mt8173 mfgtop
> > > > > >   clk: mediatek: Add mt8173-mfgtop driver
> > > > > >   dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU
> > > > > >   arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain
> > > > > > clock
> > > > > >   arm64: dts: mediatek: mt8173: Add GPU device nodes
> > > > > > 
> > > > > >  .../clock/mediatek,mt8173-mfgtop.yaml         |  70 +++++
> > > > > >  .../bindings/gpu/img,powervr-rogue.yaml       |   1 +
> > > > > >  arch/arm64/boot/dts/mediatek/mt8173.dtsi      |  33 ++-
> > > > > >  drivers/clk/mediatek/Kconfig                  |   9 +
> > > > > >  drivers/clk/mediatek/Makefile                 |   1 +
> > > > > >  drivers/clk/mediatek/clk-mt8173-mfgtop.c      | 243
> > > > > > ++++++++++++++++++
> > > > > >  include/dt-bindings/clock/mt8173-clk.h        |   7 +
> > > > > >  7 files changed, 363 insertions(+), 1 deletion(-)
> > > > > >  create mode 100644
> > > > > > Documentation/devicetree/bindings/clock/mediatek,mt8173-
> > > > > > mfgtop.yaml
> > > > > >  create mode 100644 drivers/clk/mediatek/clk-mt8173-
> > > > > > mfgtop.c


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-03-26  9:56 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25  7:19 [PATCH v2 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
2026-03-25  7:19 ` [PATCH v2 1/5] dt-bindings: clock: mediatek: Add mt8173 mfgtop Chen-Yu Tsai
2026-03-25  7:19 ` [PATCH v2 2/5] clk: mediatek: Add mt8173-mfgtop driver Chen-Yu Tsai
2026-03-25 14:26   ` Brian Masney
2026-03-26  1:24   ` kernel test robot
2026-03-26  7:58   ` Dan Carpenter
2026-03-25  7:19 ` [PATCH v2 3/5] dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU Chen-Yu Tsai
2026-03-25  7:19 ` [PATCH v2 4/5] arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock Chen-Yu Tsai
2026-03-25  7:19 ` [PATCH v2 5/5] arm64: dts: mediatek: mt8173: Add GPU device nodes Chen-Yu Tsai
2026-03-25  8:03 ` [PATCH v2 0/5] powervr: MT8173 GPU support Icenowy Zheng
2026-03-25  8:08   ` Chen-Yu Tsai
2026-03-25  8:30     ` Icenowy Zheng
2026-03-25  8:41       ` Icenowy Zheng
2026-03-25  9:17         ` Chen-Yu Tsai
2026-03-25  9:11       ` Icenowy Zheng
2026-03-26  5:56         ` Icenowy Zheng
2026-03-26  9:55           ` Icenowy Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox