From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
To: Heiko Stuebner <heiko@sntech.de>,
mturquette@baylibre.com, sboyd@kernel.org
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
liujianfeng1994@gmail.com, sebastian.reichel@collabora.com
Subject: Re: [PATCH] clk: check for disabled clock-provider in of_clk_get_hw_from_clkspec
Date: Sat, 22 Feb 2025 17:33:57 +0200 [thread overview]
Message-ID: <aca747a9-5244-4535-bc22-976ed4a1dc3b@collabora.com> (raw)
In-Reply-To: <20250220225448.2763166-1-heiko@sntech.de>
Hi,
On 2/21/25 12:54 AM, Heiko Stuebner wrote:
> of_clk_get_hw_from_clkspec checks all available clock-providers by
> compairing their of-nodes to the one from the clkspec. If no matching
> clock-provider is found, the function returns EPROBE_DEFER to cause a
> re-check at a later date.
>
> If a matching clock-provider is found, a authoritative answer can be
Nit: s/a authoritative/an authoritative/
> retrieved from it whether the clock exists or not.
>
> This does not take into account that the clock-provider may never appear,
> because it's node is disabled. This can happen for example when a clock
> is optional, provided by a separate block which just never gets enabled.
>
> One example of this happening is the rk3588's VOP, which has optional
> additional display-clock-supplies coming from PLLs inside the hdmiphy
> blocks. These can be used for better rates, but the system will also
> work without them.
>
> The problem around that is described in the followups to:
> https://lore.kernel.org/dri-devel/20250215-vop2-hdmi1-disp-modes-v1-3-81962a7151d6@collabora.com/
>
> As we already know the of-node of the presumed clock-provider, just add
> a check via of_device_is_available whether this is a "valid" device node.
> This prevents ethernal defer-loops.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
> drivers/clk/clk.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index cf7720b9172f..50faafbf5dda 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -5258,6 +5258,10 @@ of_clk_get_hw_from_clkspec(struct of_phandle_args *clkspec)
> if (!clkspec)
> return ERR_PTR(-EINVAL);
>
> + /* Check if node in clkspec is in disabled/fail state */
> + if (!of_device_is_available(clkspec->np))
> + return ERR_PTR(-ENOENT);
> +
> mutex_lock(&of_clk_mutex);
> list_for_each_entry(provider, &of_clk_providers, link) {
> if (provider->node == clkspec->np) {
Without this patch applied, when disabling hdmi0 and hdptxphy0 nodes on
Rock5B, rockchip-drm module fails to probe and hdmi1 output cannot be
used anymore:
rockchip-drm display-subsystem: [drm] *ERROR* failed to get pll_hdmiphy0
After applying the patch, I confirm the error is gone and hdmi1 is
functional again. Hence,
Tested-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Thanks,
Cristian
prev parent reply other threads:[~2025-02-22 15:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 22:54 Heiko Stuebner
2025-02-21 1:41 ` Sebastian Reichel
2025-02-22 15:33 ` Cristian Ciocaltea [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=aca747a9-5244-4535-bc22-976ed4a1dc3b@collabora.com \
--to=cristian.ciocaltea@collabora.com \
--cc=heiko@sntech.de \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liujianfeng1994@gmail.com \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
--cc=sebastian.reichel@collabora.com \
/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
all inboxes | Powered by JetHome®