* [PATCH RFC 0/2] clk: samsung: exynos5: fix sub-CMU power domain attach
@ 2026-11-23 14:18 ` Shigeaki Asai via B4 Relay
2026-11-23 14:18 ` [PATCH RFC 1/2] clk: samsung: exynos-audss: defer probe until pll_in is available Shigeaki Asai via B4 Relay
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Shigeaki Asai via B4 Relay @ 2026-11-23 14:18 UTC (permalink / raw)
To: Krzysztof Kozlowski, Sylwester Nawrocki, Chanwoo Choi,
Peter Griffin, Alim Akhtar, Stephen Boyd, Brian Masney,
Jerome Brunet, Marek Szyprowski
Cc: linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel,
Shigeaki Asai
Since commit c09a3e6c97f0 ("soc: samsung: pm_domains: Convert to regular
platform driver"), the exynos-pd platform driver registers the power
domains too late for exynos5-subcmu, so the sub-CMUs are not attached to
them and their clock setup is not restored. On ODROID-XU4 this drops the
GPU performance badly (about 3.5 fps in the Kodi menu, with repeated
panfrost "gpu sched timeout").
This series fixes it as follows:
- Make the exynos5-clock probe wait until the power domains are
registered, so the sub-CMUs are attached to them.
- Also make audss wait for pll_in. As a side effect of making the
sub-CMUs wait, audss would otherwise probe before pll_in exists and
generate audio from the 24 MHz pll_ref, which causes audio stuttering.
However, this relies on deferred probe, which conflicts with the move
towards platform_driver_probe(), and the sub-CMU clock data is
__initconst, so the deferred probe has to finish before init memory is
freed. So I would like to discuss the preferred way to fix it.
This may also explain the oopses seen in the RFC series "clk: samsung:
Use platform_driver_probe() to avoid __refdata". Krzysztof saw them
when converting exynos5-subcmu, and Stephen pointed out that
platform_driver_probe() is incompatible with deferred probe. The
sub-CMUs have to wait for their power domains, so exynos5-subcmu
probably cannot use platform_driver_probe() as long as exynos-pd is a
regular platform driver.
https://lore.kernel.org/all/20250305-clk-samsung-ref-init-data-v1-0-a4e03a019306@linaro.org/
Testing:
- Tested on ODROID-XU4 with a Linux 7.3 based LibreELEC kernel:
every power domain now has an exynos5-subcmu device attached in
pm_genpd_summary, the Kodi menu went from about 3.5 fps to 25-30 fps,
"gpu sched timeout" went from 17 to 0, and there is no audio
stuttering.
- On next/clk, only build-tested (exynos_defconfig, W=1) and checked
with checkpatch. I have not booted next/clk on the hardware.
- These patches are already carried in LibreELEC.
I investigated the root cause and wrote these patches and the commit
messages with the help of Claude (claude-opus-5-5). I reviewed the
changes and tested them on the hardware as described above.
Thanks,
Shigeaki
Signed-off-by: Shigeaki Asai <y-asai.0816@docomonet.jp>
---
Shigeaki Asai (2):
clk: samsung: exynos-audss: defer probe until pll_in is available
clk: samsung: exynos5-subcmu: defer probe until power domains are registered
drivers/clk/samsung/clk-exynos-audss.c | 3 ++
drivers/clk/samsung/clk-exynos5-subcmu.c | 85 ++++++++++++++++++++++----------
2 files changed, 61 insertions(+), 27 deletions(-)
---
base-commit: 783214e3268f71296cb6f62669b0daced0ac249d
change-id: 20261123-exynos5-subcmu-defer-7da3f8488c6d
Best regards,
--
Shigeaki Asai <y-asai.0816@docomonet.jp>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH RFC 1/2] clk: samsung: exynos-audss: defer probe until pll_in is available
2026-11-23 14:18 ` [PATCH RFC 0/2] clk: samsung: exynos5: fix sub-CMU power domain attach Shigeaki Asai via B4 Relay
@ 2026-11-23 14:18 ` Shigeaki Asai via B4 Relay
2026-11-23 14:18 ` [PATCH RFC 2/2] clk: samsung: exynos5-subcmu: defer probe until power domains are registered Shigeaki Asai via B4 Relay
2026-11-23 17:53 ` [PATCH RFC 0/2] clk: samsung: exynos5: fix sub-CMU power domain attach Marek Szyprowski
2 siblings, 0 replies; 5+ messages in thread
From: Shigeaki Asai via B4 Relay @ 2026-11-23 14:18 UTC (permalink / raw)
To: Krzysztof Kozlowski, Sylwester Nawrocki, Chanwoo Choi,
Peter Griffin, Alim Akhtar, Stephen Boyd, Brian Masney,
Jerome Brunet, Marek Szyprowski
Cc: linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel,
Shigeaki Asai
From: Shigeaki Asai <y-asai.0816@docomonet.jp>
The "pll_in" clock is optional, so a failed devm_clk_get() is silently
ignored and mout_audss is registered with pll_ref as its only parent.
On Exynos5800 (and Exynos5422) "pll_in" is CLK_MAU_EPLL, a gate clock
of the MAU sub-CMU. If the sub-CMU registration is deferred until the
power domains are available, this clock is not registered yet when the
audss clock controller probes. Audio then runs from the 24 MHz pll_ref
and 48 kHz playback is about twice as fast as it should be
("failed to reparent mout_audss to mau_epll: -22").
Defer the probe when "pll_in" returns -EPROBE_DEFER.
This patch was written with the help of Claude (claude-opus-5-5).
Signed-off-by: Shigeaki Asai <y-asai.0816@docomonet.jp>
---
drivers/clk/samsung/clk-exynos-audss.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/clk/samsung/clk-exynos-audss.c b/drivers/clk/samsung/clk-exynos-audss.c
index e11ac67819ef..7c06350111ed 100644
--- a/drivers/clk/samsung/clk-exynos-audss.c
+++ b/drivers/clk/samsung/clk-exynos-audss.c
@@ -153,6 +153,9 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
pll_ref = devm_clk_get(dev, "pll_ref");
pll_in = devm_clk_get(dev, "pll_in");
+ if (pll_in == ERR_PTR(-EPROBE_DEFER))
+ return dev_err_probe(dev, -EPROBE_DEFER,
+ "pll_in clock not ready\n");
if (!IS_ERR(pll_ref))
mout_audss_p[0] = __clk_get_name(pll_ref);
if (!IS_ERR(pll_in)) {
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH RFC 2/2] clk: samsung: exynos5-subcmu: defer probe until power domains are registered
2026-11-23 14:18 ` [PATCH RFC 0/2] clk: samsung: exynos5: fix sub-CMU power domain attach Shigeaki Asai via B4 Relay
2026-11-23 14:18 ` [PATCH RFC 1/2] clk: samsung: exynos-audss: defer probe until pll_in is available Shigeaki Asai via B4 Relay
@ 2026-11-23 14:18 ` Shigeaki Asai via B4 Relay
2026-11-23 17:53 ` [PATCH RFC 0/2] clk: samsung: exynos5: fix sub-CMU power domain attach Marek Szyprowski
2 siblings, 0 replies; 5+ messages in thread
From: Shigeaki Asai via B4 Relay @ 2026-11-23 14:18 UTC (permalink / raw)
To: Krzysztof Kozlowski, Sylwester Nawrocki, Chanwoo Choi,
Peter Griffin, Alim Akhtar, Stephen Boyd, Brian Masney,
Jerome Brunet, Marek Szyprowski
Cc: linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel,
Shigeaki Asai
From: Shigeaki Asai <y-asai.0816@docomonet.jp>
Since the Exynos power domain driver became a regular platform driver,
exynos5_clk_probe() may run before the power domains are registered.
The sub-CMU devices are created by the clock driver without a DT node,
so fw_devlink cannot order them after their power domains.
of_genpd_add_device() then fails silently, the sub-CMU devices are added
without a power domain and their clock setup is not restored across
power domain off/on cycles. On ODROID-XU4 this leaves the G3D clocks
misconfigured, causing very poor GPU performance and panfrost
"gpu sched timeout" errors.
Attach all sub-CMU devices to their power domains first, and defer the
probe if a power domain provider is not registered yet.
This patch was written with the help of Claude (claude-opus-5-5).
Fixes: c09a3e6c97f0 ("soc: samsung: pm_domains: Convert to regular platform driver")
Signed-off-by: Shigeaki Asai <y-asai.0816@docomonet.jp>
---
drivers/clk/samsung/clk-exynos5-subcmu.c | 85 ++++++++++++++++++++++----------
1 file changed, 58 insertions(+), 27 deletions(-)
diff --git a/drivers/clk/samsung/clk-exynos5-subcmu.c b/drivers/clk/samsung/clk-exynos5-subcmu.c
index 373129847301..797ec9f059cb 100644
--- a/drivers/clk/samsung/clk-exynos5-subcmu.c
+++ b/drivers/clk/samsung/clk-exynos5-subcmu.c
@@ -9,6 +9,7 @@
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
+#include <linux/slab.h>
#include "clk.h"
#include "clk-exynos5-subcmu.h"
@@ -131,43 +132,73 @@ static struct platform_driver exynos5_subcmu_driver __refdata = {
.probe = exynos5_subcmu_probe,
};
-static int __init exynos5_clk_register_subcmu(struct device *parent,
- const struct exynos5_subcmu_info *info,
- struct device_node *pd_node)
-{
- struct of_phandle_args genpdspec = { .np = pd_node };
- struct platform_device *pdev;
- int ret;
-
- pdev = platform_device_alloc("exynos5-subcmu", PLATFORM_DEVID_AUTO);
- if (!pdev)
- return -ENOMEM;
-
- pdev->dev.parent = parent;
- platform_set_drvdata(pdev, (void *)info);
- of_genpd_add_device(&genpdspec, &pdev->dev);
- ret = platform_device_add(pdev);
- if (ret)
- platform_device_put(pdev);
-
- return ret;
-}
-
static int __init exynos5_clk_probe(struct platform_device *pdev)
{
+ struct platform_device **subcmus;
struct device_node *np;
const char *name;
- int i;
+ int i, n = 0, ret;
+
+ subcmus = kcalloc(nr_cmus, sizeof(*subcmus), GFP_KERNEL);
+ if (!subcmus)
+ return -ENOMEM;
for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") {
+ struct of_phandle_args genpdspec = { .np = np };
+
if (of_property_read_string(np, "label", &name) < 0)
continue;
- for (i = 0; i < nr_cmus; i++)
- if (strcmp(cmu[i]->pd_name, name) == 0)
- exynos5_clk_register_subcmu(&pdev->dev,
- cmu[i], np);
+ for (i = 0; i < nr_cmus && n < nr_cmus; i++) {
+ struct platform_device *sub;
+
+ if (strcmp(cmu[i]->pd_name, name) != 0)
+ continue;
+
+ sub = platform_device_alloc("exynos5-subcmu",
+ PLATFORM_DEVID_AUTO);
+ if (!sub) {
+ of_node_put(np);
+ ret = -ENOMEM;
+ goto err;
+ }
+ sub->dev.parent = &pdev->dev;
+ platform_set_drvdata(sub, (void *)cmu[i]);
+
+ ret = of_genpd_add_device(&genpdspec, &sub->dev);
+ if (ret == -ENOENT || ret == -EPROBE_DEFER) {
+ platform_device_put(sub);
+ of_node_put(np);
+ ret = dev_err_probe(&pdev->dev, -EPROBE_DEFER,
+ "power domain %s not ready\n",
+ name);
+ goto err;
+ } else if (ret) {
+ dev_warn(&pdev->dev,
+ "failed to add %s sub-CMU to its power domain: %d\n",
+ name, ret);
+ }
+ subcmus[n++] = sub;
+ }
+ }
+
+ for (i = 0; i < n; i++) {
+ ret = platform_device_add(subcmus[i]);
+ if (ret) {
+ pm_genpd_remove_device(&subcmus[i]->dev);
+ platform_device_put(subcmus[i]);
+ }
}
+
+ kfree(subcmus);
return 0;
+
+err:
+ while (n--) {
+ pm_genpd_remove_device(&subcmus[n]->dev);
+ platform_device_put(subcmus[n]);
+ }
+ kfree(subcmus);
+ return ret;
}
static const struct of_device_id exynos5_clk_of_match[] = {
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH RFC 0/2] clk: samsung: exynos5: fix sub-CMU power domain attach
2026-11-23 14:18 ` [PATCH RFC 0/2] clk: samsung: exynos5: fix sub-CMU power domain attach Shigeaki Asai via B4 Relay
2026-11-23 14:18 ` [PATCH RFC 1/2] clk: samsung: exynos-audss: defer probe until pll_in is available Shigeaki Asai via B4 Relay
2026-11-23 14:18 ` [PATCH RFC 2/2] clk: samsung: exynos5-subcmu: defer probe until power domains are registered Shigeaki Asai via B4 Relay
@ 2026-11-23 17:53 ` Marek Szyprowski
2026-11-23 18:31 ` Krzysztof Kozlowski
2 siblings, 1 reply; 5+ messages in thread
From: Marek Szyprowski @ 2026-11-23 17:53 UTC (permalink / raw)
To: y-asai.0816, Krzysztof Kozlowski, Sylwester Nawrocki,
Chanwoo Choi, Peter Griffin, Alim Akhtar, Stephen Boyd,
Brian Masney, Jerome Brunet
Cc: linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel
On 23.11.2026 15:18, Shigeaki Asai via B4 Relay wrote:
> Since commit c09a3e6c97f0 ("soc: samsung: pm_domains: Convert to regular
> platform driver"), the exynos-pd platform driver registers the power
> domains too late for exynos5-subcmu, so the sub-CMUs are not attached to
> them and their clock setup is not restored. On ODROID-XU4 this drops the
> GPU performance badly (about 3.5 fps in the Kodi menu, with repeated
> panfrost "gpu sched timeout").
>
> This series fixes it as follows:
> - Make the exynos5-clock probe wait until the power domains are
> registered, so the sub-CMUs are attached to them.
> - Also make audss wait for pll_in. As a side effect of making the
> sub-CMUs wait, audss would otherwise probe before pll_in exists and
> generate audio from the 24 MHz pll_ref, which causes audio stuttering.
>
> However, this relies on deferred probe, which conflicts with the move
> towards platform_driver_probe(), and the sub-CMU clock data is
> __initconst, so the deferred probe has to finish before init memory is
> freed. So I would like to discuss the preferred way to fix it.
>
> This may also explain the oopses seen in the RFC series "clk: samsung:
> Use platform_driver_probe() to avoid __refdata". Krzysztof saw them
> when converting exynos5-subcmu, and Stephen pointed out that
> platform_driver_probe() is incompatible with deferred probe. The
> sub-CMUs have to wait for their power domains, so exynos5-subcmu
> probably cannot use platform_driver_probe() as long as exynos-pd is a
> regular platform driver.
> https://lore.kernel.org/all/20250305-clk-samsung-ref-init-data-v1-0-a4e03a019306@linaro.org/
>
> Testing:
> - Tested on ODROID-XU4 with a Linux 7.3 based LibreELEC kernel:
> every power domain now has an exynos5-subcmu device attached in
> pm_genpd_summary, the Kodi menu went from about 3.5 fps to 25-30 fps,
> "gpu sched timeout" went from 17 to 0, and there is no audio
> stuttering.
> - On next/clk, only build-tested (exynos_defconfig, W=1) and checked
> with checkpatch. I have not booted next/clk on the hardware.
> - These patches are already carried in LibreELEC.
>
> I investigated the root cause and wrote these patches and the commit
> messages with the help of Claude (claude-opus-5-5). I reviewed the
> changes and tested them on the hardware as described above.
https://lore.kernel.org/all/20261030075325.517182-1-m.szyprowski@samsung.com/
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=5fbe2d229bd3738ed63c7c9177466ad6bc130f18
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RFC 0/2] clk: samsung: exynos5: fix sub-CMU power domain attach
2026-11-23 17:53 ` [PATCH RFC 0/2] clk: samsung: exynos5: fix sub-CMU power domain attach Marek Szyprowski
@ 2026-11-23 18:31 ` Krzysztof Kozlowski
0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-23 18:31 UTC (permalink / raw)
To: Marek Szyprowski, y-asai.0816, Sylwester Nawrocki, Chanwoo Choi,
Peter Griffin, Alim Akhtar, Stephen Boyd, Brian Masney,
Jerome Brunet
Cc: linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel
On 23/11/2026 18:53, Marek Szyprowski wrote:
> On 23.11.2026 15:18, Shigeaki Asai via B4 Relay wrote:
>> Since commit c09a3e6c97f0 ("soc: samsung: pm_domains: Convert to regular
>> platform driver"), the exynos-pd platform driver registers the power
>> domains too late for exynos5-subcmu, so the sub-CMUs are not attached to
>> them and their clock setup is not restored. On ODROID-XU4 this drops the
>> GPU performance badly (about 3.5 fps in the Kodi menu, with repeated
>> panfrost "gpu sched timeout").
>>
>> This series fixes it as follows:
>> - Make the exynos5-clock probe wait until the power domains are
>> registered, so the sub-CMUs are attached to them.
>> - Also make audss wait for pll_in. As a side effect of making the
>> sub-CMUs wait, audss would otherwise probe before pll_in exists and
>> generate audio from the 24 MHz pll_ref, which causes audio stuttering.
>>
>> However, this relies on deferred probe, which conflicts with the move
>> towards platform_driver_probe(), and the sub-CMU clock data is
>> __initconst, so the deferred probe has to finish before init memory is
>> freed. So I would like to discuss the preferred way to fix it.
>>
>> This may also explain the oopses seen in the RFC series "clk: samsung:
>> Use platform_driver_probe() to avoid __refdata". Krzysztof saw them
>> when converting exynos5-subcmu, and Stephen pointed out that
>> platform_driver_probe() is incompatible with deferred probe. The
>> sub-CMUs have to wait for their power domains, so exynos5-subcmu
>> probably cannot use platform_driver_probe() as long as exynos-pd is a
>> regular platform driver.
>> https://lore.kernel.org/all/20250305-clk-samsung-ref-init-data-v1-0-a4e03a019306@linaro.org/
>>
>> Testing:
>> - Tested on ODROID-XU4 with a Linux 7.3 based LibreELEC kernel:
>> every power domain now has an exynos5-subcmu device attached in
>> pm_genpd_summary, the Kodi menu went from about 3.5 fps to 25-30 fps,
>> "gpu sched timeout" went from 17 to 0, and there is no audio
>> stuttering.
>> - On next/clk, only build-tested (exynos_defconfig, W=1) and checked
>> with checkpatch. I have not booted next/clk on the hardware.
>> - These patches are already carried in LibreELEC.
>>
>> I investigated the root cause and wrote these patches and the commit
>> messages with the help of Claude (claude-opus-5-5). I reviewed the
>> changes and tested them on the hardware as described above.
>
> https://lore.kernel.org/all/20261030075325.517182-1-m.szyprowski@samsung.com/
>
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=5fbe2d229bd3738ed63c7c9177466ad6bc130f18
Which was even committed three weeks ago! I guess author just sends slop.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-23 18:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20261123141844eucas1p221c650882789ccab239e57ee458c02a1@eucas1p2.samsung.com>
2026-11-23 14:18 ` [PATCH RFC 0/2] clk: samsung: exynos5: fix sub-CMU power domain attach Shigeaki Asai via B4 Relay
2026-11-23 14:18 ` [PATCH RFC 1/2] clk: samsung: exynos-audss: defer probe until pll_in is available Shigeaki Asai via B4 Relay
2026-11-23 14:18 ` [PATCH RFC 2/2] clk: samsung: exynos5-subcmu: defer probe until power domains are registered Shigeaki Asai via B4 Relay
2026-11-23 17:53 ` [PATCH RFC 0/2] clk: samsung: exynos5: fix sub-CMU power domain attach Marek Szyprowski
2026-11-23 18:31 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox