From: Stephen Boyd <sboyd@kernel.org>
To: Jerome Brunet <jbrunet@baylibre.com>
Cc: Kevin Hilman <khilman@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Michael Turquette <mturquette@baylibre.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/3] clk: amlogic: drop clk_regmap tables
Date: Thu, 27 Feb 2025 14:55:00 -0800 [thread overview]
Message-ID: <5109de7fe1a1a8467118daf80c7b7f8a.sboyd@kernel.org> (raw)
In-Reply-To: <1j4j205ark.fsf@starbuckisacylon.baylibre.com>
Quoting Jerome Brunet (2025-01-15 07:58:55)
>
> I'd like to register controller init hook to apply on all the clocks of
> a particular type. The reason to do that is to drop the big clk_regmap
> table that are a pain to maintain (in addition to be ugly). I hoped it
> would also save a bit of memory.
>
> The solutions we've been discussing so far feels like we are moving
> around the problem, recreating the memory saved somewhere else,
> perhaps in a more complicated way. I'd like to find something more
> convinient to use, which does not scale the memory used with the number
> of clock registered. The point is not a different hook for clk_hw after
> all.
What are the goals?
1. Drop clk_regmap table
2. Reduce memory
3. ??
>
> Here is an idea, how about list of hook identified by ops and controller ?
>
> The node would look like this
>
> struct clk_type_init_node {
> struct list_head entry;
>
> struct device_node *of_node;
> struct device *dev;
> const struct clk_ops *ops;
>
> int (*init_hook)(struct clk_hw *hw);
> };
>
> The change would be minimal in core CCF, just searching the list for a
> match in clk_register. On most platform the list would be empty so there
> is virtually no penalty when it is not used.
>
> From the controller, the usage would be very simple, just calling a
> function before registering the clocks, something like:
>
> int clk_type_register_dev_hook(struct device *dev,
> const struct clk_ops *ops,
> int (*init_hook)(struct clk_hw *hw))
>
> or the 'of_node' equivalent.
Why can't we register the clk at the same time? I don't understand why
we want to search a list to match something up to what could be another
argument to the clk registration API. Isn't this the same as
clk_hw_register_data(struct device *dev, struct clk_hw *hw, const struct clk_register_data *data)
Why is that hard to maintain? Is that because the clk driver is
registering various different types of clks and it wants to do different
stuff depending on the type of clk? Why wouldn't wrapping the clk_ops
in another struct and then using container_of to find the custom clk_ops
not work there?
>
> I admit this is heavily inspired by how devres works :) but it does solve
> the early clock controller problem and does not scale with the number of
> clock registered.
>
I don't know if devres is a good model. It's about tracking allocations
and things to undo later, not really to track things to do when called
initially.
next prev parent reply other threads:[~2025-02-27 22:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-20 17:17 [PATCH 0/3] clk: amlogic: drop clk_regmap tables Jerome Brunet
2024-12-20 17:17 ` [PATCH 1/3] clk: add a clk_hw helper to get the associate device structure Jerome Brunet
2024-12-20 23:55 ` Stephen Boyd
2024-12-20 17:17 ` [PATCH 2/3] clk: amlogic: drop clk_regmap tables Jerome Brunet
2024-12-21 0:12 ` Stephen Boyd
2024-12-21 11:09 ` Jerome Brunet
2024-12-31 1:08 ` Stephen Boyd
2025-01-06 10:12 ` Jerome Brunet
2025-01-06 21:09 ` Stephen Boyd
2025-01-07 14:46 ` Jerome Brunet
2025-01-07 21:28 ` Stephen Boyd
2025-01-15 15:58 ` Jerome Brunet
2025-02-27 22:55 ` Stephen Boyd [this message]
2025-03-21 15:46 ` Jerome Brunet
2025-03-21 15:55 ` Jerome Brunet
2024-12-20 17:17 ` [PATCH 3/3] clk: amlogic: s4: remove unused data Jerome Brunet
2024-12-23 7:59 ` Chuan Liu
2024-12-23 9:01 ` [DMARC error][DKIM error]Re: " Dmitry Rokosov
2024-12-24 5:20 ` Chuan Liu
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=5109de7fe1a1a8467118daf80c7b7f8a.sboyd@kernel.org \
--to=sboyd@kernel.org \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=mturquette@baylibre.com \
--cc=neil.armstrong@linaro.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