From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: "Jerome Brunet" <jbrunet@baylibre.com>,
"Neil Armstrong" <narmstrong@baylibre.com>,
"Kevin Hilman" <khilman@baylibre.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"thierry.reding@gmail.com" <thierry.reding@gmail.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"open list:ARM/Amlogic Meson..."
<linux-amlogic@lists.infradead.org>,
linux-pwm@vger.kernel.org
Subject: Re: [PATCH 1/2] pwm: meson: make full use of common clock framework
Date: Tue, 11 Apr 2023 01:27:43 +0200 [thread overview]
Message-ID: <CAFBinCCaca-VKmxv_SaPxOzBrix98Nj+VDaD1bfqSwvDBg+eKQ@mail.gmail.com> (raw)
In-Reply-To: <08085ec6-0450-2477-e35f-5af19c1de857@gmail.com>
Hi Heiner,
On Sat, Apr 8, 2023 at 10:43 PM Heiner Kallweit <hkallweit1@gmail.com> wrote:
[...]
> + init.name = name;
> + init.ops = &clk_divider_ops;
> + init.flags = CLK_SET_RATE_PARENT;
> + parent_hws[0] = &channel->mux.hw;
> + init.parent_hws = parent_hws;
> + init.num_parents = 1;
There's a very subtle bug in this code:
You're re-using the same struct clk_init_data for all clocks.
The mux above sets
- init.parent_names
- init.num_parents
- (amongst others)
but for the divider and gate you're only overwriting init.num_parents,
which is why I end up with:
xtal 8 8 1 24000000
0 0 50000 Y
[...]
c1108650.pwm#gate1 1 1 0 24000000
0 0 50000 Y
c1108650.pwm#div1 0 0 0 24000000
0 0 50000 Y
c1108650.pwm#mux1 0 0 0 24000000
0 0 50000 Y
c1108650.pwm#gate0 1 1 0 24000000
0 0 50000 Y
c1108650.pwm#div0 0 0 0 24000000
0 0 50000 Y
c1108650.pwm#mux0 0 0 0 24000000
0 0 50000 Y
My suggestion is to switch to struct clk_parent_data entirely (for the
mux this could be done with a separate commit before this one).
Then keep it consistent and don't mix parent_names/parent_hws and
parent_data (just stick to parent_data, which can manage the previous
two and more).
I *think* struct clk_parent_data can even be used to simplify the
second patch (by just having an "empty" entry - with index = -1 - in
the array).
[...]
> + channel->gate.bit_idx = __ffs(meson_pwm_per_channel_data[i].clk_en_mask);
I's the only place where clk_en_mask is now used. So I think it's
valid to just rename clk_en_mask to clk_en_idx and pass the value
without the BIT macro during initialization.
Best regards,
Martin
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2023-04-10 23:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-08 20:40 [PATCH 0/2] " Heiner Kallweit
2023-04-08 20:41 ` [PATCH 1/2] " Heiner Kallweit
2023-04-10 23:27 ` Martin Blumenstingl [this message]
2023-04-11 6:34 ` Heiner Kallweit
2023-04-08 20:43 ` [PATCH 2/2] pwm: meson: omit video/hdmi clock as mux parent Heiner Kallweit
2023-04-11 17:09 ` Martin Blumenstingl
2023-04-10 22:15 ` [PATCH 0/2] pwm: meson: make full use of common clock framework Martin Blumenstingl
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=CAFBinCCaca-VKmxv_SaPxOzBrix98Nj+VDaD1bfqSwvDBg+eKQ@mail.gmail.com \
--to=martin.blumenstingl@googlemail.com \
--cc=hkallweit1@gmail.com \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pwm@vger.kernel.org \
--cc=narmstrong@baylibre.com \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/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®