linux-sunxi.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Make Allwinner A64's pll-mipi keep its rate when parent rate changes
@ 2023-08-25  5:36 Frank Oltmanns
  2023-08-25  5:36 ` [PATCH 1/3] clk: keep clock " Frank Oltmanns
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Frank Oltmanns @ 2023-08-25  5:36 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Maxime Ripard, David Airlie, Daniel Vetter,
	Ondrej Jirman, Icenowy Zheng
  Cc: linux-clk, linux-kernel, linux-arm-kernel, linux-sunxi, dri-devel,
	Frank Oltmanns, Icenowy Zheng

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>


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-08-28 14:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-25  5:36 [PATCH 0/3] Make Allwinner A64's pll-mipi keep its rate when parent rate changes Frank Oltmanns
2023-08-25  5:36 ` [PATCH 1/3] clk: keep clock " 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

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).