* [PATCH] clk: samsung: exynos5-subcmu: Defer probe until power domains are available
[not found] <CGME20261013111847eucas1p24df37631cc74fa27879f7d979348a1e1@eucas1p2.samsung.com>
@ 2026-10-13 11:18 ` Marek Szyprowski
2026-10-16 11:21 ` Henrik Grimler
0 siblings, 1 reply; 2+ messages in thread
From: Marek Szyprowski @ 2026-10-13 11:18 UTC (permalink / raw)
To: linux-samsung-soc, linux-clk
Cc: Marek Szyprowski, Krzysztof Kozlowski, Sylwester Nawrocki,
Chanwoo Choi, Peter Griffin, Alim Akhtar, Stephen Boyd,
Brian Masney, Jerome Brunet
Sub-CMU devices are added to their power domains with
of_genpd_add_device() during exynos5_clk_probe(). Its return value is
ignored, so if the power domain provider is not registered yet, the
sub-CMU device is silently left outside of its power domain.
Since commit c09a3e6c97f0 ("soc: samsung: pm_domains: Convert to regular
platform driver"), power domain providers are registered only when their
platform devices are probed, which happens after exynos5_clk_probe() has
already been called.
When a sub-CMU device is outside of its power domain, its runtime PM
callbacks race with the power domain state changes, which might result in
losing the proper hardware state. In practice, some clock muxes are left
switched to the oscillator instead of the respective PLLs.
Fix this by deferring exynos5_clk_probe() until the platform devices for
all available power domains are instantiated.
Fixes: c09a3e6c97f0 ("soc: samsung: pm_domains: Convert to regular platform driver")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
drivers/clk/samsung/clk-exynos5-subcmu.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/samsung/clk-exynos5-subcmu.c b/drivers/clk/samsung/clk-exynos5-subcmu.c
index 373129847301..587fe6e3bbed 100644
--- a/drivers/clk/samsung/clk-exynos5-subcmu.c
+++ b/drivers/clk/samsung/clk-exynos5-subcmu.c
@@ -6,6 +6,7 @@
#include <linux/io.h>
#include <linux/of.h>
+#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
@@ -155,11 +156,25 @@ static int __init exynos5_clk_register_subcmu(struct device *parent,
static int __init exynos5_clk_probe(struct platform_device *pdev)
{
+ static const char pd_node_name[] = "samsung,exynos4210-pd";
struct device_node *np;
const char *name;
int i;
- for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") {
+ /* Defer until all needed power domains are registered */
+ for_each_compatible_node(np, NULL, pd_node_name) {
+ if (of_device_is_available(np)) {
+ struct platform_device *pd = of_find_device_by_node(np);
+
+ if (!pd) {
+ of_node_put(np);
+ return -EPROBE_DEFER;
+ }
+ put_device(&pd->dev);
+ }
+ }
+
+ for_each_compatible_node(np, NULL, pd_node_name) {
if (of_property_read_string(np, "label", &name) < 0)
continue;
for (i = 0; i < nr_cmus; i++)
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] clk: samsung: exynos5-subcmu: Defer probe until power domains are available
2026-10-13 11:18 ` [PATCH] clk: samsung: exynos5-subcmu: Defer probe until power domains are available Marek Szyprowski
@ 2026-10-16 11:21 ` Henrik Grimler
0 siblings, 0 replies; 2+ messages in thread
From: Henrik Grimler @ 2026-10-16 11:21 UTC (permalink / raw)
To: Marek Szyprowski
Cc: linux-samsung-soc, linux-clk, Krzysztof Kozlowski,
Sylwester Nawrocki, Chanwoo Choi, Peter Griffin, Alim Akhtar,
Stephen Boyd, Brian Masney, Jerome Brunet
Hi Marek,
On Tue, Oct 13, 2026 at 01:18:38PM +0200, Marek Szyprowski wrote:
> Sub-CMU devices are added to their power domains with
> of_genpd_add_device() during exynos5_clk_probe(). Its return value is
> ignored, so if the power domain provider is not registered yet, the
> sub-CMU device is silently left outside of its power domain.
>
> Since commit c09a3e6c97f0 ("soc: samsung: pm_domains: Convert to regular
> platform driver"), power domain providers are registered only when their
> platform devices are probed, which happens after exynos5_clk_probe() has
> already been called.
>
> When a sub-CMU device is outside of its power domain, its runtime PM
> callbacks race with the power domain state changes, which might result in
> losing the proper hardware state. In practice, some clock muxes are left
> switched to the oscillator instead of the respective PLLs.
>
> Fix this by deferring exynos5_clk_probe() until the platform devices for
> all available power domains are instantiated.
>
> Fixes: c09a3e6c97f0 ("soc: samsung: pm_domains: Convert to regular platform driver")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Henrik Grimler <henrik@grimler.se>
I have noticed the same issue on my boards, and the fix looks good to
me. Thanks for fixing it!
Best regards,
Henrik Grimler
> ---
> drivers/clk/samsung/clk-exynos5-subcmu.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/samsung/clk-exynos5-subcmu.c b/drivers/clk/samsung/clk-exynos5-subcmu.c
> index 373129847301..587fe6e3bbed 100644
> --- a/drivers/clk/samsung/clk-exynos5-subcmu.c
> +++ b/drivers/clk/samsung/clk-exynos5-subcmu.c
> @@ -6,6 +6,7 @@
>
> #include <linux/io.h>
> #include <linux/of.h>
> +#include <linux/of_platform.h>
> #include <linux/platform_device.h>
> #include <linux/pm_domain.h>
> #include <linux/pm_runtime.h>
> @@ -155,11 +156,25 @@ static int __init exynos5_clk_register_subcmu(struct device *parent,
>
> static int __init exynos5_clk_probe(struct platform_device *pdev)
> {
> + static const char pd_node_name[] = "samsung,exynos4210-pd";
> struct device_node *np;
> const char *name;
> int i;
>
> - for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") {
> + /* Defer until all needed power domains are registered */
> + for_each_compatible_node(np, NULL, pd_node_name) {
> + if (of_device_is_available(np)) {
> + struct platform_device *pd = of_find_device_by_node(np);
> +
> + if (!pd) {
> + of_node_put(np);
> + return -EPROBE_DEFER;
> + }
> + put_device(&pd->dev);
> + }
> + }
> +
> + for_each_compatible_node(np, NULL, pd_node_name) {
> if (of_property_read_string(np, "label", &name) < 0)
> continue;
> for (i = 0; i < nr_cmus; i++)
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-16 11:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20261013111847eucas1p24df37631cc74fa27879f7d979348a1e1@eucas1p2.samsung.com>
2026-10-13 11:18 ` [PATCH] clk: samsung: exynos5-subcmu: Defer probe until power domains are available Marek Szyprowski
2026-10-16 11:21 ` Henrik Grimler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox