drm/vc4: hdmi: Move the HSM clock enable to runtime_pm
authorMaxime Ripard <maxime@cerno.tech>
Wed, 22 Sep 2021 12:54:18 +0000 (14:54 +0200)
committerMaxime Ripard <maxime@cerno.tech>
Mon, 25 Oct 2021 13:33:40 +0000 (15:33 +0200)
commitc86b41214362e8e715e1343e16d5d6af0562db05
tree47af398ad982caf33d6410cdbdbe964a7660f507
parent3e85b81591609bb794bb00cd619b20965b5b38cd
drm/vc4: hdmi: Move the HSM clock enable to runtime_pm

In order to access the HDMI controller, we need to make sure the HSM
clock is enabled. If we were to access it with the clock disabled, the
CPU would completely hang, resulting in an hard crash.

Since we have different code path that would require it, let's move that
clock enable / disable to runtime_pm that will take care of the
reference counting for us.

Since we also want to change the HSM clock rate and it's only valid
while the clock is disabled, we need to move the clk_set_min_rate() call
on the HSM clock above pm_runtime_get_and_sync().

Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder driver")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Tested-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Tested-by: Michael Stapelberg <michael@stapelberg.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-5-maxime@cerno.tech
Link: https://lore.kernel.org/linux-arm-kernel/20210924152334.1342630-1-maxime@cerno.tech/
drivers/gpu/drm/vc4/vc4_hdmi.c