From: Chuan Liu <chuan.liu@amlogic.com>
To: Jerome Brunet <jbrunet@baylibre.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Kevin Hilman <khilman@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 26/26] clk: amlogic: c3-peripherals: use helper for basic composite clocks
Date: Thu, 3 Jul 2025 15:56:25 +0800 [thread overview]
Message-ID: <27ae4f23-7a41-4810-9639-5bcc4cebc8dd@amlogic.com> (raw)
In-Reply-To: <20250702-meson-clk-cleanup-24-v1-26-e163c9a1fc21@baylibre.com>
Hi Jerome:
Nise, The code looks much cleaner now. Thanks!!!
Reviewed-by: Chuan Liu <chuan.liu@amlogic.com>
On 7/2/2025 11:26 PM, Jerome Brunet wrote:
> [ EXTERNAL EMAIL ]
>
> Use the composite clock helpers to define simple composite clocks of
> the c3-peripherals clock controller.
>
> This reduces the verbosity of the controller code on these very simple
> parts, making maintenance simpler.
>
> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
> ---
> drivers/clk/meson/c3-peripherals.c | 1029 +++---------------------------------
> 1 file changed, 63 insertions(+), 966 deletions(-)
>
> diff --git a/drivers/clk/meson/c3-peripherals.c b/drivers/clk/meson/c3-peripherals.c
> index fd35f9b7994720d069c5f72142d6064790d40b60..b158756cfee4dd4bad5c0c9576da02d2cb8ee515 100644
> --- a/drivers/clk/meson/c3-peripherals.c
> +++ b/drivers/clk/meson/c3-peripherals.c
[...]
> static const struct clk_parent_data c3_hcodec_pre_parents[] = {
> { .fw_name = "fdiv2p5" },
> @@ -1228,99 +755,13 @@ static const struct clk_parent_data c3_hcodec_pre_parents[] = {
> { .fw_name = "oscin" }
> };
>
> -static struct clk_regmap c3_hcodec_0_sel = {
> - .data = &(struct clk_regmap_mux_data) {
> - .offset = VDEC_CLK_CTRL,
> - .mask = 0x7,
> - .shift = 9,
> - },
> - .hw.init = &(struct clk_init_data) {
> - .name = "hcodec_0_sel",
> - .ops = &clk_regmap_mux_ops,
> - .parent_data = c3_hcodec_pre_parents,
> - .num_parents = ARRAY_SIZE(c3_hcodec_pre_parents),
> - },
> -};
> +static C3_COMP_SEL(hcodec_0, VDEC_CLK_CTRL, 9, 0x7, c3_hcodec_pre_parents);
> +static C3_COMP_DIV(hcodec_0, VDEC_CLK_CTRL, 0, 7);
> +static C3_COMP_GATE(hcodec_0, VDEC_CLK_CTRL, 8);
>
> -static struct clk_regmap c3_hcodec_0_div = {
> - .data = &(struct clk_regmap_div_data) {
> - .offset = VDEC_CLK_CTRL,
> - .shift = 0,
> - .width = 7,
> - },
> - .hw.init = &(struct clk_init_data) {
> - .name = "hcodec_0_div",
> - .ops = &clk_regmap_divider_ops,
> - .parent_hws = (const struct clk_hw *[]) {
> - &c3_hcodec_0_sel.hw
> - },
> - .num_parents = 1,
> - .flags = CLK_SET_RATE_PARENT,
> - },
> -};
> -
> -static struct clk_regmap c3_hcodec_0 = {
> - .data = &(struct clk_regmap_gate_data) {
> - .offset = VDEC_CLK_CTRL,
> - .bit_idx = 8,
> - },
> - .hw.init = &(struct clk_init_data) {
> - .name = "hcodec_0",
> - .ops = &clk_regmap_gate_ops,
> - .parent_hws = (const struct clk_hw *[]) {
> - &c3_hcodec_0_div.hw
> - },
> - .num_parents = 1,
> - .flags = CLK_SET_RATE_PARENT,
> - },
> -};
> -
> -static struct clk_regmap c3_hcodec_1_sel = {
> - .data = &(struct clk_regmap_mux_data) {
> - .offset = VDEC3_CLK_CTRL,
> - .mask = 0x7,
> - .shift = 9,
> - },
> - .hw.init = &(struct clk_init_data) {
> - .name = "hcodec_1_sel",
> - .ops = &clk_regmap_mux_ops,
> - .parent_data = c3_hcodec_pre_parents,
> - .num_parents = ARRAY_SIZE(c3_hcodec_pre_parents),
> - },
> -};
> -
> -static struct clk_regmap c3_hcodec_1_div = {
> - .data = &(struct clk_regmap_div_data) {
> - .offset = VDEC3_CLK_CTRL,
> - .shift = 0,
> - .width = 7,
> - },
> - .hw.init = &(struct clk_init_data) {
> - .name = "hcodec_1_div",
> - .ops = &clk_regmap_divider_ops,
> - .parent_hws = (const struct clk_hw *[]) {
> - &c3_hcodec_1_sel.hw
> - },
> - .num_parents = 1,
> - .flags = CLK_SET_RATE_PARENT,
> - },
> -};
> -
> -static struct clk_regmap c3_hcodec_1 = {
> - .data = &(struct clk_regmap_gate_data) {
> - .offset = VDEC3_CLK_CTRL,
> - .bit_idx = 8,
> - },
> - .hw.init = &(struct clk_init_data) {
> - .name = "hcodec_1",
> - .ops = &clk_regmap_gate_ops,
> - .parent_hws = (const struct clk_hw *[]) {
> - &c3_hcodec_1_div.hw
> - },
> - .num_parents = 1,
> - .flags = CLK_SET_RATE_PARENT,
> - },
> -};
> +static C3_COMP_SEL(hcodec_1, VDEC3_CLK_CTRL, 9, 0x7, c3_hcodec_pre_parents);
> +static C3_COMP_DIV(hcodec_1, VDEC3_CLK_CTRL, 0, 7);
> +static C3_COMP_GATE(hcodec_1, VDEC3_CLK_CTRL, 8);
Note: hcodec_clk is a no-glitch clock. The current driver may fail to set
hcodec_clk properly. A previous patch attempted to fix this by adding a
flag,
but was abandoned as it introduced other issues.
(https://lore.kernel.org/all/f8c3b6e7-2f5d-493e-8254-2a27623f0d2e@amlogic.com/)
This macro won't be suitable if we revisit the flag approach later.
>
> static const struct clk_parent_data c3_hcodec_parents[] = {
> { .hw = &c3_hcodec_0.hw },
[...]
> --
> 2.47.2
>
>
> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2025-07-03 7:56 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-02 15:25 [PATCH 00/26] clk: amlogic: clock controllers clean-up and factorisation Jerome Brunet
2025-07-02 15:25 ` [PATCH 01/26] clk: amlogic: a1-peripherals: naming consistency alignment Jerome Brunet
2025-07-02 15:26 ` [PATCH 02/26] clk: amlogic: a1-pll: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 03/26] clk: amlogic: axg-ao: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 04/26] clk: amlogic: axg: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 05/26] clk: amlogic: c3-peripherals: " Jerome Brunet
2025-07-03 2:51 ` Chuan Liu
2025-07-03 7:48 ` Jerome Brunet
2025-07-03 8:31 ` Chuan Liu
2025-07-03 9:02 ` Jerome Brunet
2025-07-03 9:23 ` Chuan Liu
2025-07-02 15:26 ` [PATCH 06/26] clk: amlogic: c3-pll: " Jerome Brunet
2025-07-03 2:57 ` Chuan Liu
2025-07-02 15:26 ` [PATCH 07/26] clk: amlogic: g12a-ao: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 08/26] clk: amlogic: g12a: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 09/26] clk: amlogic: gxbb-ao: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 10/26] clk: amlogic: gxbb: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 11/26] clk: amlogic: meson8b: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 12/26] clk: amlogic: s4-peripherals: " Jerome Brunet
2025-07-03 3:18 ` Chuan Liu
2025-07-03 7:54 ` Jerome Brunet
2025-07-03 8:00 ` Chuan Liu
2025-07-02 15:26 ` [PATCH 13/26] clk: amlogic: s4-pll: " Jerome Brunet
2025-07-03 3:19 ` Chuan Liu
2025-07-02 15:26 ` [PATCH 14/26] clk: amlogic: meson8-ddr: " Jerome Brunet
2025-07-02 15:26 ` [PATCH 15/26] clk: amlogic: drop meson-clkcee Jerome Brunet
2025-07-02 15:26 ` [PATCH 16/26] clk: amlogic: add probe helper for mmio based controllers Jerome Brunet
2025-07-03 3:29 ` Chuan Liu
2025-07-03 8:35 ` Jerome Brunet
2025-07-02 15:26 ` [PATCH 17/26] clk: amlogic: use probe helper in " Jerome Brunet
2025-07-03 6:29 ` Chuan Liu
2025-07-02 15:26 ` [PATCH 18/26] clk: amlogic: aoclk: use clkc-utils syscon probe Jerome Brunet
2025-07-02 15:26 ` [PATCH 19/26] clk: amlogic: move PCLK definition to clkc-utils Jerome Brunet
2025-07-02 15:26 ` [PATCH 20/26] clk: amlogic: drop CLK_SET_RATE_PARENT from peripheral clocks Jerome Brunet
2025-07-02 15:26 ` [PATCH 21/26] clk: amlogic: pclk explicitly use CLK_IGNORE_UNUSED Jerome Brunet
2025-07-03 7:05 ` Chuan Liu
2025-07-02 15:26 ` [PATCH 22/26] clk: amlogic: introduce a common pclk definition Jerome Brunet
2025-07-03 7:10 ` Chuan Liu
2025-07-02 15:26 ` [PATCH 23/26] clk: amlogic: use the " Jerome Brunet
2025-07-03 7:16 ` Chuan Liu
2025-07-03 8:39 ` Jerome Brunet
2025-07-02 15:26 ` [PATCH 24/26] clk: amlogic: add composite clock helpers Jerome Brunet
2025-07-03 7:24 ` Chuan Liu
2025-07-03 8:39 ` Jerome Brunet
2025-07-02 15:26 ` [PATCH 25/26] clk: amlogic: align s4 and c3 pwm clock descriptions Jerome Brunet
2025-07-03 7:27 ` Chuan Liu
2025-07-02 15:26 ` [PATCH 26/26] clk: amlogic: c3-peripherals: use helper for basic composite clocks Jerome Brunet
2025-07-03 7:56 ` Chuan Liu [this message]
2025-07-03 8:44 ` Jerome Brunet
2025-08-06 7:10 ` [PATCH 00/26] clk: amlogic: clock controllers clean-up and factorisation Chuan Liu
2025-08-25 14:24 ` Jerome Brunet
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=27ae4f23-7a41-4810-9639-5bcc4cebc8dd@amlogic.com \
--to=chuan.liu@amlogic.com \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@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 \
--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;
as well as URLs for NNTP newsgroup(s).