drm/sun4i: no picture when connected to a 4k display

Maxime Ripard maxime.ripard at free-electrons.com
Fri Dec 1 15:51:45 UTC 2017

Hi Hans,

On Thu, Nov 30, 2017 at 06:14:13PM +0100, Hans Verkuil wrote:
> Hi Maxime, Chen-Yu,
> When I connect my cubieboard running 4.15-rc1 to my 4k display I get
> no picture. Some digging found that there is no check against the
> upper pixelclock limit of the HDMI output, so X selects a 4kp60
> format at 594 MHz, which obviously won't work.
> I whipped up the quick patch below, but this information about the
> max support HDMI frequency should probably come from the device
> tree. Although for the A10 and A20 I guess it could also be
> hardcoded in the source since this code is only used for sun4i.
> Anyway, when I use this patch I get a proper 1080p60 picture.

Thanks for that patch!

> Regards,
> 	Hans
> Signed-off-by: Hans Verkuil <hans.verkuil at cisco.com>
> ---
> diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
> index dda904ec0534..dc2f550f54ff 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
> @@ -208,8 +208,17 @@ static int sun4i_hdmi_get_modes(struct drm_connector *connector)
>  	return ret;
>  }
> +static int sun4i_hdmi_mode_valid(struct drm_connector *connector,
> +				 struct drm_display_mode *mode)
> +{
> +	if (mode->clock > 170000)
> +		return MODE_CLOCK_HIGH;
> +	return MODE_OK;
> +}
> +

This is slightly more complicated than that. Even if the hardware
could be capable of achieving that rate, we might not be able to reach
it due to other constraints (such as other device already running that
would need to run at a particular rate.

A more elegant solution would be to call clk_round_rate on mode->clock
and see if the rate is close enough. You can have a look at what we
have in sun4i_rgb_mode_valid if you want.

It's still not optimal, as we have never been able to agree on what
"close enough" is and we just went to the other extreme. If you have
some input on that, it would be great :)


Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20171201/ae26f282/attachment.sig>

More information about the dri-devel mailing list