drm/bridge: samsung-dsim: reread ref clock before configuring PLL
authorMichael Tretter <m.tretter@pengutronix.de>
Fri, 6 Oct 2023 15:07:04 +0000 (17:07 +0200)
committerNeil Armstrong <neil.armstrong@linaro.org>
Mon, 9 Oct 2023 09:06:22 +0000 (11:06 +0200)
commiteb26c6ab2a11e6c595ee88ce30c7de9578d957aa
treecbbd0cac9990086d960fdc46ebc824278c78c007
parent3683182a7254f728778452814abe2437a12502c3
drm/bridge: samsung-dsim: reread ref clock before configuring PLL

The PLL reference clock may change at runtime when its parent clock
changes. For example, this may happen on the i.MX8M Nano if the
reference clock is a child of the Video PLL. If the pixel clock changes,
this may propagate to the Video PLL and as a side effect change the
reference clock. Thus, reading the clock rate during probe is not
sufficient to correctly configure the PLL for the expected hs clock.

Read the actual rate of the reference clock before calculating the PLL
configuration parameters.

Note that the "samsung,pll-clock-frequency" is always preferred and PLL
reference clock is only read from the clock tree if that device tree
property is not set.

Reviewed-by: Inki Dae <inki.dae@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de> # Kontron BL i.MX8MM + Waveshare 10.1inch HDMI LCD (E)
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20230818-samsung-dsim-v2-2-846603df0e0a@pengutronix.de
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230818-samsung-dsim-v2-2-846603df0e0a@pengutronix.de
drivers/gpu/drm/bridge/samsung-dsim.c
include/drm/bridge/samsung-dsim.h