[PATCH v2 2/2] drm: renesas: rz-du: rzg2l_du_encoder: Fix max dot clock for DPI

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Dec 10 11:13:08 UTC 2024


Hi Biju,

Thank you for the patch.

On Tue, Oct 22, 2024 at 09:24:24AM +0100, Biju Das wrote:
> As per the RZ/G2UL hardware manual Table 33.4 Clock List, the maximum
> dot clock for the DPI interface is 83.5 MHz. Add mode_valid callback
> to reject modes greater than 83.5 MHz.
> 
> Suggested-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
> Signed-off-by: Biju Das <biju.das.jz at bp.renesas.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>

> ---
> Changes in v2:
>  * Moved .mode_valid from crtc to encoder as the new state is not
>    available in crtc and instead, we could check renc->output for
>    .mode_valid() function of drm_encoder.
>  * Dropped rzg2l_du_crtc_atomic_check().
> ---
>  .../gpu/drm/renesas/rz-du/rzg2l_du_encoder.c   | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_encoder.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_encoder.c
> index 339cbaaea0b5..564ab4cb3d37 100644
> --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_encoder.c
> +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_encoder.c
> @@ -10,6 +10,7 @@
>  #include <linux/export.h>
>  #include <linux/of.h>
>  
> +#include <drm/drm_atomic_helper.h>
>  #include <drm/drm_bridge.h>
>  #include <drm/drm_bridge_connector.h>
>  #include <drm/drm_panel.h>
> @@ -24,6 +25,22 @@
>  static const struct drm_encoder_funcs rzg2l_du_encoder_funcs = {
>  };
>  
> +static enum drm_mode_status
> +rzg2l_du_encoder_mode_valid(struct drm_encoder *encoder,
> +			    const struct drm_display_mode *mode)
> +{
> +	struct rzg2l_du_encoder *renc = to_rzg2l_encoder(encoder);
> +
> +	if (renc->output == RZG2L_DU_OUTPUT_DPAD0 && mode->clock > 83500)
> +		return MODE_CLOCK_HIGH;
> +
> +	return MODE_OK;
> +}
> +
> +static const struct drm_encoder_helper_funcs rzg2l_du_encoder_helper_funcs = {
> +	.mode_valid = rzg2l_du_encoder_mode_valid,
> +};
> +
>  int rzg2l_du_encoder_init(struct rzg2l_du_device  *rcdu,
>  			  enum rzg2l_du_output output,
>  			  struct device_node *enc_node)
> @@ -48,6 +65,7 @@ int rzg2l_du_encoder_init(struct rzg2l_du_device  *rcdu,
>  		return PTR_ERR(renc);
>  
>  	renc->output = output;
> +	drm_encoder_helper_add(&renc->base, &rzg2l_du_encoder_helper_funcs);
>  
>  	/* Attach the bridge to the encoder. */
>  	ret = drm_bridge_attach(&renc->base, bridge, NULL,

-- 
Regards,

Laurent Pinchart


More information about the dri-devel mailing list