From: Benjamin Bara <bbara93@gmail.com>
To: Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Russell King <linux@armlinux.org.uk>,
Abel Vesa <abelvesa@kernel.org>, Peng Fan <peng.fan@nxp.com>
Cc: Frank Oltmanns <frank@oltmanns.dev>,
Maxime Ripard <mripard@kernel.org>,
devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
Benjamin Bara <benjamin.bara@skidata.com>,
Adam Ford <aford173@gmail.com>,
Lucas Stach <l.stach@pengutronix.de>
Subject: [PATCH 00/13] imx8mp: first clock propagation attempt (for LVDS)
Date: Mon, 18 Sep 2023 00:39:56 +0200 [thread overview]
Message-ID: <20230918-imx8mp-dtsi-v1-0-1d008b3237c0@skidata.com> (raw)
Hi!
Target of this series is to dynamically set the rate of video_pll1 to
the required LVDS clock rate(s), which are configured by the panel, and
the lvds-bridge respectively.
Some background:
The LVDS panel requires two clocks: the crtc clock and the lvds clock.
The lvds rate is always 7x the crtc rate. On the imx8mp, these are
assigned to media_disp2_pix and media_ldb, which are both
clk-composite-8m. The rates are set by drm_client_modeset_commit() (and
later by fsl_ldb_atomic_enable()), and the fsl-ldb driver, first crtc,
then lvds. The parent is typically assigned to video_pll1, which is a
clk-pll14xx (pll1443x).
The main problem:
As the clk-composite-8m currently doesn't support CLK_SET_RATE_PARENT,
the crtc rate is not propagated to video_pll1, and therefore must be
assigned in the device-tree manually.
The idea:
Enable CLK_SET_RATE_PARENT, at least for media_disp2_pix and media_ldb.
When this is done, ensure that the pll1443x can be re-configured,
meaning it ensures that an already configured rate (crtc rate) is still
supported when a second child requires a different rate (lvds rate). As
the children have divider, the current approach is straight forward by
calculating the LCM of the required rates. During the rate change of the
PLL, it must ensure that all children still have the configured rate at
the end (and maybe also bypass the clock while doing so?). This is done
by implementing a notifier function for the clk-composite-8m. The tricky
part is now to find out if the rate change was intentional or not. This
is done by adding the "change trigger" to the notify data. In our case,
we now can infer if we aren't the change trigger, we need to keep the
existing rate after the PLL's rate change. We keep the existing rate by
modifying the new_rate of the clock's core, as we are quite late in an
already ongoing clock change process.
Future work:
The re-configuration of the PLL can definitely be improved for other use
cases where the children have more fancy inter-dependencies. That's one
of the main reasons I currently only touched the mentioned clocks.
Additionally, it might make sense to automatically re-parent if a
different possible parent suits better.
For the core part, I thought about extending my "unintentional change
check" so that the core ensures that the children keep the configured
rate, which might not be easy as the parent could be allowed to "round",
but it's not clear (at least to me yet) how much rounding is allowed. I
found a similar discussion posted here[1], therefore added Frank and
Maxime.
Thanks & regards,
Benjamin
[1] https://lore.kernel.org/lkml/20230825-pll-mipi_keep_rate-v1-0-35bc43570730@oltmanns.dev/
---
Benjamin Bara (13):
arm64: dts: imx8mp: lvds_bridge: use root instead of composite
arm64: dts: imx8mp: re-parent IMX8MP_CLK_MEDIA_MIPI_PHY1_REF
clk: implement clk_hw_set_rate()
clk: print debug message if parent change is ignored
clk: keep track of the trigger of an ongoing clk_set_rate
clk: keep track if a clock is explicitly configured
clk: detect unintended rate changes
clk: divider: stop early if an optimal divider is found
clk: imx: pll14xx: consider active rate for re-config
clk: imx: composite-8m: convert compute_dividers to void
clk: imx: composite-8m: implement CLK_SET_RATE_PARENT
clk: imx: imx8mp: allow LVDS clocks to set parent rate
arm64: dts: imx8mp: remove assigned-clock-rate of IMX8MP_VIDEO_PLL1
arch/arm64/boot/dts/freescale/imx8mp.dtsi | 14 +--
drivers/clk/clk-divider.c | 9 ++
drivers/clk/clk.c | 146 +++++++++++++++++++++++++++++-
drivers/clk/imx/clk-composite-8m.c | 89 +++++++++++++++---
drivers/clk/imx/clk-imx8mp.c | 4 +-
drivers/clk/imx/clk-pll14xx.c | 20 ++++
drivers/clk/imx/clk.h | 4 +
include/linux/clk-provider.h | 2 +
include/linux/clk.h | 2 +
9 files changed, 261 insertions(+), 29 deletions(-)
---
base-commit: e143016b56ecb0fcda5bb6026b0a25fe55274f56
change-id: 20230913-imx8mp-dtsi-7c6e25907e0e
Best regards,
--
Benjamin Bara <benjamin.bara@skidata.com>
next reply other threads:[~2023-09-17 22:40 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-17 22:39 Benjamin Bara [this message]
2023-09-17 22:39 ` [PATCH 01/13] arm64: dts: imx8mp: lvds_bridge: use root instead of composite Benjamin Bara
2023-09-19 6:47 ` Maxime Ripard
2023-09-20 7:27 ` Benjamin Bara
2023-09-17 22:39 ` [PATCH 02/13] arm64: dts: imx8mp: re-parent IMX8MP_CLK_MEDIA_MIPI_PHY1_REF Benjamin Bara
2023-10-03 13:01 ` Adam Ford
2023-10-04 8:36 ` Benjamin Bara
2023-09-17 22:39 ` [PATCH 03/13] clk: implement clk_hw_set_rate() Benjamin Bara
2023-09-19 6:50 ` Maxime Ripard
2023-09-17 22:40 ` [PATCH 04/13] clk: print debug message if parent change is ignored Benjamin Bara
2023-09-17 22:40 ` [PATCH 05/13] clk: keep track of the trigger of an ongoing clk_set_rate Benjamin Bara
2023-09-19 7:06 ` Maxime Ripard
2023-09-20 7:50 ` Benjamin Bara
2023-09-17 22:40 ` [PATCH 06/13] clk: keep track if a clock is explicitly configured Benjamin Bara
2023-09-19 7:07 ` Maxime Ripard
2023-09-20 7:22 ` Benjamin Bara
2023-09-25 15:07 ` Maxime Ripard
2023-09-17 22:40 ` [PATCH 07/13] clk: detect unintended rate changes Benjamin Bara
2023-09-19 7:22 ` Maxime Ripard
2023-09-17 22:40 ` [PATCH 08/13] clk: divider: stop early if an optimal divider is found Benjamin Bara
2023-09-17 22:40 ` [PATCH 09/13] clk: imx: pll14xx: consider active rate for re-config Benjamin Bara
2023-09-17 22:40 ` [PATCH 10/13] clk: imx: composite-8m: convert compute_dividers to void Benjamin Bara
2023-09-17 22:40 ` [PATCH 11/13] clk: imx: composite-8m: implement CLK_SET_RATE_PARENT Benjamin Bara
2023-09-17 22:40 ` [PATCH 12/13] clk: imx: imx8mp: allow LVDS clocks to set parent rate Benjamin Bara
2023-09-17 22:40 ` [PATCH 13/13] arm64: dts: imx8mp: remove assigned-clock-rate of IMX8MP_VIDEO_PLL1 Benjamin Bara
2023-09-18 5:00 ` [PATCH 00/13] imx8mp: first clock propagation attempt (for LVDS) Adam Ford
2023-09-18 17:59 ` Benjamin Bara
2023-09-19 7:37 ` Maxime Ripard
2023-09-18 17:24 ` Frank Oltmanns
2023-09-18 18:05 ` Benjamin Bara
2023-09-19 7:39 ` Maxime Ripard
2023-09-19 7:31 ` Maxime Ripard
2023-10-03 13:28 ` Adam Ford
2023-10-04 8:04 ` Alexander Stein
2023-10-04 8:28 ` Benjamin Bara
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=20230918-imx8mp-dtsi-v1-0-1d008b3237c0@skidata.com \
--to=bbara93@gmail.com \
--cc=abelvesa@kernel.org \
--cc=aford173@gmail.com \
--cc=benjamin.bara@skidata.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=frank@oltmanns.dev \
--cc=kernel@pengutronix.de \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=l.stach@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mripard@kernel.org \
--cc=mturquette@baylibre.com \
--cc=peng.fan@nxp.com \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=sboyd@kernel.org \
--cc=shawnguo@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).