f576b8624e12c55131e2b0ef0289ebbab2bd828f
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0612-drm-vc4-Alter-the-HDMI-state-machine-clock-calc-to-a.patch
1 From 37b204f22778f51cad7bdf678d7574ff6d7508a6 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Wed, 25 Mar 2020 18:22:40 +0000
4 Subject: [PATCH] drm/vc4: Alter the HDMI state machine clock calc to
5 allow for 1920x1200
6
7 Whilst the documentation for BCM2835 states that the HDMI state machine
8 clock needs to be 108% of the pixel clock, other documentation says
9 that it only has to be greater than the pixel clock. The firmware
10 uses 101%, and that allows 1920x1200@60Hz to work within the
11 constraint of the HSM clock being < 163.68MHz.
12
13 Adopt 101%, and increase the maximum pixel clock for vc4 to 162MHz
14 so that it too supports 1920x1200@60.
15
16 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
17 ---
18 drivers/gpu/drm/vc4/vc4_hdmi.c | 9 +++++----
19 1 file changed, 5 insertions(+), 4 deletions(-)
20
21 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
22 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
23 @@ -581,10 +581,11 @@ static void vc4_hdmi_encoder_enable(stru
24 }
25
26 /*
27 - * The HSM rate needs to be at 108% of the pixel clock, with a
28 - * minimum of 108MHz.
29 + * The HSM rate needs to be slightly greater than the pixel clock, with
30 + * a minimum of 108MHz.
31 + * Use 101% as this is what the firmware uses.
32 */
33 - hsm_rate = max_t(unsigned long, 108000000, (pixel_rate / 100) * 108);
34 + hsm_rate = max_t(unsigned long, 108000000, (pixel_rate / 100) * 101);
35 ret = clk_set_rate(vc4_hdmi->hsm_clock, hsm_rate);
36 if (ret) {
37 DRM_ERROR("Failed to set HSM clock rate: %d\n", ret);
38 @@ -1730,7 +1731,7 @@ static int vc4_hdmi_dev_remove(struct pl
39 }
40
41 static const struct vc4_hdmi_variant bcm2835_variant = {
42 - .max_pixel_clock = 148500000,
43 + .max_pixel_clock = 162000000,
44 .audio_available = true,
45 .cec_available = true,
46 .registers = vc4_hdmi_fields,