From: Frank Oltmanns <frank@oltmanns.dev>
To: 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>,
Maxime Ripard <mripard@kernel.org>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Ondrej Jirman <x@xnux.eu>, Icenowy Zheng <uwu@icenowy.me>
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, dri-devel@lists.freedesktop.org,
Frank Oltmanns <frank@oltmanns.dev>,
Icenowy Zheng <icenowy@aosc.io>
Subject: [PATCH 0/3] Make Allwinner A64's pll-mipi keep its rate when parent rate changes
Date: Fri, 25 Aug 2023 07:36:36 +0200 [thread overview]
Message-ID: <20230825-pll-mipi_keep_rate-v1-0-35bc43570730@oltmanns.dev> (raw)
I would like to make the Allwinner A64's pll-mipi to keep its rate when
its parent's (pll-video0) rate changes. Keeping pll-mipi's rate is
required, to let the A64 drive both an LCD and HDMI display at the same
time, because both have pll-video0 as an ancestor.
PATCH 1 adds this functionality as a feature into the clk framework (new
flag: CLK_KEEP_RATE).
Cores that use this flag, store a rate as req_rate when it or one of its
descendants requests a new rate.
That rate is then restored in the clk_change_rate recursion, which walks
through the tree. It will reach the flagged core (e.g. pll-mipi) after
the parent's rate (e.g. pll-video0) has already been set to the new
rate. It will then call determine_rate (which requests the parent's
current, i.e. new, rate) to determine a rate that is close to the
flagged core's previous rate. Afterward it will re-calculate the rates
for the flagged core's subtree.
PATCH 2 & 3 demonstrate how the new flag can be used for A64's pll-mipi.
By setting this flag, it is no longer required to get an exclusive lock
when setting tcon0's rate, because the rate will be restored when its
parent's (pll-mipi) rate is restored.
This work is inspired by an out-of-tree patchset [1] [2] [3].
Unfortunately, the patchset uses clk_set_rate() in a notifier callback,
which the following comment on clk_notifier_register() forbids: "The
callbacks associated with the notifier must not re-enter into the clk
framework by calling any top-level clk APIs." [4] Furthermore, that
out-of-tree patchset no longer works with the current linux-next,
because setting pll-mipi is now also resetting pll-video0 [5].
Thank you for considering this contribution,
Frank
[1] https://github.com/megous/linux/commit/4124e115de82797f604808aaa5caad4512a9a1ed
[2] https://github.com/megous/linux/commit/edc93fd70ee759fd989664fcb85996cb48a006e6
[3] https://github.com/megous/linux/commit/40f5fc5b08b21142931662147d039ec217c9ba2f
[4] https://elixir.bootlin.com/linux/v6.4.11/source/drivers/clk/clk.c#L4578
[5] https://lore.kernel.org/linux-kernel/20230807-pll-mipi_set_rate_parent-v6-0-f173239a4b59@oltmanns.dev/
Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
---
Frank Oltmanns (2):
clk: keep clock rate when parent rate changes
clk: sunxi-ng: a64: keep rate of pll-mipi stable across parent rate changes
Icenowy Zheng (1):
drm/sun4i: tcon: parent keeps TCON0 clock stable on A64
drivers/clk/clk.c | 48 ++++++++++++++++++++++++++++++++++-
drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 3 ++-
drivers/gpu/drm/sun4i/sun4i_tcon.c | 15 +++++++++--
drivers/gpu/drm/sun4i/sun4i_tcon.h | 1 +
include/linux/clk-provider.h | 2 ++
5 files changed, 65 insertions(+), 4 deletions(-)
---
base-commit: c539c5c0a7ccafe7169c02564cceeb50317b540b
change-id: 20230824-pll-mipi_keep_rate-0a3a0d3574cf
Best regards,
--
Frank Oltmanns <frank@oltmanns.dev>
next reply other threads:[~2023-08-25 5:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-25 5:36 Frank Oltmanns [this message]
2023-08-25 5:36 ` [PATCH 1/3] clk: keep clock rate when parent rate changes Frank Oltmanns
2023-08-25 5:36 ` [PATCH 2/3] clk: sunxi-ng: a64: keep rate of pll-mipi stable across " Frank Oltmanns
2023-08-25 5:36 ` [PATCH 3/3] drm/sun4i: tcon: parent keeps TCON0 clock stable on A64 Frank Oltmanns
2023-08-25 8:13 ` [PATCH 0/3] Make Allwinner A64's pll-mipi keep its rate when parent rate changes Maxime Ripard
2023-08-25 15:07 ` Frank Oltmanns
2023-08-26 9:12 ` Frank Oltmanns
2023-08-28 8:25 ` Maxime Ripard
2023-08-28 14:14 ` Frank Oltmanns
2023-08-28 8:04 ` Maxime Ripard
2023-08-28 14:17 ` 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=20230825-pll-mipi_keep_rate-v1-0-35bc43570730@oltmanns.dev \
--to=frank@oltmanns.dev \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=icenowy@aosc.io \
--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=mripard@kernel.org \
--cc=mturquette@baylibre.com \
--cc=samuel@sholland.org \
--cc=sboyd@kernel.org \
--cc=uwu@icenowy.me \
--cc=wens@csie.org \
--cc=x@xnux.eu \
/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