From: "Nils Büchner" <nils@buechner.me>
To: Ulf Hansson <ulfh@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
"Nils Büchner" <nils@buechner.me>
Subject: [PATCH] pmdomain: mediatek: Don't power off default-off domains in probe cleanup
Date: Tue, 6 Oct 2026 04:53:18 +0200 [thread overview]
Message-ID: <20261006025318.503422-1-nils@buechner.me> (raw)
scpsys_remove_one_domain() runs the power-off sequence for every domain
that reads back as on. Domains with MTK_SCPD_KEEP_DEFAULT_OFF are
registered with genpd as off and are never powered on by the driver
before the provider is added, so their clocks are not enabled. When the
bootloader left such a domain on and scpsys_probe() fails (typically
-EPROBE_DEFER) after it was added, the cleanup disables those clocks
anyway, triggering "already disabled"/"already unprepared" warnings from
the clock core.
Seen on MT8183 Juniper once the audio domain is KEEP_DEFAULT_OFF: six
clk_core_disable/unprepare WARNs with backtraces on every boot.
Skip the power-off sequence for these domains; only drop the clock
references.
Runtime-tested on an Acer Chromebook Spin 311 (MT8183, juniper) with a
7.0-based kernel (the hardware is not set up to boot mainline);
build-tested on mainline with W=1. On the device with the audio
domain marked MTK_SCPD_KEEP_DEFAULT_OFF: the six clk core warnings on
the deferred first probe are gone and audio still works.
The change and this changelog were drafted with an AI coding assistant
during a debugging session on the hardware; they were reviewed and
tested by the submitter.
Fixes: c1f3163d8ff3 ("soc: mediatek: pm-domains: Add default power off flag")
Assisted-by: Claude Opus 5.5
Signed-off-by: Nils Büchner <nils@buechner.me>
---
This is a follow-up to "pmdomain: mediatek: mt8183: Fix silent audio
from premature sync_state" (sent 2026-10-05), which marks the MT8183
audio domain MTK_SCPD_KEEP_DEFAULT_OFF. With that applied, the firmware
leaves the audio domain on at boot, so a deferred first probe of
scpsys runs into this cleanup path on every boot. The fix itself is
independent and applies on its own.
drivers/pmdomain/mediatek/mtk-pm-domains.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/pmdomain/mediatek/mtk-pm-domains.c b/drivers/pmdomain/mediatek/mtk-pm-domains.c
index f0fa79e01..2b41bb8ed 100644
--- a/drivers/pmdomain/mediatek/mtk-pm-domains.c
+++ b/drivers/pmdomain/mediatek/mtk-pm-domains.c
@@ -1100,6 +1100,16 @@ static void scpsys_remove_one_domain(struct scpsys_domain *pd)
"failed to remove domain '%s' : %d - state may be inconsistent\n",
pd->genpd.name, ret);
+ /*
+ * Domains with MTK_SCPD_KEEP_DEFAULT_OFF are registered as off and were
+ * never powered on by this driver (nothing can use them before the
+ * provider is added), so their clocks were never enabled. If the
+ * bootloader left one on, running the power-off sequence here would
+ * disable clocks that are not enabled.
+ */
+ if (MTK_SCPD_CAPS(pd, MTK_SCPD_KEEP_DEFAULT_OFF))
+ goto put_clocks;
+
if (scpsys->soc_data->type == SCPSYS_MTCMOS_TYPE_HW_VOTER) {
if (scpsys_hwv_domain_is_enable_done(pd))
scpsys_hwv_power_off_internal(pd);
@@ -1108,6 +1118,7 @@ static void scpsys_remove_one_domain(struct scpsys_domain *pd)
scpsys_power_off_internal(pd);
}
+put_clocks:
clk_bulk_put(pd->num_clks, pd->clks);
clk_bulk_put(pd->num_subsys_clks, pd->subsys_clks);
}
--
2.53.0
reply other threads:[~2026-10-06 2:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261006025318.503422-1-nils@buechner.me \
--to=nils@buechner.me \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=ulfh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox