[PATCH 5/7] drm/bridge: tc358767: reject modes which require too much BW

Andrzej Hajda a.hajda at samsung.com
Mon Nov 19 07:36:11 UTC 2018


On 29.10.2018 12:46, Tomi Valkeinen wrote:
> The current driver accepts any videomode with pclk < 154MHz. This is not
> correct, as with 1 lane and/or 1.62Mbps speed not all videomodes can be
> supported.
>
> Add code to reject modes that require more bandwidth that is available.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ti.com>

> ---
>  drivers/gpu/drm/bridge/tc358767.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
> index ab299f4debfa..b026b5ef7378 100644
> --- a/drivers/gpu/drm/bridge/tc358767.c
> +++ b/drivers/gpu/drm/bridge/tc358767.c
> @@ -1114,10 +1114,20 @@ static bool tc_bridge_mode_fixup(struct drm_bridge *bridge,
>  static enum drm_mode_status tc_connector_mode_valid(struct drm_connector *connector,
>  				   struct drm_display_mode *mode)
>  {
> +	struct tc_data *tc = connector_to_tc(connector);
> +	u32 req, avail;
> +	u32 bits_per_pixel = 24;
> +
>  	/* DPI interface clock limitation: upto 154 MHz */
>  	if (mode->clock > 154000)
>  		return MODE_CLOCK_HIGH;
>  
> +	req = mode->clock * bits_per_pixel / 8 / 1000;
> +	avail = tc->link.base.num_lanes * tc->link.base.rate / 1000;


You can remove "/ 1000" from both lines.

Reviewed-by: Andrzej Hajda <a.hajda at samsung.com>

 --
Regards
Andrzej



> +
> +	if (req > avail)
> +		return MODE_BAD;
> +
>  	return MODE_OK;
>  }
>  




More information about the dri-devel mailing list