drm/vc4: hdmi: Rework hdmi_enable_4kp60 detection
authorMaxime Ripard <maxime@cerno.tech>
Thu, 24 Mar 2022 10:57:57 +0000 (11:57 +0100)
committerPhil Elwell <8911409+pelwell@users.noreply.github.com>
Fri, 22 Apr 2022 09:17:27 +0000 (10:17 +0100)
commit15acfbaf70d7f4b371f2a3fe85e47d5988264217
tree0f2dda4477ce39509e1e58a8149712e02ecd98b3
parentd1962cf8040f5e7db883cc5d076e3e8523f1bcf2
drm/vc4: hdmi: Rework hdmi_enable_4kp60 detection

In order to support higher HDMI frequencies, users have to set the
hdmi_enable_4kp60 parameter in their config.txt file.

We were detecting this so far by calling clk_round_rate on the core
clock with the frequency we're supposed to run at when one of those
modes is enabled. Whether or not the parameter was enabled could then be
inferred by the returned rate since the maximum clock rate reported by
the firmware was one of the side effect of setting that parameter.

However, the recent clock rework we did changed what clk_round_rate was
returning to always return the minimum allowed, and thus this test
wasn't reliable anymore.

Let's instead try to set a minimum on that clock for the rate we'd like
to reach. If the maximum reported by the firmware is below the minimum
we're trying to set, the clock framework will return an error which we
then can use to infer whether the parameter is set or not.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
drivers/gpu/drm/vc4/vc4_drv.h
drivers/gpu/drm/vc4/vc4_hdmi.c
drivers/gpu/drm/vc4/vc4_hdmi.h
drivers/gpu/drm/vc4/vc4_hvs.c