[PATCH v2 3/4] pmdomain: mediatek: mt8188: Enable the GPU timestamp counter
Michał Kopeć
michal at nozomi.space
Sun Oct 11 11:47:54 PDT 2026
The GPU timestamp counter only counts once the TOP_TSVALUEB enable bits
in MFGCFG feed it the SoC system timer, and MFGCFG loses them whenever
the MFG1 power domain is turned off. Without them GPU_TIMESTAMP reads
zero, so timestamp queries in userspace drivers and the timestamps
written by GPU jobs are always zero.
Add MFGCFG as the second MT8188 access controller and set the bits every
time MFG1 has been powered on.
Signed-off-by: Michał Kopeć <michal at nozomi.space>
---
drivers/pmdomain/mediatek/mt8188-pm-domains.h | 16 +++++++++++++++-
drivers/pmdomain/mediatek/mtk-pm-domains.h | 1 +
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/pmdomain/mediatek/mt8188-pm-domains.h b/drivers/pmdomain/mediatek/mt8188-pm-domains.h
index 3a989e83e9b79..88035cc6a808b 100644
--- a/drivers/pmdomain/mediatek/mt8188-pm-domains.h
+++ b/drivers/pmdomain/mediatek/mt8188-pm-domains.h
@@ -14,8 +14,21 @@
* MT8188 power domain support
*/
+#define MT8188_MFG_TIMESTAMP 0x130
+#define MT8188_MFG_TIMESTAMP_EN GENMASK(1, 0)
+
static enum scpsys_bus_prot_block scpsys_bus_prot_blocks_mt8188[] = {
- BUS_PROT_BLOCK_INFRA
+ BUS_PROT_BLOCK_INFRA, BUS_PROT_BLOCK_MFGCFG
+};
+
+/*
+ * The GPU timestamp counter only counts once MFGCFG feeds it the SoC system
+ * timer, which MFGCFG forgets whenever MFG1 is powered off.
+ */
+static const struct scpsys_reg_init mt8188_mfg_timestamp = {
+ .block = BUS_PROT_BLOCK_MFGCFG,
+ .ofs = MT8188_MFG_TIMESTAMP,
+ .val = MT8188_MFG_TIMESTAMP_EN,
};
static const struct scpsys_domain_data scpsys_domain_data_mt8188[] = {
@@ -70,6 +83,7 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8188[] = {
MT8188_TOP_AXI_PROT_EN_SUB_INFRA_VDNR_STA),
},
.caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_DOMAIN_SUPPLY,
+ .reg_init = &mt8188_mfg_timestamp,
},
[MT8188_POWER_DOMAIN_MFG2] = {
.name = "mfg2",
diff --git a/drivers/pmdomain/mediatek/mtk-pm-domains.h b/drivers/pmdomain/mediatek/mtk-pm-domains.h
index 4c2c56addb3cc..191d5cfb60fe7 100644
--- a/drivers/pmdomain/mediatek/mtk-pm-domains.h
+++ b/drivers/pmdomain/mediatek/mtk-pm-domains.h
@@ -71,6 +71,7 @@ enum scpsys_bus_prot_block {
BUS_PROT_BLOCK_CAM_SUB0,
BUS_PROT_BLOCK_IPE_SUB0,
BUS_PROT_BLOCK_VLP,
+ BUS_PROT_BLOCK_MFGCFG,
BUS_PROT_BLOCK_COUNT,
};
--
2.56.0
More information about the linux-arm-kernel
mailing list