Hi,

On 11/09/2025 14:07, Swamil Jain wrote:
> From: Jayesh Choudhary <[email protected]>
> 
> Since OLDI consumes DSS VP clock directly as serial clock, mode_valid()
> check cannot be performed in tidss driver which should be checked
> in OLDI driver.

Please explain here a bit more what's going on here. You say
mode_valid() cannot be done in tidss. Why not? Then you add atomic_check
to oldi driver here, why is that the same as model_valid in tidss?

> Fixes: 7246e0929945 ("drm/tidss: Add OLDI bridge support")

What bug does this fix?

> Tested-by: Michael Walle <[email protected]>
> Reviewed-by: Devarsh Thakkar <[email protected]>
> Signed-off-by: Jayesh Choudhary <[email protected]>
> Signed-off-by: Swamil Jain <[email protected]>
> ---
>  drivers/gpu/drm/tidss/tidss_oldi.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tidss/tidss_oldi.c 
> b/drivers/gpu/drm/tidss/tidss_oldi.c
> index 7ecbb2c3d0a2..ada691839ef3 100644
> --- a/drivers/gpu/drm/tidss/tidss_oldi.c
> +++ b/drivers/gpu/drm/tidss/tidss_oldi.c
> @@ -309,6 +309,26 @@ static u32 *tidss_oldi_atomic_get_input_bus_fmts(struct 
> drm_bridge *bridge,
>       return input_fmts;
>  }
>  
> +static int tidss_oldi_atomic_check(struct drm_bridge *bridge,
> +                                struct drm_bridge_state *bridge_state,
> +                                struct drm_crtc_state *crtc_state,
> +                                struct drm_connector_state *conn_state)
> +{
> +     struct tidss_oldi *oldi = drm_bridge_to_tidss_oldi(bridge);
> +     struct drm_display_mode *adjusted_mode;
> +     unsigned long round_clock;
> +
> +     adjusted_mode = &crtc_state->adjusted_mode;
> +     round_clock = clk_round_rate(oldi->serial, adjusted_mode->clock * 7 * 
> 1000);
> +     /*
> +      * To keep the check consistent with dispc_vp_set_clk_rate(),
> +      * we use the same 5% check here.
> +      */
> +     if (dispc_pclk_diff(adjusted_mode->clock * 7 * 1000, round_clock) > 5)
> +             return -EINVAL;
> +     return 0;
> +}
> +
>  static const struct drm_bridge_funcs tidss_oldi_bridge_funcs = {
>       .attach = tidss_oldi_bridge_attach,
>       .atomic_pre_enable = tidss_oldi_atomic_pre_enable,
> @@ -317,6 +337,7 @@ static const struct drm_bridge_funcs 
> tidss_oldi_bridge_funcs = {
>       .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
>       .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
>       .atomic_reset = drm_atomic_helper_bridge_reset,
> +     .atomic_check = tidss_oldi_atomic_check,
>  };
>  
>  static int get_oldi_mode(struct device_node *oldi_tx, int 
> *companion_instance)

Reply via email to