]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/bridge: sii902x: Add pixel clock check in atomic_check
authorJayesh Choudhary <j-choudhary@ti.com>
Thu, 13 Jun 2024 08:38:05 +0000 (14:08 +0530)
committerMaxime Ripard <mripard@kernel.org>
Thu, 13 Jun 2024 15:36:44 +0000 (17:36 +0200)
Check the pixel clock for the mode in atomic_check and ensure that
it is within the range supported by the bridge.

Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
Reviewed-by: Aradhya Bhatia <a-bhatia1@ti.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240613083805.439337-4-j-choudhary@ti.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/bridge/sii902x.c

index 00a8c469f5532b07610eb795dabfd37cccbfc883..7f91b0db161ed5137103034850aa03e4a660bcb7 100644 (file)
@@ -496,6 +496,10 @@ static int sii902x_bridge_atomic_check(struct drm_bridge *bridge,
                                       struct drm_crtc_state *crtc_state,
                                       struct drm_connector_state *conn_state)
 {
+       if (crtc_state->mode.clock < SII902X_MIN_PIXEL_CLOCK_KHZ ||
+           crtc_state->mode.clock > SII902X_MAX_PIXEL_CLOCK_KHZ)
+               return -EINVAL;
+
        /*
         * There might be flags negotiation supported in future but
         * set the bus flags in atomic_check statically for now.