Re: [PATCH 2/4] drm/vc4: hdmi: Enable power domain before setting minimum

From: Javier Martinez Canillas
Date: Mon Feb 13 2023 - 08:00:01 EST


On 1/26/23 18:05, Maxime Ripard wrote:
> On the RaspberryPi0-3, the HSM clock was provided by the clk-bcm2835
> driver, but on the Pi4 it was provided by the firmware through the
> clk-raspberrypi driver.
>
> The clk-bcm2835 driver registers the HSM clock using the
> CLK_SET_RATE_GATE flag that prevents any modification to the rate while
> the clock is active.
>
> This meant that we needed to call clk_set_min_rate() before our call to
> pm_runtime_resume_and_get() since our runtime_resume implementation
> needs to enable the HSM clock for the HDMI controller registers to be
> functional.
>
> However, the HSM clock is part of the HDMI power domain which might not
> be powered prior to the pm_runtime_resume_and_get() call, so we could
> end up changing the rate of the HSM clock while its power domain was
> disabled.
>
> We recently changed the backing driver for the RaspberryPi0-3 to
> clk-raspberrypi though, which doesn't have such restrictions. We can
> thus move the clk_set_min_rate() after our call to runtime_resume and
> avoid the access while the power domain is disabled.
>
> Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx>
> ---

I'm not familiar with the RPi clock hierarchy but the commit message explains
why a clk_set_min_rate() was needed before the pm_runtime_resume_and_get(),
and why that isn't needed anymore after the switch to clk-raspberrypi driver.

And certainly, the correct thing to do is to enable the power domain that a
controller is part of, before attempting to change the rate for one of its
clocks. So the patch looks good to me.

Reviewed-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>

--
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat