diff mbox series

[02/33] drm/vc4: kms: Warn if clk_set_min_rate fails

Message ID 20220613144800.326124-3-maxime@cerno.tech (mailing list archive)
State New, archived
Headers show
Series drm/vc4: Misc fixes | expand

Commit Message

Maxime Ripard June 13, 2022, 2:47 p.m. UTC
We currently ignore the clk_set_min_rate return code assuming it would
succeed. However, it can fail if we ask for a rate higher than the
current maximum for example.

Since we can't fail in atomic_commit, at least warn on failure.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Dave Stevenson June 28, 2022, 11:28 a.m. UTC | #1
On Mon, 13 Jun 2022 at 15:48, Maxime Ripard <maxime@cerno.tech> wrote:
>
> We currently ignore the clk_set_min_rate return code assuming it would
> succeed. However, it can fail if we ask for a rate higher than the
> current maximum for example.
>
> Since we can't fail in atomic_commit, at least warn on failure.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

> ---
>  drivers/gpu/drm/vc4/vc4_kms.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
> index c169bd72e53b..7a7c90d8520b 100644
> --- a/drivers/gpu/drm/vc4/vc4_kms.c
> +++ b/drivers/gpu/drm/vc4/vc4_kms.c
> @@ -405,7 +405,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
>                  * Do a temporary request on the core clock during the
>                  * modeset.
>                  */
> -               clk_set_min_rate(hvs->core_clk, core_rate);
> +               WARN_ON(clk_set_min_rate(hvs->core_clk, core_rate));
>         }
>
>         drm_atomic_helper_commit_modeset_disables(dev, state);
> @@ -438,7 +438,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
>                  * Request a clock rate based on the current HVS
>                  * requirements.
>                  */
> -               clk_set_min_rate(hvs->core_clk, new_hvs_state->core_clock_rate);
> +               WARN_ON(clk_set_min_rate(hvs->core_clk, new_hvs_state->core_clock_rate));
>
>                 drm_dbg(dev, "Core clock actual rate: %lu Hz\n",
>                         clk_get_rate(hvs->core_clk));
> --
> 2.36.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index c169bd72e53b..7a7c90d8520b 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -405,7 +405,7 @@  static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
 		 * Do a temporary request on the core clock during the
 		 * modeset.
 		 */
-		clk_set_min_rate(hvs->core_clk, core_rate);
+		WARN_ON(clk_set_min_rate(hvs->core_clk, core_rate));
 	}
 
 	drm_atomic_helper_commit_modeset_disables(dev, state);
@@ -438,7 +438,7 @@  static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
 		 * Request a clock rate based on the current HVS
 		 * requirements.
 		 */
-		clk_set_min_rate(hvs->core_clk, new_hvs_state->core_clock_rate);
+		WARN_ON(clk_set_min_rate(hvs->core_clk, new_hvs_state->core_clock_rate));
 
 		drm_dbg(dev, "Core clock actual rate: %lu Hz\n",
 			clk_get_rate(hvs->core_clk));