From: Vyacheslav Yurkov <uvv.mail@gmail.com>
To: Jerome Brunet <jbrunet@baylibre.com>,
Vyacheslav Yurkov <V.Yurkov.EXT@bruker.com>
Cc: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Brian Masney <bmasney@redhat.com>,
Brian Masney <bmasney+clk@redhat.com>,
Jerome Brunet <jbrunet+clk@baylibre.com>,
Jyri Sarha <jsarha@ti.com>,
linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v9 2/2] clk: Add gpio-enabled clock driver
Date: Sat, 21 Nov 2026 12:54:46 +0100 [thread overview]
Message-ID: <7b96eb55-d357-4289-85ff-c0eaab53e8c5@gmail.com> (raw)
In-Reply-To: <179519084929.3795820.7180605641448271689.b4-review@b4>
On 20.11.2026 17:07, Jerome Brunet wrote:
> This comment has been carried since v5, where the reasoning was already
> answered: returning an error from .prepare()/.enable() when the clock isn't
> running is simply how a provider reports failure, not a workaround for the
> framework. The claim is also wrong: the framework does call .is_prepared()
> (clk_unprepare_unused_subtree(), clk_hw_is_prepared()). The rest describes return
> conventions. Something like this would be enough:
>
> /* The clock cannot be turned on, only waited for. */
>
Perhaps the claim is not clear enough then, the .is_prepared() is not
called _before_ prepare. I didn't mean it's not called at all.
>> +static int clk_gpio_enabled_enable(struct clk_hw *hw)
>> +{
>> + struct clk_gpio_enabled *clk = to_clk_gpio_enabled(hw);
>> + int value = 0;
>> +
>> + readx_poll_timeout_atomic(gpiod_get_value, clk->gpiod, value,
>> + value != 0, 10, clk->timeout_us);
>
> Same error handling as in the prepare variant above.
>
> Also looking at it more closely, the binding allow 1ms max. It is lot of
> time holding a spinlock without IRQ. If you don't stricly need this variant
> please drop it for now.
>
>
>> +
>> + device_property_read_u32(dev, "poll-timeout-us", &timeout_us);
>> + if (timeout_us < GPIO_ENABLED_TIMEOUT_MIN ||
>> + timeout_us > GPIO_ENABLED_TIMEOUT_MAX)
>> + return dev_err_probe(dev, -EINVAL,
>> + "poll-timeout-us is out of range [%u, %u]\n",
>> + GPIO_ENABLED_TIMEOUT_MIN,
>> + GPIO_ENABLED_TIMEOUT_MAX);
>> + clk->timeout_us = timeout_us;
>> +
>> + if (gpiod_cansleep(clk->gpiod))
>> + ops = &clk_gpio_enabled_sleeping_ops;
>> + else
>> + ops = &clk_gpio_enabled_ops;
>
> As I noted above, I prefer if you dropped the enabled variant that run with
> irq off, unless you scrictly need it. Return -ENOTSUPP if the gpio can't sleep.
I would rather keep only 1 variant in general, because my GPIO
controller can't sleep, but gpiod_get_value_cansleep works for both type
of controllers.
Slava
prev parent reply other threads:[~2026-11-21 11:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 14:22 [PATCH v9 0/2] A proposal to add a " Vyacheslav Yurkov via B4 Relay
2026-10-15 14:22 ` [PATCH v9 1/2] dt-bindings: gpio-enabled-clock: Add a new binding Vyacheslav Yurkov via B4 Relay
2026-10-15 19:58 ` Rob Herring (Arm)
2026-11-20 16:07 ` Jerome Brunet
2026-11-20 17:18 ` Conor Dooley
2026-11-20 18:25 ` Jerome Brunet
2026-10-15 14:22 ` [PATCH v9 2/2] clk: Add gpio-enabled clock driver Vyacheslav Yurkov via B4 Relay
2026-11-20 16:07 ` Jerome Brunet
2026-11-21 11:54 ` Vyacheslav Yurkov [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=7b96eb55-d357-4289-85ff-c0eaab53e8c5@gmail.com \
--to=uvv.mail@gmail.com \
--cc=V.Yurkov.EXT@bruker.com \
--cc=bmasney+clk@redhat.com \
--cc=bmasney@redhat.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jbrunet+clk@baylibre.com \
--cc=jbrunet@baylibre.com \
--cc=jsarha@ti.com \
--cc=krzk+dt@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--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 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®