kernel: bump 4.14 to 4.14.93
[openwrt/staging/chunkeey.git] / target / linux / brcm2708 / patches-4.14 / 950-0179-drm-vc4-Reject-HDMI-modes-with-too-high-of-clocks.patch
1 From ee3cf448adf29e8948c40d251f87d87a9817515c Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Wed, 20 Sep 2017 15:59:34 -0700
4 Subject: [PATCH 179/454] drm/vc4: Reject HDMI modes with too high of clocks.
5
6 Peter Robinson reported issues on Fedora with 4k monitors not having
7 their modes filtered down to 1920x1080 on Raspberry Pi.
8
9 v2: Fix vc5 typo in place of vc4.
10
11 Cc: Peter Robinson <pbrobinson@redhat.com>
12 Signed-off-by: Eric Anholt <eric@anholt.net>
13 Link: https://patchwork.freedesktop.org/patch/msgid/20170920225935.14566-1-eric@anholt.net
14 Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v1)
15 (cherry picked from commit 32e823c63e90f7535ea1cc5311d25c0233e1456d)
16 ---
17 drivers/gpu/drm/vc4/vc4_hdmi.c | 15 +++++++++++++++
18 1 file changed, 15 insertions(+)
19
20 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
21 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
22 @@ -695,7 +695,22 @@ static void vc4_hdmi_encoder_enable(stru
23 }
24 }
25
26 +static enum drm_mode_status
27 +vc4_hdmi_encoder_mode_valid(struct drm_encoder *crtc,
28 + const struct drm_display_mode *mode)
29 +{
30 + /* HSM clock must be 108% of the pixel clock. Additionally,
31 + * the AXI clock needs to be at least 25% of pixel clock, but
32 + * HSM ends up being the limiting factor.
33 + */
34 + if (mode->clock > HSM_CLOCK_FREQ / (1000 * 108 / 100))
35 + return MODE_CLOCK_HIGH;
36 +
37 + return MODE_OK;
38 +}
39 +
40 static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs = {
41 + .mode_valid = vc4_hdmi_encoder_mode_valid,
42 .disable = vc4_hdmi_encoder_disable,
43 .enable = vc4_hdmi_encoder_enable,
44 };