From: Frank Oltmanns <frank@oltmanns.dev>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Andre Przywara <andre.przywara@arm.com>,
Roman Beranek <me@crly.cz>,
linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 6/8] clk: sunxi-ng: mux: Support finding closest rate
Date: Mon, 03 Jul 2023 11:17:24 +0200 [thread overview]
Message-ID: <87fs65s6aj.fsf@oltmanns.dev> (raw)
In-Reply-To: <b7gnap57aajkbhbbcbgallvqjdc7nzppjjwnancgmm5ibmhdaq@cftau72qyjdu>
On 2023-07-03 at 09:38:48 +0200, Maxime Ripard <maxime@cerno.tech> wrote:
> [[PGP Signed Part:Undecided]]
> On Sun, Jul 02, 2023 at 07:55:25PM +0200, Frank Oltmanns wrote:
>> When finding the best rate for a mux clock, consider rates that are
>> higher than the requested rate by introducing a new clk_ops structure
>> that uses the existing __clk_mux_determine_rate_closest function.
>> Furthermore introduce an initialization macro that uses this new
>> structure.
>>
>> Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
>> ---
>> drivers/clk/sunxi-ng/ccu_mux.c | 13 +++++++++++++
>> drivers/clk/sunxi-ng/ccu_mux.h | 17 +++++++++++++++++
>> 2 files changed, 30 insertions(+)
>>
>> diff --git a/drivers/clk/sunxi-ng/ccu_mux.c b/drivers/clk/sunxi-ng/ccu_mux.c
>> index 8594d6a4addd..49a592bdeacf 100644
>> --- a/drivers/clk/sunxi-ng/ccu_mux.c
>> +++ b/drivers/clk/sunxi-ng/ccu_mux.c
>> @@ -264,6 +264,19 @@ static unsigned long ccu_mux_recalc_rate(struct clk_hw *hw,
>> parent_rate);
>> }
>>
>> +const struct clk_ops ccu_mux_closest_ops = {
>> + .disable = ccu_mux_disable,
>> + .enable = ccu_mux_enable,
>> + .is_enabled = ccu_mux_is_enabled,
>> +
>> + .get_parent = ccu_mux_get_parent,
>> + .set_parent = ccu_mux_set_parent,
>> +
>> + .determine_rate = __clk_mux_determine_rate_closest,
>> + .recalc_rate = ccu_mux_recalc_rate,
>> +};
>> +EXPORT_SYMBOL_NS_GPL(ccu_mux_closest_ops, SUNXI_CCU);
>> +
>
> This is also a bit inconsistent with the other clocks: most (all?) of
> them will simply handle this through a flag, but this one requires a new
> set of clk_ops as well?
>
> I think we should create our own wrapper here around
> __clk_mux_determine_rate and either call
> __clk_mux_determine_rate_closest or __clk_mux_determine_rate depending
> on the state of the flags, or call __clk_mux_determine_rate_flags with
> the proper flags set for our clock.
>
> The former is probably slightly simpler.
Ok, I will address that in v4.
>
>> const struct clk_ops ccu_mux_ops = {
>> .disable = ccu_mux_disable,
>> .enable = ccu_mux_enable,
>> diff --git a/drivers/clk/sunxi-ng/ccu_mux.h b/drivers/clk/sunxi-ng/ccu_mux.h
>> index 2c1811a445b0..c4ee14e43719 100644
>> --- a/drivers/clk/sunxi-ng/ccu_mux.h
>> +++ b/drivers/clk/sunxi-ng/ccu_mux.h
>> @@ -46,6 +46,22 @@ struct ccu_mux {
>> struct ccu_common common;
>> };
>>
>> +#define SUNXI_CCU_MUX_TABLE_WITH_GATE_CLOSEST(_struct, _name, _parents, _table, \
>> + _reg, _shift, _width, _gate, \
>> + _flags) \
>> + struct ccu_mux _struct = { \
>> + .enable = _gate, \
>> + .mux = _SUNXI_CCU_MUX_TABLE(_shift, _width, _table), \
>> + .common = { \
>> + .reg = _reg, \
>> + .hw.init = CLK_HW_INIT_PARENTS(_name, \
>> + _parents, \
>> + &ccu_mux_closest_ops, \
>> + _flags), \
>> + .features = CCU_FEATURE_CLOSEST_RATE, \
>> + } \
>> + }
>> +
>
> I'm fine with that one, but like we discussed on the NM (I think?) patch
> already, this creates some clocks and macros that will use the feature
> as a flag, and some will encode it into their name.
>
> Given that we need it here too, I'm really inclined to prefer what you
> did there, and thus create a new macro for pll-video0 instead of
> modifying the existing one.
Ok. Just to be clear: What I did in this patch is fine and I should use
the same approach for NM. Did I get that right?
Thanks,
Frank
>
> Maxime
>
> [[End of PGP Signed Part]]
WARNING: multiple messages have this Message-ID (diff)
From: Frank Oltmanns <frank@oltmanns.dev>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Andre Przywara <andre.przywara@arm.com>,
Roman Beranek <me@crly.cz>,
linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 6/8] clk: sunxi-ng: mux: Support finding closest rate
Date: Mon, 03 Jul 2023 11:17:24 +0200 [thread overview]
Message-ID: <87fs65s6aj.fsf@oltmanns.dev> (raw)
In-Reply-To: <b7gnap57aajkbhbbcbgallvqjdc7nzppjjwnancgmm5ibmhdaq@cftau72qyjdu>
On 2023-07-03 at 09:38:48 +0200, Maxime Ripard <maxime@cerno.tech> wrote:
> [[PGP Signed Part:Undecided]]
> On Sun, Jul 02, 2023 at 07:55:25PM +0200, Frank Oltmanns wrote:
>> When finding the best rate for a mux clock, consider rates that are
>> higher than the requested rate by introducing a new clk_ops structure
>> that uses the existing __clk_mux_determine_rate_closest function.
>> Furthermore introduce an initialization macro that uses this new
>> structure.
>>
>> Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
>> ---
>> drivers/clk/sunxi-ng/ccu_mux.c | 13 +++++++++++++
>> drivers/clk/sunxi-ng/ccu_mux.h | 17 +++++++++++++++++
>> 2 files changed, 30 insertions(+)
>>
>> diff --git a/drivers/clk/sunxi-ng/ccu_mux.c b/drivers/clk/sunxi-ng/ccu_mux.c
>> index 8594d6a4addd..49a592bdeacf 100644
>> --- a/drivers/clk/sunxi-ng/ccu_mux.c
>> +++ b/drivers/clk/sunxi-ng/ccu_mux.c
>> @@ -264,6 +264,19 @@ static unsigned long ccu_mux_recalc_rate(struct clk_hw *hw,
>> parent_rate);
>> }
>>
>> +const struct clk_ops ccu_mux_closest_ops = {
>> + .disable = ccu_mux_disable,
>> + .enable = ccu_mux_enable,
>> + .is_enabled = ccu_mux_is_enabled,
>> +
>> + .get_parent = ccu_mux_get_parent,
>> + .set_parent = ccu_mux_set_parent,
>> +
>> + .determine_rate = __clk_mux_determine_rate_closest,
>> + .recalc_rate = ccu_mux_recalc_rate,
>> +};
>> +EXPORT_SYMBOL_NS_GPL(ccu_mux_closest_ops, SUNXI_CCU);
>> +
>
> This is also a bit inconsistent with the other clocks: most (all?) of
> them will simply handle this through a flag, but this one requires a new
> set of clk_ops as well?
>
> I think we should create our own wrapper here around
> __clk_mux_determine_rate and either call
> __clk_mux_determine_rate_closest or __clk_mux_determine_rate depending
> on the state of the flags, or call __clk_mux_determine_rate_flags with
> the proper flags set for our clock.
>
> The former is probably slightly simpler.
Ok, I will address that in v4.
>
>> const struct clk_ops ccu_mux_ops = {
>> .disable = ccu_mux_disable,
>> .enable = ccu_mux_enable,
>> diff --git a/drivers/clk/sunxi-ng/ccu_mux.h b/drivers/clk/sunxi-ng/ccu_mux.h
>> index 2c1811a445b0..c4ee14e43719 100644
>> --- a/drivers/clk/sunxi-ng/ccu_mux.h
>> +++ b/drivers/clk/sunxi-ng/ccu_mux.h
>> @@ -46,6 +46,22 @@ struct ccu_mux {
>> struct ccu_common common;
>> };
>>
>> +#define SUNXI_CCU_MUX_TABLE_WITH_GATE_CLOSEST(_struct, _name, _parents, _table, \
>> + _reg, _shift, _width, _gate, \
>> + _flags) \
>> + struct ccu_mux _struct = { \
>> + .enable = _gate, \
>> + .mux = _SUNXI_CCU_MUX_TABLE(_shift, _width, _table), \
>> + .common = { \
>> + .reg = _reg, \
>> + .hw.init = CLK_HW_INIT_PARENTS(_name, \
>> + _parents, \
>> + &ccu_mux_closest_ops, \
>> + _flags), \
>> + .features = CCU_FEATURE_CLOSEST_RATE, \
>> + } \
>> + }
>> +
>
> I'm fine with that one, but like we discussed on the NM (I think?) patch
> already, this creates some clocks and macros that will use the feature
> as a flag, and some will encode it into their name.
>
> Given that we need it here too, I'm really inclined to prefer what you
> did there, and thus create a new macro for pll-video0 instead of
> modifying the existing one.
Ok. Just to be clear: What I did in this patch is fine and I should use
the same approach for NM. Did I get that right?
Thanks,
Frank
>
> Maxime
>
> [[End of PGP Signed Part]]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-07-03 9:18 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-02 17:55 [PATCH v3 0/8] clk: sunxi-ng: Consider alternative parent rates when determining NKM clock rate Frank Oltmanns
2023-07-02 17:55 ` Frank Oltmanns
2023-07-02 17:55 ` [PATCH v3 1/8] clk: sunxi-ng: nkm: consider alternative parent rates when determining rate Frank Oltmanns
2023-07-02 17:55 ` Frank Oltmanns
2023-07-03 6:47 ` Maxime Ripard
2023-07-03 6:47 ` Maxime Ripard
2023-07-03 8:02 ` Frank Oltmanns
2023-07-03 8:02 ` Frank Oltmanns
2023-07-02 17:55 ` [PATCH v3 2/8] clk: sunxi-ng: a64: allow pll-mipi to set parent's rate Frank Oltmanns
2023-07-02 17:55 ` Frank Oltmanns
2023-07-03 6:47 ` Maxime Ripard
2023-07-03 6:47 ` Maxime Ripard
2023-07-02 17:55 ` [PATCH v3 3/8] clk: sunxi-ng: Add feature to find closest rate Frank Oltmanns
2023-07-02 17:55 ` Frank Oltmanns
2023-07-03 6:48 ` Maxime Ripard
2023-07-03 6:48 ` Maxime Ripard
2023-07-02 17:55 ` [PATCH v3 4/8] clk: sunxi-ng: nm: Support finding " Frank Oltmanns
2023-07-02 17:55 ` Frank Oltmanns
2023-07-03 7:24 ` Maxime Ripard
2023-07-03 7:24 ` Maxime Ripard
2023-07-03 8:46 ` Frank Oltmanns
2023-07-03 8:46 ` Frank Oltmanns
2023-07-02 17:55 ` [PATCH v3 5/8] clk: sunxi-ng: nkm: " Frank Oltmanns
2023-07-02 17:55 ` Frank Oltmanns
2023-07-02 20:06 ` kernel test robot
2023-07-02 20:06 ` kernel test robot
2023-07-03 7:17 ` Frank Oltmanns
2023-07-03 7:17 ` Frank Oltmanns
2023-07-03 7:25 ` Maxime Ripard
2023-07-03 7:25 ` Maxime Ripard
2023-07-03 8:59 ` Frank Oltmanns
2023-07-03 8:59 ` Frank Oltmanns
2023-07-03 11:36 ` Maxime Ripard
2023-07-03 11:36 ` Maxime Ripard
2023-07-03 7:33 ` Maxime Ripard
2023-07-03 7:33 ` Maxime Ripard
2023-07-02 17:55 ` [PATCH v3 6/8] clk: sunxi-ng: mux: " Frank Oltmanns
2023-07-02 17:55 ` Frank Oltmanns
2023-07-03 7:38 ` Maxime Ripard
2023-07-03 7:38 ` Maxime Ripard
2023-07-03 9:17 ` Frank Oltmanns [this message]
2023-07-03 9:17 ` Frank Oltmanns
2023-07-03 11:37 ` Maxime Ripard
2023-07-03 11:37 ` Maxime Ripard
2023-07-02 17:55 ` [PATCH v3 7/8] clk: sunxi-ng: div: " Frank Oltmanns
2023-07-02 17:55 ` Frank Oltmanns
2023-07-03 7:39 ` Maxime Ripard
2023-07-03 7:39 ` Maxime Ripard
2023-07-02 17:55 ` [PATCH v3 8/8] clk: sunxi-ng: a64: select closest rate for pll-video0 Frank Oltmanns
2023-07-02 17:55 ` Frank Oltmanns
2023-07-03 7:50 ` Maxime Ripard
2023-07-03 7:50 ` Maxime Ripard
2023-07-03 9:28 ` Frank Oltmanns
2023-07-03 9:28 ` Frank Oltmanns
2023-07-03 7:51 ` [PATCH v3 0/8] clk: sunxi-ng: Consider alternative parent rates when determining NKM clock rate Maxime Ripard
2023-07-03 7:51 ` Maxime Ripard
2023-07-03 9:36 ` Frank Oltmanns
2023-07-03 9:36 ` Frank Oltmanns
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=87fs65s6aj.fsf@oltmanns.dev \
--to=frank@oltmanns.dev \
--cc=andre.przywara@arm.com \
--cc=jernej.skrabec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=maxime@cerno.tech \
--cc=me@crly.cz \
--cc=mturquette@baylibre.com \
--cc=samuel@sholland.org \
--cc=sboyd@kernel.org \
--cc=wens@csie.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.