bf27d7aa53e9c21e2dc54a69ced3c2d8b8856d93
[openwrt/openwrt.git] /
1 From ff882e312a746a4a794a089e912e5e56baa8b5b4 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Fri, 3 Jul 2020 14:11:55 +0100
4 Subject: [PATCH] drm/vc4: Make FKMS max refresh rate a module
5 parameter
6
7 Some people want to use the high refresh rate modes for 1080p100
8 and 1080p120, but they're currently filtered out as generally
9 they don't add anything.
10
11 Make the filter threshold a module parameter so that it can be
12 adjusted.
13
14 https://github.com/raspberrypi/linux/issues/3677
15
16 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
17 ---
18 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 12 ++++++++++--
19 1 file changed, 10 insertions(+), 2 deletions(-)
20
21 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
22 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
23 @@ -14,6 +14,8 @@
24 * Pi's firmware display stack.
25 */
26
27 +#include <linux/module.h>
28 +
29 #include "drm/drm_atomic_helper.h"
30 #include "drm/drm_gem_framebuffer_helper.h"
31 #include "drm/drm_plane_helper.h"
32 @@ -32,6 +34,10 @@
33 #include "vc_image_types.h"
34 #include <soc/bcm2835/raspberrypi-firmware.h>
35
36 +int fkms_max_refresh_rate = 85;
37 +module_param(fkms_max_refresh_rate, int, 0644);
38 +MODULE_PARM_DESC(fkms_max_refresh_rate, "Max supported refresh rate");
39 +
40 struct get_display_cfg {
41 u32 max_pixel_clock[2]; //Max pixel clock for each display
42 };
43 @@ -1069,8 +1075,10 @@ vc4_crtc_mode_valid(struct drm_crtc *crt
44 return MODE_NO_DBLESCAN;
45 }
46
47 - /* Disable refresh rates > 85Hz as limited gain from them */
48 - if (drm_mode_vrefresh(mode) > 85)
49 + /* Disable refresh rates > defined threshold (default 85Hz) as limited
50 + * gain from them
51 + */
52 + if (drm_mode_vrefresh(mode) > fkms_max_refresh_rate)
53 return MODE_BAD_VVALUE;
54
55 /* Limit the pixel clock based on the HDMI clock limits from the