All of lore.kernel.org
 help / color / mirror / Atom feed
From: Henrik Grimler <henrik@grimler.se>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Peter Griffin <peter.griffin@linaro.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney+clk@redhat.com>,
	Jerome Brunet <jbrunet+clk@baylibre.com>
Subject: Re: [PATCH] clk: samsung: exynos5-subcmu: Defer probe until power domains are available
Date: Fri, 16 Oct 2026 13:21:40 +0200	[thread overview]
Message-ID: <20261016112140.GA17404@localhost> (raw)
In-Reply-To: <20261013111840.3645724-1-m.szyprowski@samsung.com>

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
> 
> 

      parent reply	other threads:[~2026-10-16 11:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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-13 11:35   ` sashiko-bot
2026-10-16 11:21   ` Henrik Grimler [this message]

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=20261016112140.GA17404@localhost \
    --to=henrik@grimler.se \
    --cc=alim.akhtar@samsung.com \
    --cc=bmasney+clk@redhat.com \
    --cc=cw00.choi@samsung.com \
    --cc=jbrunet+clk@baylibre.com \
    --cc=krzk@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=peter.griffin@linaro.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sboyd@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.